Meego Wiki
Views

ARM/N900/Install/U-Boot from scratch

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "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 …")
Line 1: Line 1:
-
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. <strong>Users follow it at their own risk</strong>
+
This page describes how to create a MeeGo installation suitable for dual-booting with Maemo on the Nokia N900, using [http://sourceforge.net/projects/u-boot/ 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. <strong>Users follow these instructions at their own risk</strong>
==WARNING==
==WARNING==
Line 8: Line 8:
==Prerequisites==
==Prerequisites==
-
* an N900 and micro USB cable. This was tested with Maemo PR1.2 but should work in principle with PR1.3
+
* an N900 and microUSB cable. This was tested with Maemo PR1.2 but should work in principle with PR1.3
* a microSD card (at least 2GB in size)
* 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 [http://wiki.meego.com/Image_Creation_For_Beginners this] and [http://wiki.meego.com/Image_Creation this] and in particular [http://wiki.meego.com/ARM/Creating_ARM_image_using_MeeGo_Image_Creator this documentation]
+
* a computer to build MeeGo. For absolute compatability a CPU supporting SSSE3 is recommended but in practice for the ARM build, any MIC2 supported x86 Linux distirubtion will do. The examples here use Fedora 13. See [http://wiki.meego.com/Image_Creation_For_Beginners the beginners guide to image creation], [http://wiki.meego.com/Image_Creation the general image creation guide for background/supported environments] and in particular [http://wiki.meego.com/ARM/Creating_ARM_image_using_MeeGo_Image_Creator the image creation for ARM documentation]
==Procedure==
==Procedure==
Line 16: Line 16:
===Overview===
===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 <strong>it is only recommended for those who know how to recover their device if it goes wrong</strong>.
+
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 [http://sourceforge.net/projects/u-boot/ 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 <strong>it is only recommended for those who know how to recover their device if it goes wrong</strong>.
===Create MeeGo image suitable for use with u-boot===
===Create MeeGo image suitable for use with u-boot===
-
Again see the full documentation for [http://wiki.meego.com/ARM/Creating_ARM_image_using_MeeGo_Image_Creator ARM image creation]. uboot requires a <tt>vfat</tt> partition. This is achieved as follows:
+
The following assumes familiarity with MIC2 see the full [http://wiki.meego.com/ARM/Creating_ARM_image_using_MeeGo_Image_Creator ARM image creation documentation] for specifics. u-boot requires a <tt>vfat</tt> 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 uboot:
+
1. On the build host, install u-boot:
<pre>
<pre>
Line 88: Line 88:
3. Build the image as normal, and <tt>dd</tt> to the target microSD card as normal.
3. Build the image as normal, and <tt>dd</tt> 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
+
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 <tt>dpkg -l | grep kernel</tt> as root.
-
=== Prepare uboot kernel image for flasher ===
+
=== Prepare u-boot kernel image for flasher ===
-
1. On your build host, install <tt>dpkg</tt> support if your build host doesn't natively support it (i.e. on RPM-based distributions):
+
1. On your build host, install <tt>dpkg</tt> if your build host doesn't natively support it (i.e. on RPM-based distributions), for example:
<pre>
<pre>
sudo yum -y install dpkg
sudo yum -y install dpkg
-
[sudo] password for steph:
 
Setting up Install Process
Setting up Install Process
Resolving Dependencies
Resolving Dependencies
Line 131: Line 130:
Complete!
Complete!
</pre>
</pre>
 +
 +
2. Download the Maemo kernel package that matches <strong>exactly</strong> your running Maemo kernel.[http://repository.maemo.org/pool/maemo5.0/free/k/kernel/ packages are available from here].
-
2. Download the Maemo kernel package [http://repository.maemo.org/pool/maemo5.0/free/k/kernel/ from here]that <strong>exactly</strong> matches the version of your running kernel.
+
3. Unpack the kernel package: <tt>cd /tmp && dpkg-deb -x kernel_2.6.28-20101501+0m5_armel.deb maemo_kernel</tt>
-
 
+
-
3. Unpack the kernel package: <tt>dpkg-deb -x kernel_2.6.28-20101501+0m5_armel.deb maemo_kernel</tt>
+
4. Extract the kernel image from the fiasco flasher file:
4. Extract the kernel image from the fiasco flasher file:
Line 157: Line 156:
</pre>
</pre>
-
6. Download [http://al.robotfuzz.com/~al/maemo/u-boot/u-boot.bin u-boot.bin] and [http://al.robotfuzz.com/~al/maemo/u-boot/builder.py builder.py] and run them. They will then create a kernel image suitable for use with flasher:
+
6. Download [http://al.robotfuzz.com/~al/maemo/u-boot/u-boot.bin u-boot.bin] and [http://al.robotfuzz.com/~al/maemo/u-boot/builder.py builder.py] and run the builder python script. That process will then create an image suitable for flashing the N900 with the flasher tool:
<pre>
<pre>
-
[steph@builder tmp]$ wget http://al.robotfuzz.com/~al/maemo/u-boot/u-boot.bin
+
$ 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
--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:80... connected.
-
Connecting to al.robotfuzz.com|87.106.101.225|:80... connected.
+
HTTP request sent, awaiting response... 200 OK
HTTP request sent, awaiting response... 200 OK
Length: 167192 (163K) [application/octet-stream]
Length: 167192 (163K) [application/octet-stream]
Line 172: Line 170:
2010-10-26 12:56:34 (288 KB/s) - “u-boot.bin” saved [167192/167192]
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
+
$ 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
--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:80... connected.
-
Connecting to al.robotfuzz.com|87.106.101.225|:80... connected.
+
HTTP request sent, awaiting response... 200 OK
HTTP request sent, awaiting response... 200 OK
Length: 456 [text/plain]
Length: 456 [text/plain]
Line 184: Line 181:
2010-10-26 12:56:42 (33.7 MB/s) - “builder.py” saved [456/456]
2010-10-26 12:56:42 (33.7 MB/s) - “builder.py” saved [456/456]
-
[steph@builder tmp]$ python builder.py  
+
$ python builder.py  
0x28d18 0x1aa4c0
0x28d18 0x1aa4c0
-
[steph@builder tmp]$ ls -l combined.bin  
+
$ ls -l combined.bin  
-rw-r--r--. 1 steph users 2008256 Oct 26 12:56 combined.bin
-rw-r--r--. 1 steph users 2008256 Oct 26 12:56 combined.bin
[steph@builder tmp]$  
[steph@builder tmp]$  
Line 195: Line 192:
===Test the uboot kernel===
===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. <tt>flasher-3.5 -b -l -k /tmp/combined.bin</tt>) should boot into MeeGo. If the microSD card is then removed, flashing the same kernel should boot into Maemo instead.
+
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. <tt>flasher-3.5 -b -l -k /tmp/combined.bin</tt>) should boot into MeeGo. If the microSD card is then removed, flashing the same kernel should boot into Maemo instead.

Revision as of 17:49, 26 October 2010

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-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 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
[steph@builder tmp]$ 

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