From 1ea4401882f2863ae5c5313c3b28645c60fc93b3 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Fri, 10 Oct 2014 01:38:27 -0500 Subject: [PATCH 2/3] add support for devicetree directories for use on arm --- grubby.c | 3 +++ new-kernel-pkg | 31 ++++++++++++++++++++++++++----- test.sh | 5 +++++ test/extlinux.6 | 21 +++++++++++++++++++++ test/results/add/extlinux6.1 | 21 +++++++++++++++++++++ 5 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 test/extlinux.6 create mode 100644 test/results/add/extlinux6.1 diff --git a/grubby.c b/grubby.c index bbe54b6..8a8df98 100644 --- a/grubby.c +++ b/grubby.c @@ -582,6 +582,7 @@ struct keywordTypes extlinuxKeywords[] = { { "append", LT_KERNELARGS, ' ' }, { "prompt", LT_UNKNOWN, ' ' }, { "fdt", LT_DEVTREE, ' ' }, + { "fdtdir", LT_DEVTREE, ' ' }, { NULL, 0, 0 }, }; int useextlinuxmenu; @@ -4269,6 +4270,8 @@ int main(int argc, const char ** argv) { _("display the title of the default kernel") }, { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0, _("device tree file for new stanza"), _("dtb-path") }, + { "devtreedir", 0, POPT_ARG_STRING, &newDevTreePath, 0, + _("device tree directory for new stanza"), _("dtb-path") }, { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0, _("configure elilo bootloader") }, { "efi", 0, POPT_ARG_NONE, &isEfi, 0, diff --git a/new-kernel-pkg b/new-kernel-pkg index 9784f2b..8d55abf 100755 --- a/new-kernel-pkg +++ b/new-kernel-pkg @@ -131,7 +131,7 @@ usage() { echo " [--banner=] [--multiboot=multiboot]" >&2 echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 echo " [--add-plymouth-initrd]" >&2 - echo " [--host-only] [--devtree=]" >&2 + echo " [--host-only] [--devtree=] [--devtreedir=]" >&2 echo " <--install | --remove | --update | --rpmposttrans> " >&2 echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2 exit 1 @@ -191,11 +191,17 @@ install() { fi DEVTREE="" - if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then + if [ -n $devtreefile -a -f "$devtreefile" ]; then [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" DEVTREE="--devtree $devtreefile" fi + DEVTREEDIR="" + if [ -n $devtreedir -a -d "$devtreedir" ]; then + [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby" + DEVTREEDIR="--devtreedir $devtreedir" + fi + # FIXME: is this a good heuristic to find out if we're on iSeries? if [ -d /proc/iSeries ]; then [ -n "$verbose" ] && echo "On an iSeries, just making img file" @@ -297,7 +303,7 @@ install() { [ -n "$verbose" ] && echo "adding $version to $extlinuxConfig" ARGS="--extlinux -c $extlinuxConfig --add-kernel=$kernelImage \ - $DEVTREE $INITRD --copy-default --title \"$title\$debugtitle\" \ + $DEVTREE $DEVTREEDIR $INITRD --copy-default --title \"$title\$debugtitle\" \ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ${mbargs:+--mbargs=\"$mbargs\"} \ --args=\"root=$rootdevice $kernargs \$debugargs\" \ @@ -451,11 +457,17 @@ update() { fi DEVTREE="" - if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then + if [ -n $devtreefile -a -f "$devtreefile" ]; then [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" DEVTREE="--devtree $devtreefile" fi + DEVTREEDIR="" + if [ -n $devtreedir -a -d "$devtreedir" ]; then + [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby" + DEVTREEDIR="--devtreedir $devtreedir" + fi + if [ -n "$cfgGrub" ]; then [ -n "$verbose" ] && echo "updating $version from $grubConfig" ARGS="--grub -c $grubConfig --update-kernel=$kernelImage $INITRD \ @@ -551,7 +563,7 @@ update() { if [ -n "$cfgExtlinux" ]; then [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \ - $DEVTREE $INITRD ${kernargs:+--args=\"$kernargs\"} \ + $DEVTREE $DEVTREEDIR $INITRD ${kernargs:+--args=\"$kernargs\"} \ ${removeargs:+--remove-args=\"$removeargs\"} \ --title=\"$title\$debugtitle\"" @@ -615,6 +627,15 @@ while [ $# -gt 0 ]; do fi ;; + --devtreedir*) + if [[ $1 == --devtreedir\=* ]]; then + devtreedir=${1#--devtreedir=} + else + devtreedir=$2 + shift + fi + ;; + --dracut) dracut=--dracut ;; diff --git a/test.sh b/test.sh index 67b932d..fe574c3 100755 --- a/test.sh +++ b/test.sh @@ -652,6 +652,11 @@ extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1. --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)" +extlinuxTest extlinux.6 add/extlinux6.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \ + --devtreedir='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/' \ + --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.6 b/test/extlinux.6 new file mode 100644 index 0000000..c28a4a8 --- /dev/null +++ b/test/extlinux.6 @@ -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 +fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/ +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 +fdtdir /dtb-3.12.0-0.fc21.armv7hl/ +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/extlinux6.1 b/test/results/add/extlinux6.1 new file mode 100644 index 0000000..ec2a2ea --- /dev/null +++ b/test/results/add/extlinux6.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 +fdtdir /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/ +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 +fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/ +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 + -- 2.1.0