A rewrite of the steps for Windows users - boot Xandros from USB on Eeepc

Update: Now there is an easy solution to build this making use of the Asus EeePC USB Recovery Disk. Please refer to the page Boot Xandros on USB for Dummies.

This is a re-write of the steps for Windows users to built Xandros (the stock distro on eeepc) on USB from your desktop with Puppy Linux live CD. This is especially for those who have already installed Windows on the SSD of your eeepc, so you are opt to do it on your desktop with a Puppy Linux live CD. If you want to build it from within your Eeepc, please refer to this page for instructions.

Booting the stock distro from USB flash disk has been reported to be working good for the simple desktop. But for the advanced desktop on USB flash disk, some people have reported problem. So be conservative on this.

Please note that the stock distro on Eeepc uses an union filesystem that overlays a read only SYSTEM partition with a read/write USER partition. In this way, you can easily restore to factory default if you mess things up. This is recommended for newbies and is also what I am describing here. However, for advanced Linux users, they may consider this a nuisance and want to do away with the union filesystem. I have written variations of the steps here to create a non-unionfs Xandros on USB.

What You Will Need
Downloads
Explanation of Linux Terminology
Puppy Linux Specific Instructions
Easy Steps
For the Adventurous


 WHAT YOU WILL NEED

1) A desktop PC that supports booting from CD.
2) A DVD ROM on your desktop PC.
3) The Asus P701L.gz image file of the stock distro (from the rescue DVD that comes with your eeepc). [Update: Now it is possible to download the Eeepc 701 iso image for 4G model from SourceForge.net. For other models, you can download the iso from http://downloads.k0k0.de/index.php?dir=EeePC%2F]
4) A Puppy Linux live CD ISO image which you can download from here: pupeee.iso and burn into a bootable CD. The md5sum is 8642c0b6a62817ea3cf38812d398f380.
5) A target USB device where you want to install your Xandros on USB. It can be any SD, or SD or CF card in a card reader, USB flash disk or USB hard disk partitions of at least 4G size.
[NB. Be sure to buy a good quality SDHC / USB flash disk. If you find many filesystem errors during the final step of filesystem checking, it would mean you will probably also end up with many errors running Xandros from USB that will make the system unstable.]

We will need to built 2 partitions: the SYSTEM partition (2.5G) and the USER partition (around 1.5G, can be more or less). They can be on separate drives. All we need to do is to identify them with a volume label to be specified in the menu.lst config file of GRUB (the default boot loader). Here I have used the volume labels SYSTEM_USB and USER_USB respectively. Feel free to change to whatever you like, but remember to change them also in your partitions and GRUB menu.lst accordingly.


 DOWNLOADS

For those who are not familiar with Linux operations or those who want to live an easy life, I have hosted a package of the 4 necessary files available for download eeepc-bootusb.tgz.

You can just copy them to the relevant locations in your Xandros on USB filesystem:
- initramfs-usb-eeepc.img > copy to /mnt/sdx1/boot/
- menu.lst > copy to /mnt/sdx1/boot/grub/
- formatuser.sh > copy to /mnt/sdx1/sbin/
- scanuser.sh > copy to /mnt/sdx1/sbin/

where /mnt/sdx1 is the path where your USB device is mounted by Puppy Linux (check in Pmount, the Puppy Mount Monitor). But do not uncompress the archive in Windows so as to preserve the file attributes. Otherwise, you will need to give exec permissions to the scripts formatuser.sh and scanuser.sh or it will not run.


 EXPLANATION OF LINUX TERMINOLOGY

1) Devices
In Linux, each disk and each partition on the disk is treated as a device. For example, the SSD in eeepc is known as /dev/sda (by the stock distro), and the second hard disk (SD0, the built-in card reader) is /dev/sdb. The first partition of the first hard disk is /dev/sda1, and the second partition is /dev/sda2, and so on.

USB flash disk will usually be registered by the kernel of the stock distro as /dev/sdc. If you have more than one USB storage device plugged in, then it may varies. Also for some multi-card reader, I have experience coming up to /dev/sdg with the eeepc.

SATA, SCSI and USB disks are all known as /dev/sdx. For IDE hard disks, they are known as /dev/hda, hdb, hdc and so on. The complication here is that Puppy Linux sees the devices differently. It sees the SSD of eeepc as /dev/hdc, and SD0 (the built-in card reader) as /dev/sda. So do not mix up, verify by looking at their volume label, sizes and file types in Pmount: The SSD is "SILICONMOTION SM223AC" and the built-in card reader is "USB2.0 CardReader SD0".

2) Running Linux commands
Although Puppy Linux has lots of GUI tools, but some advanced operations still need to be done on the command line. See this wiki on EeeUser Wiki: Guide to terminal for more information.

3) The mknod command
The mknod command creates device special files. Some arguments need to be specified running this command. The arguments we need here are:
-m     set permission modes. We are using 644 (rw-r--r--) for SYSTEM partition because it is mounted read only and 660 (rw-rw----) for USER partitions read/write
b       - specify as a block device (hard disk).
major - major device number = 8 for SCSI disk driver
minor - minor device number (0 = /dev/sda, 16 = /dev/sdb, 32 = /dev/sdc ...)

You can refer to the manual page of this command for more details here.


 PUPPY LINUX SPECIFIC INSTRUCTIONS

1) Mount/umount a drive
On the desktop of Puppy Linux, there is a "drives" icon. Click on that will launch Pmount, the Puppy Mount Monitor

On startup of Pmount or when you click , Pmount will scan your computer and list all drives. Click on the rightmost icon will mount that partition. The icon will then turn green and show the mounting point and partition size on the left together with the  icon.

[NB. If your desktop is too small, and not all the drives are seen. You can press Alt + Mouse left click on the Pmount window to drag it up.]

2) File Manager
Open the default file manager of Puppy Linux (Rox-filer) by clicking on the icon in pmount for that drive.

3) Terminal
Open a terminal from file manager by [Right click] > Window > Terminal Here

4) Edit Text file
Edit a text file by [Right click] on the file > File 'xxxxx' > Open As Text

5) Drag and Copy files
Copy files between 2 windows of Rox-filer by drag and drop

6) Create New Directory
Create a new directory by [Right Click] on empty space > New > Directory


EASY STEPS

[NB. In the steps here, I have used /dev/sdx for the target device where you want to install your Xandros on USB. Check the correct device name in Pmount and substitute them in the commands accordingly.]

1) Copy the Asus P701L.gz image file of the stock distro from the rescue DVD and put it somewhere on the hard disk of your desktop PC.

2) Put the Puppy Linux live CD into your CDROM and boot your desktop with it. You may need to enter BIOS to change the boot sequence. During the boot process, you will have to answer a few questions:
   (i) Options - just [Enter]
   (ii) Keyboard - choose your national keyboard
   (iii) Display Driver (Xorg or Xvesa) - Any will do
   (iv) Display resolution - 1024x768 should do for most modern desktop PC

3) Click on the "drives" icon on the desktop of Puppy Linux to launch Pmount. Mount the device where you have copied the P701L.gz image file.

4) In Pmount, open File Manager by clicking on the icon for the device where you have copied the P701L.gz file. Navigate into the folder with the image file.

5) Open a terminal and run this command to extract the P701L.gz image to the target device. Replace sdx with the correct device name as you can see in Pmount. [Caution: Umount the target device first]

Code:

gunzip -c P701L.gz | dd of=/dev/sdx

This will copy the MBR and the SYSTEM partition (/dev/sdx1) to the target drive (/dev/sdx).

6) Change the volume label of the SYSTEM partition, SYSTEM_USB for me or any for your choice. Open a terminal and run this command:

Code:

e2label /dev/sdx1 SYSTEM_USB

7) Start cfdisk and create the USER partition on remaining space of USB device

Menu > System > Pdisk Partition Manager > sdx > cfdisk

New > Primary > Enter > Write > "yes" > Quit

[NB. Pressing [Enter] after selecting [Primary] will use all the remaining space for your USER partition. If you have a 8G SD, you may want to specify the size and reserve some space for another fat32 data partition.]

8) Open a terminal and format the new partition to ext3 filesystem with this command:

Code:

mke2fs -c -L USER_USB /dev/sdx2
tune2fs -j /dev/sdx2

Change USER_USB in this command if you choose a different volume label.

You may also do it with GParted Partition Manager:

Menu > System > GParted Partition Manager


It has a graphical interface and is quite straightforward. But lots of steps compared with the command line!

9) Click in Pmount and mount /dev/sdx1 (click the rightmost  icon). Then open file manager for that drive (click the leftmost  icon). Navigate into the folder /mnt/sdx1/boot.

10) Mount the device where you have downloaded the 4 files. Open file manager for that drive and navigate to the folder where you have put them. Drag and drop the file "initramfs-usb-eeepc.img" to the other window of /mnt/sdx1/boot.

11) Navigate into the folder /mnt/sdx1/sbin. Then drag and drop the files "scanuser.sh" and "formatuser.sh" you have downloaded here.

12) Navigate into the folder /mnt/sdx1/boot/grub, drag and drop the file "menu.lst
" you have downloaded here.

13) Run a filesystem check on your partitions before you reboot. For me, the easy way is to do it on the command line. Open a terminal and run these commands:

Code:

umount /dev/sdx1
e2fsck -c /dev/sdx1
umount /dev/sdx2
e2fsck -c /dev/sdx2

Or you can do it with GParted partition manager:

- Menu > System > GParted partition manager
- Select /dev/sdx on the top right (Maximize the window if you can't see it)
- Highlight the line /dev/sdx1
- Partition > Check

- Highlight the line /dev/sdx2
- Partition > Check
- Edit > Apply all operations

[NB. Umount the partitions with Pmount before running filesystem check.]

14) Now your Xandros on USB is ready for use. Plug it into your eeepc, press [Esc] at startup and select USB: USB2.0 Card Reader SD0 or USB: Generic Storage Device as first boot device.


 FOR THE ADVENTUROUS

For the adventurous, you may want to build the init RAM filesystem image from scratch. Here are the modified steps:

9) Create a new directory "temp" in /mnt/sdx1/boot. This is where you will extract the original initramfs iimage.

10) Navigate into the new folder /mnt/sdx1/boot/temp, open a terminal and extract the original initramfs image with this command:

Code:

gunzip < ../initramfs-eeepc.img | cpio -i

11) Edit the file "init". Replace its content with this init.

13) Navigate into the folder /mnt/sdx1/boot/temp/modules. Open another file manager window of the same drive and navigate into the folder /mnt/sdx1/lib/modules/2.6.21.4-eeepc/kernel/drivers/usb. Look for the files usbcore.ko, ehci-hcd.ko, uhci-hcd.ko, libusual.ko and usb-storage.ko in the different sub-folders. These are the kernel modules you will need to boot from USB device. Drag and copy them here.

14) [NB. With devices dynamically created by mdev in the new "init", this step is no longer needed.] Navigate into the folder /mnt/sdx1/boot/temp/dev. Open a terminal and create the necessary devices for mounting the root filesystem during startup with the mknod command:

Code:

mknod -m 644 sdb1 b 8 17
mknod -m 660 sdb2 b 8 18
mknod -m 660 sdb3 b 8 19
mknod -m 644 sdc1 b 8 33
mknod -m 660 sdc2 b 8 34
mknod -m 660 sdc3 b 8 35
mknod -m 644 sdd1 b 8 49
mknod -m 660 sdd2 b 8 50
mknod -m 660 sdd3 b 8 51
mknod -m 644 sde1 b 8 65
mknod -m 660 sde2 b 8 66
mknod -m 660 sde3 b 8 67
mknod -m 644 sdf1 b 8 81
mknod -m 660 sdf2 b 8 82
mknod -m 660 sdf3 b 8 83
mknod -m 644 sdg1 b 8 97
mknod -m 660 sdg2 b 8 98
mknod -m 660 sdg3 b 8 99
mknod -m 644 sdh1 b 8 113
mknod -m 660 sdh2 b 8 114
mknod -m 660 sdh3 b 8 115

Instead of running those commands one by one, you can also download a package sdxx.tar.gz of the device files I have created and extract it to the folder /mnt/sdx1/boot/temp/dev.

15) Now you can pack the initramfs image. Navigate into the folder /mnt/sdx1/boot/temp, open a terminal and run this command:

Code:

 find | cpio -H newc -o | gzip -9 > ../initramfs-usb-eeepc.img

16) Navigate into the folder /mnt/sdx1/boot/grub. Edit the file menu.lst, and replace its content as per this thread on EeeUser Forum. If you choose to use your own volume labels for the SYSTEM and USER partitions, change them in these lines:

kernel /boot/vmlinuz-2.6.21.4-eeepc ... root=label:SYSTEM_USB USERLABEL:USER_USB ...

17) Navigate into the folder /mnt/sdx1/sbin. Edit the files "scanuser.sh" and "formatuser.sh". Replace their content as per this thread on EeeUser Forum.

18) Continue as per step 13 above to run a filesystem check before you reboot.