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.
These are the steps for to built Xandros on USB working from your EeePC (instead of from Puppy Linux as in the other page). This is a rewrite of my write up in this thread on the EeeUser Forum for booting Xandros from USB by seeking the root and user partitions with the volume label method as worked out by tuxpocket in this thread. This is the preferred method for booting from USB flash disk because the Eeepc may assign a different device name if you have more than one USB device plugged in. For booting from SD card only, you can refer to the steps in the EeeUser PC Wiki: How to boot Xandros from an USB flash drive as the Eeepc will always assign /dev/sdb to the built-in SD card.
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. For advanced Linux users, they may consider this a nuisance and want to do away with the union filesystem. As there is no re-partitioning tool in the Eeepc, the easier way I considered is to build it with a Puppy Linux Live CD or Pupeee: Puppy Linux for the Eeepc on your desktop. See this page for instructions.
| What You Will Need |
| Downloads |
| Easy Steps |
| Build initramfs from Scratch (Advanced) |
WHAT YOU WILL NEED
1) 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 the 4G model from SourceForge.net. For
other models, you can download the iso from http://downloads.k0k0.de/index.php?dir=EeePC%2F]
2)
A target USB device where you want to install your Xandros on USB. It can be any
SD, or SD or CF card in an external 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
To make life easy for all of you, I have hosted a package of the 4 necessary
files available for download eeepc-bootusb.tgz. Download it
to /home/user and extract it there (Right
click on the file > Extract
All).
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 of your USB device.
For SD card, the Eeepc will always see it as /dev/sdb. But for USB flash disk, it may become /dev/sdc or /dev/sdd ... , depending on how many USB devices you have plugged in. For multi-card readers, it may even go up to /dev/sdh. You can verify this by entering the command df in a terminal. It will list all mounted partitions. e.g.
/home/user> df -h Filesystem Size Used Avail Use% Mounted on rootfs 3.7G 430M 3.1G 12% / /dev/sda1 3.7G 430M 3.1G 12% / unionfs 3.7G 430M 3.1G 12% / tmpfs 249M 12K 249M 1% /dev/shm tmpfs 128M 16K 128M 1% /tmp /dev/sdc1 979M 738M 241M 76% /media/PDU01_1G 67A2.0/JT_1GB_USB /home/user>
In the instructions below, I have used /dev/sdx to denote your target USB device. Replace sdx with the correct device name as you see it in df.
NB. All steps described here have to be done with root privilege. To run a command, open a Terminal from File Manager by selecting Tools > Open Console Window. Then change user to root by:
sudo bash
To copy and paste files, you will need to run a Superuser File Manager with this command:
sudo XandrosFileManager
1) Copy the Asus P701L.gz image file of the stock distro from the rescue DVD
to somewhere accessible to the Eeepc.
2) Open a terminal and run this
command to extract the P701L.gz image to the target device.
[Caution: Umount the target device
first]
umount /dev/sdx gunzip -c /Path To/P701L.gz | dd of=/dev/sdx
This will copy the MBR and the SYSTEM
partition (1st partition) to the target drive
(/dev/sdx).
[NB. The better way to
do this is to navigate first to the folder where you have save the DVD image
file, then open a terminal there and run the command. In this way, you can
skip "/Path To/" in the command above.]
3) Change the
volume label of the SYSTEM partition (SYSTEM_USB for me or any for your
choice):
e2label /dev/sdx1 SYSTEM_USB
4) Start cfdisk and create the
USER partition on remaining space of USB device:
cfdisk /dev/sdx
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 data partition.]
5) Open a terminal and format the new partition to ext3 filesystem with this command:mke2fs -c -L USER_USB /dev/sdx2 tune2fs -j /dev/sdx2
Change USER_USB in this
command if you choose a different volume label.
6) Mount the SYSTEM partition of your target
USB device.
mkdir /mnt/sdx1 mount -t ext2 /dev/sdx1 /mnt/sdx1
7) Open a Superuser File Manager, copy and paste the 4 files you have downloaded (and extracted) to their relevant locations in the filesystem of /mnt/sdx1.
8) 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 ...
9) Run a filesystem check on your
partitions before you reboot:
umount /dev/sdx1 e2fsck -c /dev/sdx1
9) 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 (for SD)
or USB: Generic Storage Device
(for USB flash disk) as first boot device.
Build initramfs from Scratch (Advanced)
For the adventurous, you may want to build the init RAM filesystem image from scratch. Here are the modified steps:gunzip < ../initramfs-eeepc.img | cpio -i
9) Open a Superuser File Manager, edit the file "init" (Right click > Open With > Text Editor). Replace its content with this init. Then save and exit.
10) 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 and copy them to /mnt/sdx1/boot/temp/modules. These are the kernel modules you will need to boot from USB device.
11) [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:
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.
12) Now you can pack the initramfs image. Navigate into the folder /mnt/sdx1/boot/temp, open a terminal and run this command:
find | cpio -H newc -o | gzip -9 > ../initramfs-usb-eeepc.img
13) 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.
14) Navigate into the folder /mnt/sdx1/boot/grub. Edit the file
menu.lst, and replace its content as
per this thread on EeeUser
Forum.
15) Continue as per step 8 above.