[BusyBox] off topic: 'device table support' for mkcramfs?

Jonas Holmberg jonas.holmberg at axis.com
Fri May 3 09:57:03 UTC 2002


On Fri, 2002-05-03 at 17:16, Erik Andersen wrote:
> All of us embedded folks should decide on the One True Way(tm)
> and get all these patches standardized, so that one can use the
> exact same options and config file across all the various mkfs
> tools, and get the expected result.

Agreed.

>   As is, we have seem to be
> creating one incompatible way of doing the same thing per mkfs
> tool, which is a bit silly.

Yep.

> 
> Am I correct in understanding that your metafiles are used the
> same was as the device_table support I added when I rewrote 
> mkfs.jffs2, but merely differ in syntax?  

Yes, we have been using metafiles for years. Unfortunately noone has
submitted any patches until recently. We haven't really been using jffs2
that much, but I was adding metafile-support to mkfs.jffs2 when you
rewrote it (then I cursed myself for not announcing it before i started
my work:-). I still have the code here somwhere I think. But that's
before your rewrite. It was hard to merge metafile support into the
rewritten mkfs.jffs2 and since noone needed it at the time I didn't
finish it. But in genromfs and mkcramfs we have been using it for a long
time. Our buildsystem depends on it.

> Can you show me some
> examples of their usage?
> 

When we install files and directories into the root-directory (what will
become the root-directory in the cramfs-image) we use our own
install-script that adds rows in a metafile if it has to do anything
that requires root access.

mkcramfs is invoked with "-m metafilename" which makes it look for files
named "metafilename" in each directory before processing it. The /dev/
directory, for example, contains one that looks like this:

Device: ram0 b 1 0
GroupId: ram0 6 (disk)
Device: ram1 b 1 1
GroupId: ram1 6 (disk)
Device: null c 1 3
Device: zero c 1 5
Device: random c 1 8
Device: urandom c 1 9
Device: ptyp0 c 2 0
GroupId: ptyp0 5 (tty)
Device: ptyp1 c 2 1
GroupId: ptyp1 5 (tty)
Device: ptyp2 c 2 2
.
.
.

In the /lib directory we want to place all lib-files that may be needed
when building applications, but when we create the cramfs we only want
the libraries actually used to be included. So a script that searches
all binaries creates a metafile that may look like this:

Include: modules
Include: iptables
Include: libcrypt.so.1
Include: libparhand.so
Include: libtransfer.so
Include: libdl.so.2
Include: libkfirmc.so
Include: libpthread.so.0
Include: ld.so.1
Include: libutil.so.1
Include: libc.so.6
Include: libkfir.so
Include: libnss_dns.so.2
Include: libnss_files.so.2
Include: libresolv.so.2

Also a top-level metafile (in "/") makes all files belong to root.root
(unless overridden in subdirectories). It looks like this.

DefaultUserId: 0
DefaultGroupId: 0
Ignore: include
Ignore: man
IgnoreContents: var

The last three lines make mkcramfs ignore include/ and man/ but keep
var/ but not its contents. var/ will be empty so it can be used as a
mount point for another partition. (The tool that generates the image of
the /var directory can then use /var as root).

What do you think of it?

/Jonas




More information about the busybox mailing list