Well, I have a 256Mb SD card and use it with 2 partitions, /usr and /opt on each one. I prefer this to symlink to /mnt/card, since some packages delete the symlinks and create a dir in their place, and all gets broken.
I\'m using OZ 3.3.6-pre1, and already created the two partitions on the SD card and mounted them as /mnt/card1 and /mnt/card2.
My partitions divide the sd card in half.
I wrote a script to do the changes and altered /etc/sdcontrol and /etc/fstab to mount the two partitions as /usr and /opt.
The card partitions should be mounted as /mnt/card1 and /mnt/card2, and the new sdcontrol version should be in the same dir as the script.
sdcontrol:
#!/bin/sh
#
# sdcontrol 1.0 2001/8/8 21:33:19 (Hideki Hayami)
# edited 2004/02/05 13:43 (Bruno Santos)
# Initialize or shutdown a SD card device
#
# The first argument should be either \'insert\' of \'eject\'.
#
# NOTE: Since we use the SD card as /usr and /opt we can\'t eject it
# So, some of this script functions will be disabled.
ACTION=$1
DEVICE1=/etc/dev/mmcda1
MOUNT_POINT1=/opt
DEVICE2=/etc/dev/mmcda2
MOUNT_POINT2=/usr
case "$ACTION" in
\'insert\')
fsck $MOUNT_POINT1
mount $MOUNT_POINT1
fsck $MOUNT_POINT2
mount $MOUNT_POINT2
MOUNT_RES = `mount | grep $DEVICE1`
# If the mount via fstab fails, force it
if [ "$MOUNT_RES" = "" ]; then
mount $DEVICE1 $MOUNT_POINT1
fi
MOUNT_RES = `mount | grep $DEVICE2`
if [ "$MOUNT_RES" = "" ]; then
mount $DEVICE2 $MOUNT_POINT2
fi
;;
\'eject\')
# Do nothing
true
;;
\'compeject\')
# Do nothing
true
;;
\'change\')
# Do nothing also
true
;;
\'*\')
exit 1
;;
esac
exit 0
sdcardstuff.sh:
#!/bin/sh
#
# Put together by bluey[at]netcabo[dot]pt
#
# Move /usr and /opt to SD card and make the sd card mount earlier.
# Based on daniel@steen-family.com script to boot from the sd card
# found in http://www.openzaurus.org/oz_website/faq/faq?id=192 and
# "Moving all of /usr to SD" from
# http://www.linux-migration.org/ch05s10s05s06.html
# Take care of busybox command links
echo -n "Creating some busybox command links in /bin: "
for cmd in [ tail cut test dc; do
ln -s /bin/busybox /bin/$cmd
done
for cmd in /usr/bin/* /usr/sbin/*; do
[ /bin/busybox -ef $cmd ] && ln -sf /bin/busybox $cmd
done
echo "done."
# Create the sd first partition device somewhere else
echo -n "Creating mmcda1 and mmcda2 in /etc/dev: "
mkdir /etc/dev
mknod /etc/dev/mmcda1 b 60 1
mknod /etc/dev/mmcda2 b 60 2
echo "done."
# Copy /opt/* to the first sd card partition
echo "Copying /opt/* to the first partition"
echo -n "of the sd card (this will take a while): "
cp -a /opt/* /mnt/card1/
echo "done."
# Copy /usr/* to the second sd card partition
echo "Copying /usr/* to the second partition"
echo -n "of the sd card (this will take a while): "
cp -a /usr/* /mnt/card2/
echo "done."
# Unmount the first sd card partition
echo -n "Unmouting the first sd card partition: "
umount /mnt/card1
echo "done."
# Unmount the second sd card partition
echo -n "Unmouting the second sd card partition: "
umount /mnt/card2
echo "done."
# Copy the new sdcontrol script to /etc
echo -n "Copying the new sdcontrol script to /etc: "
rm -f /etc/sdcontrol
cp sdcontrol /etc
echo "done."
# Change the sd card attributes, device and mount point in fstab
echo "Updating fstab with the new devices"
echo -n "and mount points for the sd card partitions: "
cat /etc/fstab | grep -v mmcda > /tmp/fstab
echo "/etc/dev/mmcda1 /opt auto defaults,noatime 0 0" >> /tmp/fstab
echo "/etc/dev/mmcda2 /usr auto defaults,noatime 0 0" >> /tmp/fstab
rm -f /etc/fstab
mv /tmp/fstab /etc
echo "done."
# Delete /opt contents
echo -n "Deleting /opt contents(may take a while): "
rm -rf /opt/*
echo "done."
# Delete /usr contents
echo -n "Deleting /usr contents(may take a while): "
rm -rf /usr/*
echo "done."
# Mount the sd card partitions in their new locations
echo -n "Mounting the first sd card partition in /opt: "
mount /opt
echo "done."
echo -n "Mounting the second sd card partition in /usr: "
mount /usr
echo "done."
# Make the sd card mount earlier
echo -n "Changing the sd boot order so the /usr is available at boot time: "
mv /etc/rcS.d/S01devices /etc/rcS.d/S04devices
ln -s /etc/init.d/sd /etc/rcS.d/S02sd
echo "done."
# Erase the sd card reference from the ipkg script
echo -n "Updating the ipkg configuration to not show the sd card: "
cat /etc/ipkg.conf | grep -v /mnt/card > /tmp/ipkg.conf
rm -f /etc/ipkg.conf
mv /tmp/ipkg.conf /etc
echo "done."
echo "Finished, you can now reboot your zaurus."
I\'m testing everything now, as for the sdcontrol, I believe a true call in the actions that won\'t be done should do the trick, but still haven\'t see if it works well like that.
I hope someone finds this useful.
Have a wonderful day!