Author Topic: Tcc Base + Include Cramfs (squashfs?)  (Read 2981 times)

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Tcc Base + Include Cramfs (squashfs?)
« on: December 31, 2004, 04:26:04 pm »
Hi --

Anyone have a link on how to do cramfs and/or squashfs (for pdaXrom)?

Which is beter, cramfs or squashfs?  sq looks like it might be better
compression -- but does this come at the price of compatibility and cpu
speed?

I'd like to make a cramfs, say, 300 mb, but if I only put 20 MB in it -- will
it only be the compression size of that 20mb (should be 95-98% for
the text that I want...) plus some cramfs overhead?

I want to put all the .h files into a cramfs so this can be mounted and added to...
and then use tcc to run simple c programs -- including gtk c progs, etc.

Scott

rgrep

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Tcc Base + Include Cramfs (squashfs?)
« Reply #1 on: December 31, 2004, 06:41:08 pm »
Quote
Hi --

Anyone have a link on how to do cramfs and/or squashfs (for pdaXrom)?

Which is beter, cramfs or squashfs?  sq looks like it might be better
compression -- but does this come at the price of compatibility and cpu
speed?

I'd like to make a cramfs, say, 300 mb, but if I only put 20 MB in it -- will
it only be the compression size of that 20mb (should be 95-98% for
the text that I want...) plus some cramfs overhead?

I want to put all the .h files into a cramfs so this can be mounted and added to...
and then use tcc to run simple c programs -- including gtk c progs, etc.

Scott
squashfs was created by Phillip Lougher to be better than cramfs.  It has the advantage that metadata is compressed, the file compression block size is larger, full uid/gid and file creation times are stored, and it supports files up to 4GB (the maximum size of a squashfs filesystem is also 4GB).  My biggest gripe about cramfs is that it only supports files up to 16MB although the filesystem can be up to ~256MB (this has stopped me being able to create a cramfs image of the BASS Talkie for ScummVM ).

Unfortunately squashfs isn't supported by the pdaXrom kernel, although someone should be able to compile the module pretty easily.  So for now you're stuck with cramfs.  You can create a cramfs filesystem very easily (note that cramfs and squashfs filesystems are read-only so you can only build them once).  The mkcramfs command takes a directory containing your files and creates a file that holds the cramfs filesystem.  For example if you want to package up all the files and directories in /opt/tcc into a file called tcc.cramfs you would run the following:
Code: [Select]
mkcramfs /opt/tcc tcc.cramfsYou could then mount this filesystem on your Zaurus using the following:
Code: [Select]
mkdir /opt/tcc
mount -t cramfs /mnt/card/tcc.cramfs /opt/tcc -o loop,ro
Hopefully we'll get squashfs support shortly.

Matt
« Last Edit: December 31, 2004, 06:42:50 pm by rgrep »
[img]https://www.oesf.org/forums/style_emoticons/default/smile.gif\" border=\"0\" class=\"linked-sig-image\" /] Has: Dynamism C760 / Linksys WCF12 WiFi / Kingston 512MB SD
[img]https://www.oesf.org/forums/style_emoticons/default/biggrin.gif\" border=\"0\" class=\"linked-sig-image\" /] Loves: pdaXrom / Warwalking
[img]https://www.oesf.org/forums/style_emoticons/default/sad.gif\" border=\"0\" class=\"linked-sig-image\" /] Hates: NetGear MA701 WiFi / SanDisk 256MB SD / C760 Charging Faults

rgrep

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Tcc Base + Include Cramfs (squashfs?)
« Reply #2 on: January 02, 2005, 04:24:55 am »
I tried to compile the squashfs module but unfortunately the patch (for 2.4.20) doesn't work on the pdaXrom kernel (2.4.18) due to a missing do_mounts.c file.  Hopefully I can either fix the patch (unlikely) or find one that works.

However in searching for squashfs info I came across a different compressed filesystem that is already supported by pdaXrom.  It's called zisofs and is basically a compressed layer on top of an ISO9660 (CD-ROM) filesystem.  Support for it under pdaXrom is included in the isofs module ("ipkg install kernel-modules-isofs").  Its performance (compression and speed) isn't as good as squashfs but the filesystem can be read by legacy systems that don't have kernel support for zisofs (a userland tool is just required to read the compressed files).  Phillip Lougher from the squashfs project has done some benchmark comparisons of squashfs, cramfs, cloop and zisofs: http://kerneltrap.org/files/PERFORMANCE.README.txt

To make a zisofs image you need mkzftree from zisofs-tools (if you use Debian it's included in the mkisofs package) and a zisofs-patched version of mkisofs (also included in the Debian mkisofs package).  mkzftree takes an input file tree and creates a corresponding compressed file tree ready for mkisofs to build the ISO image.  For example to build a zisofs image of Sam & Max Hit the Road for ScummVM I did the following:
Code: [Select]
mkzftree samnmax-talkie samnmax-talkie.zftree
mkisofs -z -r -o samnmax-talkie.ziso samnmax.zftree
To mount it on my Zaurus I just type:
Code: [Select]
mount -t iso9660 /mnt/card/samnmax-talkie.ziso /opt/scummvm/samnmax-talkie -o loop,roThe compression was pretty good in this case, bringing samnmax down from 190MB to 113MB.  For Beneath a Steal Sky it only saved me 3MB but I find it more convenient to have the games in single files I mount automatically before running ScummVM.

I am still hanging out for squashfs support but this suits me fine for now.

Matt
« Last Edit: January 02, 2005, 04:25:44 am by rgrep »
[img]https://www.oesf.org/forums/style_emoticons/default/smile.gif\" border=\"0\" class=\"linked-sig-image\" /] Has: Dynamism C760 / Linksys WCF12 WiFi / Kingston 512MB SD
[img]https://www.oesf.org/forums/style_emoticons/default/biggrin.gif\" border=\"0\" class=\"linked-sig-image\" /] Loves: pdaXrom / Warwalking
[img]https://www.oesf.org/forums/style_emoticons/default/sad.gif\" border=\"0\" class=\"linked-sig-image\" /] Hates: NetGear MA701 WiFi / SanDisk 256MB SD / C760 Charging Faults

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Tcc Base + Include Cramfs (squashfs?)
« Reply #3 on: January 02, 2005, 09:08:50 am »
ya
squash looks like the way to go.

ziso was at least 2x slower, etc.

:-/

Scott

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Tcc Base + Include Cramfs (squashfs?)
« Reply #4 on: January 04, 2005, 08:16:33 am »
Quote
I tried to compile the squashfs module but unfortunately the patch (for 2.4.20) doesn't work on the pdaXrom kernel (2.4.18) due to a missing do_mounts.c file.  Hopefully I can either fix the patch (unlikely) or find one that works.
rgrep,

I patched this to the 2.4.18 kernel for the Cacko/Sharp ROM some time ago.

Just tried it with the 2.1r2 patch set and it works fine.

Steps. (backup the source tree first just in case !)

i. Apply the patch with -p1, hit return when the prompt about do_mounts.c is shown. - You don't need this (more later).
ii. Go to linux/fs and you will have a Makefile.rej containing the offending DIFF that didn't apply. Basically just adds the line...

subdir-$(CONFIG_SQUASHFS) + = squashfs

So edit the Makefile, find an appropriate spot and add the line manually.

iii. Create your .config file or edit an existing one and add CONFIG_SQUASHFS=m

iv. Run make oldconfig, make dep & make modules.

You should find squashfs.o in the linux/fs/squashfs directory.

v. Put the file in the /lib/modules/`uname -r`/fs directory on your Z (create the directory first).

vi. Run depmod and away you go.

mount file systems with...

mount -t squashfs <squash file> <mount point> -o loop

...Now all this works fine for Cacko/Sharp so I think this should work for PDAXROM but I don't have a build environment for the Kernel set up to try it.

do_mounts.c is part of the init code and as far as I can tell the patch is mainly aimed at adding some structures to init so that the file system can be used for initrd (load from a file then RAM drive specific stuff). You shouldn't need it for normal utility type use.

Let me know how you get on.

- Andy
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Tcc Base + Include Cramfs (squashfs?)
« Reply #5 on: January 05, 2005, 02:48:12 pm »
Actually just tried the squashfs module on Kathrin RC8, seems to work a treat.

Will post it when it's had some testing.
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card

ScottYelich

  • Hero Member
  • *****
  • Posts: 992
    • View Profile
    • http://www.zaurususergroup.com/modules.php?opmodload&namephpWiki&filei
Tcc Base + Include Cramfs (squashfs?)
« Reply #6 on: January 08, 2005, 09:44:28 am »
Hmmmm. this is interesting.

maslovsky

  • Hero Member
  • *****
  • Posts: 1426
    • View Profile
    • http://my-zaurus.narod.ru
Tcc Base + Include Cramfs (squashfs?)
« Reply #7 on: January 08, 2005, 10:04:27 am »
Quote
Steps. (backup the source tree first just in case !)
...
There is an easier way to do this - use my patch, whch I created specificaly for 2.4.18 Zaurus kernel based on 2.4.20 squashfs patch (which doesn't apply cleanly).

You can download the whole set of patches used in Cacko 1.22 kernel at Cacko home page or here: http://web.mol.ru/~zaurus/cacko-1.22-kernel.tar.gz
« Last Edit: January 08, 2005, 10:06:00 am by maslovsky »

iamasmith

  • Hero Member
  • *****
  • Posts: 1248
    • View Profile
Tcc Base + Include Cramfs (squashfs?)
« Reply #8 on: January 08, 2005, 10:08:20 am »
Actually I have already built the module and the mksquashfs tool.

They are on the unstable feed. Anton's patch would be good though if this is going to move to the stable base.

- Andy
OpenBSD 4.2 -current on full 4Gb of SL-C3000
Microdrive replaced with 4Gb SanDisk Extreme III card