0
点赞
收藏
分享

微信扫一扫

程序媛的mac修炼手册-- 2024如何彻底卸载Python

问题

这是之前的,调试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 -ex

function 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" == "" ]; then
    ERROR "Usage: bash $0 emulator_path imgs_path"
    exit 1
fi

emulator_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 $? ]; then
    echo "Killing prior emulator"
    pkill qemu
    sleep 3
else
    echo "No prior emulator"
fi
set -e

if [ ! -d ~/.android ]; then
    mkdir ~/.android
fi
if [ ! -f ~/.android/advancedFeatures.ini ]; then
    echo "Vulkan = off" >> ~/.android/advancedFeatures.ini
    echo "GLDirectMem = on" >> ~/.android/advancedFeatures.ini
fi

if [ ! -d $imgs_path ]; then
    if [ ! -f /root/A*.zip ]; then
        ERROR "No images"
        exit 1
    fi
    zipfile=$(realpath /root/A*.zip)
    unzip $zipfile -d /root/

    # unzipfile=$(realpath /root/mnt/wd2/buildout/*/*/files)
    # mv $unzipfile /root/
fi

if [ ! -d $emulator_path ]; then
    emuzip=$(realpath /root/*emulator*.zip)
    unzip $emuzip -d /root/
fi

if [ ! -d "$1" ]; then
    ERROR "Path not exsit"
    exit 1
fi


function runemu() {
    DIR=$imgs_path
    export ANDROID_PRODUCT_OUT=$DIR
    export ANDROID_BUILD_TOP=$DIR

    cd $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/
举报

相关推荐

0 条评论