Building Kernels
Building Kernels
The following example uses the kernel source code for the Droid DNA, for specifics for each kernel source please see accompanying Readme.txt file.
Download:
If you are not already using an AOSP toolchain (included in an AOSP build tree), download the corresponding official android toolchain for the arm-eabi specified in the Readme.txt for this device:
for 4.4.3:
git clone https://android.googlesource.com/platform/prebuilt
dor 4.6:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6
(use darwin-x86 in place of linux-x86 for mac)
set the following environment variables:
export TOP=(where you installed the toolchain or top of android AOSP code base)
export PATH=$TOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH (use corresponding arm-eabi bin path)
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
Build the kernel:
make [config file for your device from Readme.txt](in this example 4 is the number of processors of your build machine)
make clean
make -j4
Kernel Binary Files:
After build process is finished, there should be a file named zImage under arch/arm/boot/ You can copy it to the $OUT folder if building AOSP (renaming to “kernel”)
If you are building a rom with this kernel, the following modules should also be copied into your system build folder. In this example, before packaging system.img where $OUT is your AOSP build output folder note: the following example is for DNA - see Readme.txt for specific files!
cp ./drivers/input/evbug.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/crypto/msm/qcedev.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/crypto/msm/qcrypto.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/crypto/msm/qce40.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/misc/eeprom/eeprom_93cx6.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/spi/spidev.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/scsi/scsi_wait_scan.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/video/backlight/lcd.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/bluetooth/bluetooth-power.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/net/ethernet/micrel/ks8851.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/net/wireless/bcmdhd_4334/bcmdhd.ko $OUT/target/product/dlx/system/lib/modules/
cp ./drivers/media/video/gspca/gspca_main.ko $OUT/target/product/dlx/system/lib/modules/
cp ./crypto/ansi_cprng.ko $OUT/target/product/dlx/system/lib/modules/
cp ./arch/arm/mach-msm/msm-buspm-dev.ko $OUT/target/product/dlx/system/lib/modules/
cp ./arch/arm/mach-msm/reset_modem.ko $OUT/target/product/dlx/system/lib/modules/
cp ./block/test-iosched.ko $OUT/target/product/dlx/system/lib/modules/
If you have already built and installed a boot.img with root access* you can also install the modules directly to a device as follows:
adb remount (to make system/ writable)
adb push ./drivers/input/evbug.ko system/lib/modules/
adb push ./drivers/crypto/msm/qcedev.ko system/lib/modules/
adb push ./drivers/crypto/msm/qcrypto.ko system/lib/modules/
adb push ./drivers/crypto/msm/qce40.ko system/lib/modules/
adb push ./drivers/misc/eeprom/eeprom_93cx6.ko system/lib/modules/
adb push ./drivers/spi/spidev.ko system/lib/modules/
adb push ./drivers/scsi/scsi_wait_scan.ko system/lib/modules/
adb push ./drivers/video/backlight/lcd.ko system/lib/modules/
adb push ./drivers/bluetooth/bluetooth-power.ko system/lib/modules/
adb push ./drivers/net/ethernet/micrel/ks8851.ko system/lib/modules/
adb push ./drivers/net/wireless/bcmdhd_4334/bcmdhd.ko system/lib/modules/
adb push ./drivers/media/video/gspca/gspca_main.ko system/lib/modules/
adb push ./crypto/ansi_cprng.ko system/lib/modules/
adb push ./arch/arm/mach-msm/msm-buspm-dev.ko system/lib/modules/
adb push ./arch/arm/mach-msm/reset_modem.ko system/lib/modules/
adb push ./block/test-iosched.ko system/lib/modules/
adb shell chmod 0644 system/lib/modules/*
adb reboot
additional notes:
To build a rom based on AOSP, additional proprietary binaries are required and are not available at this time. However, they could potentially be extracted from your device similar to the above adb command but using “adb pull” instead. Note: there may be distribution restrictions for files from different vendors, please note that these instructions are not to be taken as legal advice, please check applicable local laws regarding reverse engineering.
Testing a modified kernel: * coming soon!