[arch-projects] [mkinitcpio][PATCH 0/10] Kill off gen_init_cpio

Dave Reisner d at falconindy.com
Mon Jun 6 11:30:28 EDT 2011

It's like a disease... I can't stop myself...

Here's an overview of what's happening:

Patch 1 deprecates our unfortunately named 'install' function, and replaces it
with 'build'.

Patches 2 through 5 are cleanup and refactoring of the codebase in preparation
for patch 6 which introduces a new method of doing the actual initcpio
creation.  As I explained a few days back, we can directly use a cpio tool to
create images. I've opted to use bsdcpio, which imo, has some advantages over
GNU cpio:

1) it's part of libarchive. libarchive is awesome.
2) because of #1, it's already in core.
3) it has a useful farking man page instead of saying "see the info page"

So what's the downside?

1) We have to dump a whole bunch of stuff in /tmp. This is as little as 3-4Mb,
but might be as much as 20mb. I will likely add an option to change the
location of the tmpdir.
2) add_device goes away, as we can't use mknod as non-root. This was only ever
referenced in the 'base' install hook, and as explained in patch 4, we can get
around this.
3) add_symlink2 goes away. No idea why this exists. No one has ever used it.
4) the -a option to mkinitcpio goes away. I don't think anyone will miss this.

Patches 7, 8, and 10 aren't very interesting. patch 9 introduces a new feature
to allow specifying the kernel version as a path to a kernel image, rather
than an absolute version. I think this is a great thing to have as it means we
can simplify the way we do kernel PKGBUILDs. The kver file can go away, as the
kernel "version" will only ever have to be updated when the filename of the
image changes (as we may do fairly soon). As such, this is a good opportunity
to implement such a feature.

I've tested this on a few of my VMs which cover: encrypt, lvm, and raid/lvm.

My GitHub tree also contains some changes to some of the previous patches I've
sent, as I discovered a few bugs in the course of my testing.

I'm rather excited about this, as it makes mkinitcpio a lot more pleasant to
use. The SSD is extremely happy:

$ time ./mkinitcpio -k /boot/vmlinuz26 -g foo.img
:: Begin build
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
:: Parsing hook [pata]
:: Parsing hook [scsi]
:: Parsing hook [sata]
:: Parsing hook [filesystems]
:: Generating module dependencies
:: Generating image 'foo.img'
6463 blocks
:: Image generation successful

real    0m0.731s
user    0m0.440s
sys     0m0.159s

As always, comments, criticism, and tomatos welcome.


More information about the arch-projects mailing list