Re: initramfs buffer spec -- second draft

From: Andreas Dilger (adilger@turbolabs.com)
Date: Tue Jan 15 2002 - 18:59:51 EST


On Jan 16, 2002 00:09 +0100, Daniel Phillips wrote:
> On January 15, 2002 10:04 pm, Andreas Dilger wrote:
> > Well, I doubt the difference will be more than a few bytes, if you compare
> > the cpio archive sizes after compression with gzip.
>
> Side note: I have a hard time understanding the dual thinking that goes
> something like: "we have to save every nanosecond of CPU but wasting disk is
> ok because, um, disk is cheap, and everybody has more than they need anyway,
> and reading it takes zero time and oh yes, everybody has disks, don't they?"

OK, I agree somewhat that we need to save disk space, just as I agree we
should reduce CPU usage. That said, would you want to save a few CPU
cycles if (for example) it meant we didn't use the ELF binary format,
and had to change? Yes, we went from a.out to ELF, but it was a major
pain even when Linux was far less widely used.

> > But then every person who wants to build a kernel will have to have
> > the patched version of cpio until such a time it is part of the standard
> > cpio tool...
>
> If we go with little-endian then only big-endian architectures will need
> the patch, and they tend to need patches for lots of things anyway. Or
> if you like I'll write a little utility that goes through the file and
> byteswaps all the int fields.

But the proposed cpio format (AFAIK) has ASCII numbers, which is what you
were originally complaining about. I see that cpio(1) says that "by
default, cpio creates binary format archives... and can read archives
created on machines with a different byte-order".

Excluding alignment issues (which can also be handled relatively easily),
is there a reason why we chose the ASCII format over binary, especially
since the binary format _appears_ to be portable (assuming endian
conversions at decoding time), despite warnings to the contrary?

> > (which may be "never"). I would much rather use the currently
> > available tools than save 20 bytes off a 900kB kernel image.
>
> What if it's more than 20 bytes?

Well, anything less than half a sector (or a network packet) isn't
really measurable.

Well, a few quick tests show (GNU cpio version 2.4.2), with raw sizes
in "blocks" as output by cpio, compressed sizes in bytes:

find <dir> | cpio -o -H <format> | gzip -9 | wc -c

dir bin (default) newc (proposed)
                  raw gzip raw gzip
/sbin 15121 3289678 12952 2769451
/etc 8822 689517 8996 693700
/usr/local/sbin 1895 385461 1899 385764

The binary format reports lots of "truncating inode number", but for
the purpose of initramfs, that is not an issue as we don't anticipate
more than 64k files. I don't know why the /sbin test is so heavily
in favour of the newc (ASCII) format, but I repeated it to confirm
the numbers.

Cheers, Andreas

--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jan 15 2002 - 21:00:54 EST