Richard W.M. Jones
2016-Mar-18 12:12 UTC
[Libguestfs] [PATCH supermin] init: Add a blacklist of kmods that we want to exclude from the mini initrd.
We want to exclude virtio-gpu since it's irrelevant, large, and pulls in other unwanted dependencies (modeswitching, drm). Add a second list of kmods which is a blacklist, applied after the first. This reduces the libguestfs initrd size from 39M down to 17M, with concomitant small reductions in boot time. --- src/ext2_initrd.ml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ext2_initrd.ml b/src/ext2_initrd.ml index 63ed493..a177018 100644 --- a/src/ext2_initrd.ml +++ b/src/ext2_initrd.ml @@ -54,6 +54,13 @@ let kmods = [ "megaraid*.ko*"; ] +(* A blacklist of kmods which match the above patterns, but which we + * subsequently remove. + *) +let not_kmods = [ + "virtio-gpu.ko*"; +] + let rec build_initrd debug tmpdir modpath initrd if debug >= 1 then printf "supermin: ext2: creating minimal initrd '%s'\n%!" initrd; @@ -73,7 +80,8 @@ let rec build_initrd debug tmpdir modpath initrd fun topset modl -> let m = Filename.basename modl in let matches wildcard = fnmatch wildcard m [FNM_PATHNAME] in - if List.exists matches kmods then + if List.exists matches kmods && not (List.exists matches not_kmods) + then StringSet.add modl topset else topset -- 2.7.3
Pino Toscano
2016-Mar-18 13:03 UTC
Re: [Libguestfs] [PATCH supermin] init: Add a blacklist of kmods that we want to exclude from the mini initrd.
On Friday 18 March 2016 12:12:29 Richard W.M. Jones wrote:> We want to exclude virtio-gpu since it's irrelevant, large, and pulls > in other unwanted dependencies (modeswitching, drm). Add a second > list of kmods which is a blacklist, applied after the first. > > This reduces the libguestfs initrd size from 39M down to 17M, with > concomitant small reductions in boot time. > ---LGTM. Thanks, -- Pino Toscano
Seemingly Similar Threads
- [PATCH RFC supermin] ext2_initrd: error out if we can't add anything
- Re: [PATCH RFC supermin] ext2_initrd: error out if we can't add anything
- [PATCH supermin v2 1/4] init: Uncompress modules before adding them to the mini initrd.
- [PATCH 0/3] supermin: miscellaneous cleanups
- Re: [PATCH supermin 5/5] init: Drop SCSI modules.