1 Star 0 Fork 16

jackzhao166/grub2

forked from OpenCloudOS Stream/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0002-grub2-iterate-and-hook-for-extended-partition.patch 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
nilusyi 提交于 2024-04-07 16:45 . update patches
From 774bb390b2851497dc9dea84b422874cbc0b480f Mon Sep 17 00:00:00 2001
From: nilusyi <nilusyi@tencent.com>
Date: Fri, 29 Mar 2024 16:34:00 +0800
Subject: [PATCH 002/272] grub2 iterate and hook for extended partition
From: Michael Chang <mchang@suse.com>
The same as in the previous patch, add a support for installing grub
into an extended partition.
Here, we do not ignore extended partitions anymore. Instead we call a
hook that makes sure we have the partition when installing.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
References: https://bugzilla.novell.com/show_bug.cgi?id=750897
From: Andrey Borzenkov <arvidjaar@gmail.com>
Apply this logic only to primary extended partition. Ignore extended
partitions that are used to link together logical partitions.
References: https://bugzilla.novell.com/show_bug.cgi?id=785341
---
grub-core/partmap/msdos.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
index c85bb74be..ccc56a4ac 100644
--- a/grub-core/partmap/msdos.c
+++ b/grub-core/partmap/msdos.c
@@ -188,13 +188,20 @@ grub_partition_msdos_iterate (grub_disk_t disk,
(unsigned long long) p.len);
/* If this partition is a normal one, call the hook. */
- if (! grub_msdos_partition_is_empty (e->type)
- && ! grub_msdos_partition_is_extended (e->type))
+ if (! grub_msdos_partition_is_empty (e->type))
{
- p.number++;
-
- if (hook (disk, &p, hook_data))
- return grub_errno;
+ if (!grub_msdos_partition_is_extended (e->type) || p.number < 3)
+ {
+ p.number++;
+
+ /* prevent someone doing mkfs or mkswap on an
+ extended partition, but leave room for LILO */
+ if (grub_msdos_partition_is_extended (e->type))
+ p.len = 2;
+
+ if (hook (disk, &p, hook_data))
+ return grub_errno;
+ }
}
else if (p.number < 3)
/* If this partition is a logical one, shouldn't increase the
--
2.41.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jackzhao166/grub2.git
git@gitee.com:jackzhao166/grub2.git
jackzhao166
grub2
grub2
master

搜索帮助