Bump buildroot to 2019.02
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
From 842c390469e2c2e10b5aa36700324cd3bde25875 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Sat, 17 Feb 2018 06:47:28 -0800
|
||||
Subject: [PATCH] x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
|
||||
|
||||
Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:
|
||||
|
||||
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a
|
||||
|
||||
x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
|
||||
32-bit PC-relative branches. Grub2 should treat R_X86_64_PLT32 as
|
||||
R_X86_64_PC32.
|
||||
|
||||
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Romain Naour <romain.naour@smile.fr>
|
||||
---
|
||||
grub-core/efiemu/i386/loadcore64.c | 1 +
|
||||
grub-core/kern/x86_64/dl.c | 1 +
|
||||
util/grub-mkimagexx.c | 1 +
|
||||
util/grub-module-verifier.c | 1 +
|
||||
4 files changed, 4 insertions(+)
|
||||
|
||||
diff --git a/grub-core/efiemu/i386/loadcore64.c b/grub-core/efiemu/i386/loadcore64.c
|
||||
index e49d0b6..18facf4 100644
|
||||
--- a/grub-core/efiemu/i386/loadcore64.c
|
||||
+++ b/grub-core/efiemu/i386/loadcore64.c
|
||||
@@ -98,6 +98,7 @@ grub_arch_efiemu_relocate_symbols64 (grub_efiemu_segment_t segs,
|
||||
break;
|
||||
|
||||
case R_X86_64_PC32:
|
||||
+ case R_X86_64_PLT32:
|
||||
err = grub_efiemu_write_value (addr,
|
||||
*addr32 + rel->r_addend
|
||||
+ sym.off
|
||||
diff --git a/grub-core/kern/x86_64/dl.c b/grub-core/kern/x86_64/dl.c
|
||||
index 4406906..3a73e6e 100644
|
||||
--- a/grub-core/kern/x86_64/dl.c
|
||||
+++ b/grub-core/kern/x86_64/dl.c
|
||||
@@ -70,6 +70,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr,
|
||||
break;
|
||||
|
||||
case R_X86_64_PC32:
|
||||
+ case R_X86_64_PLT32:
|
||||
{
|
||||
grub_int64_t value;
|
||||
value = ((grub_int32_t) *addr32) + rel->r_addend + sym->st_value -
|
||||
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
|
||||
index a2bb054..39d7efb 100644
|
||||
--- a/util/grub-mkimagexx.c
|
||||
+++ b/util/grub-mkimagexx.c
|
||||
@@ -841,6 +841,7 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections,
|
||||
break;
|
||||
|
||||
case R_X86_64_PC32:
|
||||
+ case R_X86_64_PLT32:
|
||||
{
|
||||
grub_uint32_t *t32 = (grub_uint32_t *) target;
|
||||
*t32 = grub_host_to_target64 (grub_target_to_host32 (*t32)
|
||||
diff --git a/util/grub-module-verifier.c b/util/grub-module-verifier.c
|
||||
index 9179285..a79271f 100644
|
||||
--- a/util/grub-module-verifier.c
|
||||
+++ b/util/grub-module-verifier.c
|
||||
@@ -19,6 +19,7 @@ struct grub_module_verifier_arch archs[] = {
|
||||
-1
|
||||
}, (int[]){
|
||||
R_X86_64_PC32,
|
||||
+ R_X86_64_PLT32,
|
||||
-1
|
||||
}
|
||||
},
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -2,6 +2,9 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
|
||||
bool
|
||||
default y if BR2_i386
|
||||
default y if BR2_x86_64
|
||||
default y if BR2_arm
|
||||
default y if BR2_aarch64
|
||||
depends on BR2_USE_MMU
|
||||
|
||||
config BR2_TARGET_GRUB2
|
||||
bool "grub2"
|
||||
@@ -29,12 +32,14 @@ choice
|
||||
|
||||
config BR2_TARGET_GRUB2_I386_PC
|
||||
bool "i386-pc"
|
||||
depends on BR2_i386 || BR2_x86_64
|
||||
help
|
||||
Select this option if the platform you're targetting is a
|
||||
x86 or x86-64 legacy BIOS based platform.
|
||||
|
||||
config BR2_TARGET_GRUB2_I386_EFI
|
||||
bool "i386-efi"
|
||||
depends on BR2_i386 || BR2_x86_64
|
||||
help
|
||||
Select this option if the platform you're targetting has a
|
||||
32 bits EFI BIOS. Note that some x86-64 platforms use a 32
|
||||
@@ -42,14 +47,38 @@ config BR2_TARGET_GRUB2_I386_EFI
|
||||
|
||||
config BR2_TARGET_GRUB2_X86_64_EFI
|
||||
bool "x86-64-efi"
|
||||
depends on BR2_ARCH_IS_64
|
||||
depends on BR2_x86_64
|
||||
help
|
||||
Select this option if the platform you're targetting has a
|
||||
64 bits EFI BIOS.
|
||||
|
||||
config BR2_TARGET_GRUB2_ARM_UBOOT
|
||||
bool "arm-uboot"
|
||||
depends on BR2_arm
|
||||
help
|
||||
Select this option if the platform you're targetting is an
|
||||
ARM u-boot platform, and you want to boot Grub 2 as an u-boot
|
||||
compatible image.
|
||||
|
||||
config BR2_TARGET_GRUB2_ARM_EFI
|
||||
bool "arm-efi"
|
||||
depends on BR2_arm
|
||||
help
|
||||
Select this option if the platform you're targetting is an
|
||||
ARM platform and you want to boot Grub 2 as an EFI
|
||||
application.
|
||||
|
||||
config BR2_TARGET_GRUB2_ARM64_EFI
|
||||
bool "arm64-efi"
|
||||
depends on BR2_aarch64
|
||||
help
|
||||
Select this option if the platform you're targetting is an
|
||||
Aarch64 platform and you want to boot Grub 2 as an EFI
|
||||
application.
|
||||
|
||||
endchoice
|
||||
|
||||
if BR2_TARGET_GRUB2_I386_PC
|
||||
if BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT
|
||||
|
||||
config BR2_TARGET_GRUB2_BOOT_PARTITION
|
||||
string "boot partition"
|
||||
@@ -60,13 +89,15 @@ config BR2_TARGET_GRUB2_BOOT_PARTITION
|
||||
first disk if using a legacy partition table, or 'hd0,gpt1'
|
||||
if using GPT partition table.
|
||||
|
||||
endif # BR2_TARGET_GRUB2_I386_PC
|
||||
endif # BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT
|
||||
|
||||
config BR2_TARGET_GRUB2_BUILTIN_MODULES
|
||||
string "builtin modules"
|
||||
default "boot linux ext2 fat squash4 part_msdos part_gpt normal biosdisk" if BR2_TARGET_GRUB2_I386_PC
|
||||
default "boot linux ext2 fat squash4 part_msdos part_gpt normal efi_gop" \
|
||||
if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI
|
||||
if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI || \
|
||||
BR2_TARGET_GRUB2_ARM_EFI || BR2_TARGET_GRUB2_ARM64_EFI
|
||||
default "linux ext2 fat part_msdos normal" if BR2_TARGET_GRUB2_ARM_UBOOT
|
||||
|
||||
config BR2_TARGET_GRUB2_BUILTIN_CONFIG
|
||||
string "builtin config"
|
||||
@@ -76,6 +107,15 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG
|
||||
device and other configuration parameters, but however menu
|
||||
entries cannot be described in this embedded configuration.
|
||||
|
||||
config BR2_TARGET_GRUB2_INSTALL_TOOLS
|
||||
bool "install tools"
|
||||
help
|
||||
Install support tools to interact with GNU GRUB Multiboot
|
||||
boot loader.
|
||||
|
||||
This will also install the Grub 2 loadable modules to the
|
||||
target.
|
||||
|
||||
endif # BR2_TARGET_GRUB2
|
||||
|
||||
comment "grub2 needs a toolchain w/ wchar"
|
||||
|
||||
@@ -9,7 +9,15 @@ GRUB2_SITE = http://ftp.gnu.org/gnu/grub
|
||||
GRUB2_SOURCE = grub-$(GRUB2_VERSION).tar.xz
|
||||
GRUB2_LICENSE = GPL-3.0+
|
||||
GRUB2_LICENSE_FILES = COPYING
|
||||
GRUB2_DEPENDENCIES = host-bison host-flex
|
||||
GRUB2_DEPENDENCIES = host-bison host-flex host-grub2
|
||||
HOST_GRUB2_DEPENDENCIES = host-bison host-flex
|
||||
GRUB2_INSTALL_IMAGES = YES
|
||||
|
||||
ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
|
||||
GRUB2_INSTALL_TARGET = YES
|
||||
else
|
||||
GRUB2_INSTALL_TARGET = NO
|
||||
endif
|
||||
|
||||
GRUB2_BUILTIN_MODULES = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES))
|
||||
GRUB2_BUILTIN_CONFIG = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_CONFIG))
|
||||
@@ -36,29 +44,48 @@ GRUB2_PREFIX = /EFI/BOOT
|
||||
GRUB2_TUPLE = x86_64-efi
|
||||
GRUB2_TARGET = x86_64
|
||||
GRUB2_PLATFORM = efi
|
||||
else ifeq ($(BR2_TARGET_GRUB2_ARM_UBOOT),y)
|
||||
GRUB2_IMAGE = $(BINARIES_DIR)/boot-part/grub/grub.img
|
||||
GRUB2_CFG = $(BINARIES_DIR)/boot-part/grub/grub.cfg
|
||||
GRUB2_PREFIX = ($(GRUB2_BOOT_PARTITION))/boot/grub
|
||||
GRUB2_TUPLE = arm-uboot
|
||||
GRUB2_TARGET = arm
|
||||
GRUB2_PLATFORM = uboot
|
||||
else ifeq ($(BR2_TARGET_GRUB2_ARM_EFI),y)
|
||||
GRUB2_IMAGE = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootarm.efi
|
||||
GRUB2_CFG = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
|
||||
GRUB2_PREFIX = /EFI/BOOT
|
||||
GRUB2_TUPLE = arm-efi
|
||||
GRUB2_TARGET = arm
|
||||
GRUB2_PLATFORM = efi
|
||||
else ifeq ($(BR2_TARGET_GRUB2_ARM64_EFI),y)
|
||||
GRUB2_IMAGE = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootaa64.efi
|
||||
GRUB2_CFG = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
|
||||
GRUB2_PREFIX = /EFI/BOOT
|
||||
GRUB2_TUPLE = arm64-efi
|
||||
GRUB2_TARGET = aarch64
|
||||
GRUB2_PLATFORM = efi
|
||||
endif
|
||||
|
||||
# Grub2 is kind of special: it considers CC, LD and so on to be the
|
||||
# tools to build the native tools (i.e to be executed on the build
|
||||
# machine), and uses TARGET_CC, TARGET_CFLAGS, TARGET_CPPFLAGS,
|
||||
# TARGET_LDFLAGS to build the bootloader itself. However, to add to
|
||||
# the confusion, it also uses NM, OBJCOPY and STRIP to build the
|
||||
# bootloader itself; none of these are used to build the native
|
||||
# tools.
|
||||
# tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
|
||||
# TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
|
||||
#
|
||||
# NOTE: TARGET_STRIP is overridden by !BR2_STRIP_strip, so always
|
||||
# use the cross compile variant to ensure grub2 builds
|
||||
|
||||
HOST_GRUB2_CONF_ENV = \
|
||||
CPP="$(HOSTCC) -E"
|
||||
|
||||
GRUB2_CONF_ENV = \
|
||||
$(HOST_CONFIGURE_OPTS) \
|
||||
CPP="$(HOSTCC) -E" \
|
||||
CPP="$(TARGET_CC) -E" \
|
||||
TARGET_CC="$(TARGET_CC)" \
|
||||
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
|
||||
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS) -fno-stack-protector" \
|
||||
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
NM="$(TARGET_NM)" \
|
||||
OBJCOPY="$(TARGET_OBJCOPY)" \
|
||||
STRIP="$(TARGET_CROSS)strip"
|
||||
TARGET_NM="$(TARGET_NM)" \
|
||||
TARGET_OBJCOPY="$(TARGET_OBJCOPY)" \
|
||||
TARGET_STRIP="$(TARGET_CROSS)strip"
|
||||
|
||||
GRUB2_CONF_OPTS = \
|
||||
--target=$(GRUB2_TARGET) \
|
||||
@@ -72,12 +99,13 @@ GRUB2_CONF_OPTS = \
|
||||
--enable-libzfs=no \
|
||||
--disable-werror
|
||||
|
||||
# We don't want all the native tools and Grub2 modules to be installed
|
||||
# in the target. So we in fact install everything into the host
|
||||
# directory, and the image generation process (below) will use the
|
||||
# grub-mkimage tool and Grub2 modules from the host directory.
|
||||
|
||||
GRUB2_INSTALL_TARGET_OPTS = DESTDIR=$(HOST_DIR) install
|
||||
HOST_GRUB2_CONF_OPTS = \
|
||||
--disable-grub-mkfont \
|
||||
--enable-efiemu=no \
|
||||
ac_cv_lib_lzma_lzma_code=no \
|
||||
--enable-device-mapper=no \
|
||||
--enable-libzfs=no \
|
||||
--disable-werror
|
||||
|
||||
ifeq ($(BR2_TARGET_GRUB2_I386_PC),y)
|
||||
define GRUB2_IMAGE_INSTALL_ELTORITO
|
||||
@@ -86,10 +114,10 @@ define GRUB2_IMAGE_INSTALL_ELTORITO
|
||||
endef
|
||||
endif
|
||||
|
||||
define GRUB2_IMAGE_INSTALLATION
|
||||
define GRUB2_INSTALL_IMAGES_CMDS
|
||||
mkdir -p $(dir $(GRUB2_IMAGE))
|
||||
$(HOST_DIR)/bin/grub-mkimage \
|
||||
-d $(HOST_DIR)/lib/grub/$(GRUB2_TUPLE) \
|
||||
$(HOST_DIR)/usr/bin/grub-mkimage \
|
||||
-d $(@D)/grub-core/ \
|
||||
-O $(GRUB2_TUPLE) \
|
||||
-o $(GRUB2_IMAGE) \
|
||||
-p "$(GRUB2_PREFIX)" \
|
||||
@@ -99,14 +127,14 @@ define GRUB2_IMAGE_INSTALLATION
|
||||
$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG)
|
||||
$(GRUB2_IMAGE_INSTALL_ELTORITO)
|
||||
endef
|
||||
GRUB2_POST_INSTALL_TARGET_HOOKS += GRUB2_IMAGE_INSTALLATION
|
||||
|
||||
ifeq ($(GRUB2_PLATFORM),efi)
|
||||
define GRUB2_EFI_STARTUP_NSH
|
||||
echo $(notdir $(GRUB2_IMAGE)) > \
|
||||
$(BINARIES_DIR)/efi-part/startup.nsh
|
||||
endef
|
||||
GRUB2_POST_INSTALL_TARGET_HOOKS += GRUB2_EFI_STARTUP_NSH
|
||||
GRUB2_POST_INSTALL_IMAGES_HOOKS += GRUB2_EFI_STARTUP_NSH
|
||||
endif
|
||||
|
||||
$(eval $(autotools-package))
|
||||
$(eval $(host-autotools-package))
|
||||
|
||||
@@ -53,8 +53,8 @@ To test your BIOS image in Qemu
|
||||
|
||||
qemu-system-{i386,x86-64} -hda disk.img
|
||||
|
||||
Notes on using Grub2 for EFI-based platforms
|
||||
============================================
|
||||
Notes on using Grub2 for x86/x86_64 EFI-based platforms
|
||||
=======================================================
|
||||
|
||||
1. Create a disk image
|
||||
dd if=/dev/zero of=disk.img bs=1M count=32
|
||||
@@ -83,16 +83,108 @@ Notes on using Grub2 for EFI-based platforms
|
||||
sudo losetup -d /dev/loop0
|
||||
7. Your disk.img is ready!
|
||||
|
||||
To test your EFI image in Qemu
|
||||
------------------------------
|
||||
To test your i386/x86-64 EFI image in Qemu
|
||||
------------------------------------------
|
||||
|
||||
1. Download the EFI BIOS for Qemu
|
||||
Version IA32 or X64 depending on the chosen Grub2
|
||||
platform (i386-efi vs. x86-64-efi)
|
||||
http://sourceforge.net/projects/edk2/files/OVMF/
|
||||
https://www.kraxel.org/repos/jenkins/edk2/
|
||||
(or use one provided by your distribution as OVMF)
|
||||
2. Extract, and rename OVMF.fd to bios.bin and
|
||||
CirrusLogic5446.rom to vgabios-cirrus.bin.
|
||||
3. qemu-system-{i386,x86-64} -L ovmf-dir/ -hda disk.img
|
||||
4. Make sure to pass pci=nocrs to the kernel command line,
|
||||
to workaround a bug in the EFI BIOS regarding the
|
||||
EFI framebuffer.
|
||||
|
||||
Notes on using Grub2 for ARM u-boot-based platforms
|
||||
===================================================
|
||||
|
||||
The following steps show how to use the Grub2 arm-uboot platform
|
||||
support in the simplest way possible and with a single
|
||||
buildroot-generated filesystem.
|
||||
|
||||
1. Load qemu_arm_vexpress_defconfig
|
||||
|
||||
2. Enable u-boot with the vexpress_ca9x4 board name and with
|
||||
u-boot.elf image format.
|
||||
|
||||
3. Enable grub2 for the arm-uboot platform.
|
||||
|
||||
4. Enable "Install kernel image to /boot in target" in the kernel
|
||||
menu to populate a /boot directory with zImage in it.
|
||||
|
||||
5. The upstream u-boot vexpress_ca9x4 doesn't have CONFIG_API enabled
|
||||
by default, which is required.
|
||||
|
||||
Before building, patch u-boot (for example, make u-boot-extract to
|
||||
edit the source before building) file
|
||||
include/configs/vexpress_common.h to define:
|
||||
|
||||
#define CONFIG_API
|
||||
#define CONFIG_SYS_MMC_MAX_DEVICE 1
|
||||
|
||||
6. Create a custom grub2 config file with the following contents and
|
||||
set its path in BR2_TARGET_GRUB2_CFG:
|
||||
|
||||
set default="0"
|
||||
set timeout="5"
|
||||
|
||||
menuentry "Buildroot" {
|
||||
set root='(hd0)'
|
||||
linux /boot/zImage root=/dev/mmcblk0 console=ttyAMA0
|
||||
devicetree /boot/vexpress-v2p-ca9.dtb
|
||||
}
|
||||
|
||||
7. Create a custom builtin config file with the following contents
|
||||
and set its path in BR2_TARGET_GRUB2_BUILTIN_CONFIG:
|
||||
|
||||
set root=(hd0)
|
||||
set prefix=/boot/grub
|
||||
|
||||
8. Create a custom post-build script which copies files from
|
||||
${BINARIES_DIR}/boot-part to $(TARGET_DIR)/boot (set its path in
|
||||
BR2_ROOTFS_POST_BUILD_SCRIPT):
|
||||
|
||||
#!/bin/sh
|
||||
cp -r ${BINARIES_DIR}/boot-part/* ${TARGET_DIR}/boot/
|
||||
|
||||
9. make
|
||||
|
||||
10. Run qemu with:
|
||||
|
||||
qemu-system-arm -M vexpress-a9 -kernel output/images/u-boot -m 1024 \
|
||||
-nographic -sd output/images/rootfs.ext2
|
||||
|
||||
11. In u-boot, stop at the prompt and run grub2 with:
|
||||
|
||||
=> ext2load mmc 0:0 ${loadaddr} /boot/grub/grub.img
|
||||
=> bootm
|
||||
|
||||
12. This should bring the grub2 menu, upon which selecting the "Buildroot"
|
||||
entry should boot Linux.
|
||||
|
||||
|
||||
Notes on using Grub2 for Aarch64 EFI-based platforms
|
||||
====================================================
|
||||
|
||||
The following steps show how to use the Grub2 arm64-efi platform,
|
||||
using qemu and EFI firmware built for qemu.
|
||||
|
||||
1. Load aarch64_efi_defconfig
|
||||
|
||||
2. make
|
||||
|
||||
3. Download the EFI firmware for qemu aarch64
|
||||
https://www.kraxel.org/repos/jenkins/edk2/
|
||||
(or use one provided by your distribution as OVMF-aarch64 or AAVMF)
|
||||
|
||||
4. Run qemu with:
|
||||
|
||||
qemu-system-aarch64 -M virt -cpu cortex-a57 -m 512 -nographic \
|
||||
-bios <path/to/EDK2>/QEMU_EFI.fd -hda output/images/disk.img \
|
||||
-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
|
||||
|
||||
5. This should bring the grub2 menu, upon which selecting the
|
||||
"Buildroot" entry should boot Linux.
|
||||
|
||||
Reference in New Issue
Block a user