configs/pc_x86_64_efi: add GPT partition table support.
PATCH v2 1/1 configs/pc_x86_64_efi: add GPT partition table support.
From: Alexandre PAYEN <[email protected]>
Commit fee29b05bb7db25e37c8a5175ce00dc712554edf replaced the use of genimage by a shell script to use GPT partitioning on pc_x86_64_efi.
Since version 11, genimage supports GPT, so add a corresponding config file ad update the post-image script to use genimage again. Keep using the UUID to identify the root partition.
---
Changes v1->v2
- Simplify post-image script.
- Update the commit message.
--- board/pc/genimage-efi.cfg | 39 +++++++++++++++++++++ board/pc/grub-efi.cfg | 6 ++++ board/pc/post-build.sh | 14 ++++++-- board/pc/post-image-efi-gpt.sh | 62 --------------------------------- board/pc/post-image-efi.sh | 9 +++++ configs/pc_x86_64_efi_defconfig | 4 ++- 6 files changed, 69 insertions(+), 65 deletions(-) create mode 100644 board/pc/genimage-efi.cfg create mode 100644 board/pc/grub-efi.cfg delete mode 100755 board/pc/post-image-efi-gpt.sh create mode 100755 board/pc/post-image-efi.sh
board/pc/genimage-efi.cfg new file +39 -0
@@ -0,0 +1,39 @@ +image efi-part.vfat { + vfat { + file startup.nsh { + image = "efi-part/startup.nsh" + } + file EFI { + image = "efi-part/EFI" + } + file bzImage { + image = "bzImage" + } + } + size = 16777216 +} + +image disk.img { + + + hdimage { + gpt = true + } + + partition boot { + image = "efi-part.vfat" + partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b + offset = 32768 + size = 16777216 + bootable = true + } + + partition root { + partition-type-uuid = 44479540-f297-41b2-9af7-d131d5f0458a + partition-uuid = UUID_TMP + image = "rootfs.ext2" + offset = 16809984 + } + + +}
board/pc/grub-efi.cfg new file +6 -0
@@ -0,0 +1,6 @@ +set default="0" +set timeout="5" + +menuentry "Buildroot" { + linux /bzImage root=PARTUUID=UUID_TMP rootwait console=tty1 +}
board/pc/post-build.sh +12 -2
@@ -4,7 +4,17 @@ set -e BOARD_DIR=$(dirname "$0") -cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" +# Detect boot strategy, EFI or BIOS +if [ -f "$BINARIES_DIR/efi-part/startup.nsh" ]; then + cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg" +else + cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" + + # Copy grub 1st stage to binaries, required for genimage + cp -f "$HOST_DIR/lib/grub/i387-pc/boot.img" "$BINARIES_DIR" +fi + +#cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" # Copy grub 1st stage to binaries, required for genimage -cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR" +#cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR"
board/pc/post-image-efi-gpt.sh deleted +0 -62
62 lines not on this page · raw message
board/pc/post-image-efi.sh new file +9 -0
@@ -0,0 +1,9 @@ +#!/bin/sh + +# exit on any failure +set -e + +UUID=$(dumpe2fs "$BINARIES_DIR/rootfs.ext2" 2>/dev/null | sed -n 's/^Filesystem UUID: *\(.*\)/\1/p') +sed -i "s/UUID_TMP/$UUID/g" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg" +sed "s/UUID_TMP/$UUID/g" board/pc/genimage-efi.cfg > "$BINARIES_DIR/genimage-efi.cfg" +support/scripts/genimage.sh -c "$BINARIES_DIR/genimage-efi.cfg"
configs/pc_x86_64_efi_defconfig +3 -1
@@ -10,6 +10,7 @@ BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y # Required tools to create bootable media BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y # Bootloader
@@ -21,7 +22,8 @@ BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set -BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image-efi-gpt.sh" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/pc/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image-efi.sh" # Linux headers same as kernel, a 4.18 series BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_18=y
Signature · 1 line
2.18.1
PATCH v2 1/1 configs/pc_x86_64_efi: add GPT partition table support.
Hello Carlos,
Thanks for following up on this.
board/pc/post-build.sh set -e · line 17
Quoted 12 lines · On Sat, 21 Sep 2019 21:03:23 -0300 unixmania at gmail.com wrote:
board/pc/post-build.sh +11
-1-cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" +# Detect boot strategy, EFI or BIOS +if [ -f "$BINARIES_DIR/efi-part/startup.nsh" ]; then + cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg" +else + cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" + + # Copy grub 1st stage to binaries, required for genimage + cp -f "$HOST_DIR/lib/grub/i387-pc/boot.img" "$BINARIES_DIR" +fi + +#cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg"
Do we need to keep this commented line ?
board/pc/post-build.sh set -e · line 20
Quoted 4 lines
# Copy grub 1st stage to binaries, required for genimage
board/pc/post-build.sh +1
-1-cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR" +#cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR"
Here as well, and the comment above ?
Note: no need to respin just for this, I can fixup when applying, just let me know.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/1 configs/pc_x86_64_efi: add GPT partition table support.
Quoted 30 lines · Thomas Petazzoni
Hello Carlos,
Thanks for following up on this.
board/pc/post-build.sh set -e · line 17
Quoted 12 lines · On Sat, 21 Sep 2019 21:03:23 -0300 unixmania at gmail.com wrote:
board/pc/post-build.sh +11
-1-cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" +# Detect boot strategy, EFI or BIOS +if [ -f "$BINARIES_DIR/efi-part/startup.nsh" ]; then + cp -f "$BOARD_DIR/grub-efi.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg" +else + cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg" + + # Copy grub 1st stage to binaries, required for genimage + cp -f "$HOST_DIR/lib/grub/i387-pc/boot.img" "$BINARIES_DIR" +fi + +#cp -f "$BOARD_DIR/grub-bios.cfg" "$TARGET_DIR/boot/grub/grub.cfg"Do we need to keep this commented line ?
board/pc/post-build.sh set -e · line 20
Quoted 4 lines
# Copy grub 1st stage to binaries, required for genimage
board/pc/post-build.sh +1
-1-cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR" +#cp -f "$HOST_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR"Here as well, and the comment above ?
Quoted 6 lines
Note: no need to respin just for this, I can fixup when applying, just let me know.
Thanks!
Thomas
The comments can be removed.
Signature · 1 line
Carlos Santos <[email protected]>