(→Prepare u-boot kernel image for flasher) |
(wikify links, categorize) |
||
| (19 intermediate revisions not shown) | |||
| Line 5: | Line 5: | ||
This feature is currently experimental and <strong>intended for experienced users only</strong>. 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 <strong>strongly advised not to proceed any further</strong>. | This feature is currently experimental and <strong>intended for experienced users only</strong>. 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 <strong>strongly advised not to proceed any further</strong>. | ||
| + | <strong>WARNING: This guide is experimental and everything you do with this guide is at your own responsibility and risk and will probably void your warranty</strong> | ||
| + | |||
| + | <strong>WARNING: DO NOT RELY ON WALL CHARGER, ONLY USB CHARGING FOR 1.1 IMAGES, see [http://bugs.meego.com/show_bug.cgi?id=2260 meego bug #2260]</strong> | ||
| + | |||
| + | <strong>WARNING: If you are unable to boot anything, do NOT let the device stay in u-boot. IMMEDIATELY reflash back to Maemo. Your battery may drain otherwise. You can solve a drain situation by reflashing back to Maemo using another, charged, battery. Or charge your battery in another Nokia device using the same battery type, such as the 5800, using a wall charger. Read a guide on [[ARM/N900/Recover From Drained Battery|recovering after battery drainage]].</strong> | ||
| + | |||
| + | <strong>If you are unable to get back into Maemo, please follow http://wiki.maemo.org/Updating_the_tablet_firmware in order to reflash your device. This will destroy your current Maemo setup, but return your device to a working state</strong> | ||
| + | |||
| + | <strong>For the technically minded, you can flasher '-F <firmware image> -u' and 'flasher -f zImage -R' to get your original kernel back and hopefully get back to your current Maemo setup. If you have used other kernels than PR1.3 kernel as is required, this will not work.</strong> | ||
==Prerequisites== | ==Prerequisites== | ||
| - | * | + | * This guide is tested with PR 1.2 and PR 1.3 releases of Maemo 5. |
| + | * an N900 and microUSB cable. | ||
* a microSD card (at least 2GB in size) | * a microSD card (at least 2GB in size) | ||
| - | * a computer to build MeeGo. For absolute | + | * a computer to build MeeGo. For absolute compatibility a CPU supporting SSSE3 is recommended but in practice for the ARM build, any MIC2 supported x86 Linux distribution will do. The examples here use Fedora 13. See [[Image Creation For Beginners|the beginners guide to image creation]], [[Image Creation|the general image creation guide for background/supported environments]] and in particular [[ARM/Creating ARM image using MeeGo Image Creator|the image creation for ARM documentation]] |
==Procedure== | ==Procedure== | ||
| Line 20: | Line 30: | ||
===Create MeeGo image suitable for use with u-boot=== | ===Create MeeGo image suitable for use with u-boot=== | ||
| - | The following assumes familiarity with MIC2 see the full [ | + | The following assumes familiarity with MIC2 see the full [[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 u-boot (on Ubuntu the packages are uboot-mkimage and uboot-envtools); | ||
| - | + | $ sudo yum -y install uboot-tools | |
<pre> | <pre> | ||
| - | |||
Setting up Install Process | Setting up Install Process | ||
Resolving Dependencies | Resolving Dependencies | ||
| Line 61: | Line 72: | ||
</pre> | </pre> | ||
| - | 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: | + | 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 ('''NOTE:''' depending of your microSD card size you might need to reduce the size of the other partitions (with the amount of /boot partition) to get the image fit to your SD card): |
<pre> | <pre> | ||
| - | + | $ diff -ruN daily-testing.ks daily-testingwithvfat.ks | |
--- daily-testing.ks 2010-10-20 08:00:08.000000000 +0100 | --- daily-testing.ks 2010-10-20 08:00:08.000000000 +0100 | ||
+++ daily-testingwithvfat.ks 2010-10-25 14:40:04.000000000 +0100 | +++ daily-testingwithvfat.ks 2010-10-25 14:40:04.000000000 +0100 | ||
| Line 86: | Line 97: | ||
</pre> | </pre> | ||
| - | 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 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. | 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 u-boot kernel image for flasher === | === Prepare u-boot kernel image for flasher === | ||
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: | 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: | ||
| + | |||
| + | $ sudo yum -y install dpkg | ||
<pre> | <pre> | ||
| - | |||
Setting up Install Process | Setting up Install Process | ||
Resolving Dependencies | Resolving Dependencies | ||
| Line 131: | Line 141: | ||
</pre> | </pre> | ||
| - | 2. | + | 2. Clean the old packages if there are any. |
| + | rm -f /tmp/zImage* /tmp/kernel_2.6.28-*.deb* /tmp/uImage* /tmp/u-boot.bin* /tmp/builder.py* | ||
| - | 3. | + | 3. 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]. |
| - | 4. Extract the kernel image from the fiasco flasher file: | + | Maemo 5 - Pr 1.2 |
| + | wget http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20101501+0m5_armel.deb -P /tmp | ||
| + | Maemo 5 - Pr 1.3 | ||
| + | wget http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb -P /tmp | ||
| + | |||
| + | 4. Unpack the kernel package: | ||
| + | cd /tmp && dpkg-deb -x kernel_2.6.28-*_armel.deb maemo_kernel | ||
| + | |||
| + | 5. Extract the kernel image from the fiasco flasher file: | ||
<pre> | <pre> | ||
| - | flasher-3.5 -F maemo_kernel/boot/zImage-2.6.28- | + | $ flasher-3.5 -F maemo_kernel/boot/zImage-2.6.28-*.fiasco -u |
flasher v2.5.2 (Oct 21 2009) | flasher v2.5.2 (Oct 21 2009) | ||
| Line 145: | Line 164: | ||
</pre> | </pre> | ||
| - | + | 6. Make a u-boot image from the compressed kernel image: | |
<pre> | <pre> | ||
| - | + | $ mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n meego -d zImage uImage | |
Image Name: meego | Image Name: meego | ||
Created: Tue Oct 26 12:54:32 2010 | Created: Tue Oct 26 12:54:32 2010 | ||
| Line 156: | Line 175: | ||
</pre> | </pre> | ||
| - | + | 7. Download [http://stskeeps.subnetmask.net/u-boot.bin u-boot.bin (with CONFIG_CMD_ONENAND disabled)] 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> | ||
| - | $ wget http:// | + | $ wget http://stskeeps.subnetmask.net/u-boot.bin -P /tmp |
| - | --2010-10- | + | --2010-10-29 11:40:05-- http://stskeeps.subnetmask.net/u-boot.bin |
| - | Connecting to | + | Resolving stskeeps.subnetmask.net... 208.101.21.58 |
| + | Connecting to stskeeps.subnetmask.net|208.101.21.58|:80... connected. | ||
HTTP request sent, awaiting response... 200 OK | HTTP request sent, awaiting response... 200 OK | ||
| - | Length: | + | Length: 162180 (158K) [application/octet-stream] |
| - | Saving to: | + | Saving to: “/tmp/u-boot.bin” |
| - | 100%[=================================================================>] | + | 100%[=================================================================>] 162,180 214K/s in 0.7s |
| - | 2010-10- | + | 2010-10-29 11:40:06 (214 KB/s) - “/tmp/u-boot.bin” saved [162180/162180] |
$ wget http://al.robotfuzz.com/~al/maemo/u-boot/builder.py | $ wget http://al.robotfuzz.com/~al/maemo/u-boot/builder.py | ||
| Line 185: | Line 205: | ||
$ 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 | ||
| - | + | $ | |
</pre> | </pre> | ||
| Line 200: | Line 220: | ||
To make the changes permanent flash the image thus: <tt>flasher-3.5 -f -R -k /tmp/combined.bin</tt>. | To make the changes permanent flash the image thus: <tt>flasher-3.5 -f -R -k /tmp/combined.bin</tt>. | ||
| + | |||
| + | |||
| + | ===Potential gotchas=== | ||
| + | |||
| + | * On subsequent installs, those of you that copy over to your microSD card whilst booted in Maemo on the N900, you must now make sure that both the MeeGo root <em>and</em> /boot are unmounted on the host computer: Linux automounters will mount both and this may result in an unbootable image if you dd whilst mounted. | ||
| + | |||
| + | * u-boot expects the vfat <tt>/boot</tt> partition to be the third on the card. If it is at another position the boot to MeeGo will fail. This is of particular concern to those who have [[ARM/N900/Tips and Tricks/Extending the root btrfs filesystem|extended their btrfs root filesystems]]. | ||
| + | |||
| + | [[Category:N900]] | ||
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 |
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.
WARNING: This guide is experimental and everything you do with this guide is at your own responsibility and risk and will probably void your warranty
WARNING: DO NOT RELY ON WALL CHARGER, ONLY USB CHARGING FOR 1.1 IMAGES, see meego bug #2260
WARNING: If you are unable to boot anything, do NOT let the device stay in u-boot. IMMEDIATELY reflash back to Maemo. Your battery may drain otherwise. You can solve a drain situation by reflashing back to Maemo using another, charged, battery. Or charge your battery in another Nokia device using the same battery type, such as the 5800, using a wall charger. Read a guide on recovering after battery drainage.
If you are unable to get back into Maemo, please follow http://wiki.maemo.org/Updating_the_tablet_firmware in order to reflash your device. This will destroy your current Maemo setup, but return your device to a working state
For the technically minded, you can flasher '-F <firmware image> -u' and 'flasher -f zImage -R' to get your original kernel back and hopefully get back to your current Maemo setup. If you have used other kernels than PR1.3 kernel as is required, this will not work.
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.
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 (on Ubuntu the packages are uboot-mkimage and uboot-envtools);
$ 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 (NOTE: depending of your microSD card size you might need to reduce the size of the other partitions (with the amount of /boot partition) to get the image fit to your SD card):
$ 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.
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. Clean the old packages if there are any.
rm -f /tmp/zImage* /tmp/kernel_2.6.28-*.deb* /tmp/uImage* /tmp/u-boot.bin* /tmp/builder.py*
3. Download the Maemo kernel package that matches exactly your running Maemo kernel. Packages are available from here.
Maemo 5 - Pr 1.2
wget http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20101501+0m5_armel.deb -P /tmp
Maemo 5 - Pr 1.3
wget http://repository.maemo.org/pool/maemo5.0/free/k/kernel/kernel_2.6.28-20103103+0m5_armel.deb -P /tmp
4. Unpack the kernel package:
cd /tmp && dpkg-deb -x kernel_2.6.28-*_armel.deb maemo_kernel
5. 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'...
6. 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
7. Download u-boot.bin (with CONFIG_CMD_ONENAND disabled) 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://stskeeps.subnetmask.net/u-boot.bin -P /tmp --2010-10-29 11:40:05-- http://stskeeps.subnetmask.net/u-boot.bin Resolving stskeeps.subnetmask.net... 208.101.21.58 Connecting to stskeeps.subnetmask.net|208.101.21.58|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 162180 (158K) [application/octet-stream] Saving to: “/tmp/u-boot.bin” 100%[=================================================================>] 162,180 214K/s in 0.7s 2010-10-29 11:40:06 (214 KB/s) - “/tmp/u-boot.bin” saved [162180/162180] $ 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.
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.
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.