This page describes the port of the u-boot bootloader to the Galaxy Nexus phone
There were a couple reasons to port u-boot to Galaxy Nexus
Source code is in https://github.com/Ksys-labs/uboot-tuna
There exist two branches of interest
To compile, you need to have the ARM cross-compiler. I recommend codesourcery 2010q1-188 because that’ s what I ‘m using and some users reported that newer compilers produce broken binaries.
There are two ways to use the u-boot. One is flashing it instead of the Samsung SBL bootloader. The other one is chainloading it from the SBL.
Flashing instead of SBL has the following advantages
There is a number of issues and therefore we do not recommend flashing it instead of SBL
By default, the chainloaded version is compiled. It is loaded (by the SBL) to the address 0x81808000.
If you want to build the SBL replacement version, edit the include/configs/omap4_tuna.h file and uncomment the #define TUNA_SPL_BUILD line. X-loader loads the bootloader to the address 0xa0208000.
export PATH=/home/alexander/handhelds/armv6/codesourcery/bin:$PATH export ARCH=arm export CROSS_COMPILE=arm-none-eabi- U_BOARD=omap4_tuna make clean make distclean make ${U_BOARD}_config make -j8 ${U_BOARD} mkbootimg --kernel u-boot.bin --ramdisk /dev/null -o u-boot.aimg
Chainloaded Mode
You will need the root access to your device. You can take the prebuilt u-boot here. [gnex-uboot-chainloaded.img]
The u - boot has the support for android boot images.When flashed instead of the SBL, it boots the kernel off the “Boot” partition. When chainloaded, it looks for the kernel in /system/boot/vmlinux.uimg. Additionally, it first looks for the /system/boot/boot.scr.uimg so you can put custom commands there and override the kernel image.
It also supports booting custom images from /sdcard/boot/vmlinux.uimg and /sdcard/boot/boot.scr.uimg.
If you need larger images, I suggest that you use the tuna-fosdem-hacks branch, format the cache partition to ext2 and put the files to /cache/media/boot/.
push the files to your device via adb
adb push gnex-uboot-chainloaded.img /sdcard/ adb hell
now, in the device shell, do the following:
su cat /dev/block/platform /omap/omap_hsmmc.0/by-name/boot > /sdcard /vmlinux.uimg mount - o remount, rw /system mkdir/system/boot cp /sdcard/vmlinux.uimg /system/boot/ cat /sdcard/gnex-uboot-chainloaded.img > /dev/block/platform /omap /omap_hsmmc.0/by-name/boot sync reboot
you can also use fastboot to flash u-boot.img instead of dd’ing it
fastboot flash:raw boot u-boot.img”
OMAP4 devices cannot be bricked completely because the CPU has a firmware loader in the OTP (one-time programmable) memory. When the device is powered, it tries booting from USB.
Make sure to have an old version of x-loader (PRIMEKK14) because newer ones have the security hole which allowed booting unsigned bootloaders fixed.
Take the x-loader here [gnex-xloader-working.img]
adb push gnex-xloader-working.img /sdcard/
The installation procedure is roughly the same, but use sbl partition. Also, install xloader by
cat /sdcard/gnex-xloader-working.img > /dev/block/platform/omap/omap_hsmmc.0/by-name/xloader
There exists a Samsung recovery tool which can unbrick the devices with corrupted xloader/SBL. You will need a computer running Windows XP.
Search the internet for the archive named “OMAPFlash_tuna.zip” which has md5 “ddbf07a1d36b044c40af5788a83b5395”. We cannot upload it here because of the unclear license status.
You can either use Android’ s mkbootimg to produce ANDROID !type images (not recommended) or u-boot’s mkimage (in the u-boot tools directory) to make boot images. Using ANDROID! format is discouraged because the loader code in the u-boot is buggy and may fail in some corner cases such as large images.
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n linux -d zImage vmlinux.uimg
#alternatively, just do that when compiling linux
#do not forget to add mkimage to your PATH variable make uImage making a custom boot script
mkimage -A arm -O linux -T script -C none -a 0x84000000 -e 0x84000000 -n android -d boot.scr boot.scr.uimg
The bootloader supports several boot modes. Each boot mode is indicated by the color of the LED and activated by a combination of hardware buttons. It also supports the Android “reboot to recovery” and “reboot to bootloader” features
Make a boot.scr.uimg from it and push it to the correct location.
setenv bootargs “mem=1G vmalloc=768M omap_wdt.timer_margin=30 mms_ts.panel_id=18 no_console_suspend console=ttyFIQ0”;
setenv loaddaddr 0x82000000;
setenv devtype mmc;
setenv devnum 0;
setenv kernel_part 0xc;
setenv kernel_name /media/boot/vmlinux.uimg;
echo Load Address: ${loaddaddr};
echo cmdline:${bootargs};
if ext4load ${devtype} ${devnum}:${kernel_part} ${loaddaddr} ${kernel_name}; then
bootm ${loaddaddr}; exit 0\;
elif ext2load ${devtype} ${devnum}:${kernel_part} ${loaddaddr} ${kernel_name}; then
bootm ${loaddaddr}; exit 0;
else
echo failed to boot custom image;
fi