OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Sharp ROMs => Topic started by: Ragnorok on November 09, 2005, 09:23:03 pm

Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: Ragnorok on November 09, 2005, 09:23:03 pm
- I'd like to update Cacko 1.23 Full's /usr squashfs image.  I could just use Lite, but I like the fact that everything I want is already installed and working in Full, where I have to install and configure quite a bit of stuff in Lite.  I'm getting a bit tired of installing and configuring for the nonce.  Also, by updating the sqaushfs, the things I put in there will have the advantage of the superior compression, just like what's in there now.  Bonus!  I'm thinking there's a good 7MB or so of things I can replace without just a whole of dependecy issues.
- Thing is I'm not too awful sure how to do that.  There doesn't seem to be an "unsquashfs" command, and I haven't seen just a lot on the forum about using mksquashfs, so I'm kind of soliciting input from Those Who Have Gone Before.
- Here's what I'm thinking I'd do:

1. Copy the entire /usr directory somewhere, say the SD card.  I mean, it's mounted, right?  (grin)
2. Tweak up whatever I want to tweak up in that copy.
3. mksquashfs on that modded directory.
4. Make sure the new squashfs is no bigger than 26959872 bytes.
5. Replace /root/usr.bin with the new squashfs.

- Here's what am pretty much completely unsure about.

1. Where is this thing mounted?  I don't see it in fstab, and I don't see it under /etc/rc.d anywhere.  It's magic, I tells ya!
2. How do I replace the file?  I'm assuming, since all of the ".rom" stuff is in this squashfs, that I won't be able to unmount it whilst Qtopia is up.  Do I just go to shutdown and "Terminate Qtopia"?  Is it really that simple?  (snicker)  That didn't work ... it's restarting Qtopia, and "q" at the "Wait..." prompt didn't prevent it from loading, though it really garbulated the display for a short.  Bogomips, I say.

EDIT: Found what I wanted: have to hit "/" at the Waiting... to present a menu, at which "a" gets to the console.  But, alas, /usr is still mounted and unmountabel from there.  So I do an "init 1" to go single-user ... and /usr is still mounted and umountable.  Double Bogomips!  How does one go about umounting /usr on this thing?
DE-EDIT

3. What are the best options for creating the squashfs.  For instance, I'm not thinking the default block size of 64KB is right.  There could easily be others.  What might those be?

Thanks for your time...
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: Stubear on November 10, 2005, 06:28:52 pm
you may have problems if the SD card is not formated ext2 (or another fs that use permisions). Also you should use cp -a to ensure that you keep the same permisions on the new directory that the original files had (just cp will chown the files to root.root

To change the usr.bin file you will need to remount / as read-write (mount -o remount,rw /) and then unmount /usr. You will need to shutdown all qtopia apps to do this of course. Use ps ax to see what processes are running and kill them, but it's probably faster to just reboot into D+B mode and mount the / partion read-write and copy the usr.bin across and reboot.

Good Luck

Stu
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: Ragnorok on November 11, 2005, 01:32:17 am
- SD is formatted ext2 so I can load Debian on it.  (grin)  Thanks for the tip on cp -a, though, Stubear!  I can hope I woulda found that, but now I don't have to!  (happy smile)
- I just dropped to single-user mode, remounted / rw, then tried to unmount /usr, and it still says it's busy.  I'm not aware of any processes running that are launched from there, but I don't claim to have hunted down the source directory for the couple of dozen that are still present.  Things associated with init, like the "loop0" process, can't be killed, anyway.  Perhaps a loop device takes something more special than "umount /usr" to unmount it?
- I don't know how to get a C1000 into the "D+B" mode, or I'd be more than happy to give that a go.  I've tried the sequences I've seen here on OESF, but they're for Cxx0 series, not Cxx00 series, and they don't work.  I know how to get to the NAND backup menu, and the Flash menu, but no "D+B" mode.  Maybe that's one of them and I'm just too much of a n00b to know?  I certainly can't read Japanese, so if it's the Flash menu I'd never know it.  (wink)
- I'll figure this out sooner or later.  It's got to be mounted somehow, which means it's got to be unmountable somehow.  I just hafta poke at it 'til something shakes loose.  Then I'll be there.
- 'Til then, it's not like that 58MB free is making me feel pressed for space.  (heh heh)  More of an exercise, this is.  What's the fun of having a Z if'n you don't poke at it?  (wonderous stare)  I'm pretty determined, though, all the same.  I'd hate to have to rebuild the whole darned ROM, but if that's what it takes, maybe that's what I'll do.  Time will tell, or it won't, and we'll be happy with that.  (wolfish grin)
- Thanks for your time...
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: maslovsky on November 11, 2005, 09:23:16 am
Just a couple of notes: usr.bin is mounted from scripts /root/etc/rc.d/sysinit. You can those scripts the editable if you remount / in rw mode.

You can't "unsquashfs" an image - it's s one way process (one of the drawbacks of high compression rate). You need to mount it, copy its contents somewhere, modify and then build new image.

And finally - modifying usr.bin is only possibly theoretically. I never tried it myself and won't  - I see no reason to me for that
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: euroclie on November 11, 2005, 11:58:21 am
Quote
- I don't know how to get a C1000 into the "D+B" mode, or I'd be more than happy to give that a go.  I've tried the sequences I've seen here on OESF, but they're for Cxx0 series, not Cxx00 series, and they don't work.  I know how to get to the NAND backup menu, and the Flash menu, but no "D+B" mode.  Maybe that's one of them and I'm just too much of a n00b to know?  I certainly can't read Japanese, so if it's the Flash menu I'd never know it.  (wink)
I was having troubles getting the console at boot with the "D+B" trick, and I've managed to get it at last. Last time I suceeded, I simply removed the battery, pressed D+B, then put the battery in position and moved the little switch (the one supposed to lock the cover in place), then my C3k started to boot and a few seconds later I saw the text displayed at the bottom of the screen, scrolling, so I knew I was in the console and stopped pressing the D and B keys.

I'll try it again, and if I find a "reliable" (i.e. easy enough to reproduce for  someone with big paws like me  ) method, I'll try to make a short movie with my digicam, and will upload it here.
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: Ragnorok on November 11, 2005, 08:03:49 pm
Quote
Just a couple of notes: usr.bin is mounted from scripts /root/etc/rc.d/sysinit. You can those scripts the editable if you remount / in rw mode.

You can't "unsquashfs" an image - it's s one way process (one of the drawbacks of high compression rate). You need to mount it, copy its contents somewhere, modify and then build new image.

And finally - modifying usr.bin is only possibly theoretically. I never tried it myself and won't  - I see no reason to me for that :)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=103295\"][{POST_SNAPBACK}][/a][/div]
- Thanks for the script location!  I looked in there last night, but I must have missed it, 'cause I didn't find where it's mounted.  D'oh!!
- I wouldn't expect you to have tried modifying usr.bin ... you're all set up to rebuild the ROM on an as-needed basis, where I am not.  You've offered to assist in that regard, and I greatly appreciate that offer, but I've been avoiding it because, in my little mind, it's going to be simpler (for me) to modify usr.bin instead.

- Thanks euroclie!  I tried it again, and it worked; the step I was missing was to continue to hold D+B while turning the power on, because the C1K doesn't come on by itself when the battery is inserted.
- Turns out "D+B" mode is just init 4 ... now that I know that it'll be a lot simpler to "get into".  (wide grin)  Don't even need to pull the battery to get to init 4.  And sho'nuff, no loop0 process or /usr mounted.  Ha ha!  I knew it was simple!!

- It's really amazing how quickly one becomes used to the "comma" key being slash, like it seems like it should be.  In init 4 it's using the old keymap.  I can't hardly change directories any more!  (guffaw)

- More as things develop, but it's looking pretty hopeful now.  Thanks again, all!!
Title: Rebuilding Cacko's /usr Sqaushfs Image
Post by: Ragnorok on November 17, 2005, 07:50:34 pm
- Busy five days.  Haven't had a chance to look at this 'til today.

- First, the squashfs is mounted in /root/etc/rc.d/rc.rofilesys on Hiro.  There are two different actions in there depending if it thinks it's recovering from a hard reset or a soft one.

- Second, "D+B Mode" is not init 4.  It says "Init: Entering runlevel 4" right on the screen just after booting to this, so I was mislead.  Init 4 reloads Qtopia, though I haven't investigated what's different between it and the normal init 5, because it wasn't where I wanted to be.  (grin)  If anyone reads my prior post they could be led astray.  Bad Rags!

- So, I go to "D+B Mode", which conveniently already has my SD mounted.  Then I:

mount -t jffs -o noatime /dev/mtdblock2 /mnt/cf ('cause I have no cf in the slot)
cp -a /mnt/cf/boot/usr/bin /mnt/card/Backup_Files (that's where I'd look for it later)
(urk ... no "less" here, and no scrollback buffer)
pop over to root/etc/rc.d and see how the squashfs is mounted
try to mount the usr.bin copy ... D'oh! As expected, it don't know the file type
searched for something I could load to tell it what a squashfs is and found nada

Guess I'll have to go back to Qtopia and look from the official system ... prolly be faster ... or I could copy it to one of the Linux boxen and play with it there.  Thing is the things I want to put in there are on Hiro, not the Linux boxen, and copying stuff from one to the other isn't the most painless process.  'Course this ain't either!  (wolfish grin)

Ding!
Just mounted the usr.bin copy from the official system to /mnt/ide, which is currently A) preexisting and B) unused.  Why run in the stripped-down "D+B Mode" to update this?  (snicker)  Stuck in a box, I were.

- But when I do:

mount -n -r -t squashfs /usr/mnt.rom/card/Backup_files/usr.bin /mnt/ide

it says it failed because a block device is required.  Hurm.  The original /boot/usr.bin file doesn't indicate it's a block device.  D'oh!  Forgot "-o loop" on the end!

Now I'm cookin' wif fahr!!  (gap-toothed smile)  See?  Simple!

- Or so I thought.  When I try to copy the usr.bin copy, I get tons of "file not found" errors, the last of which pointed to images in /usr/QtPalmtop.rom/pics.  So the usr.bin images appears to have soft links to to itself at /usr, which can't be resolved unless it's mounted in the correct place.  Uncool!  Any thoughts on how to get around that?  Thanks for your time...