Skip to contentSkip to conversation

grub-efi: align the rootfs to start at 16MB offset from start of the image

PATCH New Florian La Roche 2 participants 3 messages Oct 22, 2020 – Nov 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grub-efi: align the rootfs to start at 16MB offset from start of the image

For grub-efi we can align the rootfs to start at exactly 16MB from the beginning of the disk. This can be done by reducing the vfat partition to be 32 KB smaller than its 16MB size, just like the offset of the vfat partition.

---
 board/pc/genimage-efi.cfg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
board/pc/genimage-efi.cfg +3 -3
index ea15ae5cfb..304e964f14 100644
@@ -10,7 +10,7 @@ image efi-part.vfat {
       image = "bzImage"
     }
   }
-  size = 16777216
+  size = 16744448
 }
 
 image disk.img {
@@ -22,7 +22,7 @@ image disk.img {
     image = "efi-part.vfat"
     partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
     offset = 32768
-    size = 16777216
+    size = 16744448
     bootable = true
   }
 
@@ -30,6 +30,6 @@ image disk.img {
     partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
     partition-uuid = UUID_TMP
     image = "rootfs.ext2"
-    offset = 16809984
+    offset = 16777216
   }
 }
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 grub-efi: align the rootfs to start at 16MB offset from start of the image

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Florian" == Florian La Roche via buildroot <[email protected]> writes:

For grub-efi we can align the rootfs to start at exactly 16MB from the beginning of the disk. This can be done by reducing the vfat partition to be 32 KB smaller than its 16MB size, just like the offset of the vfat partition.

Is there any specific reason for this or just that the offset looks "nicer"?

Quoted 18 lines
---
 board/pc/genimage-efi.cfg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
board/pc/genimage-efi.cfg +1 -1
index ea15ae5cfb..304e964f14 100644
@@ -10,7 +10,7 @@ image efi-part.vfat {
       image = "bzImage"
     }
   }
-  size = 16777216
+  size = 16744448
 }
 
 image disk.img {

board/pc/genimage-efi.cfg image disk.img { · line 25

Quoted 5 lines
board/pc/genimage-efi.cfg +1 -1
@@ -22,7 +22,7 @@ image disk.img {
     image = "efi-part.vfat"
     partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
     offset = 32768
-    size = 16777216
+    size = 16744448

There is actually no need to specify the size here again, it will by default use the size of the vfat image.

board/pc/genimage-efi.cfg image disk.img { · line 33

Quoted 9 lines
board/pc/genimage-efi.cfg +1 -1
     bootable = true
   }
 
@@ -30,6 +30,6 @@ image disk.img {
     partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a
     partition-uuid = UUID_TMP
     image = "rootfs.ext2"
-    offset = 16809984
+    offset = 16777216

Same for the offset, it will by default be put after the vfat image.

Committed with these changes, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 grub-efi: align the rootfs to start at 16MB offset from start of the image

Hello Peter,

Am Di., 3. Nov. 2020 um 22:44 Uhr schrieb Peter Korsgaard <[email protected]>:

Quoted 2 lines

Is there any specific reason for this or just that the offset looks "nicer"?

"nicer" is the only reason, not sure if newer hardware has any real alignment reasons
that would benefit from this.

Quoted 1 line

Committed with these changes, thanks.

Thanks,

Florian La Roche