kernel, stage2: rearranged initrd hooks

stage2 has been thinking it's synonymous with propagator
and used to usurp kernel's belongings either; carefully
tear scripts apart so that kernel feature makes sure
initrd gets generated, and stage2 (which is still all
about propagator) cares for its bits.
This commit is contained in:
Michael Shigorin 2014-09-18 18:38:30 +04:00
parent 730e791fec
commit 8faf140777
5 changed files with 35 additions and 19 deletions

View File

@ -27,7 +27,7 @@ ALT Linux 6.0+ и GNU make 3.81+ (на которых и разрабатыва
E: Couldn't find package E: Couldn't find package
* features.in/stage2/stage1/scripts.d/02-kdefault * features.in/kernel/stage1/scripts.d/80-make-initrd
* features.in/stage2/stage1/scripts.d/03-test-kernel * features.in/stage2/stage1/scripts.d/03-test-kernel
* sub.in/stage1/Makefile * sub.in/stage1/Makefile
** ожидают, что в stage1 попадёт строго одно ядро сообразно ** ожидают, что в stage1 попадёт строго одно ядро сообразно

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
# prepare base make-initrd configuration for stage1 # prepare base make-initrd configuration for stage1
# see also http://www.altlinux.org/Make-initrd-propagator
MAKE_INITRD_VER="`make-initrd -V \ MAKE_INITRD_VER="`make-initrd -V \
| sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`" | sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`"
@ -10,8 +9,3 @@ if [ "`rpmvercmp "$MAKE_INITRD_VER" "0.8.1"`" != "-1" ]; then
else else
sed -i 's/AUTODETECT/#&/' /etc/initrd.mk # see also #28578 sed -i 's/AUTODETECT/#&/' /etc/initrd.mk # see also #28578
fi fi
echo 'FEATURES += propagator' >> /etc/initrd.mk
# FIXME: #29705 workaround
echo 'MODULES_PRELOAD += ahci' >> /etc/initrd.mk

View File

@ -1,7 +1,7 @@
#!/bin/sh -efux #!/bin/sh -efux
# NB: /etc/initrd.mk carefully prepared by earlier scripts # NB: /etc/initrd.mk carefully prepared by earlier scripts
verbose() { [ -z "$GLOBAL_VERBOSE" ] || echo "** 80-make-initfs: $@" >&2; } fatal() { echo "** error: $@" >&1; exit 1; }
kver="$(rpm -qa 'kernel-image*' \ kver="$(rpm -qa 'kernel-image*' \
--qf '%{installtime} %{version}-%{name}-%{release}\n' \ --qf '%{installtime} %{version}-%{name}-%{release}\n' \
@ -10,6 +10,9 @@ kver="$(rpm -qa 'kernel-image*' \
| cut -f 2 -d ' ' \ | cut -f 2 -d ' ' \
| sed 's/kernel-image-//')" | sed 's/kernel-image-//')"
[ -n "$kver" ] ||
fatal "no kernel version identified"
MAKE_INITRD_OPTS="--no-checks -k $kver" MAKE_INITRD_OPTS="--no-checks -k $kver"
MAKE_INITRD_VER="`make-initrd -V \ MAKE_INITRD_VER="`make-initrd -V \
| sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`" | sed -rn 's/^make-initrd version ([0-9.]+)/\1/p'`"
@ -19,17 +22,16 @@ if [ "`rpmvercmp "$MAKE_INITRD_VER" "0.7.8"`" != "-1" ]; then
MAKE_INITRD_OPTS="$MAKE_INITRD_OPTS --no-depmod" MAKE_INITRD_OPTS="$MAKE_INITRD_OPTS --no-depmod"
fi fi
[ -z "$GLOBAL_VERBOSE" ] || MAKE_INITRD_OPTS="$MAKE_INITRD_OPTS -v" [ -z "$GLOBAL_VERBOSE" ] ||
MAKE_INITRD_OPTS="$MAKE_INITRD_OPTS -v"
if make-initrd $MAKE_INITRD_OPTS; then make-initrd $MAKE_INITRD_OPTS ||
pdir="$(getconf LIBDIR)/propagator" fatal "make-initrd failed"
mkdir -p "$pdir"
gzip < /boot/initrd-$kver.img > "$pdir"/initfs [ -h /boot/vmlinuz ] ||
else ln -s vmlinuz-$kver /boot/vmlinuz
verbose "make-initrd failed"
exit 1 [ -h /boot/initrd.img ] ||
fi ln -s initrd-$kver.img /boot/initrd.img
[ -h /boot/vmlinuz ] || ln -s vmlinuz-$kver /boot/vmlinuz
[ -h /boot/initrd.img ] || ln -s initrd-$kver.img /boot/initrd.img
: :

View File

@ -0,0 +1,7 @@
#!/bin/sh
# see also http://www.altlinux.org/Make-initrd-propagator
echo 'FEATURES += propagator' >> /etc/initrd.mk
# FIXME: #29705 workaround
echo 'MODULES_PRELOAD += ahci' >> /etc/initrd.mk

View File

@ -0,0 +1,13 @@
#!/bin/sh -efu
# NB: initrd.mk carefully built by an earlier script
verbose() { [ -z "$GLOBAL_VERBOSE" ] || echo "** 81-make-initfs: $@" >&2; }
if [ -h /boot/initrd.img ]; then
pdir="$(getconf LIBDIR)/propagator"
mkdir -p "$pdir"
gzip < /boot/initrd.img > "$pdir"/initfs
else
verbose "/boot/initrd.img missing"
exit 1
fi