ASGARD AE

1 分钟阅读时长

发布时间:

ASGARD 运行记

最近在做的工作和ASGARD的思路有点像,买了一块板子复现下看看区别。ASGARD的AE做的还是很扎实的,但是由于代码比较庞大,不太好跑起来,这里写个文档记录下复现过程。

01 Downloading sources

由于众所周知的原因,想把AOSP和git上的东西搞下来需要绕个弯,最开始用梯子猛猛冲,然后发现流量不够而且太慢了,遂智取,改下manifest用tuna源

第一个区别是要手动修改manifest,以ASGARD里的host-android为例

这里把AOSP的remote换成tuna,git的remote换成ssh,避免走代理

  <remote fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/" name="aosp" review="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/"/>
  <remote fetch="git@github.com:khadas/" name="khadas"/>
  <remote fetch="git@github.com:yonsei-sslab/" name="yonsei-sslab"/>

第二个区别是google repo不再用yonsei提供的xml了,说实话我没搞懂这AE为什么要把xml clone下来然后不用。

mkdir host-android && cd host-android
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > repo
chmod a+x repo
python3 repo init -u https://github.com/yonsei-sslab/asgard-manifest.git -b host-android
python3 repo sync -c

02 Git LFS

我最后向Git LFS投降了,khadas提供的lfs已经不再支持Android 12,Github的LFS会超quota,我最后的选择是在第二个月的1号在github上pull下来。

Github报错:

android12/external/camera_engine_rkaiq]# git lfs pull batch response: This repository exceeded its LFS budget. The account responsible for the budget should increase it to restore access.                         error: failed to fetch some objects from 'https://github.com/khadas/android_external_camera_engine_rkaiq.git/info/lfs' 

挺明显的,一眼就看懂了,只能找khadas

issue和维护方交谈了几句,最后也没拿到答案,只会删帖和复读 The Android 12 version stopped maintenance two years ago. Android 12 is very old and no longer maintained. Please be aware! 我被整无语了,也就不想寻求他们的帮助了,Khadas的工程师和(尤其是)客服已经在我这完全失去了交谈的欲望,梅姨阁诗人。不建议购买他家的任何产品,因为问题不出在产品上。

03 Compile & Install

这部分和ASGARD描述的基本一致即可。Install部分ASGARD描述了:

# The flashing might sometimes fail due to the buggy (and proprietary) flashing tool (e.g., 'Download Firmware Fail').
# Please first try resetting the device.

事实上在我这不是might sometimes, 是always

bypass的方法也很简单,不用linux flashing tools,换成windows的rkdevtool即可,一次就成功了。

在Install之前,我先用Khadas的OOWOW系统把开发板刷到了Android 12,因为看到后面要用adb,不确定会不会造成一些影响所以记录一下。

04 Evaluation

这里主要是E5及之后的部分,REE的Execute很直接很容易,随便截个图,大概结果长这样:

image-20250710131357644

接下来是with minimal enclave image,初次运行的时候出现了问题,脚本主要就是多了一个把npu解绑再绑定到vfio的过程,加上一个启crosvm的过程。

出现了一个error,紧接着reset并且adb掉了

[INFO:external/crosvm/src/linux/device_helpers.rs:131] Trying to attach block device: rootfs_minimal.ext4
[INFO:external/crosvm/disk/src/disk.rs:175] disk size 314572800,
[INFO:external/crosvm/disk/src/disk.rs:164] Disk image file is hosted on file system type f2f52010
[INFO:external/crosvm/disk/src/disk.rs:175] disk size 314572800,
[INFO:external/crosvm/disk/src/disk.rs:164] Disk image file is hosted on file system type f2f52010
resets ignored
interrupts ignored
compatible ignored
reg ignored
name ignored
[INFO:external/crosvm/src/linux/vcpu.rs:470] system reset event
[INFO:external/crosvm/src/linux/mod.rs:1857] vcpu requested reset
[ERROR:external/crosvm/src/linux/vcpu.rs:739] failed to send VcpuControl: sending on a closed channel
[INFO:external/crosvm/src/main.rs:2876] crosvm has exited normally due to reset request

看了看这个error,似乎是关机的时候才有。跳过,感觉是minimal enclave image 的问题。

去Execute ASGARD normal版本,成功。

05 Diff

因为要继续做工作,所以想看看ASGARD到底改哪里了,这一看差点没整死我

—[WIP]—