1 Star 0 Fork 99

yangqiming/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0187-Fix-savedefault-with-blscfg.patch 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
hanzj0122_admin 提交于 2020-07-29 20:47 . update to 2.04
From 51ba69910056d9720c114ed67d13da766c21a609 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Mon, 13 Jan 2020 19:29:58 +0100
Subject: [PATCH 187/220] Fix savedefault with blscfg
The GRUB_SAVEDEFAULT option was ignored on a BLS configuration. Fix it by
making the menu entries populated from the BLS files to call savedefault
if a save_default environment variable has been set to "true".
This variable is set by grub2-mkconfig to the value in GRUB_SAVEDEFAULT.
---
grub-core/commands/blscfg.c | 5 ++++-
util/grub.d/10_linux.in | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index 83b33c1..069db72 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -889,11 +889,14 @@ static void create_entry (struct bls_entry *entry)
grub_dprintf ("blscfg2", "devicetree %s for id:\"%s\"\n", dt, id);
- src = grub_xasprintf ("load_video\n"
+ const char *sdval = grub_env_get("save_default");
+ bool savedefault = ((NULL != sdval) && (grub_strcmp(sdval, "true") == 0));
+ src = grub_xasprintf ("%sload_video\n"
"set gfxpayload=keep\n"
"insmod gzio\n"
"linux %s%s%s%s\n"
"%s%s",
+ savedefault ? "savedefault\n" : "",
GRUB_BOOT_DEVICE, clinux, options ? " " : "", options ? options : "",
initrd ? initrd : "", dt ? dt : "");
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 21a6915..b70dca2 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -152,6 +152,10 @@ EOF
if [ -n "${GRUB_DEFAULT_DTB}" ]; then
${grub_editenv} - set devicetree="${GRUB_DEFAULT_DTB}"
fi
+
+ if [ -n "${GRUB_SAVEDEFAULT}" ]; then
+ ${grub_editenv} - set save_default="${GRUB_SAVEDEFAULT}"
+ fi
fi
exit 0
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yyangqiming/grub2.git
git@gitee.com:yyangqiming/grub2.git
yyangqiming
grub2
grub2
master

搜索帮助