[Galaxy S II General] sp3dev:
Hi! I have ported the u-boot bootloader to Samsung Galaxy S2.

What's this for

This is for allowing true multi-boot on our device. Since Samsung combined boot and recovery partitions into a single one, it is impossible to use different kernels for boot and recovery, thus it is impossible to, say, dual-boot android and ubuntu with different kernels without reflashing.

Is it safe?

Should be not more dangerous than flashing a new kernel. We're not overwriting the original Secondary Bootloader (SBL), we're chainloading from it.

Mind that currently only european galaxy s2 (with max8997 pmic and wvga screen) is supported.

How to install and test

Download the precompiled u-boot.bin http://www.mediafire.com/?ovd6asa90de4ifn

Download the uImage (3.0.30 cm9 image) http://www.mediafire.com/?y3g1e463rzas9vm

flash the uboot with heimdall

heimdall flash --kernel u-boot.bin

we abuse the unused-by-default recovery partition for keeping the linux kernel

heimdall flash --recovery uImage

You may put a custom uImage and u-boot boot script to the emmc ums partition (the 12G one). Put them to

boot/vmlinux.uimg
boot/boot.scr.uimg

accordingly. vmlinux.uimg is just a renamed uImage. Take care - for this 'custom' kernel the cmdline is different from android one, it tells the kernel to boot off microsd partition 2. If you want to use custom kernels, please hardcode the command line in kernel config when compiling. To boot the 'custom' kernel you need to hold the home key while turning on the device.

A practical example - booting Siyah kernel from emmc

Get boot.scr.uimg http://www.mediafire.com/?k4s2ldudk8g9u4e

Get siyah uImage http://www.mediafire.com/?w57aqn7jig4ij5k

copy them to the device

adb shell mkdir /sdcard/boot
adb push boot.scr.uimg /sdcard/boot
mv uImage android.uimg
adb push android.uimg /sdcard/boot

For devs - How to compile

Grab u-boot source @ my gitorious, branch is i9100_tracking

https://gitorious.org/i9100-proper-linux/i9100-uboot

for compiling uboot:

export PATH, CROSS_COMPILE and ARCH variables and do sth like this

make galaxys2_config
make -j6 galaxys2

for compiling uImage either add uboot/tools to PATH and use "make uImage" target in kernel. Or, wrap the existing zImage into uImage

u-boot/tools/mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000 -n Linux-android-sucks -d cm9_kernel/arch/arm/boot/zImage uImage

for compiling boot script, use the following command. Please remember that you need to use a different loadaddr not to overwrite the boto script

mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "android" -d boot.cmd boot.scr.uimg

Here is an example boot script

setenv android_cmd loglevel=4 console=ram sec_debug.enable=0 sec_debug.enable_user=0 sec_log=0x100000@0x4d900000 s3cfb.bootloaderfb=0x5ec00000 ld9040.get_lcdtype=0x2 consoleblank=0 lpj=3981312 vmalloc=144m;

if test $sgs2_bootmode_val -eq 1; then
setenv android_cmd ${android_cmd} bootmode=2;
fi
setenv bootargs ${android_cmd}

setenv devtype mmc
setenv devnum 0
setenv kernel_part 0xb
setenv kernel_name /boot/android.uimg
setenv loadaddr 0x4EF08000

echo Load Address:${loadaddr};
echo Cmdline:${bootargs};

if fatload ${devtype} ${devnum}:${kernel_part} ${loadaddr} ${kernel_name}; then
bootm ${loadaddr};
exit 0;
elif ext2load ${devtype} ${devnum}:${kernel_part} ${loadaddr} ${kernel_name}; then
bootm ${loadaddr};
exit 0;
else
echo failed to boot custom image;
fi

TODO

Add lcd and board revision detection to build a proper command line

Add support for other galaxy s2 and Note revisions - depending on the user feedback and testing volunteers

Fix MTYPE (linux kernel machine type). Samsung uses the same mtype for all boards which is clearly wrong. In my linaro-based kernel I'm using a new mtype which I registered for I9100. Since CM9 kernels enable more than one board, booting will fail if mtype is wrong. So, for now, uboot is using samsung's mtype, and I want to find a way to switch it in runtime.

Add galaxys2 modem support to fsogsmd or ofono, install Mer or ubuntu and get rid of the java-ridden crapware named Android