Compare commits

...

13 Commits
master ... f35

Author SHA1 Message Date
Fedora Release Engineering eaef784cc6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-22 07:09:11 +00:00
Javier Martinez Canillas e69860d718
Man page and package description fixes
Clarify package description
  Resolves: rhbz#1913299
Update man page to not mention the GRUB config in the ESP anymore
  Resolves: rhbz#1958458

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-06-23 10:21:14 +02:00
Javier Martinez Canillas 9ebc469d54
Update man page to not mention the GRUB config in the ESP anymore
After https://fedoraproject.org/wiki/Changes/UnifyGrubConfig the config in
ESP is only used as a stub to load the actual GRUB config the in /boot dir.

Don't mention this file in the grubby man page, since users shouldn't even
be aware of that config file.

Resolves: rhbz#1958458

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-06-23 08:22:58 +02:00
Javier Martinez Canillas e94425201f
Clarify package description
The grubby script was meant to be a temporary solution to provide backward
compatibility with existing grubby users. But it turned out that grubby is
the recommended approach to modify the boot loader entries.

Let's make clear in the package description that this is not only meant to
be used for legacy compatibility purposes, which may discourage its usage.

Resolves: rhbz#1913299

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-06-23 07:56:49 +02:00
Javier Martinez Canillas 2b59d1355d
grubby-bls: expand only the kernelopts variable
The BLS snippets have the options field set to a kernelopts variable by
default, which is set in GRUB's environemnt block to the kernel cmdline.

When the kernel command line parameters are modified for all the entries,
the value of this kernelopts variable is modified. But if the cmdline is
modified for a single entry, then the kernelopts variable is expanded and
the resulted modified value stored in the BLS snippet.

The grubby tool expanded all the variables in the options field, but it's
possible that some of these variables are managed by another tool. For
example the tuned program adds a tuned variable that shouldn't be changed
by the grubby tool. Otherwise it will mangle the tuned configuration set.

To prevent this, let's make grubby to only expand the kernelopts variable.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-06-09 23:40:23 +02:00
Javier Martinez Canillas 5d3963841d
grubby-bs: Fix changing kernel cmdline params not working on ppc64le
Currently the grubby script re-generates a GRUB config file that contains
menuentry commands for every /boot/loader/entries/*.conf file snippet.

But this is only needed for ppc64le machines that have a Petitboot version
that doesn't support parsing BLS snippets. Instead of generating a config
on any ppc64le machine, restrict this for the case where is really needed.

The /etc/grub.d/10_linux script already takes this into account and does
not add menuentry commands unless is needed. But the grubby script didn't
check this, causing changing kernel cmdline params to not work on ppc64le.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2021-04-26 18:46:31 +02:00
Fedora Release Engineering 786a133370 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 13:00:54 +00:00
Tom Stellard fd57e031d4
Use make_build macro instead of plain make
This will make it possible for buildroots to inject arguments to
make by redefining the %__make macro.
2020-12-30 17:27:35 +01:00
Peter Robinson 536f42db1c Add device tree kernel install option, minor cleanups 2020-11-24 10:44:12 +00:00
Josh Boyer b91640a743 Only require s390utils-core
zipl appears to be the only thing grubby needs, and that is provided by s390utils-core.  Change the Requires to that, which allows for a more minimal installation.
2020-10-26 16:13:44 -04:00
Josh Boyer 3498276978 Only require s390utils-core
zipl appears to be the only thing grubby needs, and that is provided by s390utils-core.  Change the Requires to that, which allows for a more minimal installation.
2020-10-24 12:33:50 +00:00
Fedora Release Engineering 1ead121a08 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-28 00:24:28 +00:00
Javier Martinez Canillas a5c9c3a138
fix build with rpm-4.16 and correct --extra-initrd option image path
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2020-06-26 10:16:05 +02:00
5 changed files with 186 additions and 33 deletions

View File

@ -0,0 +1,28 @@
From 1afddd618629a97479560bedbdcfa11b2c492a0e Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Fri, 26 Jun 2020 10:02:51 +0200
Subject: [PATCH] Fix build with rpm-4.16
rpmvercmp() was moved to librpmio, so link against this library instead.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ab58aeb039..a54b053a30b 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ grubby:: $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(grubby_LIBS)
rpm-sort::rpm-sort.o
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpm
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -lrpmio
clean:
rm -f *.o grubby rpm-sort *~
--
2.26.2

73
10-devicetree.install Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# set -x
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]
then
COMMAND="$1"
KERNEL_VERSION="$2"
#BOOT_DIR_ABS="$3"
#KERNEL_IMAGE="$4"
[ -f /etc/u-boot.conf ] && source /etc/u-boot.conf || true
[ -z "$FIRMWAREDT" ] || FirmwareDT=$FIRMWAREDT
if [[ $FirmwareDT == "True" ]]
then
# if we want to use firmware DT we remove symlink to current kernel DT
if [ -h /boot/dtb ]; then
rm -f /boot/dtb
fi
exit 0
fi
# Setup a /boot/dtb -> /boot/dtb-$newest_kernel_version symlink so that
# u-boot can find the correct dtb to load.
#
# If invoked to 'add' a new kernel, find the newest based on `sort`ing
# the kernel versions dtb. If 'remove', then follow basically the same
# procedure but exclude the version currently being removed.
#
# The theory of operation here is that, while newer kernels may add new
# dtb nodes and fields, as upstreaming hw support for some particular
# device progresses, it should never make backward incompatible changes.
# So it should always be safe to use a newer dtb with an older kernel.
list_dtb_versions() {
excluded_version="$1"
for dtbdir in /boot/dtb-*; do
dtbver=${dtbdir#*-}
if [ "$dtbver" != "$excluded_version" ]; then
echo $dtbver
fi
done
}
setup_dtb_link() {
ver=`list_dtb_versions $1 | sort -r --sort=version | head -1`
if [ -h /boot/dtb ]; then
rm -f /boot/dtb
fi
ln -s dtb-$ver /boot/dtb
}
ret=0
case "$COMMAND" in
add)
# If we're adding a kernel we want that version
if [ -h /boot/dtb ]; then
rm -f /boot/dtb
fi
ln -s dtb-$KERNEL_VERSION /boot/dtb
ret=$?
;;
remove)
setup_dtb_link $KERNEL_VERSION
ret=$?
;;
esac
exit $ret
else
# Just exit on non ARM
exit 0
fi

View File

@ -235,7 +235,7 @@ get_bls_args() {
local opts=(${args})
for opt in ${opts[*]}; do
if [[ $opt =~ ^\$ ]]; then
if [[ $opt = "\$kernelopts" ]]; then
value="$(expand_var $opt)"
args="$(echo ${args} | sed -e "s/${opt}/${value}/")"
fi
@ -429,7 +429,7 @@ add_bls_fragment() {
fi
if [[ -n $extra_initrd ]]; then
append_bls_value "${bls_target}" "initrd" "${extra_initrd}"
append_bls_value "${bls_target}" "initrd" " ${extra_initrd}"
fi
if [[ $MAKEDEBUG = "yes" ]]; then
@ -567,7 +567,7 @@ remove_var_prefix() {
fi
if [[ -n $extra_initrd ]]; then
extra_initrd=" /${extra_initrd##${prefix}/}"
extra_initrd="/${extra_initrd##${prefix}/}"
fi
if [[ -n $kernel ]]; then
@ -581,8 +581,33 @@ remove_var_prefix() {
update_grubcfg()
{
if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
# Older ppc64le OPAL firmware (petitboot version < 1.8.0) don't have BLS support
# so grub2-mkconfig has to be run to generate a config with menuentry commands.
if [ "${arch}" = "ppc64le" ] && [ -d /sys/firmware/opal ]; then
RUN_MKCONFIG="true"
petitboot_path="/sys/firmware/devicetree/base/ibm,firmware-versions/petitboot"
if test -e ${petitboot_path}; then
read -r -d '' petitboot_version < ${petitboot_path}
petitboot_version="$(echo ${petitboot_version//v})"
if test -n ${petitboot_version}; then
major_version="$(echo ${petitboot_version} | cut -d . -f1)"
minor_version="$(echo ${petitboot_version} | cut -d . -f2)"
re='^[0-9]+$'
if [[ $major_version =~ $re ]] && [[ $minor_version =~ $re ]] &&
([[ ${major_version} -gt 1 ]] ||
[[ ${major_version} -eq 1 &&
${minor_version} -ge 8 ]]); then
RUN_MKCONFIG="false"
fi
fi
fi
fi
if [[ $RUN_MKCONFIG = "true" ]]; then
grub2-mkconfig --no-grubenv-update -o "${grub_config}" >& /dev/null
fi
}
@ -683,7 +708,7 @@ while [ ${#} -gt 0 ]; do
shift
;;
--extra-initrd|-i)
extra_initrd=" /${2}"
extra_initrd="${2}"
shift
;;
--make-default)

View File

@ -19,13 +19,10 @@ about the configuration files for the \fBgrub2\fR and \fBzipl\fR boot loaders.
It is primarily designed to be used from scripts which install new kernels and
need to find information about the current boot environment.
On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and
the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel
x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration
file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On PowerPC platforms, systems
based on Power8 and Power9 support \fBgrub2\fR as a bootloader and use a
configuration stored in \fB/boot/grub2/grub.cfg\fR. On s390x platforms the
\fBzipl\fR bootloader use a default configuration in \fB/etc/zipl.conf\fR.
On BIOS-based Intel x86, PowerPC and UEFI-based platforms, \fBgrub2\fR is the
default bootloader and the configuration file is in \fB/boot/grub2/grub.cfg\fR.
On s390x platforms, the \fBzipl\fR bootloader use a default configuration in
\fB/etc/zipl.conf\fR.
All bootloaders define the boot entries as individual configuration fragments
that are stored by default in \fB/boot/loader/entries\fR. The format for the

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.40
Release: 45%{?dist}
Release: 55%{?dist}
Summary: Command line tool for updating bootloader configs
License: GPLv2+
URL: https://github.com/rhinstaller/grubby
@ -14,7 +14,9 @@ Source2: grubby.in
Source3: installkernel.in
Source4: installkernel-bls
Source5: 95-kernel-hooks.install
Source6: grubby.8
Source6: 10-devicetree.install
Source7: grubby.8
Patch0001: 0001-remove-the-old-crufty-u-boot-support.patch
Patch0002: 0002-Change-return-type-in-getRootSpecifier.patch
Patch0003: 0003-Add-btrfs-subvolume-support-for-grub2.patch
@ -27,10 +29,11 @@ Patch0009: 0009-Improve-man-page-for-info-option.patch
Patch0010: 0010-Fix-GCC-warnings-about-possible-string-truncations-a.patch
Patch0011: 0011-Fix-stringop-overflow-warning.patch
Patch0012: 0012-Fix-maybe-uninitialized-warning.patch
Patch0013: 0013-Fix-build-with-rpm-4.16.patch
BuildRequires: gcc
BuildRequires: pkgconfig glib2-devel popt-devel
BuildRequires: libblkid-devel git-core sed make
BuildRequires: libblkid-devel sed make
# for make test / getopt:
BuildRequires: util-linux-ng
BuildRequires: rpm-devel
@ -40,33 +43,25 @@ Requires: grub2-tools-minimal
Requires: grub2-tools
%endif
%ifarch s390 s390x
Requires: s390utils-base
Requires: s390utils-core
%endif
Requires: findutils
Requires: util-linux
Conflicts: uboot-tools < 2021.01-0.1.rc2
Obsoletes: %{name}-bls < %{version}-%{release}
%description
This package provides a grubby compatibility script that manages
BootLoaderSpec files and is meant to only be used for legacy compatibility
users with existing grubby users.
BootLoaderSpec files and is meant to be backward compatible with
the previous grubby tool.
%prep
%setup -q -n grubby-%{version}-1
git init
git config user.email "noone@example.com"
git config user.name "no one"
git add .
git commit -a -q -m "%{version} baseline"
git am %{patches} </dev/null
git config --unset user.email
git config --unset user.name
%autosetup -p1 -n grubby-%{version}-1
%build
%set_build_flags
make %{?_smp_mflags} LDFLAGS="${LDFLAGS}"
%make_build LDFLAGS="${LDFLAGS}"
%ifnarch aarch64 %{arm}
%check
@ -86,8 +81,9 @@ sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/grubby,g" %{SOURCE2} \
sed -e "s,@@LIBEXECDIR@@,%{_libexecdir}/installkernel,g" %{SOURCE3} \
> %{buildroot}%{_sbindir}/installkernel
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5}
install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE6}
rm %{buildroot}%{_mandir}/man8/grubby.8*
install -m 0644 %{SOURCE6} %{buildroot}%{_mandir}/man8/
install -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man8/
%post
if [ "$1" = 2 ]; then
@ -111,7 +107,6 @@ scripts which install new kernels and need to find information about the
current boot environment.
%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%dir %{_libexecdir}/grubby
%dir %{_libexecdir}/installkernel
@ -120,11 +115,11 @@ current boot environment.
%attr(0755,root,root) %{_sbindir}/grubby
%attr(0755,root,root) %{_libexecdir}/installkernel/installkernel-bls
%attr(0755,root,root) %{_sbindir}/installkernel
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/10-devicetree.install
%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install
%{_mandir}/man8/[gi]*.8*
%files deprecated
%{!?_licensedir:%global license %%doc}
%license COPYING
%dir %{_libexecdir}/grubby
%dir %{_libexecdir}/installkernel
@ -136,6 +131,41 @@ current boot environment.
%{_mandir}/man8/*.8*
%changelog
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-55
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 23 2021 Javier Martinez Canillas <javierm@redhat.com> - 8.40-54
- Clarify package description
Resolves: rhbz#1913299
- Update man page to not mention the GRUB config in the ESP anymore
Resolves: rhbz#1958458
* Wed Jun 09 2021 Javier Martinez Canillas <javierm@redhat.com> - 8.40-53
- grubby-bls: expand only the kernelopts variable
* Mon Apr 26 2021 Javier Martinez Canillas <javierm@redhat.com> - 8.40-52
- grubby-bs: Fix changing kernel cmdline params not working on ppc64le
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-51
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Dec 30 2020 Tom Stellard <tstellar@redhat.com> - 8.40-50
- Use make_build macro instead of plain make
- https://docs.fedoraproject.org/en-US/packaging-guidelines/#_parallel_make
* Fri Nov 20 2020 Peter Robinson <pbrobinson@fedoraproject.org> - 8.40-49
- Add device tree kernel install option
* Mon Oct 26 2020 Josh Boyer <jwb@redhat.com> - 8.40-48
- Only require s390utils-core, not s390utils-base
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8.40-47
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jun 26 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-46
- fix build with rpm-4.16
- grubby-bls: fix --extra-initrd option not adding the correct path
* Wed May 13 2020 Javier Martinez Canillas <javierm@redhat.com> - 8.40-45
- grubby-bls: don't replace options with kernelopts if values are the same