Skip to content

Commit 6ef2816

Browse files
committed
fix: increase EFI partition to 1G for actual EFI systems
https://applink.feishu.cn/client/message/link/open?token=Ami%2F2XW%2Fg4ADaT%2FXUwXBDM8%3D Signed-off-by: ZHANG Yuntian <yt@radxa.com>
1 parent 274c91b commit 6ef2816

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/share/rsdk/build/image.jsonnet

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ then
66
else
77
2
88
);
9+
// part_size unit is MiB
10+
local efi_part_end_sector_internal(part_size, start_sector, sector_size) =
11+
(part_size * 1024 * 1024 / sector_size) + start_sector - 1;
12+
local efi_part_end_sector(efi_boot, start_sector, sector_size) = (if efi_boot
13+
then
14+
efi_part_end_sector_internal(1024, start_sector, sector_size)
15+
else
16+
efi_part_end_sector_internal(300, start_sector, sector_size)
17+
);
918

1019
function(
1120
output = "output.img",
@@ -23,7 +32,7 @@ function(
2332
!echo "Image generation started at $(date)."
2433
echo "Allocating image file..."
2534
!rm -f "%(output)s"
26-
disk-create "%(output)s" raw 9G
35+
disk-create "%(output)s" raw 10G
2736
add-drive "%(output)s" format:raw discard:besteffort blocksize:%(sector_size)d
2837
run
2938
@@ -38,11 +47,14 @@ function(
3847
(if efi
3948
then
4049
|||
41-
part-add /dev/sda primary 65536 679935
50+
part-add /dev/sda primary 65536 %(efi_part_end_sector)d
4251
part-set-bootable /dev/sda 2 true
43-
part-add /dev/sda primary 679936 -34
52+
part-add /dev/sda primary %(root_part_start_sector)d -34
4453
part-set-bootable /dev/sda 3 true
45-
|||
54+
||| % {
55+
efi_part_end_sector: efi_part_end_sector(sdboot || product_firmware_type(product) == "edk2", 65536, sector_size),
56+
root_part_start_sector: efi_part_end_sector(sdboot || product_firmware_type(product) == "edk2", 65536, sector_size) + 1,
57+
}
4658
else
4759
|||
4860
part-add /dev/sda primary 65536 -34

0 commit comments

Comments
 (0)