A number of posts have reported failure or difficulties in recompiling a kernel with a modified configuration, and the available documentation is pretty terrible. So here's a basic guide to editing the default configuration and recompiling. Some of the instructions assume a Ubuntu/Kubuntu environment.
I came to this because I couldn't get Android-x86 to boot on a desktop machine with the available kernel as configured. I knew I had to add some SATA drivers to the existing configuration. I tried reading
http://www.android-x86.org/documents/customizekernel, unfortunately it couldn't be more confusingly written if someone had set out to be as confusing as possible to win a contest.
So, with the aim of allowing custom kernel configurations, here are the clearest instructions I can manage:
2. Put the source in a directory, let's call it "source", that is a subdirectory of a work directory, call that "work". So we have /work/source (use your own preferred names).
3. Create directory /work/config that will be used to contain the custom configuration, which must be segregated from the build tree and which you will want to retain if it's successful.
4. Now make a copy of the default Android-x86 configuration into your custom configuration directory:
FROM: /work/source/kernel/arch/x86/configs/android-x86_defconfig
TO: /work/config/.config
5. Remember this is a Ubuntu/Kubuntu example. To perform the configuration below in the least painful way, you will probably need to install some extra libraries/applications:
python-lunch
libqt4-core
libqt4-gui
qt4-default
gcc-multilib
distcc
ccache
6. These libraries are easily gotten:
# apt-get -y install python-lunch libqt4-core libqt4-gui qt4-default gcc-multilib distcc ccache
7. If you want the compilation to finish in any finite amount of time, set up distcc on every computer you can get your hands on and get networked -- separate topic, not covered here.
8. Now for the important part -- remember that we want to configure and compile a custom kernel, not a complete Android system, but we need the complete Android environment for this to be possible.
9. Enter the /work/source directory and issue these commands:
. build/envsetup.sh
export ARCH=x86
lunch android_x86-eng
make -C kernel O=/work/config/.config xconfig
10. The final command in the above list will launch a graphical configuration dialog that will look more or less like this:
https://i.imgur.com/8ROkrEy.png .
11. Make any changes you require, remembering there are some settings essential to using the kernel with Android. In my case, I needed to add some statically linked SATA drivers to support a desktop environment.
12. Save your changes and close the dialog.
13. Now to actually compile the modified kernel:
export ARCH=x86
export TARGET_PRODUCT=android_x86
export TARGET_KERNEL_CONFIG=/work/config/.config
make clean (optional, first time)
make kernel -j16 CC="distcc gcc" CXX="distcc g++" (if using distcc on a populated network)
make kernel -j4 (if not using distcc, very slow)
14. Now copy the compiled kernel, which of course will have compiled without error and in a finite amount of time:
FROM: /work/source/out/target/product/x86/kernel
TO: any chosen destination.
15. To deal with the issue of a system that the default Android-x86 installation code can't understand or install to:
a. Install Android-x86 on any convenient device that the installer does recognize, like a USB stick.
b. Create a suitable partition on the target drive.
c. Copy the working installation from the source USB stick into the newly created partition.
d. Overwrite the default kernel (located by default at (device)/android-4.4-RC1/kernel) with the modified kernel compiled above.
16. To get grub2 to recognize and list the new partition in its menus, create a configuration file named 45_android, containing:
#!/bin/sh
echo "$0: Android-4.4-RC1 (on /dev/sda4)" >&2
exec tail -n +4 $0
menuentry "Android android-4.4-RC1 Normal (on /dev/sda4)" {
set root=(hd0,4)
linux /android-4.4-RC1/kernel root=/dev/ram0 androidboot.hardware=android_x86 acpi_sleep=s3_bios,s3_mode SRC=/android-4.4-RC1 DPI=160 UVESA_MODE=1280x1024
initrd /android-4.4-RC1/initrd.img
}
menuentry "Android android-4.4-RC1 Debug (on /dev/sda4)" {
set root=(hd0,4)
linux /android-4.4-RC1/kernel pnp.debug=1 root=/dev/ram0 androidboot.hardware=android_x86 acpi_sleep=s3_bios,s3_mode SRC=/android-4.4-RC1 DEBUG=1 DPI=160 UVESA_MODE=1280x1024
initrd /android-4.4-RC1/initrd.img
}
17. Change the above references to "/dev/sda4" and "hd0,4" to the actual target partition on your system, examples: /dev/sda1 = hd0,1 , /dev/sdb3 = hd1,3
18. Change the above resolution (1280x1024) to your desired resolution. I have one laptop that supports Android-x86 at 1920x1080.
19. Copy the file 45_android into /etc/grub.d and make it executable.
20. Then, as root: update-grub
At this point you should be able to reboot into the modified Android-x86 on a desktop or laptop.
I hope this clears up the confusion surrounding the issue of custom kernel configurations.