问题
这是之前的,调试android kernel的方案还是太笨重了
 完美调试android-goldfish(linux kernel) aarch64的方法
然后,看GeekCon AVSS 2023 Qualifier,通过
 sdk-repo-linux_aarch64-emulator-8632828.zip 进行启动
 完整编译的aosp + kernnl,和 android studio下载的镜像可以正常调试,自己编译的就是不行,总是报错
 
在mac m1上调试,可以查看内存信息,但是一下断点,就报错
 
 搜不出原因,仅Can't get kernel version from the kernel image file,说是emulator版本低了
解决
下载最新版本的sdk-repo-linux_aarch64-emulator就可以了
 网址
https://ci.android.com/builds/branches/aosp-emu-master-dev/grid?

 
效果

使用
在mac m1中的aarch64 ubuntu22.04中
#!/bin/bash
set -exfunction LOG() {echo -e "\e[96m LOG : $1 \e[0m"
}
function INFO() {echo -e "\e[40;38;5;82m INFO: $1 \e[0m"
}
function ERROR() {echo -e "\e[41m ERROR: $1 \e[0m"
}if [ $# -lt 2 ] || [ "$1" == "" ]; thenERROR "Usage: bash $0 emulator_path imgs_path"exit 1
fiemulator_path=$1
imgs_path=$2
args=${@:3}INFO "emulator_path: $emulator_path"
INFO "imgs_path: $imgs_path"
# INFO "args: $args"set +e
ps -e | grep "qemu"
if [ -z $? ]; thenecho "Killing prior emulator"pkill qemusleep 3
elseecho "No prior emulator"
fi
set -eif [ ! -d ~/.android ]; thenmkdir ~/.android
fi
if [ ! -f ~/.android/advancedFeatures.ini ]; thenecho "Vulkan = off" >> ~/.android/advancedFeatures.iniecho "GLDirectMem = on" >> ~/.android/advancedFeatures.ini
fiif [ ! -d $imgs_path ]; thenif [ ! -f /root/A*.zip ]; thenERROR "No images"exit 1fizipfile=$(realpath /root/A*.zip)unzip $zipfile -d /root/# unzipfile=$(realpath /root/mnt/wd2/buildout/*/*/files)# mv $unzipfile /root/
fiif [ ! -d $emulator_path ]; thenemuzip=$(realpath /root/*emulator*.zip)unzip $emuzip -d /root/
fiif [ ! -d "$1" ]; thenERROR "Path not exsit"exit 1
fifunction runemu() {DIR=$imgs_pathexport ANDROID_PRODUCT_OUT=$DIRexport ANDROID_BUILD_TOP=$DIRcd $DIR$emulator_path/emulator -system $DIR/system.img -data $DIR/userdata.img -ramdisk $DIR/ramdisk.img -kernel $DIR/kernel-ranchu -cache $DIR/cache.img -vendor $DIR/vendor.img -sysdir $DIR \-writable-system \-no-window  \-verbose \-show-kernel \-no-cache \-no-snapstorage \-no-audio \-no-snapshot \-wipe-data \-accel on -netdelay none -no-sim \-qemu -s -S -append 'nokaslr' -no-reboot \-cpu max -machine gic-version=max# -no-snapshot-save \
# -no-snapshot-load \# PID=$!# python3 /root/emuinit.py  >> /root/1.log 2>&1 &# INFO "DONE"
}runemu# while true; do
#   tail -n 10 /tmp/qemu.log | while read line; do
#     if [[ $line == *"Kernel panic"* ]]; then
#         if ps -p $PID > /dev/null; then
#             kill -9 $PID
#         fi
#     fi  
#   done#   if ! ps -p $PID > /dev/null; then
#     echo "Process exited unexpectedly, restarting" 
#     runemu
#     sleep 10
#   fi
#   sleep 3
# done# bash runemu.sh /root/emulator/ /root/mnt/wd2/buildout/2023-06-16-06-44-59/12/files/arm64-v8a/
# bash /root/runemu.sh /root/emulator/ /root/arm64-v8a/runemu.sh /root/emulator/ /root/arm64-v8a/