Devan Rehunathan

School of Computer Science, University of St Andrews

How to Build and Install Custom N900 Kernel on Ubuntu Desktop 8.04

Setup ARM Build Environment
- mkdir emdebian_fs
- sudo debootstrap sid ./emdebian_fs http://ftp.fr.debian.org/debian
- sudo chroot ./emdebian_fs /bin/bash
- aptitude install emdebian-archive-keyring
- vi /etc/apt/sources.list and add “deb http://www.emdebian.org/debian/ lenny main”
- aptitude update && aptitude dist-upgrade && aptitude install emdebian-tools

- aptitude install binutils-arm-linux-gnueabi cpp-4.3-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi gcc-4.3-arm-linux-gnueabi-base gcc-4.3-base-armel-cross libc6-armel-cross libc6-dev-armel-cross libgcc1-armel-cross linux-libc-dev-armel-cross

Build N900 Kernel
- wget http://repository.maemo.org/pool/fremantle/free/k/kernel/kernel_2.6.28-20094803.3+0m5.diff.gz
- wget http://repository.maemo.org/pool/fremantle/free/k/kernel/kernel_2.6.28-20094803.3+0m5.dsc
- wget http://repository.maemo.org/pool/fremantle/free/k/kernel/kernel_2.6.28.orig.tar.gz
- dpkg-source -x kernel_2.6.28-20094803.3+0m5.dsc
- wget -q http://natisbad.org/N900/n900-2.6.28.10-20094803.patch
- wget -q http://natisbad.org/N900/n900-2.6.28.10-20094803.patch.sign
- cd kernel-2.6.28
- patch -p1 -i ../n900-2.6.28.10-20094803.patch
- CROSS_COMPILE=arm-linux-gnueabi- make rx51_defconfig
- aptitude install libncurses5-dev
- CROSS_COMPILE=arm-linux-gnueabi- make menuconfig (configure MobileIP/NEMO settings)
- CROSS_COMPILE=arm-linux-gnueabi- make

Install the Kernel
- mkdir ../modules
- find . -name ‘*.ko’ -exec cp ‘{}’ ../modules/ \;
- ssh root@n900 mkdir /lib/modules/2.6.28.10-omap1
- scp ../modules/*.ko root@n900:/lib/modules/2.6.28.10-omap1
- ssh root@n900 depmod 2.6.28.10-omap1
- sudo flasher-3.5 -k arch/arm/boot/zImage -f -R

Gaining root on N900
- Install “gainroot.sh” fro application store
- To install ssh server, see References

Setting Maemo device to flashing mode
Before flashing a Maemo device with a FIASCO image, it is recommended to
firstly set the Maemo device into flashing mode. When you attempt to flash the
device, it tries to enable flashing mode on the fly, in which case setting the
device to flashing mode explicitly is not required, but there have been reports
that with some clients this does not work.

For Nokia N900 with a Fremantle image, flashing mode can be enabled by following these steps:

1. Switch off the Maemo device
2. Press and hold down the ‘u’ key
3. Connect a USB cable between the Maemo device and host PC while holding down the ‘u’ key
4. When the USB cable is connected, it powers the Maemo device and sets it to flashing mode
5. When the USB icon appears in the upper right-hand corner, the Maemo device is in flashing mode
6. Release the ‘u’ key

If performed correctly, the USB image is visible in the upper right-hand corner of the screen.

The Maemo device waits indefinitely for Flasher-3.5 input when it is in flashing mode. If flashing is tried without first setting the Maemo device to flashing mode, image flashing may fail because the Maemo device may not be able to change to the flashing mode automatically.

References

http://natisbad.org/N900/n900-custom-kernel.html

http://www.emdebian.org/packages/keys.html

N900 Kernel sources: http://repository.maemo.org/pool/fremantle/free/k/kernel/

http://www.nautilus6.org/doc/nepl-howto/nepl-howto.html

http://scratching.psybermonkey.net/2010/06/n900-how-to-ssh-into-n900-using-openssh.html

http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Development_Environment/Maemo_Flasher-3.5

How to build custom Android 2.1 Kernel on Ubuntu Desktop 8.04

Getting the source
- mkdir kernel-2.1
- git clone git://android.git.kernel.org/kernel/common.git android-kernel
- cd android-kernel
- export ARCH=arm
- make msm_defconfig
- make menuconfig
- export CROSS_COMPILE=/home/dr/android-coralic-2.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
- make

References

http://marakana.com/forums/android/examples/111.html

http://www.mitchtech.net/archives/kernel-2-6-29-incredible

http://wiki.cyanogenmod.com/index.php?title=Building_Kernel_from_source

Split boot.img: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images

http://forum.xda-developers.com/showthread.php?t=780754&page=1

http://android.modaco.com/content/htc-hero-hero-modaco-com/296389/24-nov-unlocked-spl-for-gsm-hero/

http://code.google.com/p/android-roms/wiki/SPL

http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack%2C_Edit%2C_and_Re-Pack_Boot_Images

How to build custom Android 1.5 Kernel on Ubuntu Desktop 8.04

Getting the source
- wget http://member.america.htc.com/download/RomCode/Source_and_Binaries/kernel_hero_0078c992.tar.bz2
- tar xvjf kernel_hero_0078c992.tar.bz2
- rm -rf kernel_hero_0078c992.tar.bz2
- cd kernel_hero
- adb pull /proc/config.gz .
- gunzip config.gz
- mv config .config
- export ARCH=arm
- export CROSS_COMPILE=/home/dr/android-coralic-2.1/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
- make

Install Kernel with Fastboot
- download the following things and put them all in one folder including your zImage: boot.img mkbootimg repack-bootimg.pl(altered) unpack-bootimg.pl
- unzip mkbootimg.zip
- perl unpack-bootimg.pl boot.img
- perl repack-bootimg.pl zImage boot.img-ramdisk newBoot.img
- fastboot flash boot newBoot.img
- fastboot reboot

Install Fastboot
- gksudo gedit /etc/udev/rules.d/51-android.rules
- SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
- sudo /etc/init.d/udev restart

How to Pull kernel .config from real phone
- adb pull /proc/config.gz .
- gunzip config.gz
- mv config .config

References

http://www.cianer.com/androidg1/28-building-android-kernel-images

http://www.johandekoning.nl/index.php/2009/06/08/building-android-15-building-the-source/

http://blog.coralic.nl/2009/10/26/how-to-use-the-htc-hero-kernel/

How to install and build Android Eclair on Ubuntu Desktop 8.04

Setup build environment
- Use createAndroidEclairRepo.sh

Special Coralic instructions
- gedit ~/android-coralic-2.1/vendor/community/products/AndroidProducts.mk and remove “$(LOCAL_DIR)/community_hero_eu.mk \”
- rm ~/android-coralic-2.1/vendor/community/products/ community_hero_eu.mk

Install proprietary HTC Hero files
- Download the HERO21 rom and save it in “~/android-coralic-2.1” as “update-hero.zip”.
- cd ~/android-coralic-2.1
- pushd vendor/community/hero && ./unzip-files.sh && popd

Build update.zip
! Removed Superuser and Busybox
- . build/envsetup.sh
- lunch community_hero_us-eng
- make
- NOTE: this will fail because of missing licamera.so. Just extract from HERO21 and place in out/target/product/hero/system/lib and out/target/product/hero/obj/lib

Install android on Phone
- Download unyaffs source (http://blog.coralic.nl/2010/01/25/how-to-create-update-zip-using-your-build-aka-system-img/)
- gcc -o unyaffs unyaffs.c
- mkdir ~/update-2.1
- cd ~/update-2.1
- mkdir system
- cd system
- ~/unyaffs  ~/android-coralic-2.1/out/target/product/hero/system.img
- cd ..
- mkdir -p META-INF/com/google/android
- Download update-script (http://blog.coralic.nl/2010/01/28/build-eclair-aka-android-2-1-for-hero-from-source/)
- remove line 5 : raio image from update-script and remove trace of su and busybox (use adb logcat to check boot process)
- cp ~/android-coralic-2.1/out/target/product/hero/boot.img ~/update-2.1
- zip -r update.zip system META-INF boot.img

Install Superuser and Busybox
- Download Superuser.zip and extract the contents to your SDK/tools folder (C:\android-sdk\tools).
- Then type the following commands in CMD exactly as they are here, hitting enter for a new line.
c:\android-sdk\tools> adb shell mount /system
c:\android-sdk\tools> adb push su /system/bin/
c:\android-sdk\tools> adb shell chmod 4755 /system/bin/su
c:\android-sdk\tools> adb push Superuser.apk /system/app/
c:\android-sdk\tools> adb shell reboot
OR
- copy su binary to system/bin
- copy busybox binary to system/xbin

Additional Files
- extract libcamera.so from HERO21 and place in proprietary folder (vendor/community/hero/proprietary)
- after some compilation also place in out/target/product/hero/system/lib and out/target/product/hero/obj/lib
- extract recovery.img to out/target/product/hero

References

http://blog.coralic.nl/2010/01/28/build-eclair-aka-android-2-1-for-hero-from-source/

HERO21: http://www.4shared.com/file/180010369/db272d/HERO21-18-Community-signed.html
Busxbox error: http://forum.xda-developers.com/showthread.php?t=711173
Busybox error: http://github.com/loxK/android_vendor_community/issues/issue/12
Busybox error: http://forum.cyanogenmod.com/topic/3601-add-config-feature-ip-rule-to-busybox/
Prebuilt: http://github.com/loxK/android_vendor_community/tree/eclair-cyanogen/prebuilt/bin/
Superuser: http://www.plinky.it/blog/2010/01/23/how-to-install-eclair-2-1-on-htc-hero/

How to install and build Android Cupcake on Ubuntu Desktop 8.04

Setup build environment
- Use createAndroidCupcakeRepo.sh

Install proprietary HTC Hero files
- cd ~/android-coralic-1.5/vendor/htc
- unzip hero-configfiles.zip
- sudo chmod 755 hero/proprietary/akm8973

Build update.zip
- cd ~/android-coralic-1.5
- vim buildspec.mk :
TARGET_PRODUCT:=htc_hero
TARGET_PREBUILT_KERNEL:=/home/dr/kernel_hero/arch/arm/boot/zImage
- make

References

http://blog.coralic.nl/2010/01/21/how-to-create-a-custom-rom-for-hero-from-android-sources/

http://blog.coralic.nl/2010/01/27/how-to-create-otapackage-aka-update-zip-from-your-build/

http://www.johandekoning.nl/index.php/2009/06/07/building-android-15-build-environment/