|
Yu Watanabe |
ee8fc2 |
From d279b185c004fdaf7913778f052ec2ab249cd473 Mon Sep 17 00:00:00 2001
|
|
Yu Watanabe |
ee8fc2 |
From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
|
|
Yu Watanabe |
ee8fc2 |
Date: Sun, 27 Jan 2019 17:32:21 +0100
|
|
Yu Watanabe |
ee8fc2 |
Subject: [PATCH] kernel-install: fix dracut initrd detection (240 backward
|
|
Yu Watanabe |
ee8fc2 |
compatibility) (#11570)
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
* kernel-install: fix initrd when called as installkernel
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
Running make install from the kernel runs e.g.:
|
|
Yu Watanabe |
ee8fc2 |
installkernel 4.20.5 arch/x86/boot/bzImage System.map "/boot"
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
Since 0912c0b80eb24fb9a4e1cc4abf274a1358b9943d this would
|
|
Yu Watanabe |
ee8fc2 |
cal 90-loaderentry.install with those arguments:
|
|
Yu Watanabe |
ee8fc2 |
add 4.20.5 /boot/... arch/x86/boot/bzImage System.map "/boot"
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
The two last arguments would then be handled as the initrd files.
|
|
Yu Watanabe |
ee8fc2 |
As System.map exists in current directory but not in /boot/...
|
|
Yu Watanabe |
ee8fc2 |
it would get copied there, and used as initrd intead of the initrd
|
|
Yu Watanabe |
ee8fc2 |
which has been generated by dracut.
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
With this change, nothing changes when kernel-install is called
|
|
Yu Watanabe |
ee8fc2 |
directly, but when it's called as installkernel, we now pass
|
|
Yu Watanabe |
ee8fc2 |
thos arguments to 90-loaderentry.install:
|
|
Yu Watanabe |
ee8fc2 |
add 4.20.5 /boot/... arch/x86/boot/bzImage initrd
|
|
Yu Watanabe |
ee8fc2 |
initrd is thus detected as the file to use for the initrd, and as it
|
|
Yu Watanabe |
ee8fc2 |
exists, nothing is copied over and the initrd line generated is
|
|
Yu Watanabe |
ee8fc2 |
consistent with what one would expect
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
* kernel-install: fix dracut initrd detection when called directly
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
This brings back the systemd 240 behaviour when called directly too
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
* kernel-install: unify initrd fallback
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
* kernel-install: move initrd fallback handling to 90-loaderentry.install
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
* kernel-install: move initrd fallback just before creating loader entry
|
|
Yu Watanabe |
ee8fc2 |
---
|
|
Yu Watanabe |
ee8fc2 |
src/kernel-install/90-loaderentry.install | 10 ++++++++--
|
|
Yu Watanabe |
ee8fc2 |
src/kernel-install/kernel-install | 6 ++++--
|
|
Yu Watanabe |
ee8fc2 |
2 files changed, 12 insertions(+), 4 deletions(-)
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
|
|
Yu Watanabe |
ee8fc2 |
index e5fb232f35..75dd5a1b7d 100644
|
|
Yu Watanabe |
ee8fc2 |
--- a/src/kernel-install/90-loaderentry.install
|
|
Yu Watanabe |
ee8fc2 |
+++ b/src/kernel-install/90-loaderentry.install
|
|
Yu Watanabe |
ee8fc2 |
@@ -83,7 +83,9 @@ cp "$KERNEL_IMAGE" "$BOOT_DIR_ABS/linux" &&
|
|
Yu Watanabe |
ee8fc2 |
exit 1
|
|
Yu Watanabe |
ee8fc2 |
}
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
-for initrd in "${@:${INITRD_OPTIONS_START}}"; do
|
|
Yu Watanabe |
ee8fc2 |
+INITRD_OPTIONS=( "${@:${INITRD_OPTIONS_START}}" )
|
|
Yu Watanabe |
ee8fc2 |
+
|
|
Yu Watanabe |
ee8fc2 |
+for initrd in "${INITRD_OPTIONS[@]}"; do
|
|
Yu Watanabe |
ee8fc2 |
if [[ -f "${initrd}" ]]; then
|
|
Yu Watanabe |
ee8fc2 |
initrd_basename="$(basename ${initrd})"
|
|
Yu Watanabe |
ee8fc2 |
cp "${initrd}" "$BOOT_DIR_ABS/${initrd_basename}" &&
|
|
Yu Watanabe |
ee8fc2 |
@@ -95,6 +97,10 @@ for initrd in "${@:${INITRD_OPTIONS_START}}"; do
|
|
Yu Watanabe |
ee8fc2 |
fi
|
|
Yu Watanabe |
ee8fc2 |
done
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
+# If no initrd option is supplied, fallback to "initrd" which is
|
|
Yu Watanabe |
ee8fc2 |
+# the name used by dracut when generating it in its kernel-install hook
|
|
Yu Watanabe |
ee8fc2 |
+[[ ${#INITRD_OPTIONS[@]} == 0 ]] && INITRD_OPTIONS=( initrd )
|
|
Yu Watanabe |
ee8fc2 |
+
|
|
Yu Watanabe |
ee8fc2 |
mkdir -p "${LOADER_ENTRY%/*}" || {
|
|
Yu Watanabe |
ee8fc2 |
echo "Could not create loader entry directory '${LOADER_ENTRY%/*}'." >&2
|
|
Yu Watanabe |
ee8fc2 |
exit 1
|
|
Yu Watanabe |
ee8fc2 |
@@ -106,7 +112,7 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
|
|
Yu Watanabe |
ee8fc2 |
echo "machine-id $MACHINE_ID"
|
|
Yu Watanabe |
ee8fc2 |
echo "options ${BOOT_OPTIONS[*]}"
|
|
Yu Watanabe |
ee8fc2 |
echo "linux $BOOT_DIR/linux"
|
|
Yu Watanabe |
ee8fc2 |
- for initrd in "${@:${INITRD_OPTIONS_START}}"; do
|
|
Yu Watanabe |
ee8fc2 |
+ for initrd in "${INITRD_OPTIONS[@]}"; do
|
|
Yu Watanabe |
ee8fc2 |
[[ -f $BOOT_DIR_ABS/$(basename ${initrd}) ]] && \
|
|
Yu Watanabe |
ee8fc2 |
echo "initrd $BOOT_DIR/$(basename ${initrd})"
|
|
Yu Watanabe |
ee8fc2 |
done
|
|
Yu Watanabe |
ee8fc2 |
diff --git a/src/kernel-install/kernel-install b/src/kernel-install/kernel-install
|
|
Yu Watanabe |
ee8fc2 |
index 7973818bca..b85c7c557e 100644
|
|
Yu Watanabe |
ee8fc2 |
--- a/src/kernel-install/kernel-install
|
|
Yu Watanabe |
ee8fc2 |
+++ b/src/kernel-install/kernel-install
|
|
Yu Watanabe |
ee8fc2 |
@@ -65,14 +65,16 @@ done
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
if [[ "${0##*/}" == 'installkernel' ]]; then
|
|
Yu Watanabe |
ee8fc2 |
COMMAND='add'
|
|
Yu Watanabe |
ee8fc2 |
+ # make install doesn't pass any parameter wrt initrd handling
|
|
Yu Watanabe |
ee8fc2 |
+ INITRD_OPTIONS=()
|
|
Yu Watanabe |
ee8fc2 |
else
|
|
Yu Watanabe |
ee8fc2 |
COMMAND="$1"
|
|
Yu Watanabe |
ee8fc2 |
shift
|
|
Yu Watanabe |
ee8fc2 |
+ INITRD_OPTIONS=( "${@:3}" )
|
|
Yu Watanabe |
ee8fc2 |
fi
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
KERNEL_VERSION="$1"
|
|
Yu Watanabe |
ee8fc2 |
KERNEL_IMAGE="$2"
|
|
Yu Watanabe |
ee8fc2 |
-INITRD_OPTIONS_START="3"
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
if [[ -f /etc/machine-id ]]; then
|
|
Yu Watanabe |
ee8fc2 |
read MACHINE_ID < /etc/machine-id
|
|
Yu Watanabe |
ee8fc2 |
@@ -124,7 +126,7 @@ case $COMMAND in
|
|
Yu Watanabe |
ee8fc2 |
|
|
Yu Watanabe |
ee8fc2 |
for f in "${PLUGINS[@]}"; do
|
|
Yu Watanabe |
ee8fc2 |
if [[ -x $f ]]; then
|
|
Yu Watanabe |
ee8fc2 |
- "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE" "${@:${INITRD_OPTIONS_START}}"
|
|
Yu Watanabe |
ee8fc2 |
+ "$f" add "$KERNEL_VERSION" "$BOOT_DIR_ABS" "$KERNEL_IMAGE" "${INITRD_OPTIONS[@]}"
|
|
Yu Watanabe |
ee8fc2 |
x=$?
|
|
Yu Watanabe |
ee8fc2 |
if [[ $x == $SKIP_REMAINING ]]; then
|
|
Yu Watanabe |
ee8fc2 |
ret=0
|
|
Yu Watanabe |
ee8fc2 |
--
|
|
Yu Watanabe |
ee8fc2 |
2.20.1
|
|
Yu Watanabe |
ee8fc2 |
|