maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia 770 (https://talk.maemo.org/forumdisplay.php?f=24)
-   -   Please check my guide for booting from MMC for correctness (https://talk.maemo.org/showthread.php?t=12916)

brian911 2007-12-09 11:30

Please check my noob guide for booting from MMC for correctness
 
I wrote a complete noobie guide for booting the Nokia 770 from MMC since I never found one while doing my own research. Please check it for correctness.

-----------------
REV.2:
1. Removed reboot commands for formatting in step 8 per fanoush's suggestion.
2. Revised explanation of EXT3.
3. Linked WLAN hotfix to thread on the topic.
-----------------

This guide will take you step-by-step through hacking your Nokia 770 to make it better and faster. I had a hard time finding all the information I needed to hack my 770 in one place. Instructions I found were also meant more for seasoned developers and Linux-savvy people. So I decided to write my own guide, for the complete noob!

The Plan:
1. Patch the operating system to fix a bug that can corrupt data and cause crashes.
2. Partition the RS-MMC into a Linux partition for the OS and a Windows compatible partition to access the card via USB.
3. Clone the operating system from the internal flash memory to the RS-MMC memory card. This will increase the space available to install program and slightly increase the speed as well. At the same time, the original operating system on the internal memory will be kept intact for backup or recovery mode if the memory card dies.

fanoush says: cloning without using kernel with faster mmc wil not give massive speedups, it will take off some load from CPU due to no jffs2 compression and may make your device more responsive under load but the average read/write speed is about the same (slow mmc vs compressed jffs2). So yes it may speed it up a bit but not significantly so...

4. Install a boot screen to allow you to choose which operating system (OS) to load - the original OS backup on the internal memory, or the OS on the RS-MMC memory card.

// to be added later...
5. Install hack that will increase read/write speed on the memory card which will increase the speed of your 770.

Warning:
1. This guide is a work-in-progress. It has not been thoroughly checked yet.
2. Make sure the 770 is hooked up to AC power, or the battery is full. You don't want it to die in the middle of something critical.
3. This guide has only been tested with OS 3.2006.49-2 and a Kingston 2GB MMCMobile RS-MMC (the fastest you can buy).


Procedure:

1. Get bug hotfix:
Download the WLAN hotfix to your computer and transfer it to a RS-MMC memory card (either the original 64MB card or your new one will do). You don't want to do this on the 770 because using the WiFi may corrupt the OS or the hotfix - the very same thing you are trying to fix. If you don't have a MMC card reader for your computer, you can take a chance by using the 770. If you flash the OS, then there's only the remote chance the hotfix on the memory card is corrupted, and not the OS as well.

2. Flash your 770:
Install OS2006 3.2006.49-2 by running the Nokia update wizard and following the onscreen instructions (hold down 'Home' key while powering on the device). Even if you have the newest OS, it's a good idea to reflash in case you have corrupted data. It is important not to use WiFi before the hotfix is applied!

3. Install bug hotfix:
Pop in the RS-MMC with the hotfix. Install the hotfix by going to Tools->Application manager->Package->Install from file... Select the hotfix on the memory card and install.

4. Become root:
Connect to the internet. Install Xterm and Becomeroot using the following two repositories:
Web address: http://eko.one.pl/maemo/
Distribution: mistral
Components: user

Web address: http://repository.maemo.org/
Distribution: mistral
Components: free non-free

Then go into Xterm and type using your stylus:
Quote:

sudo gainroot
You now have administrative rights. This would be a good time to assign your root password. To do this, type:
Quote:

passwd root
5. Install SSH:
Now, we want to install the SSH protocol to communicate wirelessly with the 770 using your computer. This will allow us to issue commands using the keyboard instead of the stylus (very tedious). You have to make sure your wireless connection is reliable though. If not, you have to resort to using Xterm with a stylus, or use a Bluetooth keyboard (which will require a bluetooth hack).
To install the SSH protocol, type in xterm:
Quote:

apt-get install ssh
6. Install remote XTerm:
To emulate XTerm on Windows after SSH is installed, you'll need to use Putty. Open the program and input your Nokia 770's IP address. You can find the IP address by going to Connection manager menu->Internet connection->IP Address. You can also find out by going into your router config. While you are there, it's not a bad idea to assign a static IP to your 770 MAC address so that the router's DHCP always assigns the same IP to the 770.

7. Partition RS-MMC:
We will now partition the memory card into two partitions. One is for the Linux operating system, and the other will be for transfering files to the card via USB.

Launch putty and log in as root. Now type:
Quote:

apt-get install e2fsprogs
umount /media/mmc1
sfdisk /dev/mmcblk0
After running the sfdisk command, it will prompt you for the size of the partitions. You can enter something like this:
Quote:

/dev/mmcblk0p1:1,15000,6
/dev/mmcblk0p2:15001,,
/dev/mmcblk0p3:
/dev/mmcblk0p4:
In the above example, we are assigning the first partition to use 1 through 15000 of cylinders (memory chunks) with type 6 (A.K.A. FAT16, VFAT, or USB compatible). Each cylinder represents 32KB of information with type 6. Hence, we just assigned 15000x32KB = 480MB of space for USB storage/transfer.

The second partition (for Linux OS) is assigned cylinders 15001 to whatever the memory card has left. So on a 2GB memory card, it's approximately 1520MB.

Now will be a good time to talk about the memory allocation - how do you choose how much to use for the OS, and how much is for the USB? The answer is it depends on what you want to do. If you foresee yourself installing a lot of programs, then a larger Linux partition may make sense. If you want the convenience of transfering large size files through USB, then you may want to increase the FAT16 partition. But beware, FAT16 isn't very efficient at storing small files (around 32KB or the chunk size). To overcome this problem, you can format using FAT32 which is also compatible, but I'll leave you to tackle that problem by yourself.

8. Format partitions:
The next step is to format the partitions. Type the following to format the 1st partition to FAT16:
Quote:

mkdosfs /dev/mmcblk0p1
Format the second partition to a Linux EXT2 partition.
Quote:

mke2fs /dev/mmcblk0p2
Why are we using EXT2 instead of the more popular EXT3 format? The reason is memory cards will eventually die after a certain amount of writes. EXT3 features a journal system which writes metadata (file system and time keeping information - i.e. filenames, attributes, etc...) twice. Hence, using EXT2 will prolong the life of your memory card.

fanoush says: Yes it it slightly slower and yes it wears the card slightly more but still it may make sense, depends on you, if you use ext2 don't forget to boot from flash and fsck it when device crashes (fsck -fy /dev/mmcblk0p2). --Fsck is a file system checking utility.

9. Install boot menu:
Mount the Linux partition:
Quote:

insmod /mnt/initfs/lib/modules/current/ext2.ko
mount /dev/mmcblk0p2 /media/mmc2
Download fanoush's boot menu to your Documents folder on your 770 (it's at /home/user/MyDocs/.documents if you want to move it there using WinSCP). Now, type the following:
Quote:

cd /home/user/MyDocs/.documents/
tar zxvf initfs_flasher.tgz
cd initfs_flasher/
./initfs_flash
Follow the on-screen instructions.

10. Clone OS:
We are now ready to copy the OS to the memory card. First, we need to mount the partitions. Type the following:
Quote:

insmod /mnt/initfs/lib/modules/current/ext2.ko
mkdir /opt/
mount /dev/mmcblk0p2 /opt
mkdir /floppy/
mount -t jffs2 /dev/mtdblock4 /floppy
I don't know why but we need a new version of tar for the next step. Apt-get the tar debian package and extract the files. It will tell you it will delete some files. Ignore the warning since we told apt-get to only download the package, not install it using the -d parameter. Then rename the executable tar to targnu to avoid evoking the system tar.
Quote:

apt-get -d install tar
cd /var/cache/apt/archives/
mkdir /tar-temp/
dpkg -x tar*.deb /tar-temp/
cd /tar-temp/bin/
cp tar targnu
We are now ready to start copying over the OS. Type the following command to clone everything including retaining the directory hierarchy. Note, the '|' not the letter 'l'. It's shift-backslash on the keyboard.
Quote:

./targnu cf - -C /floppy . | ./targnu xvf - -C /opt
11. Almost there:
Unmount the partitions and set the default OS to the one on the RS-MMC:
Quote:

umount /opt
umount /floppy
chroot /mnt/initfs cal-tool --set-root-device ask:mmc2
shutdown -r now
You are done!

fanoush 2007-12-09 13:04

Re: Please check my guide for booting from MMC for correctness
 
Just few random comments
- wlan fix - maybe it is better to link the bug in bugzilla or the thread here in case my site goes down

- cloning without using kernel with faster mmc wil not give massive speedups, it will take off some load from CPU due to no jffs2 compression and may make your device more responsive under load but the average read/write speed is about the same (slow mmc vs compressed jffs2). So yes it may speed it up a bit but not significantly so I wouldn't put it on first place when mentioning advantages. Having backup and more room is bigger reason. You can still have it worded like above but someone may complain (after long and frustrating cloning process) that there is no speedup.

-partitioning - sfdisk has -uM argument which takes all units in megabytes, this may be more intuitive when selecting partition size

- rebooting - I think it is not needed to reboot after formatting partition, you can regroup it to make only one reboot after optionally flashing kernel and installing boot menu

-ext3 vs ext2 - ext3 will write only metadata twice, not data, metadata is filesystem timekeeping information (file name, attributes, location of blocks belonging to files), yes it it slightly slower and yes it wears the card slightly more but still it may make sense, depends on you, if you use ext2 don't forget to reboot to flash and fsck it when device crashes

I'm not sure where you will publish this guide but it may be better to improve existing guides, the last 'rewrite targeted for newbies' is here http://maemo.org/community/wiki/howt...from_mmc_card/

brian911 2007-12-09 19:39

Re: Please check my guide for booting from MMC for correctness
 
Thanks for the comments. I will correct them the first chance I get.

As to where to publish the guide, I was thinking of making it a sticky here since the forum is flooded with people asking the same questions.

fanoush 2007-12-09 21:50

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by brian911 (Post 106463)
As to where to publish the guide, I was thinking of making it a sticky here since the forum is flooded with people asking the same questions.

Might be a good idea and won't hurt, thanks. In that case you may also link the guide in wiki and thread with step by step script by Milhouse.

brian911 2007-12-11 04:07

Re: Please check my guide for booting from MMC for correctness
 
Updated guide according to fanoush's comments.

I did not modify the sfdisk command to use -uM as I am unsure how to properly give each partition start and end values.

rogue_ronin 2007-12-13 18:29

Re: Please check my guide for booting from MMC for correctness
 
Could you flesh out how to reflash the device, and how to install fanoush's kernel?

nosam 2007-12-13 20:29

Re: Please check my guide for booting from MMC for correctness
 
Hmm.. so if you don't have wi-fi at home, you either:
1) have to type all on the onscreen keyboard, which someone wrote was very long, or
2) could use a blue tooth keyboard?
I was juts wondering, can you reflash without a BT keyboard or wifi? or is it pretty hard.
Also, apt get needs wifi connection? so I have to modify the instructions if I don't use wifi?
I am a complete linux newbie (except I know dos - so understand basic xterm commands), and I need to reflash my 770. I wonder if I can do this without having wifi at home.
[Edit: I realize I need to spend more time reading all the posts about reflashing, so you don't have to explain any basic stuff I can find on my own. Very short answer is OK]

brian911 2007-12-13 22:29

Re: Please check my guide for booting from MMC for correctness
 
nosam:
Reflashing the device is relatively simple. You need to install Nokia Internet Tablet Software Update Wizard and follow the prompts. The device connects to your computer with internet via USB so no wifi required.

If you don't have wifi, then you will have to manually download everything needed in the guide on your desktop computer, then transfer the files to your Nokia via the USB cable.

You don't need a BT keyboard to follow the above guide. The first time I hacked my Nokia, I used my stylus. Took about 3 times longer but it still worked.

fanoush 2007-12-13 22:40

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by nosam (Post 108345)
Hmm.. so if you don't have wi-fi at home, you either:
1) have to type all on the onscreen keyboard, which someone wrote was very long, or
2) could use a blue tooth keyboard?

Or you can log into the device via ssh over usbnet (network over usb cable) or over bluetooth PAN (network over bluetooth). Both works with Linux and Windows XP. Both need some searching here or in maemo wiki.

brian911 2007-12-13 22:41

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by rogue_ronin (Post 108278)
Could you flesh out how to reflash the device, and how to install fanoush's kernel?

I am doing further research into which instances this modified kernel is safe. There are two: one that increases read speed - in which my understanding is that it will work with newer cards based on the MMC4.1 standard (not the included 64MB card), and another one that adds to the first hack, but also increases write speed via multiblock writing. This multiblock kernel is what I am using now and it has dramatically increased the speed of my Nokia. However, I have only tested the multiblock kernel with a Kingston 2GB MMCMobile card.

fanoush 2007-12-13 22:48

Re: Please check my guide for booting from MMC for correctness
 
There is also newer version of that - kernel based on MMC taken from N800 2.6.18 kernel which also has SDHC functionality but may (or may not) also work slightly better with MMC cards. http://fanoush.wz.cz/maemo/#sdhc This is newer code with many fixes but not so well tested as the older mmcplus kernel. There are only versions with multiblock writing enabled because this is enabled by default in 2.6.18 kernel.

PattiM 2007-12-14 16:28

Re: Please check my guide for booting from MMC for correctness
 
It seemed complicated, but was simple, actually. I now boot from both the mmc and internal memory, but as mentioned there doesn't seem to be any significant speed up. Still waiting for noob instructions for enabling multiblock read/write.
:D Patti :eek:

PS: I forgot to mention that if the user only uses Linux on their laptops/desktops, then we can dispense with the fat16 partition, can't we? And what're the advantages to using fsck as opposed to e2fsck, the latter of which I use on my SuSE systems...

PPS: In reference to the mmc wear associated with ext2/ext3 - I think mmc is so cheap that one could "clone" their mmc card to a backup mmc card periodically (with an mmc card reader and g4l) and use ext3 to avoid frustrating (unrecognized) file corruptions. With this in mind, could you indicate the command to format ext3?

PPPS: I also noticed that there doesn't seem to be a .bash-history file between boots - so I have to memorize the fsck disk check command and run it a LOT. :( I would be running fsck at least once a day...

brian911 2007-12-14 21:26

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by PattiM (Post 108637)
It seemed complicated, but was simple, actually. I now boot from both the mmc and internal memory, but as mentioned there doesn't seem to be any significant speed up. Still waiting for noob instructions for enabling multiblock read/write.
:D Patti :eek:

PS: I forgot to mention that if the user only uses Linux on their laptops/desktops, then we can dispense with the fat16 partition, can't we? And what're the advantages to using fsck as opposed to e2fsck, the latter of which I use on my SuSE systems...

PPS: In reference to the mmc wear associated with ext2/ext3 - I think mmc is so cheap that one could "clone" their mmc card to a backup mmc card periodically (with an mmc card reader and g4l) and use ext3 to avoid frustrating (unrecognized) file corruptions. With this in mind, could you indicate the command to format ext3?

PPPS: I also noticed that there doesn't seem to be a .bash-history file between boots - so I have to memorize the fsck disk check command and run it a LOT. :( I would be running fsck at least once a day...

Hi Patti:
Which MMC card are you using? To format to EXT3, it's the same mke2fs command, but with -j switch (since EXT3 is just EXT2 with journalling).

Bundyo 2007-12-14 21:31

Re: Please check my guide for booting from MMC for correctness
 
Or mkfs.ext3 :)

norom 2007-12-18 01:04

Re: Please check my guide for booting from MMC for correctness
 
If the WLAN memory bug-fix was installed on flash and then copied to the mmc with everything else does it not need to be installed again onto the mmc?
thx.

brian911 2007-12-18 02:29

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by norom (Post 109949)
If the WLAN memory bug-fix was installed on flash and then copied to the mmc with everything else does it not need to be installed again onto the mmc?
thx.

No, you don't have to. You are cloning the system to the MMC which already includes the patch to the OS.

dont 2008-01-29 14:34

Re: Please check my guide for booting from MMC for correctness
 
Brian:

I have just followed your recipe and it worked out fine for me.

I decided to go for an ext3 rather than an ext2 file system so I was a little worried about the following line (used 2x):

insmod /mnt/initfs/lib/modules/current/ext2.ko

I tried substituting ext3.ko with no luck so I went ahead and used the line as above. Everything seems to be working fine so far, but I wonder if I should have found an ext3.ko?

Finally, I have a Kingston 2GB. MMC card so I would like to try Fanoush's MMCPlus + Multiblock Writes experimental kernel. I think that you have been using this kernel on the same hardware. If so, any thoughts?

coffeedrinker 2008-01-29 21:54

Re: Please check my guide for booting from MMC for correctness
 
To use ext3 you need to use these:

insmod /mnt/initfs/lib/modules/2.6.21-omap1/mbcache.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/jbd.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext3.ko

YOU MUST ALSO change them in the boot menu.

dont 2008-01-29 22:41

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by coffeedrinker (Post 135401)
To use ext3 you need to use these:

insmod /mnt/initfs/lib/modules/2.6.21-omap1/mbcache.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/jbd.ko
insmod /mnt/initfs/lib/modules/2.6.21-omap1/ext3.ko

YOU MUST ALSO change them in the boot menu.

I have been running all day using ext2.ko on a ext3 file system with no apparent problems.

Should I start over again completely? Do I have to re-partition or re-format?

coffeedrinker 2008-01-29 22:53

Re: Please check my guide for booting from MMC for correctness
 
LOL I have no idea! I'm not that savvy about the filesystems. All I know is, the filesystems are the same except for the journal that ext3 uses, which you are not using. That's why it all works for you. There are some commands to enable the journal but I don't know them off hand.

dont 2008-01-29 23:44

Re: Please check my guide for booting from MMC for correctness
 
Ok, I will start over. Thanks.

gmstrong 2008-01-29 23:51

Re: Please check my guide for booting from MMC for correctness
 
I followed these directions http://maemo.org/community/wiki/howt..._from_mmc_card and now I am having trouble installing or uninstalling applications. If I boot to flash it seems to work but not when I boot to mmc. I tried sudo gainroot before opening app manager but that didn't help. Here is my app manager log.

osso-application-installer 4.46, UI version 2
apt-worker: Forcing /var/lib/dpkg/lock
-----
Uninstalling canola2 2.0.0~beta1-maemo.1
apt-worker: Not handling unrelated package idea.
(Reading database ... dpkg: error processing canola2 (--remove):
files list file for package `idea' contains empty filename
Errors were encountered while processing:
canola2
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

What did I do wrong, did I miss a step?

youbecha 2008-01-30 01:23

Re: Please check my guide for booting from MMC for correctness
 
I just got a refurbished? N770 back from Nokia due to WSOD (warrantee).

I had a working MMC install from the dead machine...I popped the card into the new one...ran the steps again, but skipped the partition-format-copy steps.

Worked perfectly!

dont 2008-01-30 02:22

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by gmstrong (Post 135457)
I followed these directions http://maemo.org/community/wiki/howt..._from_mmc_card and now I am having trouble installing or uninstalling applications.

This is a different set of instructions to the ones detailed in this thread.

Maybe you should ask about your problems in the http://maemo.org/community/wiki/howt..._from_mmc_card
thread or try the instructions in this thread instead.

gmstrong 2008-01-30 17:36

Re: Please check my guide for booting from MMC for correctness
 
I compared the two sets of instructions and the commands you enter are pretty much identical. But that's ok. I'll take my problem somewhere else.

gmstrong 2008-02-01 21:48

Re: Please check my guide for booting from MMC for correctness
 
I booted to flash removed a damaged package (idea) and repeated the process. It works great now. I received some great help from the author of the instructions I mentioned in previous posts. Your instructions work great and they are virtually identical.

sebastian.linux 2008-11-03 00:37

Re: Please check my guide for booting from MMC for correctness
 
Quote:

Originally Posted by gmstrong (Post 136817)
I booted to flash removed a damaged package (idea) and repeated the process. It works great now. I received some great help from the author of the instructions I mentioned in previous posts. Your instructions work great and they are virtually identical.

This thread is just a copy-cat of this
:D

It's incredible what people is able to do for... what??? I don't know... :confused:


All times are GMT. The time now is 06:12.

vBulletin® Version 3.8.8