1 Star 0 Fork 50

山竹/grub2

forked from src-anolis-os/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0254-Make-grub2-mkconfig-to-honour-GRUB_CMDLINE_LINUX-in-.patch 3.42 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:15 . update to grub2-2.02-120.el8.src.rpm
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 10 Dec 2018 13:11:58 +0100
Subject: [PATCH] Make grub2-mkconfig to honour GRUB_CMDLINE_LINUX in
/etc/default/grub
The kernelopts grub environment variable is set with the GRUB_CMDLINE_LINUX
value only if wasn't set before. This is because the kernel cmdline params
of the entries are not in the grub.cfg anymore so grub2-mkconfig shouldn't
have side effects on neither the entries nor their kernel cmdline params.
But there's a lot of documentation pointing at modifying GRUB_CMDLINE_LINUX
to change the kernel cmdline params and users have built a muscle memory on
it, so the BLS support should be compatible.
Make the grub2-mkconfig script update the $kernelopts environment variable
unless the --no-grubenv-update option is used.
Resolves: rhbz#1637875
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
util/grub-mkconfig.8 | 4 ++++
util/grub-mkconfig.in | 6 ++++++
util/grub.d/10_linux.in | 2 +-
util/grub.d/10_linux_bls.in | 2 +-
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/util/grub-mkconfig.8 b/util/grub-mkconfig.8
index a2d1f577b..434fa4ded 100644
--- a/util/grub-mkconfig.8
+++ b/util/grub-mkconfig.8
@@ -13,5 +13,9 @@
\fB--output\fR=\fIFILE\fR
Write generated output to \fIFILE\fR.
+.TP
+\fB--no-grubenv-update\fR
+Do not update variables in the grubenv file.
+
.SH SEE ALSO
.BR "info grub"
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index c20171919..5e643e169 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -50,6 +50,8 @@ grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
+export GRUB_GRUBENV_UPDATE="yes"
+
. "${pkgdatadir}/grub-mkconfig_lib"
# Usage: usage
@@ -59,6 +61,7 @@ usage () {
gettext "Generate a grub config file"; echo
echo
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
+ print_option_help "--no-grubenv-update" "$(gettext "do not update variables in the grubenv file")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
echo
@@ -94,6 +97,9 @@ do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
+ --no-grubenv-update)
+ GRUB_GRUBENV_UPDATE="no"
+ ;;
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index b54d2774a..da2992ac9 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -165,7 +165,7 @@ if [ -s \$prefix/grubenv ]; then
fi
EOF
- if ! grub2-editenv - list | grep -q kernelopts; then
+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
fi
diff --git a/util/grub.d/10_linux_bls.in b/util/grub.d/10_linux_bls.in
index 8cff4c58a..175bedd07 100644
--- a/util/grub.d/10_linux_bls.in
+++ b/util/grub.d/10_linux_bls.in
@@ -225,7 +225,7 @@ linux_entry ()
populate_header_warn
populate_menu
- if ! grub2-editenv - list | grep -q kernelopts; then
+ if [ "x${GRUB_GRUBENV_UPDATE}" = "xyes" ]; then
${grub_editenv} - set kernelopts="root=${linux_root_device_thisversion} ro ${args}"
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangpingping000/grub2.git
git@gitee.com:wangpingping000/grub2.git
wangpingping000
grub2
grub2
a8

搜索帮助