Allow initramfs search depth to be user-configurable
Currently, the initramfs searches for two items:
- A “bootrepo”, identified by a
.boot_repository
file - An apkovl file, identified as
*.apkovl.tar.gz*
This is done within nlplug-findfs
, which recurses into various
coldplugged devices.
The depth of the recursion is controlled by
struct recurseopts.maxdepth
, which is hardcoded to 1 in
nlplug-findfs.c::893
.
There is also a find_boot_repositories
function in
initramfs-init.in::240
, which uses a hardcoded maxdepth of 3.
However, find_boot_repositories
seems to be more of a fallback, only
being called after relocation, and using $ALPINE_REPO
if/when
available.
This is fine for the default images, in which apks
is in the root of
the filesystem, but makes creating custom boot media much more
difficult.
As such, please make the maxdepth configurable, with the initramfs flag
being shared between nlplug-findfs
and find_boot_repositories
.
These are the things that would need to be done, from what I can tell:
- Add a new initramfs-init command line option, e.g “depth”, which should default to 1 (current value).
- Use
$KOPT_depth
infind_boot_repositories
. - Add a new int to
struct ueventconf
, e.g “depth”, which should be of type int, or unsigned int. - Add parsing for ‘d’ in
main()
and document it inusage()
. - Set
.maxdepth
toconf->depth
innlplug-findfs.c::893
. - Set various invocations of
trigger_path
to useconf->depth
instead of a hardcodedmax_depth
when appropriate. - Pass
-d $KOPT_depth
tonlplug-findfs
when appropriate withininitramfs-init
. - Document the changes in
nlplug-findfs.1.in
andmkinitfs-bootparam.7.in
.
(from redmine: issue id 9978, created on 2019-02-12)