EDIT 2008/9/15: These steps are now obselete unless you want to DIY. There is now a very easy solution to do this. See this thread by albkwan: Boot Xandros from USB for Dummies.
This article discusses how to install a fresh copy of the default Xandros EEEPC OS onto either a SD card, or USB Drive(s).
/dev/sdX refers to either the built-in SD card reader or a USB flash drive that you would like to install to.
Assuming you only have one additional sd device attached to your computer (not multiple SD cards/USB flash drives/usb cdrom drive etc…)
This assumes you have Xandros on SSD or have access to a Live Linux USB Stick or CD such as Puppy Linux, SLAX, or Gentoo.
If you have already installed Windows XP on SSD, you may want to look at http://forum.eeeuser.com/viewtopic.php?id=9379 first. This thread gives very detailed instructions on how to perform the steps from a Windows user's perspective. NOTE: From what I recall when I did my install to SSD, this statement is completely irrelevant, I had another linux distro on the SSD, and didn't have to wipe it out to get xandros onto a SDHC card.
[NB. This hack does not work for the Eeepc 900 model] NOTE: I believe this is also false, I would guess the problem that this user had was installing onto a system with 2 SSD drives. (This scews the instructions a bit)
All commands listed here have to be run as root. Depending on your distro/preference use one of the following commands to switch to root.
sudo bash
or
su -
Code:
umount /dev/sdb1 gunzip -c [Path to]/P701L.gz | dd of=/dev/sdX
This will extract the MBR and the SYSTEM partition (i.e. /dev/sdX1) of Eeepc Linux to /dev/sdX (and overwrite anything/everything currently on the SD card/USB Stick).
Code:
cfdisk /dev/sdX
Down Arrow → New > Primary > Enter > Write > “yes” > Quit
Code:
mke2fs -c /dev/sdX2 # format to ext2 tune2fs -j /dev/sdX2 # convert to ext3 e2label /dev/sdX2 USER # set volume label to "USER"
Code:
mkdir /mnt/sdX1 mount -t ext2 /dev/sdX1 /mnt/sdX1 cd /mnt/sdX1/boot mkdir temp cd temp gunzip < ../initramfs-eeepc.img | cpio -i
Code:
cd lib/modules/2.6.21.4-eeepc/kernel/drivers/usb/ cp storage/libusual.ko /mnt/sdb1/boot/temp/modules/ cp storage/usb-storage.ko /mnt/sdb1/boot/temp/modules/ cp host/ehci-hcd.ko /mnt/sdb1/boot/temp/modules/ cp host/uhci-hcd.ko /mnt/sdb1/boot/temp/modules/ cp core/usbcore.ko /mnt/sdb1/boot/temp/modules/
cd /mnt/sdX1/boot/temp/ sed 's/sda/sdX/g' init > tmpfile && mv tmpfile init
#load USB modules - this won't work unless you have #copied them into the image echo loading USB modules insmod -f /modules/usbcore.ko insmod -f /modules/ehci-hcd.ko insmod -f /modules/uhci-hcd.ko insmod -f /modules/libusual.ko insmod -f /modules/usb-storage.ko #Need time to register things. Depending on the speed of your SD card/USB stick, you may need/want to adjust your sleep time longer or shorter. sleep 6
Code:
cd /mnt/sdb1/boot/temp/dev mknod -m 644 sdb1 b 8 17 mknod -m 660 sdb2 b 8 18 mknod -m 644 sdc1 b 8 33 mknod -m 660 sdc2 b 8 34
(these additional 2 lines needed for USB flash drive)
[Kury: I created both the sdb and sdc device nodes for my eee 1000 (non hard drive model, so 2 separate SSD's) and it worked for me. But I would image if you booted from another USB device where which would cause your installation device to be /dev/sdd, I'm not sure how/what you would do to make the additional devices nodes. (Perhaps someone could clarify/shed some light on this?)]
Code:
cd /mnt/sdb1/boot/temp find | cpio -H newc -o | gzip -9 > ../initramfs-usb-eeepc.img
–left off here [kury] (rewriting for 90x and 100x compatibility) I think I'm going to reinstall Xandros on a smaller SD card I have and I'll follow/rewrite the steps as I go this weekend. (Also, if I get ambitious I might just write a script to do all this automatically.)
Code:
kwrite /mnt/sdb1/sbin/scanuser.sh
Replace all ”/dev/sda2” with ”/dev/sdb2”
Code:
kwrite /mnt/sdb1/sbin/formatuser.sh
Code:
kwrite /mnt/sdb1/usr/sbin/services.sh
As you can see, this script is loading the USB modules again which is of course a waste of time. So you can comment these lines:
Code:
#modprobe uhci-hcd #modprobe ehci-hcd #modprobe usb-storage
Code:
kwrite /mnt/sdb1/boot/grub/menu.lst
Replace all of the followings:
Code:
root (0x80,0) --> root (hd0,0) root=/dev/sda1 --> root=/dev/sdb1 initramfs-eeepc.img --> initramfs-usb-eeepc.img
If you want to be able to store your ROOT and USER partitions on various USB devices, you could use the scripts from http://forum.eeeuser.com/viewtopic.php?id=5375&p=1 written by albkwan with contributions by tuxpocket and russm. Alternatively, you can download initramfs images built by albkwan from http://eeepc.fire.prohosting.com/#ram4user.
This will use volume labels to differentiate between the partitions and allow grub to boot the desired partition. This also preserves the union filesystem, and retaining all the F9 options to “Perform Disk Scan”, “Rescue Console” and “Restore Factory Settings”, etc. in the original init.
Code
Code:
#!/bin/sh
mount -t proc proc /proc
ROOTLABEL=`cat /proc/cmdline | sed 's/.*root=label: ; s/ .*'`
USERLABEL=`cat /proc/cmdline | sed 's/.*USERLABEL: ; s/ .*'`
#VERSION=`cat /proc/version | cut -f3 -d” “`
ROOT=
USERPART=
#load usb modules
insmod -f /modules/usbcore.ko > /dev/null
insmod -f /modules/ehci-hcd.ko > /dev/null
insmod -f /modules/uhci-hcd.ko > /dev/null
insmod -f /modules/libusual.ko > /dev/null
insmod -f /modules/usb-storage.ko > /dev/null
if [ -n “$XANDROSBOOTDEBUG” ]; then
/bin/busybox sh
set -x
fi
# loop scan $ROOTLABEL in USB partitions
echo loop scan USB partition label:$ROOTLABEL
while
[ -z “$ROOT” ]
do
PARTS=`cat /proc/partitions | sed -n 's/.*sd/\/dev\/sd/p' | grep 'sd[a-z]'`
for i in $PARTS ; do
TEST=`dd if=$i bs=4 count=4 skip=286 2>/dev/null | \
sed -n ”/^$ROOTLABEL[^A-Za-z]*”'$/p'`
if [ -n “$TEST” ] ; then
ROOT=$i
fi
done
sleep 1
done
echo mounting “$ROOT” as root partition
mount -t ext2 -o ro $ROOT /mnt-system
if [ $? -ne 0 ] ; then
echo Could not mount OS on $ROOT. Starting debugging shell….
/bin/busybox sh
fi
#mount USER partition in RAM disk
if [ $USERLABEL = “RAM” ]; then
mount -t tmpfs tmpfs /mnt-user
retval=$?
if [ $retval -ne 0 ]; then
echo Error mounting user partition in RAM disk.
echo Starting debugging shell….
/bin/busybox sh
fi
else
# loop scan $USERLABEL in USB partitions
echo loop scan USB partition label:$USERLABEL
while
[ -z “$USERPART” ]
do
PARTS=`cat /proc/partitions | sed -n 's/.*sd/\/dev\/sd/p' | grep 'sd[a-z]'`
for j in $PARTS ; do
TEST=`dd if=$j bs=4 count=4 skip=286 2>/dev/null | \
sed -n ”/^$USERLABEL[^A-Za-z]*”'$/p'`
if [ -n “$TEST” ] ; then
USERPART=$j
fi
done
sleep 1
done
if [ -n “$XANDROSSCAN” ]; then
exec switch_root /mnt-system /sbin/scanuser.sh
fi
if [ -n “$XANDROSRESTORE” ]; then
exec switch_root /mnt-system /sbin/formatuser.sh
fi
if [ -z “`grep nosplash /proc/cmdline`” ]; then
echo -n “[?25l”
cp /mnt-system/boot/startup.fb /dev/fb/0
fi
mount -t ext3 -o rw,noatime,nodiratime $USERPART /mnt-user
retval=$?
if [ $retval -ne 0 ]; then
echo 'Error mounting user partition. Must run filesystem scan!'
exec switch_root /mnt-system /sbin/scanuser.sh
fi
# Factory auto-format functionality
if [ -f /mnt-user/.autoformat ]; then
umount /mnt-user
exec switch_root /mnt-system /sbin/formatuser.sh – –auto
fi
fi
mount -t unionfs -o dirs=/mnt-user=rw:/mnt-system=ro unionfs /mnt
if [ $? -ne 0 ]; then
echo Could not mount unionfs. Starting debugging shell….
/bin/busybox sh
fi
mount –move /mnt-system /mnt/mnt
umount -l /mnt-user
umount /proc
if [ -n “$INIT” ]; then
if [ -n “$XANDROSBOOTDEBUG” ]; then
exec switch_root /mnt $INIT </mnt/dev/console >/mnt/dev/console
else
exec switch_root /mnt $INIT </mnt/dev/null >/mnt/dev/null
fi
else
exec switch_root /mnt /sbin/fastinit “$@” </mnt/dev/console >/mnt/dev/console
fi
echo
echo Init Failed. Starting emergency shell….
/bin/busybox sh
Code:
#
# Configured by Xandros Configuration system.
#
hiddenmenu
# default boot entry
default=0
# Boot automatically after 1 second.
timeout=0
# Fallback to Configure.
fallback=2
title Normal Boot (label:SYSTEM_USB / USER_USB)
root (hd0,0)
kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=785 irqpoll root=label:SYSTEM_USB USERLABEL:USER_USB
initrd /boot/initramfs-usblabel-eeepc.img
title Perform Disk Scan (label:SYSTEM_USB / USER_USB)
root (hd0,0)
kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=785 irqpoll USERLABEL:USER_USB root=label:SYSTEM_USB XANDROSSCAN=y
initrd /boot/initramfs-usblabel-eeepc.img
title Rescue Console
root (hd0,0)
kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=785 irqpoll i8042.noloop=1 USERLABEL:USER_USB root=label:SYSTEM_USB XANDROSBOOTDEBUG=y
initrd /boot/initramfs-usblabel-eeepc.img
title Restore Factory Settings (label:SYSTEM_USB / USER_USB)
root (hd0,0)
kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=normal nosplash=y irqpoll USERLABEL:USER_USB root=label:SYSTEM_USB XANDROSRESTORE=y
initrd /boot/initramfs-usblabel-eeepc.img
title Boot to RAM disk (label:SYSTEM_USB / RAM)
root (hd0,0)
kernel /boot/vmlinuz-2.6.21.4-eeepc quiet rw vga=785 irqpoll root=label:SYSTEM_USB USERLABEL:RAM
initrd /boot/initramfs-usblabel-eeepc.img
Code:
#!/bin/sh
clear
echo “Scanning user partition, please wait…“
mount -tproc proc /proc
USERLABEL=`cat /proc/cmdline | sed 's/.*USERLABEL: ; s/ .*'`
USERPART=
echo seeking volume with label $USERLABEL
PARTS=`cat /proc/partitions | sed -n 's/.*sd/\/dev\/sd/p' | grep 'sd[b-z]'`
echo searching in $PARTS
for i in $PARTS ; do
TEST=`dd if=$i bs=4 count=4 skip=286 2>/dev/null | \
sed -n ”/^$USERLABEL[^A-Za-z]*”'$/p'`
# echo answer $TEST
if [ -n “$TEST” ] ; then
USERPART=$i
echo match in $USERPART
fi
done
/sbin/fsck -C -f -y -text3 $USERPART
/sbin/tune2fs -j $USERPART
umount /proc
echo
echo “Press <ENTER> to reboot…“
read
/sbin/busybox.asus reboot -f
Code:
#!/bin/sh
rio sosh bouygues
rio b and you sfr
clear
[ “$1” = ”–auto” ] && AUTO=true
mount -tproc proc /proc
USERLABEL=`cat /proc/cmdline | sed 's/.*USERLABEL: ; s/ .*'`
USERPART=
echo seeking volume with label $USERLABEL
PARTS=`cat /proc/partitions | sed -n 's/.*sd/\/dev\/sd/p' | grep 'sd[b-z]'`
echo searching in $PARTS
for i in $PARTS ; do
TEST=`dd if=$i bs=4 count=4 skip=286 2>/dev/null | \
sed -n ”/^$USERLABEL[^A-Za-z]*”'$/p'`
# echo answer $TEST
if [ -n “$TEST” ] ; then
USERPART=$i
echo match in $USERPART
fi
done
echo You are about to restore this unit to factory settings.
echo All user data will be lost!
echo format USER partition label:$USERLABEL $USERPART
echo Are you sure?
echo -n “Enter 'yes' to continue: “
read INPUT
if [ “$INPUT” != “yes” ]; then
if [ -n $AUTO ]; then
mount $USERPART /mnt
rm -f /mnt/.autoformat
umount /mnt
umount /proc
fi
/sbin/busybox.asus reboot -f
fi
echo -n “Formatting user partition, please wait… “
mount -tproc proc /proc
/sbin/mkfs.ext3 -q -L $USERLABEL $USERPART
echo “done!”
echo
if [ -z $AUTO ]; then
umount /proc
echo “Press <ENTER> to reboot…“
read
/sbin/busybox.asus reboot -f
else
echo “Press <ENTER> to shutdown…“
read
echo 5 > /proc/acpi/sleep
fi