git clone https://android.googlesource.com/kernel/goldfish/ -b android-goldfish-3.18
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9
cd goldfish
export CROSS_COMPILE=x86_64-linux-android-
export ARCH=x86_64
export PATH=$PATH:/path/to/x86_64-linux-android-4.9/bin
make x86_64_ranchu_defconfig
make menuconfig # enable overlayfs and namespaces support here
make -j8
Then create an Android virtual device via android avd
. Here I use x86-64 image for API 24 (7.0 Nougat). Don't forget to use a larger internal memory size when creating the virtual device. (The default is 200MB and I use 2000MB) After that run the emulator with:
emulator -avd (avd_name) -kernel /path/to/goldfish/arch/x86/boot/bzImage -show-kernel
Steps to follow
I had ubuntu 16.04 with 16GB RAM and 1TB disk
also install
openjdk-8
git
BASIC:
=====
mkdir
/bin/bin:$PATHPATH=
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
GET ANDROID_SOURCE CODE and BUILD same
===================
mkdir ~/WORKING_DIRECTORY
cd ~/WORKING_DIRECTORY
repo init -u https://android.googlesource.com/platform/manifest -b android-7.0.0_r3
repo sync
source ./build/envsetup.sh
lunch asop_x86_64-eng
GET THE FIX into thread.cc ( in simple way: remove lines prefixed with - and add lines prefixed with + )
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wframe-larger-than="
+#pragma GCC diagnostic pop
make -j8
=====================
git clone https://android.googlesource.com/kernel/goldfish/ -b android-goldfish-3.18
cd goldfish
export CROSS_COMPILE=x86_64-linux-android-
export ARCH=x86_64
export PATH=$PATH:~/WORKING_DIRECTORY/prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin
make x86_64_ranchu_defconfig
make menuconfig # enable overlayfs and namespaces support here
make -j8
=====================
./emulator -mem 2048 ./arch/x86/boot/bzImage
To figure out all these took me some time.. as i had to build android also.. which i think could be avoided.
Any way welcome to word of android system programming, wish you all the best.
-thanks
harish