This plugin can be used to add parameters to kernel (boot/dracut) command line. Currently only grub2 bootloader is used and reboot is required to apply the tunings. The tuning can be only unloaded by profile change followed by reboot. It patches grub.cfg at runtime and installs /etc/grub.d/00_tuned grub2 template. So it's possible to regenerate grub.cfg by grub2-mkconfig and the tuning persists. It also patches /etc/default/grub and adds tuned_params grub2 variable to GRUB_CMDLINE_LINUX. This is probably the only way how to get variables into kernel command line in grub.cfg. Nothing else is added to /etc/default and it's patched if the plugin is used for the first time. It's re-patched on plugin initialization only if the tuned_params variable is missing. On subsequent invocation only the tuned_params grub2 variable and grub.cfg are changed. Example of use: [bootloader] cmdline=quiet This adds "quiet" parameter to the kernel boot command line (reboot is required). EFI is also supported. By default it autodetects redhat and fedora directories (in this order). Nothing else is touched. If you have different EFI system and your grub.cfg location is not auto-detected or your grub.cfg is located on different place you can specify the grub.cfg location manually: [bootloader] grub2_cfg_file=CUSTOM_PATH/grub.cfg cmdline=quiet This has precedence over auto-detection. This is used for runtime patching. In case it is not set correctly, the grub.cfg patching will not work, but you can still regenerate the config by hand by grub2-mkconfig. Resolves: rhbz#1044111 Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
29 lines
1 KiB
Bash
29 lines
1 KiB
Bash
#! /bin/sh
|
|
set -e
|
|
|
|
# grub-mkconfig helper script.
|
|
# Copyright (C) 2014 Red Hat, Inc
|
|
# Author: Jaroslav Škarvada <jskarvad@redhat.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
|
|
tunedcfgdir=/etc/tuned
|
|
tuned_bootcmdline_file=$tunedcfgdir/bootcmdline
|
|
|
|
. $tuned_bootcmdline_file
|
|
|
|
[ "$TUNED_BOOT_CMDLINE" ] && \
|
|
echo "set tuned_params=\"$TUNED_BOOT_CMDLINE\""
|