[klibc] [PATCH v3 0/2] Support drop directories directly from kinit
Mike Waychison
mikew at google.com
Wed Aug 3 12:38:17 PDT 2011
This patchset applies to klibc mainline.
This patchset introduces the ability to kinit to execute scripts or
executable files present in in the initramfs before switching over to
the root filesystem.
This functionality is implemented in a newly introduced run_parts()
call, which calls scandir() to iterate through files which in then
executes in sequence.
run_parts() is also available as a minimal run-parts executable (that
doesn't yet take any flags).
This patchset then introduces two different drop directories, though
this is of course subject to change and these are only presented in an
effort to put an example forward. I currently only have a requirement
to run stuff between the time we call do_mounts() and the time we call
run_init().
These are the directories:
/scripts/after-network: ipconfig is completed, but the root
filesystem isn't yet mounted.
/scripts/after-mount: the root filesystem has just been mounted at
/root.
I believe this would help both our use-case (where we'd like to do
customization of the early-bootup sequence without having to hack kinit
too much), and the use case for initramfs-tools, opening the door to
replace all the "core" shell there with kinit as a C implementation.
Thanks,
Mike Waychison
Changelog
=========
v3
- Renamed run_scripts() to run_parts().
- Introduced the build of a standalone run-parts binary.
- Dropped the alphasort and scandir parts of the series as they are
now merged.
v2
- Added __extern to alphasort declaration.
- Split alphasort() out into alphasort.c and its own patch.
Related discussions
===================
- We recently had a discussion at:
http://www.zytor.com/pipermail/klibc/2011-July/003014.html
where I wanted to refactor bits of kinit out so that I could
invoke them from a shell script. This patchset is an alternative
solution that would allow users of kinit to add custom logic at
the intermediate stages without having to have the whole init
driven by a shell script.
- earlier sendouts:
v1: http://www.zytor.com/pipermail/klibc/2011-July/003032.html
v2: http://www.zytor.com/pipermail/klibc/2011-August/003055.html
Patchset summary
================
kinit: Add run_parts()
kinit: Add callsites to execute files in drop-directories.
More information about the klibc
mailing list