Meego Wiki
Views

ARM/N900/Install/U-Boot from scratch

From MeeGo wiki
< ARM | N900 | Install
Revision as of 07:42, 28 October 2010 by Sage (Talk | contribs)
Jump to: navigation, search

This page describes how to create a MeeGo installation suitable for dual-booting with Maemo on the Nokia N900, using u-boot. Currently this process is the only way to dual-boot on the device without requiring another computer. It is not very user friendly and is only provided as a stop-gap until packaged Maemo software replaces it. Users follow these instructions at their own risk

Contents

WARNING

This feature is currently experimental and intended for experienced users only. Several commands here are dangerous if executed incorrectly and may damage your Maemo installation or your N900. If you are unfamiliar with image creation, the flasher and MeeGo you are strongly advised not to proceed any further.


Prerequisites

Procedure

Overview

Due to various kexec problems and a lack of btrfs filesystem support in the Maemo kernel, the only way to dual boot Maemo and MeeGo currently is to chain-load kernels from an initial boot. For this we use u-boot, which is a capable and cross-platform bootloader. Once u-boot is flashed onto the device, at first boot it looks for a bootable vfat partition & image on the SD card. If it finds one, it boots that (MeeGo), if it does not, it boots Maemo as normal. This is not destructive to either operating system but as it does involve replacing the default boot kernel on the device it is only recommended for those who know how to recover their device if it goes wrong.

Create MeeGo image suitable for use with u-boot

The following assumes familiarity with MIC2 see the full ARM image creation documentation for specifics. u-boot requires a vfat partition on which to install its kernel image and currently the default N900 MeeGo build doesn't have one so we must make our own. This is achieved as follows:

1. On the build host, install u-boot:

sudo yum -y install uboot-tools
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package uboot-tools.i686 0:2010.03-1.fc13 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================
 Package                    Arch                Version                       Repository              Size
===========================================================================================================
Installing:
 uboot-tools                i686                2010.03-1.fc13                updates                 97 k

Transaction Summary
===========================================================================================================
Install       1 Package(s)

Total download size: 97 k
Installed size: 264 k
Downloading Packages:
uboot-tools-2010.03-1.fc13.i686.rpm                                                 |  97 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing     : uboot-tools-2010.03-1.fc13.i686                                                     1/1 

Installed:
  uboot-tools.i686 0:2010.03-1.fc13                                                                        

Complete!

2. Download and edit the kickstart you wish to build from. The kickstart must be modified to create the new partition and also to generate a u-boot image of the MeeGo kernel. The changes look like this:

diff -ruN daily-testing.ks daily-testingwithvfat.ks 
--- daily-testing.ks	2010-10-20 08:00:08.000000000 +0100
+++ daily-testingwithvfat.ks	2010-10-25 14:40:04.000000000 +0100
@@ -8,6 +8,7 @@
 # device as root partition, but currently we do not want to do changes to the
 # N900 internal memories (emmc or nand).
 part swap --size=256 --ondisk mmcblk0p --fstype=swap
+part /boot --size=64 --ondisk mmcblk0p --fstype=vfat
 
 rootpw meego
 xconfig --startxonboot
@@ -113,4 +114,9 @@
 if [ -n "$IMG_NAME" ]; then
     echo "BUILD: $IMG_NAME" >> $INSTALL_ROOT/etc/meego-release
 fi
+
+# required for dual-boot support
+mkimage  -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n vmlinuz -d $INSTALL_ROOT/boot/vmlinuz* $INSTALL_ROOT/boot/uImage
+
+
 %end

3. Build the image as normal, and dd to the target microSD card as normal.

4. Boot the MeeGo image and verify that the partition layout is correct and that the u-boot image was successfully created. Once you are happy, boot back into Maemo and note your kernel version with a dpkg -l | grep kernel as root.

Prepare u-boot kernel image for flasher

1. On your build host, install dpkg if your build host doesn't natively support it (i.e. on RPM-based distributions), for example:

$ sudo yum -y install dpkg
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dpkg.i686 0:1.15.5.6-4.fc13 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                               Arch                                  Version                                          Repository                               Size
============================================================================================================================================================================
Installing:
 dpkg                                  i686                                  1.15.5.6-4.fc13                                  fedora                                  1.0 M

Transaction Summary
============================================================================================================================================================================
Install       1 Package(s)

Total download size: 1.0 M
Installed size: 5.2 M
Downloading Packages:
dpkg-1.15.5.6-4.fc13.i686.rpm                                                                                                                        | 1.0 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : dpkg-1.15.5.6-4.fc13.i686                                                                                                                            1/1 

Installed:
  dpkg.i686 0:1.15.5.6-4.fc13                                                                                                                                               

Complete!

2. Download the Maemo kernel package that matches exactly your running Maemo kernel.packages are available from here.

3. Unpack the kernel package: cd /tmp && dpkg-deb -x kernel_2.6.28-*_armel.deb maemo_kernel

4. Extract the kernel image from the fiasco flasher file:

$ flasher-3.5 -F maemo_kernel/boot/zImage-2.6.28-*.fiasco -u
flasher v2.5.2 (Oct 21 2009)

Image 'kernel', size 1705 kB
	Version 2.6.28-20101501+0m5
Unpacking kernel image to file 'zImage'...

5. Make a u-boot image from the compressed kernel image:

$ mkimage  -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n meego -d zImage uImage
Image Name:   meego
Created:      Tue Oct 26 12:54:32 2010
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    1746048 Bytes = 1705.12 kB = 1.67 MB
Load Address: 80008000
Entry Point:  80008000

6. Download u-boot.bin and builder.py and run the builder python script. That process will then create an image suitable for flashing the N900 with the flasher tool:

$ wget http://al.robotfuzz.com/~al/maemo/u-boot/u-boot.bin
--2010-10-26 12:56:33--  http://al.robotfuzz.com/~al/maemo/u-boot/u-boot.bin
Connecting to al.robotfuzz.com:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 167192 (163K) [application/octet-stream]
Saving to: “u-boot.bin”

100%[=================================================================>] 167,192      288K/s   in 0.6s    

2010-10-26 12:56:34 (288 KB/s) - “u-boot.bin” saved [167192/167192]

$ wget http://al.robotfuzz.com/~al/maemo/u-boot/builder.py
--2010-10-26 12:56:42--  http://al.robotfuzz.com/~al/maemo/u-boot/builder.py
Connecting to al.robotfuzz.com:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 456 [text/plain]
Saving to: “builder.py”

100%[=================================================================>] 456         --.-K/s   in 0s      

2010-10-26 12:56:42 (33.7 MB/s) - “builder.py” saved [456/456]

$ python builder.py 
0x28d18 0x1aa4c0
$ ls -l combined.bin 
-rw-r--r--. 1 steph users 2008256 Oct 26 12:56 combined.bin
$ 

This image is now ready for flashing.

Test the uboot kernel

Simply test the new kernel as you would any other MeeGo build. With a microSD card inserted in the N900 flashing the image (e.g. flasher-3.5 -b -l -k /tmp/combined.bin) should boot into MeeGo. If the microSD card is then removed, flashing the same kernel should boot into Maemo instead.


Make the changes permanent

Before undergoing this step make absolutely sure you understand the risks and know how to revert should something go wrong

To make the changes permanent flash the image thus: flasher-3.5 -f -R -k /tmp/combined.bin.

Personal tools