Collie/TipsAndTricks

From OpenZaurus

Contents

Tips and Tricks (posted by actual users)

poushag's HowTo: OZ Opie install on Collie (would probably work for GPE also but the GPE ROM is bigger so results are not guaranteed):

  1. From hentges.net, download your chosen initrd.bin, Zimage, and opie-cardfs to your CF card. Of course the 64-0 (SL-5500) and 32-0 (SL-5000D) ZImage is recommended to maximize RAM. This should take approximately 34MB on your CF card.
  2. Flash your Zaurus as you normally would. Refer to Collie/Install if this is your first time flashing. And yes, you still want to boot the first time without your CF or SD cards in.
  3. If you have an ext2 partition already on your SD card, skip this step. Otherwise you can do it at first boot by entering the altboot mode and selecting opt 2 (No GUI). The SD card is not yet ready so this is why the GUI is not being used at first. After bootup, run fdisk to get SD card ready. (I did the first partition as FAT so backups can be stored on my workstation. The FAT partition is half the size of the second partition where I installed cardfs. One ext2 partition will work fine if you have no desire for pulling backups from SD via a cardreader.) Once this is completed, reboot your device. (See this link for how to use fdisk.)
  4. Allow your device to do a normal boot. It will ask if you would like to install cardfs. At this point you will want to insert your CF and SD cards. Type "ok" (not the "OK" button) to procede with the installation of cardfs.
  5. Continue following the prompts until you see a window asking about mounting your card. You'll notice the window is not adjusted properly. Simply reboot your device without the SD card again to fix it. [attenpeter: rebooting did NOT fix it for me... Instead, I had to boot in non-gui mode, mount the card via "mount /dev/mmcda /mnt/card" and then run "cardfs_install.sh"]
  6. Insert your SD card and see all your wonderful programs magically appear.
  7. Now that the OS is set up, you may want to install more apps. Edit ipkg.conf so that SD is first "dest". (If you have partitioned the SD as I did, you need to edit fstab to match before adding apps.) Use the GUI to browse the package lists, but use terminal to install the ipks. And for each package installed on SD you must run ipkg-link add <pkg> (or ipkg-link mount <SD mountpoint> after installing a lot of packages). Caution: When editing ipkg.conf don't remove dest entry for rootfs. (Or else ipkg-link, when it gets to libc6, will freeze the Z until it is reflashed.)

Note: It is possible that the SD card is jarred (perhaps when the Z is dropped as happened to me) and the Z locks up. I found that it could be fixed by rebooting into altboot option 2 and running ipkg-link mount <SD mountpoint>. And then rebooting back into altboot option 1 again.

poushag is normally found on irc://freenode.net/#openzaurus and irc://freenode.net/#hentges.net for those who would like to discuss this tip or propose changes to it. poushag uses hentges OZ ROM for Collie because the standard OZ releases are mostly focused on newer 2.6 kernel devices and hentges has been more focused on supporting the Collie and very reliable in doing so. poushag also prefers hentges ROM because of the backup cli utility included (mhbackup). poushag will probably write another tip here on how to backup the Collie.

meeas fleshed out the steps a bit more, trying to leave poushag's work largely unchanged. He is still the primary authority here.

Dealing with root not on the SD card

With recent images, the only easy way to exist is to have your root on the SD card. It still _fits_ on the internal flash but there is only about 1.3M free and thus there are two factors at work: filesystem performance plummets down sharply, and may well recover to usable values only when freeing up considerably more space; some people needed to get their free space up to 4.2M for JFFS2 to be willing to write anything on the partition, depends probably on your luck. The second factor is that upgrading packages from 3.5.4 to the latest feed will not normally work, since it rewrites some 3M files, so it temporarily needs quite some extra space (and the last feed is of course still somewhat bigger than 3.5.4, so it will eat a bit more space permanently as well).

Please consider putting your root partition to the SD card first. It's the simplest solution, the following is useful only if that's a no-go for you.

So, there are several ways out; don't wipe those fs/kernel images from your CF card just yet, be prepared to flash your zaurus several times in case it messes up. The first thing to try is upgrade with Opie shut down; in that case almost no temporary extra space is required and if your flash is in good shape, you might make it. I did it over ssh - setup network on your new installation and set root password, ssh in, /etc/init.d/opie stop, ipkg update and ipkg -V 3 upgrade. It might be practical to open another ssh session and watch how does df output evolve. If ipkg upgrade got stuck, it might still progress very slowly, but if it got stuck for a long time and free block count stays about the same, too bad.

So, at this point you have to interrupt it and you probably have messed up your OPIE installation so you need to reflash again. But first consider to flash only with bootstrap image, which comes without opie thus giving you plenty of free space on your root filesystem. At this point, give your packages close scrutiny and mercilessly throw away anything you don't need (since you're about to put stuff on CF, you probably won't need wireless nor bluetooth, for example; that's quite a lot of freed up space). Then ipkg upgrade and then try your luck installing opie.

If you got stuck again, you might want to install opie on your CF card. Well, do that only if you don't care about ever ejecting it. You don't? Well, realize that it gets "ejected" even when suspending/resuming. It will break horribly if you will suspend with opie running from CF card. So, that's probably quite useless for you. So, at this point, we need to resort to dirty tricks.

You know, you can't put _all_ the opie to your CF card, but you can put non-vital bits of it there. :-) So (make sure it's mounted; it should always be mounted unless something is wrong with your system) go to /media/cf and create directory 'alt' (that's purely arbitrary name). To here we will move non-vital files from the root filesystem, keeping the same directory structure as the root fs has. At this point it would be a good idea to have ext2 on your CF card.

So, to get rid of this huge /usr/sbin/pppd, mkdir -p /media/cf/alt/usr/sbin, move it there and create a symlink in /usr/sbin/ pointing to it. You can do that with random files, but you need to know very well what are you doing since moving something required for early boot sequence (before cf _can_ and _gets_ mounted) will be fatal for your system. Don't move busybox there, /sbin/init* nor cardmgr or cardctl, for example. Also moving e2fsck to the CF is very bad idea, especially if it's ext2-formatted. ;-) But all in all, move system files to your CF only if you are skilled and desperate.

That is because the biggest boosts in free space on the root partition can be gained by moving bits of OPIE from /opt/QtPalmtop. Now, most bits are _not_ safe to move. A simple "am I safe" test is to verify that umount /media/cf works with opie shut down, and that it works with opie started up as well - if not, you need to move some files back. Use fuser -m /media/cf to check what prevents umounting, if the pids are of opie, check /proc/<pid>/maps. What I've moved (and replaced with a symlink at the original location) and it's safe? bin/opie-console, pics/*, share/*. By now, plenty of space is free and you should be still safe. If that's not enough for you, move bits of plugins/ away, but at this point you need to pay close attention to the maps files of the opie processes.

At this point, that should better be enough for you. Install all applcations with ipkg -d cf install so that they won't go to the rootfs, after installation run ipkg-link mount /media/cf/packages which will symlink them to the rootfs. You could actually do that with non-vital opie packages already installed to the rootfs as well, and it would be cleaner than manual symlinking.

Any application having anything open from CF or even itself running from CF must be auto-killed when unmounting the CF card - you want to ensure that if you want to be able to access your CF again after it's remounted (remember, this happens during suspend/resume as well). You should ensure that manually every time before suspending so that the applications are shut down properly, but also flip NO_FUSER from 'y' to 'n' in /etc/pcmcia/ide.opts, since you're bound to forget to terminate some apps before suspending time by time - this will kill those.

Good luck!

Root on SD

Root on SD doesn't work AT ALL, corruption and crazyness all around. But root on a loopback file inside the SD does, as long as the SD is formatted with vfat. Make it so that the image is in /boot-images/ and that it is called with a name that ends in "-rootfs.bin". Don't use altboot to do any of this. Good luck!


To do this without alt-boot, create a loopback file whose name ends in "-rootfs.bin" (as descrbed in [1]), and then copy your <image-name>.rootfs.tar.gz into your loopback file. Then gunzip the file, and then, as root, type

  tar xvf <image-name>.rootfs.tar

to extract your root filesystem. Delete <image-name>.rootfs.tar, unmount your loopback file, and copy it to your Zaurus.

Assuming all goes well, you are good to go! (I haven't tried it yet; this is just what I've had to learn in the process of trying to follow this little tip.)

Update: Now that I've tried it, it didn't work out so well. I ended up going back to using altboot instead.

Upgrading from OZ 3.5.4 to 3.5.4.1 on the Collie platform

This is for an install on SD as opposed to the internal Flash memory. This is important because of the free space needed when upgrading. After a clean install of OZ, change feeds to 3.5.4.1 in /etc/ipkg.conf (just add ".1" to the version number in the URLs). After this, do an update / upgrade:

  ipkg update
  ipkg upgrade

Reboot and ignore the warning about running the wrong kernel. You can remove this warning by editing the file /etc/init.d/checkversion. Just changing the version nummer is enough.