Meego Wiki
Views

ARM/N900/Install/U-Boot from scratch

From MeeGo wiki
< ARM | N900 | Install
Revision as of 12:07, 26 October 2010 by Steph (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page describes how to install MeeGo suitable for dual-booting with u-boot and Maemo on the Nokia N900. Currently this process is not very user friendly and is only provided as a stop-gap until packaged Maemo software replaces it. Users follow it 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

  • an N900 and micro USB cable. This was tested with Maemo PR1.2 but should work in principle with PR1.3
  • a microSD card (at least 2GB in size)
  • computer to build MeeGo. This was run on Fedora 13 but in principle any of the supported build environments should work. See this and this and in particular this documentation

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. U-boot is flashed onto the device and 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

Again see the full documentation for ARM image creation. uboot requires a vfat partition. This is achieved as follows:

1. On the build host, install uboot:

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 uboot image was successfully created. Once you are happy, boot back into Maemo and note your kernel version


Prepare uboot kernel image for flasher

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

sudo yum -y install dpkg
[sudo] password for steph: 
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 from herethat exactly matches the version of your running kernel.

3. Unpack the kernel package: dpkg-deb -x kernel_2.6.28-20101501+0m5_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-20101501+0m5.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:

[steph@builder tmp]$ 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 them. They will then create a kernel image suitable for use with flasher:

[steph@builder tmp]$ 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
Resolving al.robotfuzz.com... 87.106.101.225
Connecting to al.robotfuzz.com|87.106.101.225|: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]

[steph@builder tmp]$ 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
Resolving al.robotfuzz.com... 87.106.101.225
Connecting to al.robotfuzz.com|87.106.101.225|: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]

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

This image is now ready for flashing.

Test the uboot kernel

Simply test the new kernel as you would any other kernel. 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