build-vm, tar2fs: unify kver handling
No need to deduce kernel version again, just save it in a temporary file. The main reason to change what worked is that e2k kernel-image package has Linux bits named as image-$kver and not vmlinuz-$kver; the guessing logic taking all of this into account resulted in non-aesthetic patch. NB: there's a duplicating script within kernel feature; it wasn't easy to avoid this and it might differ when handling multiple kernels, I didn't think much about this now as vm images tend to ship with the sole one.
This commit is contained in:
parent
f58f10d1e1
commit
3d7a0c5c39
10
bin/tar2fs
10
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"
|
||||
|
@ -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
|
||||
:
|
||||
|
Loading…
Reference in New Issue
Block a user