diff options
author | Peter Jones <pjones@redhat.com> | 2016-12-15 10:34:30 -0500 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2018-02-19 10:47:31 -0500 |
commit | 08732ed8268cbd9fd23dfae32ffa18ea320b910e (patch) | |
tree | d6fc844afc481a4a412fcb68d6607ed22e7db491 | |
parent | 9ed1ca87cb099dcf241ba32038318c740fda590f (diff) | |
download | kernel-08732ed8268cbd9fd23dfae32ffa18ea320b910e.tar.gz kernel-08732ed8268cbd9fd23dfae32ffa18ea320b910e.tar.xz kernel-08732ed8268cbd9fd23dfae32ffa18ea320b910e.zip |
Generate BootLoaderSpec config fragments
The BootLoaderSpec (BLS) defines a scheme where different bootloaders can
share a format for boot items and a configuration directory that accepts
these common configurations as drop-in files [0].
Generate BLS snippets at build time that can be copied on kernel install,
so bootloaders can parse to create menu entries using this information.
[0]: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
Signed-off-by: Peter Jones <pjones@redhat.com>
-rwxr-xr-x | generate_bls_conf.sh | 28 | ||||
-rw-r--r-- | kernel.spec | 6 |
2 files changed, 34 insertions, 0 deletions
diff --git a/generate_bls_conf.sh b/generate_bls_conf.sh new file mode 100755 index 000000000..8d9ec0699 --- /dev/null +++ b/generate_bls_conf.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -e + +. /etc/os-release + +kernelver=$1 && shift +rootfs=$1 && shift +variant=$1 && shift + +output="${rootfs}/lib/modules/${kernelver}/bls.conf" +date=$(date -u +%Y%m%d%H%M%S) + +if [ "${variant:-5}" = "debug" ]; then + debugname=" with debugging" +else + debugname="" +fi + +cat >${output} <<EOF +title ${NAME} (${kernelver}) ${VERSION}${debugname} +linux ${bootprefix}/vmlinuz-${kernelver} +initrd ${bootprefix}/initramfs-${kernelver}.img +options \$kernelopts +id ${ID}-${date}-${kernelver} +grub_users \$grub_users +grub_arg --unrestricted +grub_class kernel${variant} +EOF diff --git a/kernel.spec b/kernel.spec index 66659ae13..38f5756dd 100644 --- a/kernel.spec +++ b/kernel.spec @@ -464,6 +464,7 @@ Source40: generate_all_configs.sh Source41: generate_debug_configs.sh Source42: process_configs.sh +Source43: generate_bls_conf.sh # This file is intentionally left empty in the stock kernel. Its a nicety # added for those wanting to do custom rebuilds with altered config opts. @@ -1104,6 +1105,7 @@ cp %{SOURCE1000} . cp %{SOURCE15} . cp %{SOURCE40} . cp %{SOURCE41} . +cp %{SOURCE43} . %if !%{debugbuildsenabled} # The normal build is a really debug build and the user has explicitly requested @@ -1518,6 +1520,9 @@ BuildKernel() { # prune junk from kernel-devel find $RPM_BUILD_ROOT/usr/src/kernels -name ".*.cmd" -exec rm -f {} \; + + # build a BLS config for this kernel + ./generate_bls_conf.sh "$KernelVer" "$RPM_BUILD_ROOT" "%{?variant}" } ### @@ -1829,6 +1834,7 @@ fi /lib/modules/%{KVERREL}%{?3:+%{3}}/build\ /lib/modules/%{KVERREL}%{?3:+%{3}}/source\ /lib/modules/%{KVERREL}%{?3:+%{3}}/updates\ +/lib/modules/%{KVERREL}%{?2:+%{2}}/bls.conf\ %if %{1}\ /lib/modules/%{KVERREL}%{?3:+%{3}}/vdso\ /etc/ld.so.conf.d/kernel-%{KVERREL}%{?3:+%{3}}.conf\ |