[PATCH] build-vm, kernel, uboot: return possibility of changing boot sequence of kernels
Anton Midyukov
antohami at altlinux.org
Sat Nov 9 16:44:03 MSK 2019
Since packet sorting is enabled by default, then
the order in KFLAVORS has ceased to matter.
Kernels are always installed in alphabetical order.
Therefore, it makes no sense to sort by buildtime.
See-also: https://bugzilla.altlinux.org/show_bug.cgi?id=30806
Also fixed my typo. When creating a symlink, the variable
$kver was used, i.e. the entire list of kernels, not the
last value $KVER of the list.
---
.../build-vm/image-scripts.d/07-kernel | 23 ++++++++++++-------
features.in/kernel/config.mk | 1 +
.../image-scripts.d/90-uboot-config-install | 17 +++++++++-----
3 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/features.in/build-vm/image-scripts.d/07-kernel b/features.in/build-vm/image-scripts.d/07-kernel
index e496a735d9..fd4280825d 100755
--- a/features.in/build-vm/image-scripts.d/07-kernel
+++ b/features.in/build-vm/image-scripts.d/07-kernel
@@ -2,13 +2,20 @@
# predictable file locations make bootloader configuration simple;
# this script relates to features.in/stage2/stage1/scripts.d/81-make-initfs
-kver="$(rpm -qa 'kernel-image*' \
- --qf '%{installtime} %{version}-%{name}-%{release}\n' \
- | sort -n \
- | cut -f 2 -d ' ' \
- | sed 's/kernel-image-//')"
+[ -n "$GLOBAL_KFLAVOURS" ] ||
+ { echo "** KFLAVOURS is empty" >&2; exit 0; }
-[ -n "$kver" ] || { echo "** unable to deduce kernel version" >&2; exit 1; }
+kver=
+echo $GLOBAL_KFLAVOURS
+for KFLAVOUR in $GLOBAL_KFLAVOURS; do
+ kver+=" $(rpm -qa 'kernel-image*' \
+ --qf '%{version}-%{name}-%{release}\n' \
+ | grep "$KFLAVOUR" \
+ | sed 's/kernel-image-//')"
+done
+
+[ ! -z "${kver#"${kver%%[! ]*}"}" ] ||
+ { echo "** unable to deduce kernel version" >&2; exit 1; }
cd /boot
@@ -20,6 +27,6 @@ for KVER in $kver; do
done
# 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
+[ -f vmlinuz-$KVER ] && ln -s vmlinuz-$KVER vmlinuz ||:
+ln -s initrd-$KVER.img initrd.img # missing at this stage
:
diff --git a/features.in/kernel/config.mk b/features.in/kernel/config.mk
index 3a00a2d469..c8caff06c0 100644
--- a/features.in/kernel/config.mk
+++ b/features.in/kernel/config.mk
@@ -20,6 +20,7 @@ else
endif
endif
endif
+ @$(call xport,KFLAVOURS)
# r8168 is a kludge, never install it by default
use/kernel/net:
diff --git a/features.in/uboot/image-scripts.d/90-uboot-config-install b/features.in/uboot/image-scripts.d/90-uboot-config-install
index b52d33d861..5dab7d1628 100755
--- a/features.in/uboot/image-scripts.d/90-uboot-config-install
+++ b/features.in/uboot/image-scripts.d/90-uboot-config-install
@@ -1,12 +1,17 @@
#!/bin/sh -x
-kver="$(rpm -qa 'kernel-image*' \
- --qf '%{installtime} %{version}-%{name}-%{release}\n' \
- | sort -n \
- | cut -f 2 -d ' ' \
- | sed 's/kernel-image-//')"
+[ -n "$GLOBAL_KFLAVOURS" ] ||
+ { echo "** KFLAVOURS is empty" >&2; exit 0; }
-[ -n "$kver" ] || { echo "** unable to deduce kernel version" >&2; exit 1; }
+kver=
+for KFLAVOUR in $GLOBAL_KFLAVOURS; do
+ kver+=" $(rpm -qa 'kernel-image*' \
+ --qf '%{version}-%{name}-%{release}\n' \
+ | grep "$KFLAVOUR" \
+ | sed 's/kernel-image-//')"
+done
+[ ! -z "${kver#"${kver%%[! ]*}"}" ] ||
+ { echo "** unable to deduce kernel version" >&2; exit 1; }
for KVER in $kver; do
/sbin/installkernel --uboot --keep-initrd "$KVER"
--
2.21.0
--------------B08AB44778962AF0185BDE66--
More information about the devel-distro
mailing list