Message info From:Dave Reisner Subject:[arch-projects] [mkinitcpio][PATCH 00/19] Break all the things! Date:Sun, 13 May 2012 13:57:03 -0400

Hi all,

What follows this is the changes I have in store for the next release, which
I'll be tagging 0.9.0. There's one change not included, but I'll explain what
that is.

I realize this patchset is huge, and I don't expect anyone to look through it
in its entirety. However, there's two things worth pointing out here that I'd
appreciate some feedback on:

* Changes to install hook API
I've added some new functions:
- add_checked_modules
- add_all_modules
- add_runscript

These are intended to replace all_modules and checked_modules, which currently
return the list of modules that the caller should add. The new functions simply
go ahead and queue the modules for addition rather than making the caller do
something with them. add_runscript does some introspection to figure out which
hook called it and add the appropriate script from /usr/lib/initcpio/hooks.

The general idea here is that we're getting rid of using MODULES, FILES, BINARIES,
and SCRIPT in the install hooks and we'll be down to a singular method of adding
files to the image. With the refactored error parsing, mkinitcpio can properly
detect errors from any add_* function, which should improve the experience a bit.

Consider the next release the deprecation warning, though I'm not sure when
I'll remove things. I've made sure that current hooks continue to work in the
same way. There's no explicit callout during runtime about these things being
deprecated, but maybe there should be? I'll plan on fixing all the hooks in the
repos myself.

Since this is new API, I'd like to get it right the first time. If anyone sees
anything lacking, room for improvement, or wants to send me death threats, feel

* Support for late running hooks
I've refactored running hooks in early userspace and we now support a second run
after root has been mounted. To make things simple, current hook files only need
to define an extra function run_latehook() to be considered. Hooks run in reverse
order from the normal run. lsinitcpio of course gains support for reading these.

We already have some obvious candidates to use this feature: udev and shutdown.
udev startup/shutdown no longer needs to be hardcoded in /init, and shutdown
can delete modules before copying / over to /run/initramfs, saving some modicum
of space in tmpfs.

I'm also tempted to move mounting of /usr to a late running hook, but I'm sure
that we'll see some breakage by doing this, even with proper warnings. Opinions
here welcome.

The final unlisted change is what I referred to earlier about udev. Since the udev
hook would be handling its own startup/shutdown, we'd simply yank those if blocks
out of /init and carry on. I've been testing this and it works quite well.

Random feedback and tomatoes unrelated to the above points are welcome, as always.


Dave Reisner (19):
use MODULEDIR as reference for *.(order|builtin) files
mkinitcpio: separate logic to resolve kernel version
document special kernel cmdline parameters
refactor error tracking in build hooks
mmc: package as mode 644, not 755
functions: remove get_dirname and get_basename
functions: move --try logic into add_module
move -g option checking to parseopts loop
functions: introduce add_checked_modules and add_all_modules
functions: introduce add_runscript
use new API for install hooks
init: correct trimming of earlymodules and MODULES
init_functions: move running hooks to separate func
init: add support for late running hooks
shutdown: package as 644, install as 755
shutdown: convert to late hook
buildsys: fix clean target
lsinitcpio: extract the image to a tempdir
lsinitcpio: add support for listing late hooks

Makefile | 2 +-
functions | 125 +++++++++++++++++++++++++++++++++++++--------------
hooks/shutdown | 3 +-
init | 26 +++--------
init_functions | 27 +++++++++++
install/consolefont | 6 +--
install/filesystems | 4 +-
install/fsck | 4 ++
install/fw | 8 +++-
install/ide | 4 +-
install/keymap | 4 +-
install/memdisk | 9 ++--
install/mmc | 7 ++-
install/pata | 6 ++-
install/resume | 2 +-
install/sata | 6 ++-
install/scsi | 9 ++--
install/shutdown | 7 +--
install/sleep | 2 +-
install/usb | 12 +++--
install/usbinput | 5 ++-
install/virtio | 2 +-
lsinitcpio | 70 +++++++++++++++++++++--------
mkinitcpio | 59 ++++++++++++++----------
mkinitcpio.8.txt | 51 +++++++++++++++++++++
25 files changed, 317 insertions(+), 143 deletions(-)
mode change 100755 => 100644 install/mmc
mode change 100755 => 100644 shutdown