1 commit 33cc4751b8f80fc3b800928b9ad93866b2569915
2 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
3 Date: Tue Dec 18 14:33:12 2018 +0100
5 Install blkid in /sbin because udevd expects it to be there.
7 diff --git a/geninitrd b/geninitrd
8 index a79b9c3..118333c 100755
11 @@ -1530,7 +1530,7 @@ chmod a+rx "$RCFILE"
12 ln -s linuxrc $DESTDIR/init
14 # create dirs that we really need
15 -inst_d /{lib,bin,etc,dev{,/pts,/shm},loopfs,var,proc,run,sys,tmp}
16 +inst_d /{lib,bin,sbin,etc,dev{,/pts,/shm},loopfs,var,proc,run,sys,tmp}
18 modules_install "$MODULES"
20 diff --git a/mod-blkid.sh b/mod-blkid.sh
21 index 8ee2a48..92df9ae 100644
24 @@ -22,12 +22,12 @@ initrd_gen_blkid() {
26 verbose "Adding BLKID support to initrd"
28 - inst_exec $blkid /bin/blkid
29 + inst_exec $blkid /sbin/blkid
32 # if built with blkid change ROOT=LABEL=something into ROOT=/dev/device parsed by blkid
33 if [ "${ROOT##LABEL=}" != "${ROOT}" -o "${ROOT##UUID=}" != "${ROOT}" ]; then
34 - blkid="$(/bin/blkid -t $ROOT -o device -l)"
35 + blkid="$(/sbin/blkid -t $ROOT -o device -l)"
36 if [ -n "$blkid" ]; then
40 commit dc5ca733ed6fe57dfa39d4598a6586069e41d0b0
41 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
42 Date: Tue Dec 18 14:34:38 2018 +0100
44 Install mdadm in /sbin because udevd expects it to be there.
46 diff --git a/mod-md.sh b/mod-md.sh
47 index 2b6f587..a358517 100644
50 @@ -133,7 +133,7 @@ initrd_gen_md() {
52 verbose "Setting up mdadm..."
54 - inst_exec $mdadm /bin/mdadm
55 + inst_exec $mdadm /sbin/mdadm
57 echo "DEVICE partitions containers" >> "$DESTDIR/etc/mdadm.conf"
59 @@ -181,7 +181,7 @@ initrd_gen_md() {
61 echo "wait_for_files $cr_dev_list" | add_linuxrc
63 - mdadm --assemble --scan
64 + /sbin/mdadm --assemble --scan
66 if [ "$DEBUGINITRD" ]; then
67 [ -e /proc/mdstat ] && echo "/proc/mdstat contents:" && cat /proc/mdstat
69 commit 3d81f1cd0bc557ad9a1f157b403f0396866c648c
70 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
71 Date: Tue Dec 18 14:38:55 2018 +0100
73 udevd uses ata_id and scsi_id, so install these.
75 diff --git a/mod-udev.sh b/mod-udev.sh
76 index 422ef3e..a2491ee 100644
79 @@ -41,9 +41,11 @@ setup_mod_udev() {
81 verbose "Setting up udev..."
83 - inst_d /sbin /etc/udev
84 + inst_d /sbin /etc/udev /lib/udev
85 inst_exec $udevd /sbin/udevd
86 inst_exec $udevadm /sbin/udevadm
87 + inst_exec /lib/udev/ata_id /lib/udev/ata_id
88 + inst_exec /lib/udev/scsi_id /lib/udev/scsi_id
89 inst /etc/udev/udev.conf /etc/udev/udev.conf
91 inst_rules 50-udev-default.rules 60-persistent-storage.rules 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
93 commit 21ad0f7980ce6a0135e4a3c37a94472ed4f1320c
94 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
95 Date: Tue Dec 18 14:43:20 2018 +0100
97 Use existing mechanism for installing udev apps but install regular variants, too if initrd-variants don't exist.
99 diff --git a/mod-udev.sh b/mod-udev.sh
100 index a2491ee..87f4b68 100644
103 @@ -44,8 +44,6 @@ initrd_gen_udev() {
104 inst_d /sbin /etc/udev /lib/udev
105 inst_exec $udevd /sbin/udevd
106 inst_exec $udevadm /sbin/udevadm
107 - inst_exec /lib/udev/ata_id /lib/udev/ata_id
108 - inst_exec /lib/udev/scsi_id /lib/udev/scsi_id
109 inst /etc/udev/udev.conf /etc/udev/udev.conf
110 # standard udev rules
111 inst_rules 50-udev-default.rules 60-persistent-storage.rules 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
112 @@ -57,6 +55,8 @@ initrd_gen_udev() {
113 for e in ata_id cdrom_id collect firmware scsi_id v4l_id; do
114 if [ -e "$initrd_dir/udev/$e" ]; then
115 inst_exec $initrd_dir/udev/$e /lib/udev/$e
116 + elif [ -e "/lib/udev/$e" ]; then
117 + inst_exec /lib/udev/$e /lib/udev/$e
122 commit ad5033d7e704edaf52f2be18d4aa98c378179ede
123 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
124 Date: Fri Jan 25 20:38:24 2019 +0100
126 Timeout here is not a good idea. rootfs cannot be mounted and kernel oopses due to that.
128 diff --git a/mod-luks.sh b/mod-luks.sh
129 index ff877f7..ffe87cb 100644
132 @@ -162,7 +162,7 @@ luks_crypttab() {
136 - verbose "+ cryptsetup --timeout=120 ${keyfile:+-d $keyfile} open $crypttab_opt '$src' '$dst'"
137 + verbose "+ cryptsetup ${keyfile:+-d $keyfile} open $crypttab_opt '$src' '$dst'"
141 @@ -189,7 +189,7 @@ luks_crypttab() {
142 crypt_status=\$(cryptsetup \$cryptsetup_opt status '$dst')
143 if [ "\${crypt_status%%is inactive*}" != "\$crypt_status" ]; then
145 - cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} --timeout 120 open $crypttab_opt "\$luksdev" '$dst' <&1
146 + cryptsetup \$cryptsetup_opt ${keyfile:+-d $keyfile} open $crypttab_opt "\$luksdev" '$dst' <&1
151 commit b565e95c147bea4e68e4ccf5ad19906d51d2375b
152 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
153 Date: Wed May 15 21:04:45 2019 +0200
155 Prepend cpu microcode to initrd image, so kernel will pick it up when LILO is in use.
157 diff --git a/geninitrd b/geninitrd
158 index 118333c..b5d405a 100755
161 @@ -17,6 +17,7 @@ PROGRAM=${0##*/}
162 # list of geninitrd modules which need setup routine after commandline args parsing
169 @@ -1186,6 +1187,16 @@ compress_image() {
170 mv -f "$tmp" "$target"
173 +# prepend file to image
174 +prepend_file_to_image() {
175 + local file="$1" target="$2" tmp
176 + tmp=$(mktemp "$target".XXXXXX) || die "mktemp failed"
178 + cat "$file" "$target" > "$tmp" || return $?
180 + mv -f "$tmp" "$target"
183 if [ -r /etc/sysconfig/geninitrd ]; then
184 . /etc/sysconfig/geninitrd
186 @@ -1801,6 +1812,14 @@ else
187 cp -a "$IMAGE" "$target"
190 +# microcode support for lilo
191 +if ! is_no "$LILO_MICROCODE"; then
192 + if [ -x /sbin/lilo -a -f "/boot/intel-ucode.img" ]; then
193 + verbose "Prepending $target with microcode image /boot/intel-ucode.img for LILO"
194 + prepend_file_to_image "/boot/intel-ucode.img" "$target"
198 # XXX. check if bootsplash can output data to tmp dir not directly to initramfs image.
199 initrd_gen_bootsplash "$target"
201 diff --git a/geninitrd.sysconfig b/geninitrd.sysconfig
202 index ccf177c..1268324 100644
203 --- a/geninitrd.sysconfig
204 +++ b/geninitrd.sysconfig
206 # Default is to use initramfs for >= 2.5.0.
209 +# Should we prepend cpu microcode when lilo is installed
212 ## Use udev to create /dev?
216 commit 662fd5a3adac2080640fa4eacd34d72504526175
217 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
218 Date: Mon Jul 15 19:59:46 2019 +0200
220 Another way for findings usb keyboard drivers that works on newer kernels.
222 diff --git a/mod-usbkbd.sh b/mod-usbkbd.sh
223 index 0dd0d20..ff8f442 100644
226 @@ -10,6 +10,23 @@ find_modules_usbkbd() {
228 local modules i module bInterfaceClass bInterfaceProtocol
230 + for i in /sys/bus/usb/devices/*-*:*; do
231 + # standard usb keyboards
232 + if [ -f $i/bInterfaceClass -a -f $i/bInterfaceProtocol ]; then
233 + bInterfaceClass=$(cat $i/bInterfaceClass)
234 + bInterfaceProtocol=$(cat $i/bInterfaceProtocol)
235 + if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
236 + module=$(readlink $i/driver/module)
237 + module=$(basename $module)
239 + if [ -n "$module" ]; then
240 + verbose "Found USB Keyboard driver: $module"
241 + modules="$modules $module"
247 for i in /sys/class/input/input*; do
248 # standard usb keyboards
249 if [ -f $i/device/bInterfaceClass -a -f $i/device/bInterfaceProtocol ]; then
251 commit 4de5a3333e772ad198381f157c014e452e42c129
252 Author: Elan Ruusamäe <glen@pld-linux.org>
253 Date: Mon Jul 15 23:56:58 2019 +0300
257 diff --git a/mod-usbkbd.sh b/mod-usbkbd.sh
258 index ff8f442..35543b7 100644
261 @@ -10,22 +10,22 @@ find_modules_usbkbd() {
263 local modules i module bInterfaceClass bInterfaceProtocol
265 - for i in /sys/bus/usb/devices/*-*:*; do
266 - # standard usb keyboards
267 - if [ -f $i/bInterfaceClass -a -f $i/bInterfaceProtocol ]; then
268 - bInterfaceClass=$(cat $i/bInterfaceClass)
269 - bInterfaceProtocol=$(cat $i/bInterfaceProtocol)
270 - if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
271 - module=$(readlink $i/driver/module)
272 - module=$(basename $module)
273 + for i in /sys/bus/usb/devices/*-*:*; do
274 + # standard usb keyboards
275 + if [ -f $i/bInterfaceClass -a -f $i/bInterfaceProtocol ]; then
276 + bInterfaceClass=$(cat $i/bInterfaceClass)
277 + bInterfaceProtocol=$(cat $i/bInterfaceProtocol)
278 + if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
279 + module=$(readlink $i/driver/module)
280 + module=$(basename $module)
282 - if [ -n "$module" ]; then
283 - verbose "Found USB Keyboard driver: $module"
284 - modules="$modules $module"
289 + if [ -n "$module" ]; then
290 + verbose "Found USB Keyboard driver: $module"
291 + modules="$modules $module"
297 for i in /sys/class/input/input*; do
298 # standard usb keyboards
300 commit 04b32086569a126d5d6f9bd0ad1b0db9f142f50e
301 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
302 Date: Sun Jul 21 21:04:05 2019 +0200
304 Try to detect a need for nvme driver. If you know better method then share with us.
306 diff --git a/geninitrd b/geninitrd
307 index b5d405a..05e290a 100755
310 @@ -673,6 +673,11 @@ find_modules_for_devpath() {
314 + if [[ "$devpath" == /dev/nvme* ]]; then
319 if [[ "$devpath" == /dev/bcache* ]]; then
320 find_modules_bcache "$devpath"
323 commit 43d2f37d89034a2e409bb4f66cca1a64b12130b8
324 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
325 Date: Mon Nov 25 20:15:24 2019 +0100
327 Accept d/D symbols, too (ffffffff825ca52c D __initramfs_start) as noticed in recent 4.19.85-1 kernel.
329 diff --git a/geninitrd b/geninitrd
330 index 05e290a..052f553 100755
333 @@ -1097,7 +1097,7 @@ sym_exists() {
337 - awk -vc=1 -vsymbol="$symbol" '($2 == "T" || $2 == "t") && $3 == symbol {c = 0} END {exit c}' $mapfile
338 + awk -vc=1 -vsymbol="$symbol" '(tolower($2) == "t" || tolower($2) == "d") && $3 == symbol {c = 0} END {exit c}' $mapfile
341 # find best compressor (or forced one) for initrd
343 commit b4c7f62cc3963af683b69092fb2f44076d5e3bb3
344 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
345 Date: Tue Feb 4 22:28:16 2020 +0100
347 glibc 2.31 ldd prints 'not a dynamic executable' on stderr, so silence it.
349 diff --git a/geninitrd b/geninitrd
350 index 052f553..e9832ef 100755
353 @@ -551,7 +551,7 @@ inst_exec() {
357 - libs=$(ldd "$obj" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
358 + libs=$(ldd "$obj" 2> /dev/null | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
359 for lib in $libs $libs_additional; do
360 libdir=$(cd $(dirname "$lib"); pwd)
361 if [ ! -f "$DESTDIR/$lib" ]; then
362 @@ -566,7 +566,7 @@ inst_exec() {
363 for _lib in $(get_libdir LIBDIR); do
364 if [ -f $DESTDIR/$_lib/libc.so.0 ]; then
365 lib=$DESTDIR/$_lib/libc.so.0
366 - lib=$(ldd "$lib" | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
367 + lib=$(ldd "$lib" 2> /dev/null | awk '/statically|linux-(gate|vdso)\.so/{next} NF == 2 {print $1} /=/{print $3}' | sort -u)
368 libdir=$(cd $(dirname "$lib"); pwd)
369 if [ ! -e $DESTDIR$libdir ]; then
370 libdir=$(dirname "$libdir")
372 commit b6efb8e39496d74852f353e5142d5cb076d7540f
373 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
374 Date: Thu Feb 6 17:34:03 2020 +0100
376 Move /run mount to newroot. Always mount run for easier transition to /run hierarchy later.
378 diff --git a/geninitrd b/geninitrd
379 index e9832ef..7f5495f 100755
382 @@ -288,8 +288,7 @@ umount_all() {
384 if is_yes "$run_mounted"; then
386 - mount --bind /run /newroot/run
388 + mount -n --move /run /newroot/run
392 @@ -1653,6 +1652,7 @@ EOF
398 modules_add_linuxrc $MODULES
401 commit 4335c9501bcb9780d486af197354af2ccb1eae89
402 Author: Jan Palus <atler@pld-linux.org>
403 Date: Thu Nov 12 11:46:39 2020 +0100
405 don't try to expand pci devices if pci bus is missing
407 diff --git a/functions b/functions
408 index 9015cc3..3a52190 100644
411 @@ -209,10 +209,12 @@ find_modules_by_class_kmod() {
415 - for i in $(grep -li "^0x${req_class}" /sys/devices/pci*/*/class); do
417 - modaliases="$modaliases $(cat $j/modalias)"
419 + if ls /sys/devices | grep -q '^pci'; then
420 + for i in $(grep -li "^0x${req_class}" /sys/devices/pci*/*/class); do
422 + modaliases="$modaliases $(cat $j/modalias)"
426 if [ -z "$modaliases" ]; then