supermin/0009-init-Add-a-blacklist-of-kmods-that-we-want-to-exclud.patch
Richard W.M. Jones 5c44b1ee43 Add all upstream patches since 5.1.15 was released.
- These should improve boot performance and initrd size.
2016-03-18 13:17:56 +00:00

48 lines
1.5 KiB
Diff

From 2de26d2eca1a39f19d2b6cc470db690216ac64ba Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 18 Mar 2016 11:57:41 +0000
Subject: [PATCH 9/9] 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 f3be0ef..b583d53 100644
--- a/src/ext2_initrd.ml
+++ b/src/ext2_initrd.ml
@@ -46,6 +46,13 @@ let kmods = [
"ibmvscsic.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;
@@ -65,7 +72,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.5.0