diff --git a/bin/tar2fs b/bin/tar2fs index 9246a3dd..f8764072 100755 --- a/bin/tar2fs +++ b/bin/tar2fs @@ -205,8 +205,14 @@ fi echo "MODULES_PRELOAD += $INITRD_MODULES $ROOTFSTYPE" >> "$ROOTFS/etc/initrd.mk" echo "FEATURES += qemu" >> "$ROOTFS/etc/initrd.mk" -KERNEL="$(readlink $ROOTFS/boot/vmlinuz | sed 's,vmlinuz-,,')" -chroot "$ROOTFS" make-initrd -k "$KERNEL" +# NB: don't stick BOOTFS here, it has slightly different semantics +pushd $ROOTFS/boot +if [ -s .origver ]; then + read KVER < .origver +fi +[ -n "$KVER" ] || fatal "unable to deduce kernel version" +chroot "$ROOTFS" make-initrd -k "$KVER" +rm -f .origver # ...target device too sed -i "s,$LOOPROOT,$ROOTDEV," "$ROOTFS/etc/fstab" diff --git a/features.in/build-vm/image-scripts.d/07-kernel b/features.in/build-vm/image-scripts.d/07-kernel index e78c52fa..4392c0fc 100755 --- a/features.in/build-vm/image-scripts.d/07-kernel +++ b/features.in/build-vm/image-scripts.d/07-kernel @@ -9,5 +9,12 @@ kver="$(rpm -qa 'kernel-image*' \ | cut -f 2 -d ' ' \ | sed 's/kernel-image-//')" -ln -s vmlinuz-$kver /boot/vmlinuz -ln -s initrd-$kver.img /boot/initrd.img +[ -n "$kver" ] || { echo "** unable to deduce kernel version" >&2; exit 1; } + +cd /boot +echo "$kver" > .origver # for tar2fs + +# NB: e2k kernel builds "image" instead of "vmlinuz" +[ -f vmlinuz-$kver ] && ln -s vmlinuz-$kver vmlinuz ||: +ln -s initrd-$kver.img initrd.img # missing at this stage +: