UPDATED 2008/9/10: The initramfs image I have hosted now also support 900 and later models.
EDIT 2009/3/14: There is another set of instructions for doing this without Puppy Linux in thread #37 of this post. You will be working solely on the command line within EeePC Linux with that method.
I have worked out this solution to mount a 4G SD card as part of the filesystem of my Eeepc Linux, in particular as the USER partition of the unionfs instead of the default /dev/sda2. So, now I have plenty of free space in my Eeepc Linux (and my next step would be to install win2k on /dev/sda2).
The steps here are actually quite similiar to the steps for booting Xandros from USB. But BEWARE: Any mistake may render the default Xandros not usable and end up having to restore from DVD image. Take your own risk in testing this steps!
What you will need:
(i) a SD card (minimum 2G)
(ii) A Linux on USB (I am using my default Xandros booting from a USB card reader, you can also try with Puppy Linux).
[NB. Another possibility would be a Linux on CD, but then you will need an external CDROM]
The commands below are for working with default Xandros booting from USB. If you are using Puppy Linux, there will be some notable difference:
(i) Puppy Linux see the SSD as IDE, so /dev/sda1 and /dev/sda2 will appear as /dev/hdc1 and /dev/hdc2, and /dev/sdb1 will appear as /dev/sda1. Verify this for yourself on your system. You will have to change the device names in the commands below accordingly.
(ii) In Puppy Linux, the user is already by default "root". But for default Xandros, you will need to change user to root to run all the commands below:
sudo bashAlso in default Xandros, better do it on konsole (File Manager > Tools > Open Console Window) as you can copy and paste commands there.
(iii) Same for the File Manager in Puppy Linux, already root. For default Xandros, run a superuser File Manager with:
sudo XandrosFileManagerHere are the steps:
1) Backup your existing USER partition (/dev/sda2) to an USB flash disk (Optional)
dd if=/dev/sda2 | gzip > /mnt/media/xxx/xxx/eeepc-sda1.img.gzReplace /mnt/media/xxx/xxx with the path of your USB storage device as you can see it in your File Manager.
2) Prepare your SD card - fdisk and format to ext3
cfdisk /dev/sdb New > Primary > Enter > Write > "yes" > Quit mke2fs -c -L USER /dev/sdb1 tune2fs -j /dev/sdb13) Copy all data from your existing USER partition (sda2) to your new USER partition (sdb1)
cd /mnt mkdir sda1 sda2 sdb1 mount -t ext3 /dev/sda2 /mnt/sda2 mount -t ext3 /dev/sdb1 /mnt/sdb1 cd /mnt/sda2 cp -ax * /mnt/sdb14) Create a temp dir in /boot of sdb1 and unpack the initramfs image there:
mount -t ext2 /dev/sda1 /mnt/sda1 cd /mnt/sdb1/boot mkdir temp cd temp gunzip < /mnt/sda1/boot/initramfs-eeepc.img | cpio -i5) Modify "init":
EDIT: Thanks to the insight of Russell, we can actually load the USB modules from within the filesystem instead of copying them into the initramfs image.
kwrite initLook for these lines:
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
Add the following lines just after it to USB modules at bootup:#load USB modules VERSION=`cat /proc/version | cut -f3 -d" "` insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/core/usbcore.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/host/ehci-hcd.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/host/uhci-hcd.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/storage/libusual.ko > /dev/null insmod -f /mnt-system/lib/modules/$VERSION/kernel/drivers/usb/storage/usb-storage.ko > /dev/null #loop scanning for usb devices while ! grep -q "sdb1" /proc/partitions; do sleep 1; doneAlso change all sda2 to sdb1. Save and quit.
6) Create device sdb1 in /dev of the temp dir:
cd /mnt/sdb1/boot/temp/dev mknod -m 660 sdb1 b 8 17[NB. don't substitute "sdb1" in the mknod command even if you are using Puppy Linux]
7) Now pack the initramfs image and move it to /mnt/sda1/boot:
cd /mnt/sda1/boot mv initramfs-eeepc.img initramfs-eeepc.img.orig cd /mnt/sdb1/boot/temp find | cpio -H newc -o | gzip -9 > ../initramfs-eeepc.img cd ../ mv initramfs-eeepc.img /mnt/sda1/boot8) Edit the file scanuser.sh:
cd /mnt/sda1/sbin cp scanuser.sh scanuser.sh.orig kwrite scanuser.shReplace all "sda2" with "sdb1".
9) Do the same for formatuser.sh:
cd /mnt/sda1/sbin cp formatuser.sh formatuser.sh.orig kwrite formatuser.shReplace all "sda2" with "sdb1".
EDIT: This step is not necessary!
10) Give exec permission to your SD card as per this thread.
11) Reboot.
The beauty of this method is that all the changes are permanent and upgrading your SD card to a even bigger capacity in the future (when price is more attractive) is very easy. You only need to repeat steps 2 and 3 for your new SD card.
So time for a beer?
Edited by albkwan, 14 March 2009 - 01:14 PM.












