Monday, April 7, 2008

Dual Booting OS 2008 Step 3: The Actual Dual boot

Ok, so now we have root access, we have a partitioned mmc/sd card.. we are ready for the cool part.

First things first, either plug in your tablet or make sure you have a full battery, you don't want the power to go out during this part.

From the tablet you need to download this;
http://fanoush.wz.cz/maemo/initfs_flasher.tgz

(for more information about fanoush's work and info on this flasher, see http://fanoush.wz.cz/maemo/#initfs)

By default the tablet will want to save to your Documents folder in your /home directory (/home/user/MyDocs/.documents/)

Don't save it on your card, not because that will cause problems, but because you can't execute applications by default from your cards. This program is going to replace the initfs section of the device with the dual boot, but first lets look at that extension...tgz

This means that this is a tar file, compressed with gzip compression.. if it read tar.gz it would mean the same thing. In linux file extensions don't mean anything. They are just there to help the user know what to do with the file.

We are going to use the version of tar that comes with the tablet to open this file. This will probably be the last time we use that version, more on this later.

In xterm as root run the following;

cd /home/user/MyDocs/.documents
tar xvzf initfs_flasher.tgz
cd initfs_flasher
./initfs_flash

The first command (cd) Changes Directory to your documents folder. The "." before a file or directory means its a hidden file and won't show up in a listing with out the -a switch (google for "manpage ls" for more info). The second command opens the archive file the switch (xvzf) means X=extract V=verbose(more info) Z=gzip format F=specified file. Then we are switching into the directory that we just extracted, and finally we are running a local application (./). Unix uses something called your "PATH" (try "echo $PATH" at xterm). The path is where the system looks for executables. Since your documents folder isn't in your path, we tell the system to run the local app directly (./ means "here" ../ means "one level above me" ../../ "two levels above" and so on and so forth)

Read the applications instructions carefully, but you should be safe answering yes to all the questions.

When it says press enter to reboot.. do so. If upon boot for some strange reason your highlighted selection is not "internal flash" hit the menu key, and then the up key to highlight it, then hit the square button. If it is highlighted, you can either wait the 30 seconds for the menu to finish, or hit the menu key, then the square key.

Congratulations! You can now dual-boot, but dual boot to what? Continued Next Time.

Just kidding.. man wouldn't that have sucked!

We are going to copy the whole rootfs over to the card. Remember when I talked about that other version of tar.. well here it is. We are going to use GNUtar.. it has more features.. though it will look and feel pretty much the same.

To install, open Xtem, and run this command

apt-get -d install tar

Apt-get is the front end for dpkg, the debian package managment software, and we are telling it to fetch and install tar...well almost. See that -d? That means download only. In this case that is 147% important! Without that it will delete your whole system and you will have to flash and start over. Don't be worried though, just double check for the -d before you hit enter.

If you made sure the -d was there you can ignore the warnings and go ahead and enter "Y".

Once it has downloaded, we will run the following commands as root in an xterm.

cd /var/cache/apt/archives/
mkdir /tar-temp/
dpkg -x tar*.deb /tar-temp/

Ok, you already know what the cd command does. The mkdir command makes a new directory where you tell it to. This new directory we are making is called tar-temp, and it is being made in the top level directory "/" also called the root. The last command uses the debian package management software to extract the tar program to that directory.

Now we need to mount our partitions to locations that we can copy over the files

Again, as root in an xterm;

insmod /mnt/initfs/lib/modules/2.6.18-omap1/mbcache.ko (this is .21-omapl in OS2008)
insmod /mnt/initfs/lib/modules/2.6.18-omap1/ext2.ko
mkdir /opt/
mount /dev/mmcblk0p2 /opt
mkdir /floppy/
mount -t jffs2 /dev/mtdblock4 /floppy

Now to explain those commands.

Insmod is a command to load a module into the running kernel space. We load the two modules needed to mount an ext2 partition. Then we make an /opt directory, and mount the ext2 second partition internal card to that directory. Then we make a directory called /floppy and mount the running rootfs to it.

Now for the magic.

/tar-temp/bin/tar cf - -C /floppy . | /tar-temp/bin/tar xvf - -C /opt

*editors note.. the above command is one long line. On some screens it gets cut into two lines. I blame blogspot :-)

That command will use our new version of tar to properly copy everything over to
our card's partition. The tall bar in the middle is called a pipe. It is located
on the finger keyboard of the third tab fifth key from the right.


again root with xterm;

umount /opt
umount /floppy
chroot /mnt/initfs cal-tool --set-root-device ask:immc2
shutdown -r now

What this does is unmounts our card and rootfs. The chroot sets a little jailed system of our initfs and the rest of it adjusts the boot menu to default to the internal card's boot. Finally we reboot with the shutdown.

When the system comes back up the internal card will be selected. You can either wait the 30 seconds for the boot to start or hit the menu key, then the square key to start it right along.

Ok, a few things to be aware of running off your internal card. Sometimes because of how the card works, your system can get a little off... if you notice items missing from menus or it's just not working right, reboot to the internal flash and run this command as root from the xterm

fsck -fy /dev/mmcblk0p2

The fsck command is a file system checker, the -fy is a force run saying yes to all fixes.

These are the only other caveats I have to booting off the internal card. First, if you hook up to usb, only the external card will be usable on the pc and the internal card will not remount for use once you disconnect without a reboot. If you have to do alot of usb work, boot off the internal flash for that time. Second, sometimes the system may lock up a bit.. just pull the battery out.. boot to internal flash, run the fsck then reboot to the card and all will be well.

Enjoy

*all procedures are attempted at your own risk. I claim no responsibility if you ruin your tablet.

Props..
www.internettablettalk.com
http://maemo.org/maemowiki/HowTo_EASILY_Boot_From_MMC_card

Friday, April 4, 2008

Dual Booting OS 2008 Step 2: Partitioning

First you need to make sure you have root access, which was described in my previous post. Now we need to partition the ssd/mc card in order to be able to handle both the OS(Operating System, in this case also called the "*rootfs", and storage space for your music/videos etc.

This entire process can be done from your tablet. I always do it from my n800, you can to. It's easy.

Step 1: Unmount the mmc/sd

Since your already root in an xterm (right???) we are going to "unmount" the card. Everything in linux is a file, harddrives, soundcards, your mmc/sd.. all files. Unix "mounts" certain devices to be seen in different locations and to make them accessible. How ever we want to make major changes to that card, so we don't want the OS controlling it.
_
umount /dev/mmcblk0p1
or
umount /media/mmc2

Now to explain what those mean.

umount is the command that removes a mounted location from the system.

/dev/mmcblk0p1 is the hardware device file for the internal card partition 1

mmcblk0 == internal card
mmcblk1 == external card
p1 == partition 1;p2 == partition 2;etc

If you are in the dir anywhere, or maybe have extended memory running on the card it won't unmount.. stop playing music, cd out of the dir, turn off your extended virtual memory.. try again.

Step 2: Partition the card

We need some tools for formating and partitioning so we have to do two things

First we have to add a new repository to our applications list.

To add a repository Click
MENU - > SETTINGS -> APPLICATION MANAGER

Then click on the file button or the title bar of Application manager and select TOOLS -> APPLICATION CATALOG

We want to add a repository so click NEW.

Catalog name: Maemo Repository
Web address: http://repository.maemo.org/
Distribution: bora
Components: free non-free

Make sure that "disabled" is unchecked

Click OK, then click CLOSE

Ok, now back in xterm as root

apt-get install e2fsprogs

now that thats installed. We are going to use sfdisk to partition the card. Sfdisk is kinda clunky and no user-friendly... however its on the tablet.

Start the app with this command

sfdisk -uM /dev/mmcblk0

the -uM means display and accept Megabyte units, and you remember that /dev/mmcblk0 is your internal card

Now once your in there you need to setup 4 partitions.. well really just two but its gonna make you set up 2 empty ones too.. don't worry it will make sense.

I am going to use my card as an example, you can modify fairly easily. I have a 2 gig sd card. I am going to give 356 megs to my first partition for use by the applications for music and files and what not, and approximately 1.6 gigs for my rootfs(where the os and applications go). I am going to show all for lines of entry, then explain them.

,356,6
,,L
,,
,,

Ok, sfdisk is configured with three items per line sepearted by ",". The first item is the starting point. We leave it blank to use default, or the next point in line. The second spot is the ending spot. In the first line I defined it to stop 356 megs into the card and in the second left it blank because I wanted to use the rest of the space. The third spot is for filesystem type. 6 is a fat16 type and L is a linux partition type(also called a type 83). The last two lines are completely empty because there is no where to start, and no where to end because there is no more space. When prompted to write the information you can type y. Don't worry about any warnings.. its an old format tool and not aware of the advances in linux.

Step 3: Formating the partitions

Now that our partitions are cut, we can begin to format them. Formating a partition gives it space usable by the OS.

The first partition we are going to format fat16 so that its usable by windows via usb and the tablets software can access it just like it could before you formated.

*The difference between the rootfs and the initfs is that the initfs is part of your firmware, replaced by flashing. It holds the kernel, that part of the unix OS that handles everything else. The rootfs is the userspace file system. All your applications, device files, program libraries etc go here. The following command will handle this

mkdosfs /dev/mmcblk0p1

As you recall mmcblk0p1 is the internal card, partition 1. The second partition we will format for the rootfs a filesystem type called EXT2.

mke2fs /dev/mmcblk0p2

mmcblk0p2 = second partition.

Now its all done. For the system to be able to recognize these partitions we have to reboot. The easiest way at this point is from the xterm using the shutdown command.

shutdown -r now

The -r means reboot, a -h would mean halt, or turn off. The "now" part defines when this action should happen. After reboot the first partition should operate just like the card did before the partitioning, and the second partition will be discussed in the next section

** Usual props to sites I get tablet info from
www.internettablettalk.com and www.maemo.org

Most of the information in this post was double checked from http://maemo.org/maemowiki/HowTo_EASILYPartition_your_MMC_card

Monday, March 31, 2008

Dual Booting OS2008 Step 1: Root Access

The first step to being able to boot your tablet off an internal mmc/sd card is to have the rights to make these kind of changes.

What is Root Access?

Root(root) is the name of a unix systems master account. Like your Local administrator or Domain Admin type accounts in windows, root is the end all be all of unix rights.

Why be root?

There are many things that can not be done as a normal user that we will need to do in order to have these extra options.

I am not going to dual boot, should I still know how to be root?

Absolutely. Even if your not going to dual boot, there are many advantages to being root and having root command line abilities.

The n800 is actually a debian linux system. Debian is a distribution of linux, like fedora, or mandriva or my favorite gentoo (google for LinuxMint if you want a reallllly easy ubuntu based desktop linux OS). Debians method of package management is called dpkg (debian package.. clever huh) and a front end for this is called apt. Apt is a tool for fetching and installing .deb files (the dpkg format) and all the files needed to install that file (called dependencies) on your system. Repositories are locations for your system to look online or locally to find these files. Get it? Good. Moving on.

Before OS2008 you had to add a terminal (a command line access to your tablet) from a new repository. With OS2008 nokia has decided to make access to this application a default install with the OS. Big thumbs up to Nokia on that one. However we still need access to the root level account.


Step 1. Install becomeroot
We are going to install a package that lets you become root.. its called becomeroot :-)

The repository that contains becomeroot doesn't work well with OS2008, but you can download the app by itself. From your n800 click on the following link

http://eko.one.pl/maemo/dists/bora/user/binary-armel/becomeroot_0.1-2_armel.deb

When the options pop up click "Open", this will run the .deb file in the Application Manager and install it properly.

Step 2. Gain root access
Once your done with that, you need to start the xterm(The console application).
MENU -> Utilities -> X Terminal

From with in xterm type the following

sudo gainroot

That command will give you your root account. Sudo is a command that lets you run other commands as root, in this case gainroot.

Do be a bit careful as root if don't know linux, as you can cause a lot of problems.

Most of this info was garnered from www.internettablettalk.com and www.maemo.org especially http://maemo.org/maemowiki/HowTo_EASILY_BecomeRoot, however this doc was written to explain whats happening and update for OS2008

OS2008 First Tweaks you should do

I am reposting some of my earlier tips because OS 2008 has changed the menu/config settings slightly.

There are two things that you should tweak on your OS2008 tablet right out of the gate.

1. Virtual Memory. Referred to as swap space in linux, this allows your running processes to use physical storage space as ram.

To set this up, you will need a card in the internal slot. If the only card you have is the one that came with the unit, that will work, though far from ideal. I suggest at least a 512 (I have a 2gig) so that in addition to the swap, you have space files.

Menu -> Settings -> Control Panel -> Memory

Select the "Virtual" tab in the Memory window.

Click the "Extend Virtual Memory" check box.

If you have plenty of space use the full 128 max option for the most performance. If you only have the 128 meg card, use 64 megs or 112 megs if you don't want to use the card for any storage. I recommend against the 128 meg file size on a 128 meg card. Even if you do get it to write.. it will most likely cause errors

Click "OK"

2. Screen - Keys Locking

While you are still in the Control Panel, select the "Display" applet.

There is a known bug that the screen won't blank when you lock the device unless you set both the "Brightness period" and the "Switch off display" time to be the same. Set it to what your comfortable with.

Now when you press the power button then the square in the directional pad.. the screen will blank with the keys.. hit the same key combination to unlock the device.

Schmots
These and other great tips have been gathered from www.internettablettalk.com and www.maemo.org

Friday, March 28, 2008

Site Needs updating

UPDATE:
I have gotten my n800 dual booting with OS2008. I notice a lot of new features and great things that can be done. I will be updating the How To shortly.

After upgrading from OS2007 to OS2008 I tried to follow my own instructions for dual booting. Unfortunately in that time a lot of files have been moved or changed/renamed. My method for dual booting is no longer valid. I will be reworking it as I get my own unit to dual boot.

Wednesday, March 26, 2008

I'm Back

Let me get re-acquainted with my device and I will hopefully begin posting new information again.

Friday, August 10, 2007

Even Easier

I have begun a project on my own to get an easy to add perl binary (its an application that runs scripts) and a script program to do all this work. All you would have to do is download two files, move one to the proper place, and run the other... I might even be able to make a bash script (thats which shell we run) to do it all so all you have to do is download one file and run it.. I will keep you posted.