From 086c96b4527425e0b4e1adf0531c83ea7f617c02 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 5 Dec 2021 11:09:42 +0100 Subject: [PATCH] configs/pc_x86_64_bios_defconfig: fix image generation after grub2 rework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 82d1e8c628cc (boot/grub2: use none platform when building for host) changed host-grub2 to only install the tools, not the actual bootloader or its modules, as they are of no use on the host. It so happened that, when not instructed to built for a specific platform, the grub2 buildsystem would default to build the legacy bios platform (at least when the build happens on an x86 or x86_64 host). However, because the host is more often than not an x86 or x86_64, when the target was also an x68 or x86_64, the modules built for the host could be re-used for the target, and this is what was done for our pc_x86_64_bios_defconfig. But now that we explicitly tell the grub2 buildsystem to not build any platform when we build host-grub2, we no longer have access to the grub2 modules from the host directory, and the build fails when assembling the final image. We fix that in two ways: First, we ensure that individual modules from the target grub2 get installed in target/; we can only do that if the target grub2 tools are also installed, so we enable that in the configuration. Second, we fix the post-build script to look in target/ rather than in host/. All that, just for the 512-byte boot.img bootstrap, which pulls in all the other modules (4.3MiB), the tools (8.8MiB)... But we are not going to cherry-pick individual modules; this is error prone and unmaintainable... Reported-by: Adam Duskett Signed-off-by: Yann E. MORIN Cc: Köry Maincent Signed-off-by: Peter Korsgaard --- board/pc/post-build.sh | 2 +- configs/pc_x86_64_bios_defconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/board/pc/post-build.sh b/board/pc/post-build.sh index db23795e27..c76dee2676 100755 --- a/board/pc/post-build.sh +++ b/board/pc/post-build.sh @@ -11,5 +11,5 @@ 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/i386-pc/boot.img" "$BINARIES_DIR" + cp -f "$TARGET_DIR/lib/grub/i386-pc/boot.img" "$BINARIES_DIR" fi diff --git a/configs/pc_x86_64_bios_defconfig b/configs/pc_x86_64_bios_defconfig index 3290a1dda0..df5988d75e 100644 --- a/configs/pc_x86_64_bios_defconfig +++ b/configs/pc_x86_64_bios_defconfig @@ -13,6 +13,7 @@ BR2_PACKAGE_HOST_GENIMAGE=y # Bootloader BR2_TARGET_GRUB2=y +BR2_TARGET_GRUB2_INSTALL_TOOLS=y # Filesystem / image BR2_TARGET_ROOTFS_EXT2=y