Download presentation
Presentation is loading. Please wait.
Published byHelena Dawsey Modified over 10 years ago
1
Prashant Somashekar
2
What will we discuss? -Brief overview of a kernel -How a kernel fits into the hierarchy -Android versus Linux kernel -Building an Android kernel from source -Flashing a kernel to bare metal (mobile) -Practical experience; pitfalls; methodology
3
What is a kernel? -Heart of the system -Hardware initialization Hierarchy of a mobile system -Bootloader -> Kernel -> OS -Kernel provides low level abstraction layer
4
What is a kernel’s function? -Provide a layer for OS/App to speak with hardware -CPU/Memory management -Resource allocation -Input/Output from/to device’s components
5
Difference between Android and Linux kernel? -Based off Linux -Wakelock/Power management implementation -No paging to disk for virtual memory -Lightweight libc standard library (Bionic) -Video framebuffer instead of X11 -Low memory killer
6
How can I acquire kernel source code? -Use of github as a source code repository -Provides timeline of changes -Eases kernel development -Facilitates code sharing and dissemination
7
Will be using ubuntu (linux) -Install git: apt-get install git-core Pulling source code from a github repo:
8
Use Codesourcery’s toolchain -ARM-EABI 2010.09 (GCC4.5) Use and setup Codesourcery’s toolchain: -Unpack to a folder (ex: toolchain in home) -export CCOMPILER=~/toolchain/arm- 2010.09/bin/arm-none-eabi- -export PATH=$PATH:~/toolchain/arm- 2010.09/bin
9
Go to kernel directory and generate a defconfig -cd mykernel -make –j2 ARCH=arm CROSS_COMPILE=$CCOMPILER pershoot_mahimahi_defconfig -sample configurations in arch/arm/configs Compile a kernel: -make –j2 ARCH=arm CROSS_COMPILE=$CCOMPILER
10
Put device in bootloader; fastboot mode Boot device with new kernel -fastboot boot zImage -kernel image will be in arch/arm/boot -zImage is a compressed kernel image Copy wireless driver to device -adb remount -adb push drivers/net/wireless/bcm4329.ko /system/lib/modules Make more configuration changes -make –j2 ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig (must have lib-ncurses installed) Clean and rebuild: -make –j2 ARCH=arm CROSS_COMPILE=$CCOMPILER clean && make –j2 ARCH=arm CROSS_COMPILE=$CCOMPILER
11
Not all devices will have fastboot -Pull existing boot.img from device -Use split_bootimg.pl to separate ramdisk and kernel -Use mkbootimg to merge your new kernel with existing ramdisk -mkbootimg --cmdline 'no_console_suspend=1 console=null' --kernel zImage --ramdisk ramdisk.gz --base 0x20000000 -o boot.img -Base listed is specific to Nexus One (Passion) Ramdisk (initrd) is a temporary root file system -Bare minimum needed for boot until the real system’s filesystem is available -May contain utilities, drivers, folder layout, etc. Flash boot.img to device via updater-script -write_raw_image("/tmp/boot.img", "boot") Alternative method -use AnyKernel (koush) -Only need to supply a zImage and modules (optional) -Resign update.zip (with a test key) or toggle signature checking off (Clockwork Mod), prior to flashing
12
Feel free to play with the source! -Adjust frequency clocks (overclock) -Under volt some frequency ranges to save some power -Implement GCC optimizations -Enable further functionality via loadable kernel modules
13
Not all devices are created equal -Hardware variances makes a ‘one size fits all’ mantra difficult to maintain at times -Different ROM bases may interact poorly -Remote troubleshooting can make resolution times lengthy It is important to adhere to the GPL -Keeping things open -Engineering for the sake of making things faster and more fine-tuned -Contribute to Social Coding -Fit to a specific environment’s form -Fix bugs -Add and enhance functionality
14
CyanogenMod -Distribution based off AOSP/CodeAurora/Nvidia/Omapzoom -Aims to provide a unified experience across multiple devices -Custom ROM and Kernel development -Open Platform which encourages social coding and development
15
Q&A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.