Reply
Thread Tools
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#1
Maemo on SD card

DISCLAIMER: THIS GUIDE CAN POTENTIALLY BRICK YOUR PHONE, THE AUTHOR IS NOT RESPONSIBLE FOR ANY DAMAGE TO YOUR PHONE

Introduction:
In this guide i will explain how to move Maemo from the internal flash to the SD card, this guide is based on what i did to unbrick my phone so it might not be 100% accurate as my success in it was mostly trial-on-error, however , the steps in this guide ARE correct, of that i am sure, it might just be that i forgot something,

Benefits:
  • More rootfs space
  • (If using U-Boot)No need for flasher anymore
  • Unbricking USB-less phones or preventing irreversable bricks on such devices
  • rootfs free for alternative OS/storage/whatever you might want to use it for

Requirements:
  • Ability to build your own (N900) kernel.
  • (Recommended) U-Boot
  • Linux PC with working UBI and nandsim (If you don't have this, the SDK VM will do fine.)
  • MicroSD card ( 1GB or larger )
  • U-Boot mkimage (uboot-mkimage package in SDK VM)

Steps:

Step 0 - Clean eMMC:
If the N900 /home partition contains optified apps/Maemo programs, you will need to format/reflash eMMC, this can be done through flashing a new eMMC image or through the devices x-terminal.
If you dont do this, the phone might get stuck at the bootscreen!

Step 1 - Partitioning SD card:
If using U-Boot, you need to create a small (a couple of MB's) FAT16 (msdos) partition before the main partition
Either way, you now need to format the main partition ext3 and mount it somewhere on your development machine

Step 2 - Mounting root filesystem:
Either enter these commands one by one or make it a script:
Code:
modprobe mtdblock
modprobe ubi
modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15
#I reccommend testing if nandsim works by catting /proc/mtd, that should yield:
#dev:    size   erasesize  name
#mtd0: 10000000 00020000 "NAND simulator partition 0"
#
#MAKE SURE THE NUMBER AFTER mtd MATCHES THE ONES IN
#THE NEXT COMMANDS OR YOU WILL NUKE A REAL FLASH
#CHIP IN YOUR DEVELOPMENT BOX
 
dd if=rootfs.jffs2 of=/dev/mtdblock0 bs=2048
ubiattach /dev/ubi_ctrl -m 0
mount -t ubifs ubi0_0 <PREFERRED MOUNT POINT>
Step 3 - Transferring rootfs:
Use the following command for this, -r will make cp recurse into directories, -p will make it preserve ownership and access masks.
Code:
cp -r -p <ROOTFS MOUNTPOINT>/* <SDCARD PART2 MOUNTPOINT>
Step 4 - Configuring your kernel:
Use your preferred ARM (GNU EABI) toolchain for this, or use scratchbox, you need to use the default config for the N900 (rx51_defconfig), and make the following changes:
  • Built in ext3 filesystem
  • Built in MMC subsystem
  • Built in OMAP MMC host driver (The one already set to module)
  • Command line: "/dev/mmcblk0p<PARTITION> rootwait rw init=/sbin/preinit" (Partition is 1 for flasher boot and 2 for U-Boot users)
  • Disable cpufreq or build as module. (WORKAROUND for kernel panic when combining mmc and cpufreq)
  • (Only for extra debugging) Framebuffer console built in
Now build the kernel and modules, install modules to the sdcard's /lib/modules/<KERNEL_NAME>'

Step 5 (U-Boot) - Configuring U-Boot
First you need to turn your kernel into an U-Boot kernel image:
Code:
mkimage  -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n MaemoSD -d <PATH TO zImage> <SD BOOT PART MOUNTPT>/lmaemosd
Next you need to create a file containing the following code:
Code:
mmc init
echo "Booting Maemo from SD card"
fatload mmc 0:1 ${loadaddr} maemosd
setenv atags ${nolo_atagaddr}
bootm ${loadaddr}
which you need to turn into a U-Boot script with:
Code:
mkimage  -A arm -O linux -T script -C none -a 0 -e 0 -n MaemoLoader -d <PATH TO SCRIPT SOURCE> <SD BOOT PART MOUNTPT>/boot.scr
Step 5(Flasher) - Flashing your new kernel
Put your N900 into flashing mode and run:
Code:
flasher-3.5 -k <PATH TO zImage> -f -R
Step 6 - Testing
Unmount all SD card partitions and put it in your phone, it should boot into Maemo, to verify that it has worked, open xterm and enter df -h, it should show a significantly larger rootfs!

Credits:
x86 - rootfs mount guide
DocScrutinizer and other people from #maemo - Helping me fix some problems with this

Last edited by peterbjornx; 2012-04-17 at 22:32.
 

The Following 12 Users Say Thank You to peterbjornx For This Useful Post:
ammyt's Avatar
Posts: 1,918 | Thanked: 3,118 times | Joined on Oct 2010 @ My pants
#2
It took 2 years for such a guide to arrive, however, it did.
This could be life-saving you know...
 
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#3
The only real down side (for now, i am not really into linux kernel development but maybe someone finds the bug) is the kernel panic when somehow the MMC driver forces cpufreq to switch clock speed, and it panics in set_frequency or something, so i had to disable cpufreq , which means battery life sucks and no overclocking either
 

The Following User Says Thank You to peterbjornx For This Useful Post:
ammyt's Avatar
Posts: 1,918 | Thanked: 3,118 times | Joined on Oct 2010 @ My pants
#4
Originally Posted by peterbjornx View Post
The only real down side (for now, i am not really into linux kernel development but maybe someone finds the bug) is the kernel panic when somehow the MMC driver forces cpufreq to switch clock speed, and it panics in set_frequency or something, so i had to disable cpufreq , which means battery life sucks and no overclocking either
At what speed does the CPU set to? Max?
 
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#5
As far as i know, it doesnt set it at all if you disable cpufreq, and judging from the speed of my phone , NOLO/U-Boot sets it to 600MHz
 
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#6
I have yet to try compiling cpufreq as module and loading it after boot,might do that tomorrow, my N900's battery is charging at the moment (external charger), also im sure this isnt a hardware bug as meego-qemu did exactly the same
 

The Following 2 Users Say Thank You to peterbjornx For This Useful Post:
Posts: 1,326 | Thanked: 1,524 times | Joined on Mar 2010
#7
A very impressive first post. Welcome to the forums! ...Although I am sure you have been viewing us for some time already

Would I be right in believing that should one were to have 2 maemo devices, then we could swap the SD cards between them and transfer all installed data too?

Last edited by MINKIN2; 2012-04-17 at 22:31.
 
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#8
Not with the steps described in this guide, this still relies on the eMMC for data and application storage, the SD card only replaces the rootfs,
the eMMC location is hardcoded into quite a lot of scripts and configuration files, moving it to a sd card would be a lot of work
 

The Following User Says Thank You to peterbjornx For This Useful Post:
ammyt's Avatar
Posts: 1,918 | Thanked: 3,118 times | Joined on Oct 2010 @ My pants
#9
Originally Posted by peterbjornx View Post
Not with the steps described in this guide, this still relies on the eMMC for data and application storage, the SD card only replaces the rootfs,
the eMMC location is hardcoded into quite a lot of scripts and configuration files, moving it to a sd card would be a lot of work
The rootFS is a very fast memory chip, so how's the performance, speed? How well would Maemo 5 run on a class 10 memory card?
 
Posts: 40 | Thanked: 144 times | Joined on Mar 2012 @ Oldenzaal, The Netherlands
#10
Only boot and application speeds are affected, as the rootfs is not used for any "normal" storage, tmp is on a ramdisk and /home and /opt are on eMMC, im using a 2GB microSD without any class advertised on it and it runs fine, no real lag only slightly slower boot
 

The Following 2 Users Say Thank You to peterbjornx For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 03:00.