x86: fix grub-bios-setup fail during sysupgrade
author李国 <uxgood.org@gmail.com>
Tue, 7 Apr 2020 09:11:46 +0000 (09:11 +0000)
committerPetr Štetiar <ynezz@true.cz>
Thu, 9 Apr 2020 10:51:10 +0000 (12:51 +0200)
grub-bios-setup requires two images (boot.img and core.img),
but they are missing. This make an error during sysupgrade:
Upgrading bootloader on /dev/sda...
grub-bios-setup: error: cannot open `/tmp/boot/boot/grub/boot.img': No
such file or directory.

Signed-off-by: 李国 <uxgood.org@gmail.com>
target/linux/x86/base-files/lib/upgrade/platform.sh
target/linux/x86/image/Makefile

index ee88dfb08269fe4f347c9d3821c85f58a0662990..829834471d301e8b6eac5b5d25b91bd96e8c7824 100644 (file)
@@ -63,7 +63,7 @@ platform_do_bootloader_upgrade() {
                        -d "/tmp/boot/boot/grub" \
                        -r "hd0,${parttable}1" \
                        "/dev/$diskdev" \
-               && touch /boot/grub/upgraded
+               && touch /tmp/boot/grub/upgraded
 
                umount /tmp/boot
        fi
index 7864dfa1f80e0fb50c10820019edf06732f89af6..7a474e7a6eb8f1803e5cd9ec7c7f787f821b353e 100644 (file)
@@ -49,6 +49,9 @@ BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS))
 define Build/combined
        $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/boot/vmlinuz
        -$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/
+       $(CP) $(STAGING_DIR_IMAGE)/grub2/boot.img $@.boot/boot/grub/
+       $(CP) $(STAGING_DIR_IMAGE)/grub2/$(if $(filter $(1),efi),gpt,$(GRUB2_VARIANT))-core.img \
+               $@.boot/boot/grub/core.img
        $(if $(filter $(1),efi),
                $(INSTALL_DIR) $@.boot/efi/boot
                $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi $@.boot/efi/boot/