Merge remote-tracking branch 'up/master' into master-riscv64

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
This commit is contained in:
David Abdurachmanov 2019-10-30 14:52:49 +02:00
commit 073986d8fc
Signed by: davidlt
GPG Key ID: 8B7F1DA0E2C9FDBB
3 changed files with 16 additions and 256 deletions

View File

@ -1,242 +0,0 @@
From 1172e7b953f3682cf7b75beeab805d7538c66827 Mon Sep 17 00:00:00 2001
From: Your Name <you@example.com>
Date: Wed, 3 Apr 2019 19:00:57 +0000
Subject: [PATCH] riscv uboot
---
new-kernel-pkg | 76 +++++++++++++++++++++++---------------------------
uboot | 39 ++++++++++----------------
2 files changed, 50 insertions(+), 65 deletions(-)
diff --git a/new-kernel-pkg b/new-kernel-pkg
index b634388..245b5e3 100755
--- a/new-kernel-pkg
+++ b/new-kernel-pkg
@@ -50,7 +50,6 @@ grubConfig=""
grub2Config=""
grub2EfiConfig=""
extlinuxConfig=""
-ubootScript="/boot/boot.scr"
ARCH=$(uname -m)
@@ -84,14 +83,27 @@ elif [[ ${ARCH} =~ armv[5|7].*l ]] ; then
liloConfig=""
bootPrefix=/boot
extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null)
+ mounted=""
+ liloFlag=""
+ isx86=""
+elif [ $ARCH = 'riscv64' ]; then
+ # RISCV 64-bit (RV64GC, riscv64)
+ liloConfig=""
+ bootPrefix=/boot
+ # /etc/extlinux.conf installed by extlinux-bootloader RPM
+ extlinuxConfig=$(readlink -f /etc/extlinux.conf 2>/dev/null)
ubootDir=${UBOOT_DIR:-"/boot"}
- ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"}
ubootKList=${UBOOT_KLIST:-"klist.txt"}
- ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"}
+ # Default names are expected by appliance-tools appliance-creator
+ # tool to generate initial /boot/extlinux/extlinux.cfg
ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"}
ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"}
- ubootAddress=${UBOOT_IMGADDR:-"0x00008000"}
- mounted=""
+ ubootImageCompression=${UBOOT_UIMAGE_COMPRESSION:-"gzip"}
+ ubootInitrdCompression=${UBOOT_UINITRD_COMPRESSION:-"gzip"}
+ # Kernel load address used by QEMU virt machine and
+ # SiFive HiFive Unleashed (SOC: SiFive Freedom U540)
+ ubootAddress=${UBOOT_IMGADDR:-"0x80200000"}
+ ubootArch=riscv
liloFlag=""
isx86=""
else
@@ -299,6 +311,10 @@ install() {
fi
if [ -n "$cfgExtlinux" ]; then
+ if [ -n "$cfguBoot" ]; then
+ kernelImage=$ubootDir/uImage-$version
+ INITRD=$(echo $INITRD | sed "s|$initrdfile|$ubootDir/uInitrd-$version|")
+ fi
[ -n "$verbose" ] && echo "adding $version to $extlinuxConfig"
ARGS="--extlinux -c $extlinuxConfig --add-kernel=$kernelImage \
@@ -417,7 +433,6 @@ remove() {
fi
mv $tmpKList $ubootDir/$ubootKList
- [ -x /sbin/a-b-c ] && /sbin/a-b-c
else
[ -n "$verbose" ] && echo "uImage $newversion does not exist!"
[ -f $tmpKList ] && rm -f $tmpKList
@@ -426,10 +441,13 @@ remove() {
[ -n "$verbose" ] && echo "No previous kernel version. U-Boot images not removed!"
fi
else
- [ -n "$verbose" ] && echo "$ubootScript does not exist, not modifying $ubootDir"
+ [ -n "$verbose" ] && echo "U-Boot is not enabled, not modifying $ubootDir"
fi
if [ -n "$cfgExtlinux" ]; then
+ if [ -n "$cfguBoot" ]; then
+ kernelImage=$ubootDir/uImage-$version
+ fi
[ -n "$verbose" ] && echo "removing $version from $extlinuxConfig"
$grubby --extlinux -c $extlinuxConfig \
--remove-kernel=$kernelImage
@@ -534,12 +552,12 @@ update() {
[ -n "$verbose" ] && echo "adding $version to $ubootDir..."
[ -n "$verbose" ] && echo "creating uImage-$version"
- mkimage -A arm -O linux -T kernel -C none -a $ubootAddress \
+ mkimage -A $ubootArch -O linux -T kernel -C $ubootImageCompression -a $ubootAddress \
-e $ubootAddress -n $version \
-d $kernelImage $ubootDir/uImage-$version
[ -n "$verbose" ] && echo "creating uInitrd-$version"
- mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \
+ mkimage -A $ubootArch -O linux -T ramdisk -C $ubootInitrdCompression -a 0 -e 0 \
-n initramfs -d $initrdfile $ubootDir/uInitrd-$version
if [ -f $ubootDir/uImage-$version ] && [ -f $ubootDir/uInitrd-$version ]; then
@@ -552,15 +570,18 @@ update() {
[ -n "$verbose" ] && echo "copy uInitrd-$version error, kernel not installed!" && exit
fi
echo $version >> $ubootDir/$ubootKList
- [ -x /sbin/a-b-c ] && /sbin/a-b-c
else
[ -n "$verbose" ] && echo "cannot make $version the default"
fi
else
- [ -n "$verbose" ] && echo "$ubootScript does not exist, not setting up $ubootDir"
+ [ -n "$verbose" ] && echo "U-Boot is not enabled, not setting up $ubootDir"
fi
if [ -n "$cfgExtlinux" ]; then
+ if [ -n "$cfguBoot" ]; then
+ kernelImage=$ubootDir/uImage-$version
+ INITRD=$(echo $INITRD | sed "s|$initrdfile|$ubootDir/uInitrd-$version|")
+ fi
[ -n "$verbose" ] && echo "updating $version from $extlinuxConfig"
ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \
$DEVTREE $DEVTREEDIR $INITRD ${kernargs:+--args=\"$kernargs\"} \
@@ -592,6 +613,8 @@ doMkinitrd() {
rminitrd() {
[ -n "$verbose" ] && echo "removing initrd $initrdfile"
[ -f $initrdfile ] && rm -f $initrdfile
+ [ -n "$verbose" -a -n "$cfguBoot" ] && "removing U-Boot wrapped initrd $ubootDir/uInitrd-$version"
+ [ -n "$cfguBoot" -a -f $ubootDir/uInitrd-$version ] && rm -f $ubootDir/uInitrd-$version
}
doDepmod() {
@@ -876,33 +899,7 @@ fi
[ -n "$grub2EfiConfig" ] && [ -f "$grub2EfiConfig" ] && cfgGrub2Efi=1;
[ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1;
[ -n "$extlinuxConfig" ] && [ -f "$extlinuxConfig" ] && cfgExtlinux=1;
-
-# if we have a U-Boot directory, but no boot script, check if the directory
-# is mounted. If not, mount it, and then check if a boot script exists.
-if [ -n "$ubootDir" ]; then
- if [ -f "$ubootScript" ]; then
- cfguBoot=1
- else
- mountEntry=`mount | grep $ubootDir`
- if [ -z "$mountEntry" ]; then
- mount $ubootDevice $ubootDir
- mounted=1
- fi
- [ -f "$ubootScript" ] && cfguBoot=1;
- fi
-fi
-
-# if we're using U-Boot, check if the default load address should change
-if [ -n "$cfguBoot" -a -z "$UBOOT_IMGADDR" ]; then
- [[ $version =~ .([^.]*)$ ]]
- platform=${BASH_REMATCH[1]}
- # A few platforms use an alternate kernel load address
- if [ "$platform" = "omap" ]; then
- ubootAddress=0x80008000
- elif [ "$platform" = "imx" ]; then
- ubootAddress=0x90008000
- fi
-fi
+[ -n "$ubootDir" ] && cfguBoot=1
# if we have a lilo config on an x86 box, see if the default boot loader
# is lilo to determine if it should be run
@@ -920,7 +917,4 @@ elif [ "$mode" == "--rpmposttrans" ]; then
rpmposttrans
fi
-# if we mounted the U-Boot directory, unmount it.
-[ -n "$mounted" ] && umount $ubootDir
-
exit 0
diff --git a/uboot b/uboot
index 07d8671..3db046a 100644
--- a/uboot
+++ b/uboot
@@ -1,43 +1,34 @@
-# Settings for uBoot setup in /sbin/new-kernel-pkg
+# Settings for U-Boot setup in /sbin/new-kernel-pkg
#
# Default values are provided below (as comments)
#
# WARNING: These values affect where grubby installs and removes
-# uBoot kernel images. Changing these _after_ kernels have
+# U-Boot kernel images. Changing these _after_ kernels have
# been installed may cause removing a kernel image to fail.
-# directory where uBoot images and scripts are found
+# Directory where U-Boot images are found.
#UBOOT_DIR=/boot
# Override the load address when running mkimage on the kernel.
-# OMAP such as Beagleboard and Pandaboard: Use 0x80008000
-# Tegra such as Trimslice: Use 0x00008000
-# IMX such as Efika mx51 smarttop: Use 0x90008000
-# Kirkwood such as Dreamplug, Guruplug, Sheevaplug: Use 0x00008000
-# If left undefined grubby will use defults for Tegra or OMAP depending
-# upon the contents of /proc/cpuinfo.
-#UBOOT_IMGADDR=0x0x00008000
-
-# name of the text file containing the list of installed kernel versions
-# NOTE: The versions are in order of installation. The last entry should
+#UBOOT_IMGADDR=0x80200000
+
+# Name of the text file containing the list of installed kernel versions
+#
+# NOTE: The versions are in order of installation. The last entry should
# always be the default boot kernel version.
#UBOOT_KLIST=klist.txt
-# device partition where uBoot images reside; mounted on $UBOOT_DIR
-#UBOOT_DEVICE=mmcblk0p1
-
-
-# NOTE: Both of the following files are automatically overwritte
+# NOTE: Both of the following files are automatically overwritten
# when a kernel package is installed or removed.
-# default kernel uImage file name
+# Default kernel uImage file name
#UBOOT_UIMAGE=uImage
-# default initrd uInitrd file name
+# Default initrd uInitrd file name
#UBOOT_UINITRD=uInitrd
-# defualt for platform shipping an onboard dtb.
-#SHIPSDTB=no
+# Default uImage compression
+#UBOOT_UIMAGE_COMPRESSION=gzip
-# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf
-#dtbfile=foo.dtb
+# Default uInitrd compression
+#UBOOT_UINITRD_COMPRESSION=gzip
--
2.21.0

View File

@ -544,24 +544,28 @@ set_default_bls() {
}
remove_var_prefix() {
local prefix="$1"
[ -z "${prefix}" ] && return
if [[ -n $remove_kernel && $remove_kernel =~ ^/ ]]; then
remove_kernel="/${remove_kernel##*/}"
remove_kernel="/${remove_kernel##${prefix}/}"
fi
if [[ -n $initrd ]]; then
initrd="/${initrd##*/}"
initrd="/${initrd##${prefix}/}"
fi
if [[ -n $extra_initrd ]]; then
extra_initrd=" /${extra_initrd##*/}"
extra_initrd=" /${extra_initrd##${prefix}/}"
fi
if [[ -n $kernel ]]; then
kernel="/${kernel##*/}"
kernel="/${kernel##${prefix}/}"
fi
if [[ -n $update_kernel && $update_kernel =~ ^/ ]]; then
update_kernel="/${update_kernel##*/}"
update_kernel="/${update_kernel##${prefix}/}"
fi
}
@ -762,9 +766,7 @@ if [[ -n $display_info ]]; then
display_info_values "${display_info}"
fi
if [[ $(get_prefix) == "/boot" ]]; then
remove_var_prefix
fi
remove_var_prefix "$(get_prefix)"
if [[ -n $kernel ]]; then
if [[ $copy_default = "true" ]]; then

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 34.0.riscv64%{?dist}
Release: 36%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -23,7 +23,6 @@ Patch0007: 0007-Make-installkernel-to-use-kernel-install-scripts-on-.patch
Patch0008: 0008-Add-usr-libexec-rpm-sort.patch
Patch0009: 0009-Improve-man-page-for-info-option.patch
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
Patch0020: 0001-riscv-uboot.patch
BuildRequires: gcc
BuildRequires: pkgconfig glib2-devel popt-devel
@ -141,10 +140,11 @@ current boot environment.
%endif
%changelog
* Mon Jul 22 2019 David Abdurachmanov <david.abdurachmanov@sifive.com> - 8.40-34.0.riscv64
- Bring back U-Boot wrapped images support for RISC-V (riscv64)
- Make grubby use U-Boot wrapped kernel and ramdisk for extlinux
configuration on RISC-V
* Tue Aug 06 2019 Yuval Turgeman <yturgema@redhat.com> - 8.40-36
- grubby-bls: strip only /boot from paths
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jun 17 2019 Javier Martinez Canillas <javierm@redhat.com> - 8.40-34
- Add a kernel-install plugin to execute hook scripts in /etc/kernel/