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
Hello,
@harishvk27: With the AOSP if you did not specify a TARGET_PREBUILT_KERNEL the common kernel is used by default.
You can export TARGET_PREBUILT_KERNEL=/your/default/goldfish/arch/$ARCH/boot/zImage
ifeq ($(TARGET_PREBUILT_KERNEL),)
LOCAL_KERNEL:= device/ti/panda/kernel
else
LOCAL_KERNEL:=$(TARGET_PREBUILT_KERNEL)
endif
PRODUCT_COPY_FILES := $(LOCAL_KERNEL):kernel
If that doesn't work you can replace the x86_64_defconfig config in the kernel folder ($AOSP/kernel/) with your own config and recompile the Kernel, you need also to remove the common Kernel that is used by default.
Best regards,