OESF Portables Forum
Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Angstrom & OpenZaurus => Topic started by: bluey on February 05, 2004, 09:48:29 am
-
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!
-
I guess this has no interest...
Either way, here is a shorter version of the script which remakes everything without copying /usr and /opt all again. Easily deductable from the first
#!/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 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."
Whatever.
Have a wonderful day!
-
I guess this has no interest...
Not to me, but it does look useful for those who want to stick stuff on their SD cards. Don\'t become disheartened.
Si
-
-
You know when you run the SECOND smaller script after accidentally saving it over the first one, and when you reboot you can\'t login and have to reflash. Nobody round here would be that stupid :oops:
Sigh - reflash 47 it is - same problem so maybe I didn\'t mix up the scripts earlier !
- looks like either the SD card is not being mounted early enough or that the data on it is corrupt.
A screen full of inode errors followed
- login prompt followed by SH -ERROR cannot find lib-curses when you try to log in.
This was on a freshly flashed 5600 with 3.3.6Pre-1, 256M sandisk SD partitioned half and half with /mnt card1 & /mnt/card2 created
-
I\'m getting the same...
Have you already understand what could be wrong?
Where do we activate boot script \"debug\" mode? Is there a quiet trigger which can be changed? Pipes to /dev/null which can be removed? I can\'t seem to find where the init output is silenced...
Are you using bash? I get that by just adding bash to the current setup. I recover my last setup, then add bash, and get that problem... :
-
I traced the problem to happen just by linking sh to bash... I believe that when scripts call /bin/sh they expect it to work, and it doesn\'t since bash need curses, so nothing works! Curses libs copied to /lib could do the trick.
Or using /usr/bin/bash as root\'s shell, that would make it as the default shell for root, and leave busybox\'s sh for the boot scripts.
-
hum anyone have issues using the open zaurus shell script to move the os to the sd card and run it from it. Mine seems never to boot after a full shutdown. DOes this script you write leave the main system on the zaurus and just use the sd card for the app folders ?
-
Did you notice the bash issues? If you use bash as your shell, /bin/sh is a link to it, and it shouldn\'t, since if libncurses is not present, bash which needs it, won\'t work, and though the init scripts may use /bin/sh as their interpreter, they\'re trying to use bash which doesn\'t work due to the lack of libncurses. You can copy the libraries to /lib or mantain sh as a link to busybox and leave /bin/bash and use that in /etc/passwd as the root/user (whichever you use) shell.
If you try to login when it doesn\'t boot does it complain about missing libncurses?
I hope I could help you.
Have a nice day
-
just sites there syas booting but i think it is cause of something with knoquer browser. I installed just the os reboot 10 times no issues installed knoquer from feed reboot dead.
Is there a way to leave the whole os on the machine ram and just move the folder that I need to run and install apps to the sd card making the best use of system speed and storage
-
Maybe the best way to do that could be installing the applications to the SD card. Did you tried to go that way? The application folder is where system applications also are, so you can\'t move only some folder to the SD as you say. Maybe if you transformed the all OS to separate the system from the applications, and you could define if an application is supposed to stay with the system or can go to another folder. With some tweaking that could be achieved. /usr for system /<put something logical here> as another /usr root dir for other applications...
But I can\'t look at that right now, I\'m doing a work for university, which I have to deliver tuesday, and it\'s 5 am.
I have the intention to look at the Z rootfs and see if I can make something better of it, it is too noodled to be easy to improve. /usr /opt, libs everywhere binaries too, argh...
Good luck to solve your problems!
Be well.
-
Which libaries would you recommend copying, just wondering if I just copy libncurses to /lib, would I get more errors for other libs, may as well get them all in one go !
-
Thanks
-
Copied the libncurses file from /usr/lib to /lib and recopied it to the name of the libncurses link on /usr/lib. Everything is working - nice one Bluey, you hero of the Zaurus nation !
I almost miss all of those link errors when installing stuff -NOT :-D
-
I went the other way around, I unistalled bash, and copied the binary to /bin/bash, then edited /etc/passwd to use /bin/bash instead of /bin/sh. That way you still can use it as your shell, you can call it in your scripts (as long as /usr is already mounted) , and there would be no problems while booting.
Either way, I guess libncurses would be enough.
Good luck, and feel free to ask for help.
(/me is listening to Community Service from The Crystal Method, quite a nice set of TCM style remixes, would fit great on NFS Underground, good old Wipeout, or any other fast racing game. )
Have a wonderful day, and have a lot of fun playin\' with your Z!
-
Copied the libncurses file from /usr/lib to /lib and recopied it to the name of the libncurses link on /usr/lib. Everything is working - nice one Bluey, you here of the Zaurus nation !
I almost miss all of those link errors when installing stuff -NOT :-D
I\'m glad I could help!
Maybe I\'m feelin\' it wrong, but it seems applications start faster with this partition scheme, than with just one partition mounted as /opt and /usr linked to it, which was my previous setup.
See you later! :wink:
-
When you originally set up the partions, how did you divide up the card? 50-50 for both /usr and /opt? Should /usr get a larger share of the partition, or do the app installations fill up /opt quicker? I have a 128 meg SD card that I am looking to carve up.
-
I believe that most apps get installed to the /opt/QtPalmtop which is similar to /usr, but some things still go to /usr, mostly libs.
I did 50/50, but with a 128Mb card, maybe you should try to see the usage you\'d get. Maybe a 50/50 for start, install all the apps you need right now, and if needed reajust the partitions.
My occupation is of 75Mb in /opt and 34Mb in /usr.
(But /opt has also /home, and must have a couple of video files, which I don\'t recall their size, but they are small)
Have a wonderful day!
-
Thanks Bluey. I\'m going to try making a 48MB partition for /usr, and leave the rest for opt, home, and root. I like the idea of having /usr, with all of those links buried in there, in a separate partition. That may be a reson why you see some performance gains.
I\'ll see how 48MB works out after a week or so and let you all know. Unfortunately I messed up some filesystem moves this morning, and I need to reflash my machine again. If you use the lcd, is it still a typo, or a tap-o?
-
Ok. I admit I do not yet have Zaurus, I\'m only thinking about it. But still...
Why do you feel any need to split you card at all ??? To avoid symlinks ? I do it with bind option on my server system.
Here is /etc/fstab :
...
/dev/md3 /mnt/RAID-A reiserfs defaults,usrquota,grpquota 1 1
/dev/md4 /mnt/RAID-B reiserfs defaults,usrquota,grpquota 1 1
/dev/md5 /mnt/RAID-C reiserfs defaults,usrquota,grpquota 1 1
/mnt/RAID-A/home /home - bind 0 0
/mnt/RAID-C/systems /var/systems - bind 0 0
/mnt/RAID-A/ftp /var/lib/ftp - bind 0 0
/mnt/RAID-C/www /var/www - bind 0 0
/mnt/RAID-B/squid-cache /var/cache/squid - bind 0 0
...
/home and /var/ftp are directories as some programs like but both are in fact from /dev/md3 ... This way I can move any part of system to any RAID and still programs will not be confused (if you\'ll simplink /home to /mnt/RAID-A/home then /home/.. will not be equal to / and this confuses some scripts but when bind mount is used everythin works as expected). Why it does not work on Z ? Why play with symplinks or split puny card in half when bind mount can solve all problems ? What I\'m missing here ?
-
Perhaps that mount option could be unknown, until know...
I\'d rather read \"you can you use this xpto option, it works without the need for that kind of kung-foo\" than that \"why don\'t you use that option? are you ignorant?\"...
I\'ll try it in the Z to see if it works, I believe it should...
Thanks.
-
It works.
-
Perhaps that mount option could be unknown, until know...
I\'d rather read \"you can you use this xpto option, it works without the need for that kind of kung-foo\" than that \"why don\'t you use that option? are you ignorant?\"...
Oops. Sorry if I offended someone. It\'s well-known feature of Linux kernel 2.4.x (Al Viro was really proud three years ago when he finally was able to make it work) and it\'s documented (it\'s used to pull parts of devfs, procfs or just any partition trees in chroot jail, for example), it\'s not some undocumented trick so I just assumed it was tried and rejected. Why was it rejected ? I was confused: I never had any problem with bind mounts for last few years but I\'ve read a lot about \"symlink horrors\" on Z so I assumed something prevent you from bind mount on Z...
-
just want to say thanks for the scripts, so far its working good.
not that any improvemwnts with the scripts are needed but if they were it would be kinda nice to start the script from the point of someone just popping in there sd card for the first time. i.e. have the fdisk part in there and each person just chooses the size of the partition. and maybe put that whole last part with the libncurses deal in the script as well
oh, and I am pretty new, is there a way to have root reflect the size correctly? i have a 256 sd but when i install to root it only shows 9660. or am i doing something dumb?
anyway thanks, i really like this setup so far.
-
one thing i have noticed is longer load times for the apps on the sd, figured this is probably normal but wanted to ask to make sure. an example time: opera 6 takes on average about 6-8 seconds for the window frame to pop up and about another 15 sec for the black to go away before it loads the page.
i never timed it before but i noticed a definite increase here.
-
SD access is rather slow, so it is normal that the load times increase. You\'ll notice that with the volume applet, which writes the current value to disk with a large frequency, which isn\'t noticed when you have have the conf files on the Z instead of on the SD, and it gets very slow while changing the volume.
The root size is what /dev/root has free, and not the SD card, that is why you see that value.
I\'ve been testing with the binds instead of breaking the card in two partitions. It works ok too, at least it seems so, I\'ve been without time to extend my testing.
I\'ll try to modify the script to use bind and that way it\'ll do everything or you, and no fdisk will be necessary.
I want pack the scripts on an ipk and make in run with opie-sh. One for creating everything, and another for recovering in case of some problem. When I do it, I\'ll post the ipk. Feel free to add and improve whatever you feel it should.
Greetings!
-
Thanks bluey for your contributions!
-
Arr..... are those for multi-parition..??
I am doing @ it, but I have no idea what you guys talking...I am an n00b..
-
Looks like I caught this thread very late, but are there any updates, Bluey?
I should be receiving my Zaurus (SL-5500) early next week, and this sounds like EXCACTLY what I want to do with it. I've got a 256M SD card, and I'd like to use all the SRAM for heap space, instead of file storage.
I'm a little worried about the earlier problems w/ libncurses and bash because I'm a Linux newbie. I only know enough to be very dangerous
Let me know if you have a pretty good script to mount the whole card (using the bind mounts) and xfer the /usr and /opt dirs to the SD.
In regards to the slow performance of the SD cards, are you binding with sync or async? I've heard that sync makes it slow, and since you aren't ejecting the card, maybe async would help? I'm not sure of all the implications of doing this, though, so don't try it out just because I said so!
Thanks,
-javamatte
-
I would like to use these scripts to run /usr and /opt off a 256MB SD card. Reading through the posts, it seems that libncurses needs to be copied from /usr/lib to /lib. However, I don't have libncurses in /usr/lib and it does not appear to be available from the OZ feeds. Where can I get this library? Will a copy from another linux system work?
Thanks.
-Rick
-
Hello!
If you don't have it, you wont need it. It is used by bash, and since bash is installed as the default sh shell when you install its package, you wouldn't be able to boot since that lib ends up being in the SD before this is available (the module hasn't been loaded yet, since sh is needed to run the init scripts).
After a long time, I've been using another scheme of installing things to SD and using ipkg-link and I've been pretty satisfied, I believe you'll be too. I have almot 4Mb of / free, and I believe more could be released.
I believe you won't need to go the kung foo way any more.
OZ 3.5.1 is a show up of what OZ will be, a new kernel will break the chains to legacy we have for 5000 and 5500 devices. We just have to wait for a working 2.6. OZ will be (and IMHO already is) perfect.
The OE team has put up together something Sharp was too blind to see, and unable to achieve. We should expect great things from OE.
C ya.