我试图编译内核金鱼:(?是它的右分支交叉编译工具链?)
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
运行,仿真器继续工作,开机动画开始,但对我来说,屏幕是黑暗和亚洲开发银行“设备离线”说。
我的AVD是Nexus S的,API 15 armeabi-V7A。我做错了什么?
这里是指令,如何构建和运行自己的金鱼内核和内核吧:
##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