I am trying to compile the goldfish kernel: (is it the right branch? cross-compile toolchain?)
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
I have zImage
and I am trying to run with the emulator:
emulator -verbose -show-kernel -avd hd4 -no-snapshot -kernel /home/mrneumann/kurs/goldfish/arch/arm/boot/zImage
The emulator starts, but it stops before running my kernel (when I run without option -kernel
, the emulator continues working and the boot animation starts,
but in my case the screen is dark and the ADB says "Device offline".
My AVD is Nexus S, API 15 armeabi-v7a. What did I do wrong?
Here is instruction, how to build and run your own goldfish-kernel and kernel for it:
##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