grubby/0008-Add-devtree-support-to-extlinux-1088933.patch
Peter Jones ee984748a5 Don't create "debug" entries yet.
This apparently interacts poorly with grub2-mkconfig's title generation
and causes weird errors, so it's not ready yet.

This commit also fixes some quoting errors in the dtbdir n-k-p code.

Resolves: rhbz#1153410
Resolves: rhbz#1088933

Signed-off-by: Peter Jones <pjones@redhat.com>
2014-10-17 18:56:25 -04:00

156 lines
5.7 KiB
Diff

From eb141563832f803abdfc1fde83fbfcc9031794b3 Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
Date: Fri, 10 Oct 2014 02:06:52 -0500
Subject: [PATCH 08/10] Add --devtree support to extlinux (#1088933)
On 32 bit arm it needs the path to the dtb. This adds support for the
fdt command to the extlinux handling. If --devtree /path/to/dtb/file.dtb
is passed grubby will add or updated it.
---
grubby.c | 1 +
new-kernel-pkg | 20 ++++++++++++++++++--
test.sh | 5 +++++
test/extlinux.5 | 21 +++++++++++++++++++++
test/results/add/extlinux5.1 | 21 +++++++++++++++++++++
5 files changed, 66 insertions(+), 2 deletions(-)
create mode 100644 test/extlinux.5
create mode 100644 test/results/add/extlinux5.1
diff --git a/grubby.c b/grubby.c
index b202b6e..cbb1cca 100644
--- a/grubby.c
+++ b/grubby.c
@@ -581,6 +581,7 @@ struct keywordTypes extlinuxKeywords[] = {
{ "initrd", LT_INITRD, ' ', ',' },
{ "append", LT_KERNELARGS, ' ' },
{ "prompt", LT_UNKNOWN, ' ' },
+ { "fdt", LT_DEVTREE, ' ' },
{ NULL, 0, 0 },
};
int useextlinuxmenu;
diff --git a/new-kernel-pkg b/new-kernel-pkg
index d9a9b67..0f21e39 100755
--- a/new-kernel-pkg
+++ b/new-kernel-pkg
@@ -265,7 +265,7 @@ install() {
$grubby --extlinux -c $extlinuxConfig \
--add-kernel=$kernelImage \
- $INITRD --copy-default $makedefault --title "$title" \
+ $DEVTREE $INITRD --copy-default $makedefault --title "$title" \
${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \
--args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title"
else
@@ -411,6 +411,12 @@ update() {
fi
fi
+ DEVTREE=""
+ if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then
+ [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby"
+ DEVTREE="--devtree $devtreefile"
+ fi
+
if [ -n "$cfgGrub" ]; then
[ -n "$verbose" ] && echo "updating $version from $grubConfig"
$grubby --grub -c $grubConfig \
@@ -499,7 +505,7 @@ update() {
[ -n "$verbose" ] && echo "updating $version from $extlinuxConfig"
$grubby --extlinux -c $extlinuxConfig \
--update-kernel=$kernelImage \
- $INITRD \
+ $DEVTREE $INITRD \
${kernargs:+--args="$kernargs"} \
${removeargs:+--remove-args="$removeargs"}
else
@@ -724,6 +730,16 @@ if [ -z "$initrdfile" ]; then
fi
[ -n "$verbose" ] && echo "initrdfile is $initrdfile"
+if [[ ${ARCH} =~ armv[5|7].*l ]]; then
+ if [ -d "$bootPrefix/dtb-$version/" ]; then
+ devtreedir="$bootPrefix/dtb-$version/"
+ if [ -n "$dtbfile" -a -f "$devtreedir/$dtbfile" ]; then
+ devtreefile="$devtreedir/$dtbfile"
+ fi
+ fi
+fi
+[ -n "$verbose" ] && echo "devtreedir is $devtreedir"
+
# add dracut i18n, keyboard and plymouth kernel args if requested
if [ -n "$dracut" -o -n "$adddracutargs" ]; then
if [ -r /etc/vconsole.conf ]; then
diff --git a/test.sh b/test.sh
index 864a8ce..67b932d 100755
--- a/test.sh
+++ b/test.sh
@@ -647,6 +647,11 @@ extlinuxTest extlinux.2 add/extlinux2.1 --add-kernel=/boot/vmlinuz-3.12.0-2.fc21
--initrd=/boot/initrd-3.12.0-2.fc21.i686-new.img --boot-filesystem=/boot --copy-default \
--title="Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)" \
--remove-kernel="TITLE=Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)"
+extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \
+ --devtree='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb' \
+ --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \
+ --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \
+ --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)"
testing="LILO long titles"
liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \
diff --git a/test/extlinux.5 b/test/extlinux.5
new file mode 100644
index 0000000..30e7572
--- /dev/null
+++ b/test/extlinux.5
@@ -0,0 +1,21 @@
+ui menu.c32
+
+menu hidden
+timeout 50
+totaltimeout 9000
+
+prompt 10
+default Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
+
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
+
+label Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)
+kernel /vmlinuz-3.12.0-0.fc21.armv7hl
+fdt /dtb-3.12.0-0.fc21.armv7hl/imx6q-cubox-i.dtb
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
+initrd /initramfs-3.12.0-0.fc21.armv7hl.img
+
diff --git a/test/results/add/extlinux5.1 b/test/results/add/extlinux5.1
new file mode 100644
index 0000000..5e97883
--- /dev/null
+++ b/test/results/add/extlinux5.1
@@ -0,0 +1,21 @@
+ui menu.c32
+
+menu hidden
+timeout 50
+totaltimeout 9000
+
+prompt 10
+default Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
+
+label Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)
+kernel /vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl
+fdt /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
+initrd /initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img
+
+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide)
+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl
+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb
+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8
+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img
+
--
1.9.3