create initrd.img with propagator instead full.cz

With this change, we simplify the created initrd image. Kernel
modules and firmware are added by make-Initrd itself. The layer
in Initrd is now one. It also allows you to unifyed configs for
bootloading with propagator and bootchain.
Config files for refind and elilo is creates in mkimage, so have
to copy initrd.img in efi/boot/ with the name full.cz.
This commit is contained in:
Anton Midyukov 2022-02-13 21:02:08 +07:00
parent 7fb148ee95
commit 71e209e201
7 changed files with 23 additions and 82 deletions

View File

@ -39,13 +39,13 @@ label=$label
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live automatic=method:cdrom ${stage2:+$stage2 }${GLOBAL_STAGE2_BOOTARGS:+$GLOBAL_STAGE2_BOOTARGS }${GLOBAL_BOOT_LANG:+lang=$GLOBAL_BOOT_LANG}
initrd=/boot/full.cz
initrd=/boot/initrd.img
label=${label}_flash
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live lowmem automatic=method:disk,label:altinst,directory:/ ${stage2:+$stage2 }${GLOBAL_STAGE2_BOOTARGS:+$GLOBAL_STAGE2_BOOTARGS }${GLOBAL_BOOT_LANG:+lang=$GLOBAL_BOOT_LANG}
initrd=/boot/full.cz
initrd=/boot/initrd.img
EOF
done

View File

@ -106,13 +106,8 @@ bootargs: clean
GRUBTHEME=$(GRUBTHEME); \
[ -n "$$GRUBTHEME" ] || GRUBTHEME=$$(cut -d "-" -f2 <<< $(BRANDING)); \
sed -i "s,@grubtheme@,$$GRUBTHEME,g" $(DSTCFGS)
@if [ "$(STAGE1_INITRD)" = initrd-propagator ]; then \
sed -i "s,@initrd@,full," $(DSTCFGS); \
sed -i "s,@initrd_ext@,cz," $(DSTCFGS); \
else \
sed -i "s,@initrd@,initrd," $(DSTCFGS); \
sed -i "s,@initrd_ext@,img," $(DSTCFGS); \
fi
@sed -i "s,@initrd@,initrd," $(DSTCFGS)
@sed -i "s,@initrd_ext@,img," $(DSTCFGS)
@sed -i "s|@initrd_bootargs@|$(STAGE1_INITRD_BOOTARGS)|g" $(DSTCFGS)
@sed -i "s|@initrd_bootmethod@|$(STAGE1_INITRD_BOOTMETHOD)|g" $(DSTCFGS)
@sed -i "s|@initrd_typeargs@|$(STAGE1_INITRD_TYPEARGS)|g" $(DSTCFGS)

View File

@ -14,12 +14,24 @@ done
[ -n "$kver" ] ||
fatal "no kernel version identified"
[ -s /.in/modules ] ||
fatal "kernel modules set not found"
cat >> /etc/initrd.mk <<EOF
FEATURES += add-modules compress cleanup
EOF
for module in $(grep -v ^# /.in/modules | sort -u | tr -s '\n' ' '); do
echo "MODULES_TRY_ADD += $module" >> /etc/initrd.mk
done
# FIXME: large storage systems can get that tmpfs filled up
# with debug data as of make-initrd 2.2.12
rm -vf /usr/share/make-initrd/data/etc/udev/rules.d/00-debug.rules \
/usr/share/make-initrd/data/lib/uevent/filters/debug
MAKE_INITRD_OPTS="--no-checks --no-depmod AUTODETECT= "
MAKE_INITRD_OPTS="--no-checks AUTODETECT= "
MAKE_INITRD_VER="`make-initrd -V \
| sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`"

View File

@ -1,29 +0,0 @@
#!/bin/sh -efu
# NB: initrd.mk carefully built by an earlier script
verbose() { [ -z "$GLOBAL_VERBOSE" ] || echo "** 81-make-initfs: $@" >&2; }
initrd="$(find /boot -type f -name 'initrd*.img' -print)"
if [ -n "$initrd" ]; then
pdir="$(getconf LIBDIR)/propagator"
mkdir -p "$pdir"
for INITRD in $initrd; do
KVER=${INITRD#*-}
KVER=${KVER%.*}
gzip < "$INITRD" > "$pdir"/initfs-"$KVER"
done
else
verbose '/boot/initrd*.img missing'
exit 1
fi
if [ -h /boot/initrd.img ]; then
KVER=$(readlink -ev /boot/initrd.img)
KVER=${INITRD#*-}
KVER=${KVER%.*}
cp "$pdir"/initfs-$KVER "$pdir"/initfs
else
verbose "/boot/initrd.img missing"
cp "$pdir"/initfs-"$KVER" "$pdir"/initfs
exit 1
fi

View File

@ -1,25 +0,0 @@
#!/bin/sh -efu
libdir="$(getconf LIBDIR)"
case "`arch`" in
e2k)
kname=image
;;
*)
kname=vmlinuz
;;
esac
kimage="$(find /boot -type f -name "$kname-*")"
# cleanup old propagator
old_propagator="$(find /boot -type f -name "full*.cz")"
[ -z "$old_propagator" ] || rm $old_propagator
for kver in $kimage; do
kver="${kver#/boot/$kname-}"
mkmodpack -p /.in/modules -o /tmp/modules-"$kver" -k "$kver"
cat "$libdir/propagator/initfs" /tmp/modules-"$kver" > /boot/full-"$kver".cz
done

View File

@ -18,26 +18,18 @@ if [ -L "/boot/$kname" ]; then
fi
kimage="$(find /boot -type f -name "$kname-*")"
propagator="$(find /boot -type f -name 'full-*.cz')"
[ -n "$propagator" ] ||
initrd="$(find /boot -type f -name 'initrd-*.img')"
initrd="$(find /boot -type f -name 'initrd-*.img')"
cp $verbose -af $kimage boot/
mv boot/$kname-$kverdef boot/$kname
if [ -n "$propagator" ]; then
cp $verbose -af $propagator boot/
mv boot/full-$kverdef.cz boot/full.cz
else
cp $verbose -af $initrd boot/
mv boot/initrd-$kverdef.img boot/initrd.img
fi
cp $verbose -af $initrd boot/
mv boot/initrd-$kverdef.img boot/initrd.img
# config is generated in mkimage
case "$GLOBAL_EFI_BOOTLOADER" in
refind|elilo)
mkdir -p EFI/BOOT
cp -lpLft EFI/BOOT -- boot/vmlinuz
[ ! -f boot/full.cz ] ||
cp -lpLft EFI/BOOT -- boot/full.cz
cp -lpLf boot/vmlinuz EFI/BOOT/
cp -lpLf boot/initrd.img EFI/BOOT/full.cz
;;
esac

View File

@ -92,11 +92,7 @@ bootargs: clean
sed -i "s,@bootvga@,$(BOOTVGA)," $(DSTCFGS); \
fi; \
sed -i "s,@bootvga@,,;s,vga= ,," $(DSTCFGS)
@if [ "$(STAGE1_INITRD)" = initrd-propagator ]; then \
sed -i "s,@initrd@,full.cz," $(DSTCFGS); \
else \
sed -i "s,@initrd@,initrd.img," $(DSTCFGS); \
fi
@sed -i "s,@initrd@,initrd.img," $(DSTCFGS)
@sed -i "s|@initrd_bootargs@|$(STAGE1_INITRD_BOOTARGS)|g" $(DSTCFGS)
@sed -i "s|@initrd_bootmethod@|$(STAGE1_INITRD_BOOTMETHOD)|g" $(DSTCFGS)
@sed -i "s|@initrd_typeargs@|$(STAGE1_INITRD_TYPEARGS)|g" $(DSTCFGS)