1 |
commit: 008d2cf12926c2fe91139c4fed802c053676d74c |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 27 12:08:07 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 27 16:18:56 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=008d2cf1 |
7 |
|
8 |
initrd.scripts: modules_load(): Log what we do |
9 |
|
10 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
11 |
|
12 |
defaults/initrd.scripts | 48 ++++++++++++++++++++++++++++-------------------- |
13 |
1 file changed, 28 insertions(+), 20 deletions(-) |
14 |
|
15 |
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts |
16 |
index 597fb09..59e39fc 100644 |
17 |
--- a/defaults/initrd.scripts |
18 |
+++ b/defaults/initrd.scripts |
19 |
@@ -29,30 +29,49 @@ modules_load() { |
20 |
modules_scan() { |
21 |
local MODS |
22 |
local loaded |
23 |
+ local x |
24 |
local smart_loading=yes |
25 |
local _root_dev |
26 |
local root_dev_found="Root block device found, skipping loading of module group \"${1}\" ..." |
27 |
|
28 |
+ MODS=$(cat /etc/modules/${1} 2>/dev/null) |
29 |
+ if [ -z "${MODS}" ] |
30 |
+ then |
31 |
+ log_msg "/etc/modules/${1} is empty; Nothing to load for '${1}' ..." |
32 |
+ return |
33 |
+ fi |
34 |
+ |
35 |
+ if [ -z "${MODULES_SCAN_WARNING_SHOWN}" ] |
36 |
+ then |
37 |
+ local note_msg="NOTE: Due to how genkernel auto-detects your" |
38 |
+ note_msg="${note_msg} hardware you will now see a lot of failed modprobe" \ |
39 |
+ note_msg="${note_msg} attempts which you can ignore:" |
40 |
+ |
41 |
+ log_msg "${note_msg}" |
42 |
+ |
43 |
+ MODULES_SCAN_WARNING_SHOWN=yes |
44 |
+ fi |
45 |
+ |
46 |
if [ "${GK_HW_LOAD_ALL_MODULES}" = '1' ] |
47 |
then |
48 |
- smart_loading= |
49 |
+ smart_loading=no |
50 |
elif [ "${1}" = "virtio" ] || [ "${1}" = "hyperv" ] |
51 |
then |
52 |
# Virtio/HyperV modules group is special -- it's about |
53 |
# hypervisor support in general, not root block device |
54 |
- smart_loading= |
55 |
+ smart_loading=no |
56 |
elif [ "${1}" = "net" ] |
57 |
then |
58 |
# We already load network modules only when we need |
59 |
# network so don't stop loading network modules when |
60 |
# $REAL_ROOT is already present or we will probably |
61 |
# end up without network we wanted ... |
62 |
- smart_loading= |
63 |
+ smart_loading=no |
64 |
elif [ "${1}" = "fs" ] |
65 |
then |
66 |
# We don't know if kernel supports root filesystem so |
67 |
# better load all filesystems ... |
68 |
- smart_loading= |
69 |
+ smart_loading=no |
70 |
elif [ "${USE_MDADM}" = '1' ] \ |
71 |
|| [ "${USE_LVM_NORMAL}" = '1' ] \ |
72 |
|| [ "${USE_CRYPTSETUP}" = '1' ] \ |
73 |
@@ -63,24 +82,13 @@ modules_scan() { |
74 |
# All of this will require the call of another program before |
75 |
# root becomes available so checking for root after each module |
76 |
# was loaded will only waste time. |
77 |
- smart_loading= |
78 |
+ smart_loading=no |
79 |
fi |
80 |
|
81 |
- MODS=$(cat /etc/modules/${1} 2>/dev/null) |
82 |
- [ -n "${MODS}" ] && [ -z "${QUIET}" ] && \ |
83 |
+ log_msg "Loading modules of module group '${1}' (smart loading: ${smart_loading}) ..." |
84 |
+ [ -z "${QUIET}" ] && \ |
85 |
printf "%b" "${BOLD} ::${NORMAL} Loading from ${1}: " |
86 |
|
87 |
- if [ -z "${MODULES_SCAN_WARNING_SHOWN}" ] |
88 |
- then |
89 |
- local note_msg="NOTE: Due to how genkernel auto-detects your" |
90 |
- note_msg="${note_msg} hardware you will now see a lot of failed modprobe" \ |
91 |
- note_msg="${note_msg} attempts which you can ignore:" |
92 |
- |
93 |
- log_msg "${note_msg}" |
94 |
- |
95 |
- MODULES_SCAN_WARNING_SHOWN=yes |
96 |
- fi |
97 |
- |
98 |
for x in ${MODS} |
99 |
do |
100 |
MLOAD=$(echo ${MLIST} | sed -e "s/.*${x}.*/${x}/") |
101 |
@@ -90,7 +98,7 @@ modules_scan() { |
102 |
printf "%b\n" "${BOLD} ::${NORMAL} Skipping ${x} ..." |
103 |
elif [ "${MLOAD}" = "${MLIST}" ] |
104 |
then |
105 |
- if [ -n "${smart_loading}" ] |
106 |
+ if [ "${smart_loading}" = "yes" ] |
107 |
then |
108 |
_root_dev=$(findfs "${REAL_ROOT}" 2>/dev/null) |
109 |
|
110 |
@@ -124,7 +132,7 @@ modules_scan() { |
111 |
printf "%b\n" "${BOLD} ::${NORMAL} Skipping ${x} ..." |
112 |
fi |
113 |
done |
114 |
- [ -n "${MODS}" ] && [ -z "${QUIET}" ] && echo |
115 |
+ [ -z "${QUIET}" ] && echo |
116 |
} |
117 |
|
118 |
uppercase() { |