我正在尝试编译金鱼内核: (是正确的分支吗?交叉编译工具链?)
git clone https://android.googlesource.com/kernel/goldfish
cd goldfish
git checkout -t origin/android-goldfish-3.10 -b android-goldfish-3.10
export ARCH=arm
export SUBARCH=arm
export PATH=/home/mrneumann/kurs/prebuilds/bin:$PATH
export CROSS_COMPILE=arm-eabi-
make goldfish_armv7_defconfig
make
我有zImage
,并且正在尝试与模拟器一起运行:
emulator -verbose -show-kernel -avd hd4 -no-snapshot -kernel /home/mrneumann/kurs/goldfish/arch/arm/boot/zImage
仿真器已启动,但在运行内核之前已停止(当我在不使用选项-kernel
的情况下运行时,仿真器将继续工作并启动动画,
但在我的情况下,屏幕变黑,ADB提示“设备离线”。
我的AVD是Nexus S,API 15 armeabi-v7a。我做错了什么?
答案 0 :(得分:0)
以下是说明,如何为其构建和运行自己的金鱼内核和内核:
##build kernel
git clone https://android.googlesource.com/kernel/goldfish
cd goldfish
git checkout -t origin/android-goldfish-3.4 -b android-goldfish-3.4
make ARCH=arm goldfish_armv7_defconfig
make ARCH=arm SUBARCH=arm CROSS_COMPILE=/<path>/prebuilds/bin/arm-eabi-
##build module http://xdshao.com/2018/05/30/Android-exploitation-Build-an-android-kernel-module/
##add to config:
# CONFIG_MODULES is not set
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
##delete from config
#CONFIG_NF_CONNTRACK_IPV6=y
#CONFIG_IP6_NF_IPTABLES=y
#CONFIG_IP6_NF_FILTER=y
#CONFIG_IP6_NF_TARGET_REJECT=y
#CONFIG_IP6_NF_TARGET_REJECT_SKERR=y
#CONFIG_IP6_NF_MANGLE=y
#CONFIG_IP6_NF_RAW=y
#CONFIG_NETFILTER_XT_MATCH_QTAGUID=y
make clean
make
##run emulator
./emulator -verbose -show-kernel -avd hd4 -engine classic -no-snapshot -kernel /<path>/kurs/zImage
##run module
cd ~/Android/Sdk/platform-tools/
#./adb kill-server
./adb push /<path>/hello.ko /data/local/tmp
./adb shell
cd /data/local/tmp
insmod hello.ko
rmmod hello
rm hello.ko