Skip site navigation (1)Skip section navigation (2)
Date:      20 Feb 2001 22:43:10 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Luigi Rizzo <luigi@info.iet.unipi.it>
Cc:        Greg Lehey <grog@lemis.com>, Luigi Rizzo <luigi@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/release/picobsd/build Makefile.mfs
Message-ID:  <xzpwvalf2tt.fsf@flood.ping.uio.no>
In-Reply-To: Dag-Erling Smorgrav's message of "20 Feb 2001 14:15:04 %2B0100"
References:  <200102200128.CAA37354@info.iet.unipi.it> <xzplmr1jy1z.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav <des@ofug.org> writes:
> You could write a short Perl script (or C program) that scans a
> directory and generates C code (using only mkdir(2), mknod(2),
> symlink(2) and chown(2)) that recreates the device nodes. I suspect
> the resulting code, when crunched, would consume less space than the
> device nodes themselves.

<URL:http://people.freebsd.org/~des/software/makedev.pl>;

Populate a directory with the desired device nodes, then generate the
C source code as follows:

$ ./makedev.pl -o makedev.c /path/to/populated/dev

Starting from an empty directory, the resulting binary weighs in at
5432 bytes; 34360 bytes when starting from /dev on my laptop (1092
nodes including directories).

You can further reduce the size of the binary if you realize that
device nodes are invariably owned by system users and groups, which
have UIDs and GIDs low enough to fit in a char. If you don't care
about ownership, you can drop the UID and GID (and the associated
code). In that case you can probably drop the mode as well.

Note that the current implementation doesn't support symlinks, but
this shouldn't be hard to add if necessary.

I don't know if this actually saves you anything; it'll probably
reduce the size of a compressed fs image, but I don't know by how
much.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpwvalf2tt.fsf>