]> git.pld-linux.org Git - packages/geninitrd.git/blob - geninitrd-git.patch
- rel 9; swsusp was breaking normal setups; fix that
[packages/geninitrd.git] / geninitrd-git.patch
1 commit 33cc4751b8f80fc3b800928b9ad93866b2569915
2 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
3 Date:   Tue Dec 18 14:33:12 2018 +0100
4
5     Install blkid in /sbin because udevd expects it to be there.
6
7 diff --git a/geninitrd b/geninitrd
8 index a79b9c3..118333c 100755
9 --- a/geninitrd
10 +++ b/geninitrd
11 @@ -1530,7 +1530,7 @@ chmod a+rx "$RCFILE"
12  ln -s linuxrc $DESTDIR/init
13  
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}
17  
18  modules_install "$MODULES"
19  
20 diff --git a/mod-blkid.sh b/mod-blkid.sh
21 index 8ee2a48..92df9ae 100644
22 --- a/mod-blkid.sh
23 +++ b/mod-blkid.sh
24 @@ -22,12 +22,12 @@ initrd_gen_blkid() {
25         fi
26         verbose "Adding BLKID support to initrd"
27  
28 -       inst_exec $blkid /bin/blkid
29 +       inst_exec $blkid /sbin/blkid
30         initrd_gen_devices
31         add_linuxrc <<-'EOF'
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
37                                 ROOT=$blkid
38                         fi
39
40 commit dc5ca733ed6fe57dfa39d4598a6586069e41d0b0
41 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
42 Date:   Tue Dec 18 14:34:38 2018 +0100
43
44     Install mdadm in /sbin because udevd expects it to be there.
45
46 diff --git a/mod-md.sh b/mod-md.sh
47 index 2b6f587..a358517 100644
48 --- a/mod-md.sh
49 +++ b/mod-md.sh
50 @@ -133,7 +133,7 @@ initrd_gen_md() {
51         fi
52         verbose "Setting up mdadm..."
53  
54 -       inst_exec $mdadm /bin/mdadm
55 +       inst_exec $mdadm /sbin/mdadm
56  
57         echo "DEVICE partitions containers" >> "$DESTDIR/etc/mdadm.conf"
58  
59 @@ -181,7 +181,7 @@ initrd_gen_md() {
60  
61         echo "wait_for_files $cr_dev_list" | add_linuxrc
62         add_linuxrc <<-'EOF'
63 -       mdadm --assemble --scan
64 +       /sbin/mdadm --assemble --scan
65  
66         if [ "$DEBUGINITRD" ]; then
67                 [ -e /proc/mdstat ] && echo "/proc/mdstat contents:" && cat /proc/mdstat
68
69 commit 3d81f1cd0bc557ad9a1f157b403f0396866c648c
70 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
71 Date:   Tue Dec 18 14:38:55 2018 +0100
72
73     udevd uses ata_id and scsi_id, so install these.
74
75 diff --git a/mod-udev.sh b/mod-udev.sh
76 index 422ef3e..a2491ee 100644
77 --- a/mod-udev.sh
78 +++ b/mod-udev.sh
79 @@ -41,9 +41,11 @@ setup_mod_udev() {
80  initrd_gen_udev() {
81         verbose "Setting up udev..."
82  
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
90         # standard udev rules
91         inst_rules 50-udev-default.rules 60-persistent-storage.rules 61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
92
93 commit 21ad0f7980ce6a0135e4a3c37a94472ed4f1320c
94 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
95 Date:   Tue Dec 18 14:43:20 2018 +0100
96
97     Use existing mechanism for installing udev apps but install regular variants, too if initrd-variants don't exist.
98
99 diff --git a/mod-udev.sh b/mod-udev.sh
100 index a2491ee..87f4b68 100644
101 --- a/mod-udev.sh
102 +++ b/mod-udev.sh
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
118                 fi
119         done
120  
121
122 commit ad5033d7e704edaf52f2be18d4aa98c378179ede
123 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
124 Date:   Fri Jan 25 20:38:24 2019 +0100
125
126     Timeout here is not a good idea. rootfs cannot be mounted and kernel oopses due to that.
127
128 diff --git a/mod-luks.sh b/mod-luks.sh
129 index ff877f7..ffe87cb 100644
130 --- a/mod-luks.sh
131 +++ b/mod-luks.sh
132 @@ -162,7 +162,7 @@ luks_crypttab() {
133                         done
134                         IFS="$old_IFS"
135  
136 -                       verbose "+ cryptsetup --timeout=120 ${keyfile:+-d $keyfile} open $crypttab_opt '$src' '$dst'"
137 +                       verbose "+ cryptsetup ${keyfile:+-d $keyfile} open $crypttab_opt '$src' '$dst'"
138                         add_linuxrc <<-EOF
139                         debugshell
140  
141 @@ -189,7 +189,7 @@ luks_crypttab() {
142                                 crypt_status=\$(cryptsetup \$cryptsetup_opt status '$dst')
143                                 if [ "\${crypt_status%%is inactive*}" != "\$crypt_status" ]; then
144                                         # is inactive
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
147                                 fi
148                         fi
149  
150
151 commit b565e95c147bea4e68e4ccf5ad19906d51d2375b
152 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
153 Date:   Wed May 15 21:04:45 2019 +0200
154
155     Prepend cpu microcode to initrd image, so kernel will pick it up when LILO is in use.
156
157 diff --git a/geninitrd b/geninitrd
158 index 118333c..b5d405a 100755
159 --- a/geninitrd
160 +++ b/geninitrd
161 @@ -17,6 +17,7 @@ PROGRAM=${0##*/}
162  # list of geninitrd modules which need setup routine after commandline args parsing
163  GENINITRD_MODS=""
164  COMPRESS=yes
165 +LILO_MICROCODE=yes
166  STRIP=/usr/bin/strip
167  target=""
168  kernel=""
169 @@ -1186,6 +1187,16 @@ compress_image() {
170         mv -f "$tmp" "$target"
171  }
172  
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"
177 +
178 +       cat "$file" "$target" > "$tmp" || return $?
179 +
180 +       mv -f "$tmp" "$target"
181 +}
182 +
183  if [ -r /etc/sysconfig/geninitrd ]; then
184         . /etc/sysconfig/geninitrd
185  fi
186 @@ -1801,6 +1812,14 @@ else
187         cp -a "$IMAGE" "$target"
188  fi
189  
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"
195 +       fi
196 +fi
197 +
198  # XXX. check if bootsplash can output data to tmp dir not directly to initramfs image.
199  initrd_gen_bootsplash "$target"
200  
201 diff --git a/geninitrd.sysconfig b/geninitrd.sysconfig
202 index ccf177c..1268324 100644
203 --- a/geninitrd.sysconfig
204 +++ b/geninitrd.sysconfig
205 @@ -18,6 +18,9 @@
206  # Default is to use initramfs for >= 2.5.0.
207  #INITRDFS=initramfs
208  
209 +# Should we prepend cpu microcode when lilo is installed
210 +#LILO_MICROCODE=no
211 +
212  ## Use udev to create /dev?
213  USE_UDEV=yes
214  
215
216 commit 662fd5a3adac2080640fa4eacd34d72504526175
217 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
218 Date:   Mon Jul 15 19:59:46 2019 +0200
219
220     Another way for findings usb keyboard drivers that works on newer kernels.
221
222 diff --git a/mod-usbkbd.sh b/mod-usbkbd.sh
223 index 0dd0d20..ff8f442 100644
224 --- a/mod-usbkbd.sh
225 +++ b/mod-usbkbd.sh
226 @@ -10,6 +10,23 @@ find_modules_usbkbd() {
227  
228         local modules i module bInterfaceClass bInterfaceProtocol
229  
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)
238 +
239 +                                if [ -n "$module" ]; then
240 +                                        verbose "Found USB Keyboard driver: $module"
241 +                                        modules="$modules $module"
242 +                                fi
243 +                        fi
244 +                fi
245 +        done
246 +
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
250
251 commit 4de5a3333e772ad198381f157c014e452e42c129
252 Author: Elan Ruusamäe <glen@pld-linux.org>
253 Date:   Mon Jul 15 23:56:58 2019 +0300
254
255     fix indent
256
257 diff --git a/mod-usbkbd.sh b/mod-usbkbd.sh
258 index ff8f442..35543b7 100644
259 --- a/mod-usbkbd.sh
260 +++ b/mod-usbkbd.sh
261 @@ -10,22 +10,22 @@ find_modules_usbkbd() {
262  
263         local modules i module bInterfaceClass bInterfaceProtocol
264  
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)
281  
282 -                                if [ -n "$module" ]; then
283 -                                        verbose "Found USB Keyboard driver: $module"
284 -                                        modules="$modules $module"
285 -                                fi
286 -                        fi
287 -                fi
288 -        done
289 +                               if [ -n "$module" ]; then
290 +                                       verbose "Found USB Keyboard driver: $module"
291 +                                       modules="$modules $module"
292 +                               fi
293 +                       fi
294 +               fi
295 +       done
296  
297         for i in /sys/class/input/input*; do
298                 # standard usb keyboards
299
300 commit 04b32086569a126d5d6f9bd0ad1b0db9f142f50e
301 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
302 Date:   Sun Jul 21 21:04:05 2019 +0200
303
304     Try to detect a need for nvme driver. If you know better method then share with us.
305
306 diff --git a/geninitrd b/geninitrd
307 index b5d405a..05e290a 100755
308 --- a/geninitrd
309 +++ b/geninitrd
310 @@ -673,6 +673,11 @@ find_modules_for_devpath() {
311                 return
312         fi
313  
314 +       if [[ "$devpath" == /dev/nvme* ]]; then
315 +               find_module "nvme"
316 +               return
317 +       fi
318 +
319         if [[ "$devpath" == /dev/bcache* ]]; then
320                 find_modules_bcache "$devpath"
321                 return
322
323 commit 43d2f37d89034a2e409bb4f66cca1a64b12130b8
324 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
325 Date:   Mon Nov 25 20:15:24 2019 +0100
326
327     Accept d/D symbols, too (ffffffff825ca52c D __initramfs_start) as noticed in recent 4.19.85-1 kernel.
328
329 diff --git a/geninitrd b/geninitrd
330 index 05e290a..052f553 100755
331 --- a/geninitrd
332 +++ b/geninitrd
333 @@ -1097,7 +1097,7 @@ sym_exists() {
334                 return 1
335         fi
336  
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
339  }
340  
341  # find best compressor (or forced one) for initrd
342
343 commit b4c7f62cc3963af683b69092fb2f44076d5e3bb3
344 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
345 Date:   Tue Feb 4 22:28:16 2020 +0100
346
347     glibc 2.31 ldd prints 'not a dynamic executable' on stderr, so silence it.
348
349 diff --git a/geninitrd b/geninitrd
350 index 052f553..e9832ef 100755
351 --- a/geninitrd
352 +++ b/geninitrd
353 @@ -551,7 +551,7 @@ inst_exec() {
354                 esac
355  
356  
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")
371
372 commit b6efb8e39496d74852f353e5142d5cb076d7540f
373 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
374 Date:   Thu Feb 6 17:34:03 2020 +0100
375
376     Move /run mount to newroot. Always mount run for easier transition to /run hierarchy later.
377
378 diff --git a/geninitrd b/geninitrd
379 index e9832ef..7f5495f 100755
380 --- a/geninitrd
381 +++ b/geninitrd
382 @@ -288,8 +288,7 @@ umount_all() {
383  
384         if is_yes "$run_mounted"; then
385                 add_linuxrc <<-EOF
386 -               mount --bind /run /newroot/run
387 -               umount /run
388 +               mount -n --move /run /newroot/run
389                 EOF
390                 run_mounted=no
391         fi
392 @@ -1653,6 +1652,7 @@ EOF
393  
394  # mount early
395  mount_tmp
396 +mount_run
397  
398  modules_add_linuxrc $MODULES
399  
400
401 commit 4335c9501bcb9780d486af197354af2ccb1eae89
402 Author: Jan Palus <atler@pld-linux.org>
403 Date:   Thu Nov 12 11:46:39 2020 +0100
404
405     don't try to expand pci devices if pci bus is missing
406
407 diff --git a/functions b/functions
408 index 9015cc3..3a52190 100644
409 --- a/functions
410 +++ b/functions
411 @@ -209,10 +209,12 @@ find_modules_by_class_kmod() {
412                 return
413         fi
414  
415 -       for i in $(grep -li "^0x${req_class}" /sys/devices/pci*/*/class); do
416 -               j=$(dirname $i)
417 -               modaliases="$modaliases $(cat $j/modalias)"
418 -       done
419 +       if ls /sys/devices | grep -q '^pci'; then
420 +               for i in $(grep -li "^0x${req_class}" /sys/devices/pci*/*/class); do
421 +                       j=$(dirname $i)
422 +                       modaliases="$modaliases $(cat $j/modalias)"
423 +               done
424 +       fi
425  
426         if [ -z "$modaliases" ]; then
427                 return
428
429 commit 152a5bf18b37b825a9b6677153aa5af54df94d7b
430 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
431 Date:   Sat Dec 26 01:03:50 2020 +0100
432
433     - swsusp support from mis@pld-linux
434
435 diff --git a/Makefile b/Makefile
436 index 1994b97..a9039b1 100644
437 --- a/Makefile
438 +++ b/Makefile
439 @@ -1,7 +1,7 @@
440  # when making release, make sure you do it as RELEASE document describes
441  NAME           := geninitrd
442  VERSION                := $(shell test -d .git && git describe --tags || echo git)
443 -MODS           := ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
444 +MODS           := ide luks multipath dmraid lvm md blkid udev tuxonice suspend swsusp fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
445  FILES_MODS  := $(MODS:%=mod-%.sh)
446  FILES_ADDON := extract-ikconfig
447  FILES_UDEV  := 01-ignore.rules 59-persistent-storage.rules 61-persistent-storage.rules 11-dm.rules
448 diff --git a/geninitrd b/geninitrd
449 index 7f5495f..ea7d438 100755
450 --- a/geninitrd
451 +++ b/geninitrd
452 @@ -1209,7 +1209,7 @@ if [ ! -f /proc/mounts ]; then
453         warn "/proc filesystem not mounted, may cause wrong results or failure."
454  fi
455  
456 -geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
457 +geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev swsusp tuxonice suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd bcache
458  
459  while [ $# -gt 0 ]; do
460         case $1 in
461 @@ -1245,6 +1245,9 @@ while [ $# -gt 0 ]; do
462         --without-fbcondecor)
463                 FB_CON_DECOR=no
464                 ;;
465 +       --without-swsusp)
466 +               USE_SWSUSP=no
467 +               ;;
468         --with-suspend)
469                 USE_SUSPEND=yes
470                 ;;
471 @@ -1508,6 +1511,10 @@ if is_yes "$USE_SUSPEND"; then
472         find_modules_suspend
473  fi
474  
475 +if is_yes "$USE_SWSUSP"; then
476 +       find_modules_swsusp
477 +fi
478 +
479  find_root "$fstab" || exit
480  verbose "Using $rootdev as device for rootfs"
481  
482 @@ -1703,6 +1710,7 @@ initrd_gen_stop_uvesafb
483  # resume after killing local processes
484  initrd_gen_tuxonice
485  initrd_gen_suspend
486 +initrd_gen_swsusp
487  
488  # clean up env
489  add_linuxrc <<-'EOF'
490 diff --git a/mod-swsusp.sh b/mod-swsusp.sh
491 new file mode 100644
492 index 0000000..d6ade58
493 --- /dev/null
494 +++ b/mod-swsusp.sh
495 @@ -0,0 +1,74 @@
496 +#!/bin/sh
497 +# geninitrd mod: swsusp
498 +#
499 +USE_SWSUSP=${USE_SWSUSP:-yes}
500 +
501 +# resume device
502 +swap_dev=""
503 +
504 +# setup geninitrd module
505 +# @access      public
506 +setup_mod_swsusp() {
507 +       if ! is_yes "$USE_SWSUSP"; then
508 +               return
509 +       fi
510 +
511 +       swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
512 +       if [ -z "$swap_dev" ]; then
513 +           warn "Cannot determine swap device. You may try add specific device to kernel command line"
514 +       else
515 +           verbose "swsusp: will try to resume from swap device $swap_dev"
516 +       fi
517 +}
518 +
519 +# find modules for for swsusp
520 +# @access      public
521 +find_modules_swsusp() {
522 +       swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
523 +
524 +       # save state
525 +       local vgvolumes=$LVM_VGVOLUMES
526 +       find_modules_for_devpath $swap_dev
527 +
528 +       # check for saved state, differenciate between rootfs VG
529 +       if [ "$LVM_VGVOLUMES" != "$vgvolumes" ]; then
530 +               # add swap device to LVM_SUSPENDVG
531 +               LVM_SUSPENDVG="$LVM_SUSPENDVG $LVM_VGVOLUMES"
532 +               LVM_VGVOLUMES=$vgvolumes
533 +               verbose "swap device is on LVM"
534 +       fi
535 +}
536 +
537 +# generate initrd fragment
538 +# @access      public
539 +initrd_gen_swsusp() {
540 +       if ! is_yes "$USE_SWSUSP"; then
541 +               return
542 +       fi
543 +
544 +       verbose "Setting up swsusp..."
545 +
546 +       mkdir -p $DESTDIR${swap_dev%/*}
547 +       inst $swap_dev $swap_dev
548 +
549 +        mount_dev
550 +       mount_sys
551 +        echo "swap_dev=$swap_dev" | add_linuxrc
552 +
553 +       add_linuxrc <<-'EOF'
554 +       resume=no
555 +       for arg in $CMDLINE; do
556 +               if [ "${arg##resume=/dev/}" != "${arg}" ]; then
557 +                       swap_dev=${arg##resume=}
558 +                       resume=yes
559 +               elif [ "${arg##resume=}" != "${arg}" ]; then
560 +                       resume=${arg##resume=}
561 +               fi
562 +       done
563 +
564 +       if [ "$resume" = "yes" ] && [ -n "$swap_dev" ]; then
565 +               echo "Resuming from $swap_dev..."
566 +               echo "$swap_dev" > /sys/power/resume
567 +       fi
568 +       EOF
569 +}
570
571 commit 55248df65f545d53bb1cfb56edcf5a699a45f52f
572 Author: Arkadiusz Miśkiewicz <arekm@maven.pl>
573 Date:   Sat Dec 26 01:04:09 2020 +0100
574
575     Disable swsusp support when swap device not found.
576
577 diff --git a/mod-swsusp.sh b/mod-swsusp.sh
578 index d6ade58..9224536 100644
579 --- a/mod-swsusp.sh
580 +++ b/mod-swsusp.sh
581 @@ -15,7 +15,8 @@ setup_mod_swsusp() {
582  
583         swap_dev="$(awk '/^\/dev\// { print $1 }' /proc/swaps | head -1)"
584         if [ -z "$swap_dev" ]; then
585 -           warn "Cannot determine swap device. You may try add specific device to kernel command line"
586 +           warn "Cannot determine swap device. You may try add specific device to kernel command line. Disabling swsusp support."
587 +           USE_SWSUSP=no
588         else
589             verbose "swsusp: will try to resume from swap device $swap_dev"
590         fi
This page took 0.246111 seconds and 3 git commands to generate.