kernel/generate_bls_conf.sh
Peter Jones 08732ed826 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>
2018-02-19 10:47:31 -05:00

29 lines
575 B
Bash
Executable File

#!/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