buildroot long term support release 2024.02.3

buildroot-2024.02.3.tar.gz

Signed-off-by: carbon <carbon@milkv.io>
This commit is contained in:
carbon
2024-06-14 22:30:26 +08:00
parent aac91c08cd
commit e42fe97d74
19479 changed files with 284259 additions and 232833 deletions

View File

@ -0,0 +1,28 @@
menu "Bootloaders"
source "boot/afboot-stm32/Config.in"
source "boot/at91bootstrap/Config.in"
source "boot/at91bootstrap3/Config.in"
source "boot/at91dataflashboot/Config.in"
source "boot/arm-trusted-firmware/Config.in"
source "boot/barebox/Config.in"
source "boot/beaglev-ddrinit/Config.in"
source "boot/beaglev-secondboot/Config.in"
source "boot/binaries-marvell/Config.in"
source "boot/boot-wrapper-aarch64/Config.in"
source "boot/edk2/Config.in"
source "boot/grub2/Config.in"
source "boot/mv-ddr-marvell/Config.in"
source "boot/mxs-bootlets/Config.in"
source "boot/optee-os/Config.in"
source "boot/opensbi/Config.in"
source "boot/s500-bootloader/Config.in"
source "boot/shim/Config.in"
source "boot/syslinux/Config.in"
source "boot/ti-k3-boot-firmware/Config.in"
source "boot/ti-k3-image-gen/Config.in"
source "boot/ti-k3-r5-loader/Config.in"
source "boot/uboot/Config.in"
source "boot/vexpress-firmware/Config.in"
endmenu

View File

@ -0,0 +1,46 @@
From 9901603e18524c4c52fd1dd47bda4ab4016628fc Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Thu, 10 Sep 2020 11:37:33 +0200
Subject: [PATCH] Pass -fno-builtin to fix build with gcc 10
gcc 10, if it recognizes some hand-written code that looks like
memcpy, will generate a call to memcpy().
For example:
while (dst < &_end_data) {
*dst++ = *src++;
}
gets recognized as such. However, in the context of bare-metal code,
having a call to memcpy() in the C library doesn't work. So we fix
that by disabling builtins.
Fixes:
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.o: in function `reset':
stm32f429i-disco.c:(.text.reset+0x1a): undefined reference to `memcpy'
/home/thomas/projets/buildroot/output/host/opt/ext-toolchain/bin/../arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: stm32f429i-disco.c:(.text.reset+0x34): undefined reference to `memset'
make[1]: *** [Makefile:26: stm32f429i-disco] Error 1
Upstream: https://github.com/mcoquelin-stm32/afboot-stm32/pull/11
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index f699176..1e8557d 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@ DTB_ADDR?=0x08004000
CFLAGS := -mthumb -mcpu=cortex-m4
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Os -std=gnu99 -Wall
+CFLAGS += -fno-builtin
LINKERFLAGS := -nostartfiles --gc-sections
obj-y += gpio.o mpu.o qspi.o start_kernel.o
--
2.35.1

View File

@ -0,0 +1,40 @@
From be760c062c5d05bd2223f3916afafd37120d3318 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Thu, 28 Apr 2022 22:47:09 +0200
Subject: [PATCH] Makefile: drop -nostartfiles
In commit 0f3e61c9dd48fd8b4248ce4672c044c2562e4de1 ("Use ld instead of
gcc for linking "), we started using ld instead of gcc for the link
step. This worked fine for a while, but recent versions of ld no
longer accept the -nostartfiles option, causing the build to break:
Error: unable to disambiguate: -nostartfiles (did you mean --nostartfiles ?)
In fact, -nostartfiles was passed to gcc prior to
0f3e61c9dd48fd8b4248ce4672c044c2562e4de1, but it is not a ld
option. It is only by luck that it was accepted and ignored by older
ld versions. Since this option is useless when calling ld directly, we
can simply drop it.
Upstream: https://github.com/mcoquelin-stm32/afboot-stm32/pull/11
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1e8557d..8f42be1 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ CFLAGS := -mthumb -mcpu=cortex-m4
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Os -std=gnu99 -Wall
CFLAGS += -fno-builtin
-LINKERFLAGS := -nostartfiles --gc-sections
+LINKERFLAGS := --gc-sections
obj-y += gpio.o mpu.o qspi.o start_kernel.o
obj-f4 += $(obj-y) usart-f4.o
--
2.35.1

View File

@ -0,0 +1,36 @@
From d65b07d6fe438e760fdbc33a8e42650a27d5b417 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 31 Dec 2022 11:09:38 +0100
Subject: [PATCH] Makefile: disable stack-protector
Disable stack-protector to avoid the following build failure:
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld -T stm32f429.lds --gc-sections -o stm32f469i-disco.elf stm32f469i-disco.o gpio.o mpu.o qspi.o start_kernel.o usart-f4.o
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.o: in function `main':
stm32f469i-disco.c:(.text.startup.main+0x3b0): undefined reference to `__stack_chk_guard'
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.c:(.text.startup.main+0x4c0): undefined reference to `__stack_chk_fail'
/home/autobuild/autobuild/instance-14/output-1/host/bin/arm-buildroot-linux-gnueabi-ld: stm32f469i-disco.c:(.text.startup.main+0x4ec): undefined reference to `__stack_chk_guard'
Fixes:
- http://autobuild.buildroot.org/results/fa6ffab24c3998f21034ab24e8d2852cacde08c1
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 8f42be1..8da7a25 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ CFLAGS := -mthumb -mcpu=cortex-m4
CFLAGS += -ffunction-sections -fdata-sections
CFLAGS += -Os -std=gnu99 -Wall
CFLAGS += -fno-builtin
+CFLAGS += -fno-stack-protector
LINKERFLAGS := --gc-sections
obj-y += gpio.o mpu.o qspi.o start_kernel.o
--
2.35.1

View File

@ -0,0 +1,27 @@
config BR2_TARGET_AFBOOT_STM32
bool "afboot-stm32"
depends on BR2_arm
help
afboot-stm32 is a very small bootloader for STM32 platforms
https://github.com/mcoquelin-stm32/afboot-stm32
if BR2_TARGET_AFBOOT_STM32
config BR2_TARGET_AFBOOT_STM32_KERNEL_ADDR
hex "Kernel load address"
default "0x08008000"
help
This is the physical address in your flash memory the kernel
will be linked for and stored to. This address is dependent on
your own flash usage.
config BR2_TARGET_AFBOOT_STM32_DTB_ADDR
hex "Device-tree load address"
default "0x08004000"
help
This is the physical address in your flash memory the
device-tree will be stored to. This address is dependent on
your own flash usage.
endif

View File

@ -0,0 +1,2 @@
# Locally calculated
sha256 2caacd302ab3ed5b70b3b93a6aef04162abf779c758a5be547be3ab01b68ca10 afboot-stm32-3566acd582e5536fb60864281788a30f5527df2d.tar.gz

View File

@ -0,0 +1,22 @@
################################################################################
#
# afboot-stm32
#
################################################################################
AFBOOT_STM32_VERSION = 3566acd582e5536fb60864281788a30f5527df2d
AFBOOT_STM32_SITE = $(call github,mcoquelin-stm32,afboot-stm32,$(AFBOOT_STM32_VERSION))
AFBOOT_STM32_INSTALL_IMAGES = YES
AFBOOT_STM32_INSTALL_TARGET = NO
define AFBOOT_STM32_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) all \
KERNEL_ADDR=$(BR2_TARGET_AFBOOT_STM32_KERNEL_ADDR) \
DTB_ADDR=$(BR2_TARGET_AFBOOT_STM32_DTB_ADDR)
endef
define AFBOOT_STM32_INSTALL_IMAGES_CMDS
$(INSTALL) -m 0755 -t $(BINARIES_DIR) -D $(@D)/stm32*.bin
endef
$(eval $(generic-package))

View File

@ -0,0 +1,270 @@
config BR2_TARGET_ARM_TRUSTED_FIRMWARE
bool "ARM Trusted Firmware (ATF)"
depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A)
help
Enable this option if you want to build the ATF for your ARM
based embedded device.
https://github.com/ARM-software/arm-trusted-firmware
if BR2_TARGET_ARM_TRUSTED_FIRMWARE
choice
prompt "ATF Version"
help
Select the specific ATF version you want to use
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION
bool "v2.10"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_LTS_2_8_VERSION
bool "latest lts-v2.8.x"
help
Select the latest LTS v2.8.x version available
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official versions
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
bool "Custom Git repository"
endchoice
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION
string "URL of custom ATF tarball"
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE
string "ATF version"
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION
string
default "v2.10" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION
default "lts-v2.8.13" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_LTS_2_8_VERSION
default "custom" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION \
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE \
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL
string "URL of custom repository"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION
string "Custom repository version"
help
Revision to use in the typical format used by Git
E.G. a sha id, a tag, ..
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM
string "ATF platform"
help
Target plaform to build for.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_TARGET_BOARD
string "ATF target board"
help
Target board to build for. In many cases, this can be left
empty.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH
string "Device Tree Source file paths"
help
Space-separated list of paths to device tree source files
that will be copied to fdts/ before starting the build.
To use this device tree source file, the ATF configuration
file must refer to it.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP
bool "Build FIP image"
help
This option enables building the FIP image (Firmware Image
Package). This is typically the image format used by
platforms were ATF encapsulates the second stage bootloader
(such as U-Boot).
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
bool "Build BL31 image"
help
This option enables building the BL31 image. This is
typically used on platforms where another bootloader (e.g
U-Boot) encapsulates ATF BL31.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT
bool "Build BL31 U-Boot image"
select BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31
help
Generates a U-Boot image named atf-uboot.ub containing
bl31.bin. This is used for example by the Xilinx version of
U-Boot SPL to load ATF on the ZynqMP SoC.
choice
prompt "BL32"
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_DEFAULT
help
Select BL32 stage for the trusted firmware
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_DEFAULT
bool "Default"
help
With this option selected, ATF will not use any BL32 stage,
unless if one is explicitly chosen using the SPD (for
AArch64) or AARCH32_SP (for AArch32) variables, which can be
passed through
BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
bool "OP-TEE OS"
depends on BR2_TARGET_OPTEE_OS
help
This option allows to embed OP-TEE OS as the BL32 part of
the ARM Trusted Firmware boot sequence.
endchoice
choice
prompt "BL33"
default BR2_TARGET_ARM_TRUSTED_FIRMWARE_NONE_AS_BL33
help
Select the image to include as BL33.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NONE_AS_BL33
bool "None"
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
bool "Barebox"
depends on BR2_TARGET_BAREBOX
help
This option allows to embed the Barebox generic BL33 image in
the ARM Trusted Firmware. It ensures that the Barebox package
gets built before ATF, and that the appropriate BL33
variable pointing to the generic bl33 image is passed
when building ATF.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
bool "U-Boot"
depends on BR2_TARGET_UBOOT
help
This option allows to embed u-boot.bin as the BL33 part of
the ARM Trusted Firmware. It ensures that the u-boot package
gets built before ATF, and that the appropriate BL33
variable pointing to u-boot.bin is passed when building ATF.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
bool "EDK2"
depends on BR2_TARGET_EDK2
help
This option allows to embed EDK2 as the BL33 part of
the ARM Trusted Firmware. It ensures that the EDK2 package
gets built before ATF, and that the appropriate BL33
variable pointing to the EDK2 is passed when building ATF.
Do not choose this option if you intend to build ATF and EDK2
for the 'qemu_sbsa' platform. In this case, due to the EDK2
build system, the dependency between ATF and EDK is reversed.
endchoice
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE
string "Barebox BL33 image name"
default "*-generic-bl33.img"
help
Name of the Barebox BL33 image to include in ATF, it must
have been installed to BINARIES_DIR by the Barebox package.
endif
if BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE
string "U-Boot BL33 image name"
default "u-boot.bin"
help
Name of the U-Boot BL33 image to include in ATF, it must
have been installed to BINARIES_DIR by the U-Boot package.
endif
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_RCW
bool "Include NXP RCW in BL2"
depends on BR2_PACKAGE_HOST_QORIQ_RCW
help
Include the NXP RCW (Reset Control Word) in BL2. See
package/qoriq-rcw/ for more details. This is mostly useful
on NXP LayerScape platforms.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS
string "Additional ATF make targets"
help
Additional targets for the ATF build
E.G. When using the QorIQ custom ATF repository from NXP,
the target 'pbl' can be used to build the pbl binary.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES
string "Additional ATF build variables"
help
Additional parameters for the ATF build
E.G. 'DEBUG=1 LOG_LEVEL=20'
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG
bool "Build in debug mode"
help
Enable this option to build ATF with DEBUG=1.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES
string "Binary boot images"
default "*.bin"
help
Names of generated image files that are installed in the
output images/ directory.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC
bool "Needs dtc"
select BR2_PACKAGE_HOST_DTC
help
Select this option if your ATF board configuration
requires the Device Tree compiler to be available.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN
bool "Needs arm-none-eabi toolchain"
depends on BR2_aarch64
depends on BR2_HOSTARCH = "x86_64"
help
Select this option if your ATF board configuration requires
an ARM32 bare metal toolchain to be available.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP
bool "Build with SSP"
depends on BR2_TOOLCHAIN_HAS_SSP
depends on !BR2_SSP_NONE
help
Say 'y' here if you want to build ATF with SSP.
Your board must have SSP support in ATF: it must have an
implementation for plat_get_stack_protector_canary().
If you say 'y', the SSP level will be the level selected
by the global SSP setting.
config BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL
string
default "default" if BR2_SSP_REGULAR
default "strong" if BR2_SSP_STRONG
default "all" if BR2_SSP_ALL
endif

View File

@ -0,0 +1,4 @@
# Locally calculated
sha256 2e18b881ada9198173238cca80086c787b1fa3f698944bde1743142823fc511c arm-trusted-firmware-v2.10.tar.gz
sha256 e55ae7105c996b60f748b2eb6adeaf5ac8946425e1d4294ecc1c56aebf435274 arm-trusted-firmware-lts-v2.8.13.tar.gz
sha256 130d0c6e5159fa454b1e969fd281fa1d388819aefb203f65dd282544b5ab7ba9 docs/license.rst

View File

@ -0,0 +1,230 @@
################################################################################
#
# arm-trusted-firmware
#
################################################################################
ARM_TRUSTED_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION))
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL),y)
# Handle custom ATF tarballs as specified by the configuration
ARM_TRUSTED_FIRMWARE_TARBALL = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION))
ARM_TRUSTED_FIRMWARE_SITE = $(patsubst %/,%,$(dir $(ARM_TRUSTED_FIRMWARE_TARBALL)))
ARM_TRUSTED_FIRMWARE_SOURCE = $(notdir $(ARM_TRUSTED_FIRMWARE_TARBALL))
else ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
ARM_TRUSTED_FIRMWARE_SITE = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL))
ARM_TRUSTED_FIRMWARE_SITE_METHOD = git
else
# Handle stable official ATF versions
ARM_TRUSTED_FIRMWARE_SITE = $(call github,ARM-software,arm-trusted-firmware,$(ARM_TRUSTED_FIRMWARE_VERSION))
# The licensing of custom or from-git versions is unknown.
# This is valid only for the latest (i.e. known) version.
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION),y)
ARM_TRUSTED_FIRMWARE_LICENSE = BSD-3-Clause
ARM_TRUSTED_FIRMWARE_LICENSE_FILES = docs/license.rst
endif
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE):$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION)$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL)$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y:y)
BR_NO_CHECK_HASH_FOR += $(ARM_TRUSTED_FIRMWARE_SOURCE)
endif
ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES = YES
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-dtc
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-arm-gnu-toolchain
endif
ARM_TRUSTED_FIRMWARE_PLATFORM = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM))
ARM_TRUSTED_FIRMWARE_TARGET_BOARD = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_TARGET_BOARD))
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_DEBUG),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += DEBUG=1
ifneq ($(ARM_TRUSTED_FIRMWARE_TARGET_BOARD),)
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)/debug
else
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/debug
endif
else
ifneq ($(ARM_TRUSTED_FIRMWARE_TARGET_BOARD),)
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD)/release
else
ARM_TRUSTED_FIRMWARE_IMG_DIR = $(@D)/build/$(ARM_TRUSTED_FIRMWARE_PLATFORM)/release
endif
endif
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
$(if $(VERBOSE),V=1) \
CROSS_COMPILE="$(TARGET_CROSS)" \
BUILD_STRING=$(ARM_TRUSTED_FIRMWARE_VERSION) \
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES)) \
PLAT=$(ARM_TRUSTED_FIRMWARE_PLATFORM) \
TARGET_BOARD=$(ARM_TRUSTED_FIRMWARE_TARGET_BOARD) \
HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)"
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
ENABLE_STACK_PROTECTOR=$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_SSP_LEVEL))
else
ARM_TRUSTED_FIRMWARE_CFLAGS += -fno-stack-protector
endif
ifeq ($(BR2_PIC_PIE),y)
ARM_TRUSTED_FIRMWARE_CFLAGS += -fno-PIE
endif
ARM_TRUSTED_FIRMWARE_MAKE_ENV += \
$(TARGET_MAKE_ENV) \
CFLAGS="$(ARM_TRUSTED_FIRMWARE_CFLAGS)"
ifeq ($(BR2_ARM_CPU_ARMV7A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=7
else ifeq ($(BR2_ARM_CPU_ARMV8A),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARM_ARCH_MAJOR=8
endif
ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch32
else ifeq ($(BR2_aarch64),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ARCH=aarch64
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += optee-os
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
BL32=$(BINARIES_DIR)/tee-header_v2.bin \
BL32_EXTRA1=$(BINARIES_DIR)/tee-pager_v2.bin \
BL32_EXTRA2=$(BINARIES_DIR)/tee-pageable_v2.bin
ifeq ($(BR2_aarch64),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SPD=opteed
endif
ifeq ($(BR2_arm),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee
endif
endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33),y)
ARM_TRUSTED_FIRMWARE_BAREBOX_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE))
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_BAREBOX_BIN)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += barebox
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2
# Since the flash device name vary between platforms, we use the variable
# provided by the EDK2 package for this. Using this variable here is OK
# as it will expand after all dependencies are resolved, inside _BUILD_CMDS.
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += \
BL33=$(BINARIES_DIR)/$(call qstrip,$(BR2_TARGET_EDK2_FD_NAME).fd)
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE))
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
endif
ifeq ($(BR2_TARGET_VEXPRESS_FIRMWARE),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += vexpress-firmware
endif
ifeq ($(BR2_TARGET_BINARIES_MARVELL),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += SCP_BL2=$(BINARIES_DIR)/scp-fw.bin
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += binaries-marvell
endif
ifeq ($(BR2_TARGET_MV_DDR_MARVELL),y)
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
endif
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS = all
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP),y)
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += fip
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-openssl
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_RCW),y)
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-qoriq-rcw
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += pbl
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += RCW=$(BINARIES_DIR)/PBL.bin
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31),y)
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += bl31
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT),y)
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_BUILD
# Get the entry point address from the elf.
BASE_ADDR=$$($(TARGET_READELF) -h $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31/bl31.elf | \
sed -r '/^ Entry point address:\s*(.*)/!d; s//\1/') && \
$(MKIMAGE) \
-A $(MKIMAGE_ARCH) -O arm-trusted-firmware -C none \
-a $${BASE_ADDR} -e $${BASE_ADDR} \
-d $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31.bin \
$(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub
endef
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL
$(INSTALL) -m 0644 $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/atf-uboot.ub \
$(BINARIES_DIR)/atf-uboot.ub
endef
ARM_TRUSTED_FIRMWARE_MAKE_OPTS += RESET_TO_BL31=1
ARM_TRUSTED_FIRMWARE_DEPENDENCIES += host-uboot-tools
endif
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
define ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL_ELF
$(INSTALL) -D -m 0644 $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/bl31/bl31.elf \
$(BINARIES_DIR)/bl31.elf
endef
endif
ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += \
$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS))
ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH))
define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
$(if $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH),
cp -f $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH) $(@D)/fdts/
)
$(ARM_TRUSTED_FIRMWARE_MAKE_ENV) $(MAKE) -C $(@D) \
$(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_BUILD)
endef
define ARM_TRUSTED_FIRMWARE_INSTALL_IMAGES_CMDS
$(foreach f,$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES)), \
cp -dpf $(ARM_TRUSTED_FIRMWARE_IMG_DIR)/$(f) $(BINARIES_DIR)/
)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL)
$(ARM_TRUSTED_FIRMWARE_BL31_UBOOT_INSTALL_ELF)
endef
# Configuration check
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE)$(BR_BUILDING),yy)
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION)),)
$(error No tarball location specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION)
endif
endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)),)
$(error No repository specified. Please check BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL)
endif
endif
endif
$(eval $(generic-package))

View File

@ -0,0 +1,77 @@
From aa57ce632c629fe72ff417e261e0f5bfd8db6bab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@arm.com>
Date: Tue, 4 Jul 2023 16:14:02 +0200
Subject: [PATCH] build(tools): avoid unnecessary link
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In their respective makefiles, cert_create, encrypt_fw and fiptool
depend on the --openssl phony target as a prerequisite. This forces
those tools to be re-linked each time.
Move the dependencies on the --openssl target from the tools to their
makefiles all targets, to avoid unnecessary linking while preserving the
OpenSSL version printing done in the --openssl targets when in debug.
Fixes: cf2dd17ddda2 ("refactor(security): add OpenSSL 1.x compatibility")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Change-Id: I98a3ab30f36dffc253cecaaf3a57d2712522135d
Upstream: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=aa57ce632c629fe72ff417e261e0f5bfd8db6bab
---
tools/cert_create/Makefile | 4 ++--
tools/encrypt_fw/Makefile | 4 ++--
tools/fiptool/Makefile | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile
index 042e844626..b911d19d2b 100644
--- a/tools/cert_create/Makefile
+++ b/tools/cert_create/Makefile
@@ -85,9 +85,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
const char platform_msg[] = "${PLAT_MSG}";' | \
diff --git a/tools/encrypt_fw/Makefile b/tools/encrypt_fw/Makefile
index 2939b142be..924e5febab 100644
--- a/tools/encrypt_fw/Makefile
+++ b/tools/encrypt_fw/Makefile
@@ -65,9 +65,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__;' | \
${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index 2ebee33931..4bdebd9235 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -68,9 +68,9 @@ DEPS := $(patsubst %.o,%.d,$(OBJECTS))
.PHONY: all clean distclean --openssl
-all: ${PROJECT}
+all: --openssl ${PROJECT}
-${PROJECT}: --openssl ${OBJECTS} Makefile
+${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
@${ECHO_BLANK_LINE}
--
2.25.1

View File

@ -0,0 +1,59 @@
From 5e1beb793c06352e87c46eca1144ff1fe8555103 Mon Sep 17 00:00:00 2001
From: Heiko Thiery <heiko.thiery@gmail.com>
Date: Mon, 10 Jul 2023 10:43:03 +0200
Subject: [PATCH] [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 721246d51..5893cf422 100644
--- a/Makefile
+++ b/Makefile
@@ -297,11 +297,16 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
TF_LDFLAGS += --remove --info=unused,unusedsymbols
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
endif
TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH))
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,61 @@
From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
From: Marco Felsch <m.felsch@pengutronix.de>
Date: Wed, 9 Nov 2022 12:59:09 +0100
Subject: [PATCH] feat(build): add support for new binutils versions
Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
of a new warning when linking the bl*.elf in the form:
ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
These new warnings are enbaled by default to secure elf binaries:
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
- https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
Fix it in a similar way to what the Linux kernel does, see:
https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/
Following the reasoning there, we set "-z noexecstack" for all linkers
(although LLVM's LLD defaults to it) and optional add
--no-warn-rwx-segments since this a ld.bfd related.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
---
Makefile | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1ddb7b844..470956b19 100644
--- a/Makefile
+++ b/Makefile
@@ -416,6 +416,8 @@ endif
GCC_V_OUTPUT := $(shell $(CC) -v 2>&1)
+TF_LDFLAGS += -z noexecstack
+
# LD = armlink
ifneq ($(findstring armlink,$(notdir $(LD))),)
TF_LDFLAGS += --diag_error=warning --lto_level=O1
@@ -442,7 +444,10 @@ TF_LDFLAGS += $(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
# LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
else
-TF_LDFLAGS += --fatal-warnings -O1
+# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
+# are not loaded by a elf loader.
+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments)
+TF_LDFLAGS += -O1
TF_LDFLAGS += --gc-sections
# ld.lld doesn't recognize the errata flags,
# therefore don't add those in that case
--
2.30.2

View File

@ -0,0 +1,77 @@
From aa57ce632c629fe72ff417e261e0f5bfd8db6bab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@arm.com>
Date: Tue, 4 Jul 2023 16:14:02 +0200
Subject: [PATCH] build(tools): avoid unnecessary link
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In their respective makefiles, cert_create, encrypt_fw and fiptool
depend on the --openssl phony target as a prerequisite. This forces
those tools to be re-linked each time.
Move the dependencies on the --openssl target from the tools to their
makefiles all targets, to avoid unnecessary linking while preserving the
OpenSSL version printing done in the --openssl targets when in debug.
Fixes: cf2dd17ddda2 ("refactor(security): add OpenSSL 1.x compatibility")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Change-Id: I98a3ab30f36dffc253cecaaf3a57d2712522135d
Upstream: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=aa57ce632c629fe72ff417e261e0f5bfd8db6bab
---
tools/cert_create/Makefile | 4 ++--
tools/encrypt_fw/Makefile | 4 ++--
tools/fiptool/Makefile | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile
index 042e844626..b911d19d2b 100644
--- a/tools/cert_create/Makefile
+++ b/tools/cert_create/Makefile
@@ -85,9 +85,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
const char platform_msg[] = "${PLAT_MSG}";' | \
diff --git a/tools/encrypt_fw/Makefile b/tools/encrypt_fw/Makefile
index 2939b142be..924e5febab 100644
--- a/tools/encrypt_fw/Makefile
+++ b/tools/encrypt_fw/Makefile
@@ -65,9 +65,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__;' | \
${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index 2ebee33931..4bdebd9235 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -68,9 +68,9 @@ DEPS := $(patsubst %.o,%.d,$(OBJECTS))
.PHONY: all clean distclean --openssl
-all: ${PROJECT}
+all: --openssl ${PROJECT}
-${PROJECT}: --openssl ${OBJECTS} Makefile
+${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
@${ECHO_BLANK_LINE}
--
2.25.1

View File

@ -0,0 +1,77 @@
From aa57ce632c629fe72ff417e261e0f5bfd8db6bab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vincent=20Stehl=C3=A9?= <vincent.stehle@arm.com>
Date: Tue, 4 Jul 2023 16:14:02 +0200
Subject: [PATCH] build(tools): avoid unnecessary link
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In their respective makefiles, cert_create, encrypt_fw and fiptool
depend on the --openssl phony target as a prerequisite. This forces
those tools to be re-linked each time.
Move the dependencies on the --openssl target from the tools to their
makefiles all targets, to avoid unnecessary linking while preserving the
OpenSSL version printing done in the --openssl targets when in debug.
Fixes: cf2dd17ddda2 ("refactor(security): add OpenSSL 1.x compatibility")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Change-Id: I98a3ab30f36dffc253cecaaf3a57d2712522135d
Upstream: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=aa57ce632c629fe72ff417e261e0f5bfd8db6bab
---
tools/cert_create/Makefile | 4 ++--
tools/encrypt_fw/Makefile | 4 ++--
tools/fiptool/Makefile | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile
index 042e844626..b911d19d2b 100644
--- a/tools/cert_create/Makefile
+++ b/tools/cert_create/Makefile
@@ -85,9 +85,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \
const char platform_msg[] = "${PLAT_MSG}";' | \
diff --git a/tools/encrypt_fw/Makefile b/tools/encrypt_fw/Makefile
index 2939b142be..924e5febab 100644
--- a/tools/encrypt_fw/Makefile
+++ b/tools/encrypt_fw/Makefile
@@ -65,9 +65,9 @@ HOSTCC ?= gcc
.PHONY: all clean realclean --openssl
-all: ${BINARY}
+all: --openssl ${BINARY}
-${BINARY}: --openssl ${OBJECTS} Makefile
+${BINARY}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__;' | \
${HOSTCC} -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index 2ebee33931..4bdebd9235 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -68,9 +68,9 @@ DEPS := $(patsubst %.o,%.d,$(OBJECTS))
.PHONY: all clean distclean --openssl
-all: ${PROJECT}
+all: --openssl ${PROJECT}
-${PROJECT}: --openssl ${OBJECTS} Makefile
+${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
${Q}${HOSTCC} ${OBJECTS} -o $@ ${LDLIBS}
@${ECHO_BLANK_LINE}
--
2.25.1

View File

@ -0,0 +1,334 @@
When using an EABI toolchain, the default compilation generates
references to __aeabi_unwind_cpp_pr0(). This symbol is defined in
libgcc, but we don't want to use it for a bootloader.
Therefore, this patch passes some additional CFLAGS to disable the
generation of such references by avoiding unwind tables, exceptions,
etc.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
board/at91cap9adk/dataflash/Makefile | 2 +-
board/at91cap9adk/norflash/Makefile | 2 +-
board/at91cap9stk/nandflash/Makefile | 2 +-
board/at91sam9260ek/dataflash/Makefile | 2 +-
board/at91sam9260ek/nandflash/Makefile | 2 +-
board/at91sam9261ek/dataflash/Makefile | 2 +-
board/at91sam9261ek/nandflash/Makefile | 2 +-
board/at91sam9263ek/dataflash/Makefile | 2 +-
board/at91sam9263ek/nandflash/Makefile | 2 +-
board/at91sam9g10ek/dataflash/Makefile | 2 +-
board/at91sam9g10ek/nandflash/Makefile | 2 +-
board/at91sam9g20ek/dataflash/Makefile | 2 +-
board/at91sam9g20ek/nandflash/Makefile | 2 +-
board/at91sam9g45ekes/nandflash/Makefile | 2 +-
board/at91sam9m10ekes/dataflash/Makefile | 2 +-
board/at91sam9m10ekes/nandflash/Makefile | 2 +-
board/at91sam9m10g45ek/dataflash/Makefile | 2 +-
board/at91sam9m10g45ek/nandflash/Makefile | 2 +-
board/at91sam9rlek/dataflash/Makefile | 2 +-
board/at91sam9rlek/nandflash/Makefile | 2 +-
board/at91sam9xeek/dataflash/Makefile | 2 +-
board/at91sam9xeek/nandflash/Makefile | 2 +-
lib/Makefile | 2 +-
23 files changed, 23 insertions(+), 23 deletions(-)
Index: Bootstrap-v1.16/board/at91cap9adk/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91cap9adk/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91cap9adk/dataflash/Makefile
@@ -34,7 +34,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91cap9adk/norflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91cap9adk/norflash/Makefile
+++ Bootstrap-v1.16/board/at91cap9adk/norflash/Makefile
@@ -34,7 +34,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91cap9stk/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91cap9stk/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91cap9stk/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -D$(BOARD) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
Index: Bootstrap-v1.16/board/at91sam9260ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9260ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9260ek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9260ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9260ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9260ek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9261ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9261ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9261ek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9261ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9261ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9261ek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9263ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9263ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9263ek/dataflash/Makefile
@@ -34,7 +34,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9263ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9263ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9263ek/nandflash/Makefile
@@ -33,7 +33,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -O0 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -O0 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9g10ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9g10ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9g10ek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9g10ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9g10ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9g10ek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9g20ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9g20ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9g20ek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9g20ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9g20ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9g20ek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9g45ekes/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9g45ekes/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9g45ekes/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9m10ekes/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9m10ekes/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9m10ekes/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9m10ekes/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9m10ekes/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9m10ekes/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9m10g45ek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9m10g45ek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9m10g45ek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9m10g45ek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9m10g45ek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9m10g45ek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -O2 -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -O2 -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9rlek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9rlek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9rlek/dataflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9rlek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9rlek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9rlek/nandflash/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9xeek/dataflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9xeek/dataflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9xeek/dataflash/Makefile
@@ -38,7 +38,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/board/at91sam9xeek/nandflash/Makefile
===================================================================
--- Bootstrap-v1.16.orig/board/at91sam9xeek/nandflash/Makefile
+++ Bootstrap-v1.16/board/at91sam9xeek/nandflash/Makefile
@@ -38,7 +38,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm9 -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm9 -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.
Index: Bootstrap-v1.16/lib/Makefile
===================================================================
--- Bootstrap-v1.16.orig/lib/Makefile
+++ Bootstrap-v1.16/lib/Makefile
@@ -37,7 +37,7 @@
SIZE=$(CROSS_COMPILE)size
OBJCOPY=$(CROSS_COMPILE)objcopy
OBJDUMP=$(CROSS_COMPILE)objdump
-CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL)
+CCFLAGS=-g -mcpu=arm926ej-s -Os -Wall -D$(TARGET) -I$(INCL) -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables
ASFLAGS=-g -mcpu=arm926ej-s -c -Os -Wall -D$(TARGET) -I$(INCL) -DTOP_OF_MEM=$(TOP_OF_MEMORY)
# Linker flags.

View File

@ -0,0 +1,29 @@
From b783d1f9bf985c0981e755bd2c13e091e9d6837f Mon Sep 17 00:00:00 2001
From: Gregory Hermant <gregory.hermant@calao-systems.com>
Date: Tue, 6 Nov 2012 09:38:50 +0100
Subject: [PATCH] at91bootstrap: fix overlap linker issue
The linker script of the at91bootstrap package has to be modified when
built from gcc-4.6.x version. Indeed a section named text.startup is
created and has to be added into the text section.
Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
---
elf32-littlearm.lds | 1 +
1 file changed, 1 insertion(+)
diff --git a/elf32-littlearm.lds b/elf32-littlearm.lds
index a33952f..4f3ba25 100644
--- a/elf32-littlearm.lds
+++ b/elf32-littlearm.lds
@@ -7,6 +7,7 @@ SECTIONS
.text : {
_stext = .;
*(.text)
+ *(.text*)
*(.rodata) /* read-only data (constants) */
*(.rodata*)
. = ALIGN(4);
--
1.7.9.5

View File

@ -0,0 +1,284 @@
From d4e4a1aad559e35d84b445d1379be94ad036984e Mon Sep 17 00:00:00 2001
From: Alexandre Belloni <alexandre.belloni@piout.net>
Date: Thu, 25 Oct 2012 22:57:14 +0200
Subject: [PATCH] u-boot relocation fix
Every AT91SAM plaforms were broken between 2010.12 and 2011.03 because
of the relocation changes.
We have to get JUMP_ADDR consistant with what is used by u-boot
(CONFIG_SYS_TEXT_BASE).
I didn't know what to do with at91sam9m10g45ek as it doesn't seems to be
converted yet. But anyway, that means that it is either not working or
doesn't care so changing it here shouldn't harm.
We also have to increase the IMG_SIZE as u-boot as grown larger than the
default value. As requested on the u-boot ML, we assume that it could
be up to 495kB big.
It means that now, you have to flash your kernel at 0x00084000 instead
of 0x00042000. And so you also have to load it from that adress from
u-boot.
Then, remember that you could decrease IMG_SIZE to boot faster.
Signed-off-by: Alexandre Belloni <alexandre.belloni@piout.net>
---
board/at91sam9260ek/dataflash/at91sam9260ek.h | 4 ++--
board/at91sam9260ek/nandflash/at91sam9260ek.h | 2 +-
board/at91sam9261ek/dataflash/at91sam9261ek.h | 4 ++--
board/at91sam9261ek/nandflash/at91sam9261ek.h | 2 +-
board/at91sam9263ek/dataflash/at91sam9263ek.h | 4 ++--
board/at91sam9263ek/nandflash/at91sam9263ek.h | 2 +-
board/at91sam9g10ek/dataflash/at91sam9g10ek.h | 4 ++--
board/at91sam9g10ek/nandflash/at91sam9g10ek.h | 2 +-
board/at91sam9g20ek/dataflash/at91sam9g20ek.h | 4 ++--
board/at91sam9g20ek/nandflash/at91sam9g20ek.h | 2 +-
board/at91sam9m10ekes/dataflash/at91sam9m10ekes.h | 2 +-
.../at91sam9m10g45ek/dataflash/at91sam9m10g45ek.h | 2 +-
board/at91sam9rlek/dataflash/at91sam9rlek.h | 4 ++--
board/at91sam9rlek/nandflash/at91sam9rlek.h | 2 +-
board/at91sam9xeek/dataflash/at91sam9xeek.h | 4 ++--
board/at91sam9xeek/nandflash/at91sam9xeek.h | 2 +-
16 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/board/at91sam9260ek/dataflash/at91sam9260ek.h b/board/at91sam9260ek/dataflash/at91sam9260ek.h
index 1834246..91081a1 100644
--- a/board/at91sam9260ek/dataflash/at91sam9260ek.h
+++ b/board/at91sam9260ek/dataflash/at91sam9260ek.h
@@ -74,10 +74,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS1_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x44B /* AT91SAM9260-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9260ek/nandflash/at91sam9260ek.h b/board/at91sam9260ek/nandflash/at91sam9260ek.h
index 2cac601..f8fdff2 100644
--- a/board/at91sam9260ek/nandflash/at91sam9260ek.h
+++ b/board/at91sam9260ek/nandflash/at91sam9260ek.h
@@ -92,7 +92,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 0x44B /* AT91SAM9260-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9261ek/dataflash/at91sam9261ek.h b/board/at91sam9261ek/dataflash/at91sam9261ek.h
index 8ce30e9..276ba3d 100644
--- a/board/at91sam9261ek/dataflash/at91sam9261ek.h
+++ b/board/at91sam9261ek/dataflash/at91sam9261ek.h
@@ -97,10 +97,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x350 /* AT91SAM9261-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9261ek/nandflash/at91sam9261ek.h b/board/at91sam9261ek/nandflash/at91sam9261ek.h
index badc3ac..e628c97 100644
--- a/board/at91sam9261ek/nandflash/at91sam9261ek.h
+++ b/board/at91sam9261ek/nandflash/at91sam9261ek.h
@@ -114,7 +114,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 0x350 /* AT91SAM9261-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9263ek/dataflash/at91sam9263ek.h b/board/at91sam9263ek/dataflash/at91sam9263ek.h
index 5c9da4b..870f9e2 100644
--- a/board/at91sam9263ek/dataflash/at91sam9263ek.h
+++ b/board/at91sam9263ek/dataflash/at91sam9263ek.h
@@ -96,10 +96,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x4B2 /* AT91SAM9263-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9263ek/nandflash/at91sam9263ek.h b/board/at91sam9263ek/nandflash/at91sam9263ek.h
index 505afc7..8ab4f46 100644
--- a/board/at91sam9263ek/nandflash/at91sam9263ek.h
+++ b/board/at91sam9263ek/nandflash/at91sam9263ek.h
@@ -108,7 +108,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 1202 /* AT91SAM9263-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9g10ek/dataflash/at91sam9g10ek.h b/board/at91sam9g10ek/dataflash/at91sam9g10ek.h
index b2faf44..f4f556b 100644
--- a/board/at91sam9g10ek/dataflash/at91sam9g10ek.h
+++ b/board/at91sam9g10ek/dataflash/at91sam9g10ek.h
@@ -98,10 +98,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x350 /* AT91SAM9261-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9g10ek/nandflash/at91sam9g10ek.h b/board/at91sam9g10ek/nandflash/at91sam9g10ek.h
index 66c40a3..6c3ecda 100644
--- a/board/at91sam9g10ek/nandflash/at91sam9g10ek.h
+++ b/board/at91sam9g10ek/nandflash/at91sam9g10ek.h
@@ -115,7 +115,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 0x350 /* AT91SAM9G10-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9g20ek/dataflash/at91sam9g20ek.h b/board/at91sam9g20ek/dataflash/at91sam9g20ek.h
index eea0439..7fc70d6 100644
--- a/board/at91sam9g20ek/dataflash/at91sam9g20ek.h
+++ b/board/at91sam9g20ek/dataflash/at91sam9g20ek.h
@@ -75,10 +75,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS1_DATAFLASH /* Boot on SPI NCS1 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x658 /* AT91SAM9G20-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9g20ek/nandflash/at91sam9g20ek.h b/board/at91sam9g20ek/nandflash/at91sam9g20ek.h
index 31bd499..e797e4d 100644
--- a/board/at91sam9g20ek/nandflash/at91sam9g20ek.h
+++ b/board/at91sam9g20ek/nandflash/at91sam9g20ek.h
@@ -93,7 +93,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 0x658 /* AT91SAM9G20-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9m10ekes/dataflash/at91sam9m10ekes.h b/board/at91sam9m10ekes/dataflash/at91sam9m10ekes.h
index a60fd41..5587a00 100644
--- a/board/at91sam9m10ekes/dataflash/at91sam9m10ekes.h
+++ b/board/at91sam9m10ekes/dataflash/at91sam9m10ekes.h
@@ -89,7 +89,7 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x9CD /* AT91SAM9M10-EKES */
#define JUMP_ADDR 0x73F00000 /* Final Jump Address */
diff --git a/board/at91sam9m10g45ek/dataflash/at91sam9m10g45ek.h b/board/at91sam9m10g45ek/dataflash/at91sam9m10g45ek.h
index 5c726b5..9090097 100644
--- a/board/at91sam9m10g45ek/dataflash/at91sam9m10g45ek.h
+++ b/board/at91sam9m10g45ek/dataflash/at91sam9m10g45ek.h
@@ -85,7 +85,7 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x726 /* AT91SAM9M10G45-EK */
#define JUMP_ADDR 0x73F00000 /* Final Jump Address */
diff --git a/board/at91sam9rlek/dataflash/at91sam9rlek.h b/board/at91sam9rlek/dataflash/at91sam9rlek.h
index 05c42dc..150f17e 100644
--- a/board/at91sam9rlek/dataflash/at91sam9rlek.h
+++ b/board/at91sam9rlek/dataflash/at91sam9rlek.h
@@ -89,10 +89,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS0_DATAFLASH /* Boot on SPI NCS0 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 1326 /* AT91SAM9RL-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9rlek/nandflash/at91sam9rlek.h b/board/at91sam9rlek/nandflash/at91sam9rlek.h
index 656b4ba..594db8f 100644
--- a/board/at91sam9rlek/nandflash/at91sam9rlek.h
+++ b/board/at91sam9rlek/nandflash/at91sam9rlek.h
@@ -112,7 +112,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 1326 /* AT91SAM9RL-EK */
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9xeek/dataflash/at91sam9xeek.h b/board/at91sam9xeek/dataflash/at91sam9xeek.h
index 27d1822..08e515d 100644
--- a/board/at91sam9xeek/dataflash/at91sam9xeek.h
+++ b/board/at91sam9xeek/dataflash/at91sam9xeek.h
@@ -74,10 +74,10 @@
#define AT91C_SPI_PCS_DATAFLASH AT91C_SPI_PCS1_DATAFLASH /* Boot on SPI NCS1 */
#define IMG_ADDRESS 0x8400 /* Image Address in DataFlash */
-#define IMG_SIZE 0x33900 /* Image Size in DataFlash */
+#define IMG_SIZE 0x7BC00 /* Image Size in DataFlash */
#define MACH_TYPE 0x44B /* AT91SAM9XE-EK same id as AT91SAM9260-EK*/
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
diff --git a/board/at91sam9xeek/nandflash/at91sam9xeek.h b/board/at91sam9xeek/nandflash/at91sam9xeek.h
index 5dbc63e..9fac7cb 100644
--- a/board/at91sam9xeek/nandflash/at91sam9xeek.h
+++ b/board/at91sam9xeek/nandflash/at91sam9xeek.h
@@ -94,7 +94,7 @@
#define IMG_SIZE 0x40000 /* Image Size in NandFlash */
#define MACH_TYPE 0x44B /* AT91SAM9XE-EK same id as AT91SAM9260-EK*/
-#define JUMP_ADDR 0x23F00000 /* Final Jump Address */
+#define JUMP_ADDR 0x21F00000 /* Final Jump Address */
/* ******************************************************************* */
/* Application Settings */
--
1.7.9.5

View File

@ -0,0 +1,49 @@
config BR2_TARGET_AT91BOOTSTRAP
bool "AT91 Bootstrap"
depends on BR2_arm926t
help
AT91Bootstrap is a first level bootloader for the Atmel AT91
devices. It integrates algorithms for:
- Device initialization such as clock configuration, PIO
settings...
- Peripheral drivers such as PIO, PMC or SDRAMC...
- Physical media algorithm such as DataFlash, NandFlash, NOR
Flash...
if BR2_TARGET_AT91BOOTSTRAP
config BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR
string "custom patch dir"
help
If your board requires custom patches, add the path to the
directory containing the patches here. The patches must be
named at91bootstrap-<version>-<something>.patch.
Most users may leave this empty
config BR2_TARGET_AT91BOOTSTRAP_BOARD
string "Bootstrap board"
default ""
help
This is used to do a make <board>_config
choice
prompt "Boot Memory"
default BR2_TARGET_AT91BOOTSTRAP_DATAFLASH
help
Select Chip for which AT91 bootstrap should be built
config BR2_TARGET_AT91BOOTSTRAP_DATAFLASH
bool "Data Flash"
config BR2_TARGET_AT91BOOTSTRAP_NANDFLASH
bool "NAND Flash"
endchoice
config BR2_TARGET_AT91BOOTSTRAP_MEMORY
string
default "dataflash" if BR2_TARGET_AT91BOOTSTRAP_DATAFLASH
default "nandflash" if BR2_TARGET_AT91BOOTSTRAP_NANDFLASH
endif

View File

@ -0,0 +1,3 @@
# locally computed
sha256 d66192a274247f4baa39fa932eadf903d7add55641d89d30402f967c4f2282a5 AT91Bootstrap1.16.zip
sha256 6a3ac5dfcf19e6bac1b1109d30d72818768a3855e2594b84fe2b012b5fe0e77b include/sdramc.h

View File

@ -0,0 +1,55 @@
################################################################################
#
# at91bootstrap
#
################################################################################
AT91BOOTSTRAP_VERSION = 1.16
AT91BOOTSTRAP_SITE = ftp://www.at91.com/pub/at91bootstrap
AT91BOOTSTRAP_SOURCE = AT91Bootstrap$(AT91BOOTSTRAP_VERSION).zip
AT91BOOTSTRAP_LICENSE = BSD-Source-Code
AT91BOOTSTRAP_LICENSE_FILES = include/sdramc.h
AT91BOOTSTRAP_BOARD = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP_BOARD))
AT91BOOTSTRAP_MEMORY = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP_MEMORY))
AT91BOOTSTRAP_MAKE_SUBDIR = board/$(AT91BOOTSTRAP_BOARD)/$(AT91BOOTSTRAP_MEMORY)
AT91BOOTSTRAP_BINARY = $(AT91BOOTSTRAP_MAKE_SUBDIR)/$(AT91BOOTSTRAP_MEMORY)_$(AT91BOOTSTRAP_BOARD).bin
AT91BOOTSTRAP_INSTALL_IMAGES = YES
AT91BOOTSTRAP_INSTALL_TARGET = NO
define AT91BOOTSTRAP_EXTRACT_CMDS
$(UNZIP) -d $(BUILD_DIR) $(AT91BOOTSTRAP_DL_DIR)/$(AT91BOOTSTRAP_SOURCE)
mv $(BUILD_DIR)/Bootstrap-v$(AT91BOOTSTRAP_VERSION)/* $(@D)
rmdir $(BUILD_DIR)/Bootstrap-v$(AT91BOOTSTRAP_VERSION)
endef
ifneq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR)),)
define AT91BOOTSTRAP_APPLY_CUSTOM_PATCHES
$(APPLY_PATCHES) $(@D) $(BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR) \*.patch
endef
AT91BOOTSTRAP_POST_PATCH_HOOKS += AT91BOOTSTRAP_APPLY_CUSTOM_PATCHES
endif
# The at91bootstrap Makefile doesn't support customizing
# CFLAGS/LDFLAGS, so we cheat and pass our custom flags through CC and
# LD.
define AT91BOOTSTRAP_BUILD_CMDS
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) \
CC="$(TARGET_CC) -fno-stack-protector" \
LD="$(TARGET_CC) -fno-PIE" \
-C $(@D)/$(AT91BOOTSTRAP_MAKE_SUBDIR)
endef
define AT91BOOTSTRAP_INSTALL_IMAGES_CMDS
cp $(@D)/$(AT91BOOTSTRAP_BINARY) $(BINARIES_DIR)
endef
$(eval $(generic-package))
ifeq ($(BR2_TARGET_AT91BOOTSTRAP)$(BR_BUILDING),yy)
ifeq ($(AT91BOOTSTRAP_BOARD),)
$(error No AT91Bootstrap board name set. Check your BR2_TARGET_AT91BOOTSTRAP_BOARD setting)
endif
endif

View File

@ -0,0 +1,117 @@
config BR2_TARGET_AT91BOOTSTRAP3
bool "AT91 Bootstrap 3+"
depends on BR2_arm926t || BR2_cortex_a5 || BR2_cortex_a7
help
AT91Bootstrap is a first level bootloader for the Atmel AT91
devices. It integrates algorithms for:
- Device initialization such as clock configuration, PIO
settings...
- Peripheral drivers such as PIO, PMC or SDRAMC...
- Physical media algorithm such as DataFlash, NandFlash, NOR
Flash...
https://www.at91.com/linux4sam/bin/view/Linux4SAM/AT91Bootstrap
if BR2_TARGET_AT91BOOTSTRAP3
choice
prompt "AT91 Bootstrap 3+ version"
config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION
bool "4.0.0"
config BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X
bool "3.10.3"
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT
bool "Custom Git repository"
help
This option allows Buildroot to get the AT91 Bootstrap 3
source code from a Git repository.
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_SVN
bool "Custom SVN repository"
help
This option allows Buildroot to get the AT91 Bootstrap 3
source code from a Subversion repository
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
bool "Custom tarball"
endchoice
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION
string "URL of custom AT91Bootstrap tarball"
depends on BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
if BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT || BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_SVN
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL
string "URL of custom repository"
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION
string "Custom repository version"
help
Revision to use in the typical format used by Git or SVN
E.G. a sha id, a tag, branch, ..
endif
config BR2_TARGET_AT91BOOTSTRAP3_VERSION
string
default "v4.0.0" if BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION
default "v3.10.3" if BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X
default BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION \
if BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT || BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_SVN
default "custom" if BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_PATCH_DIR
string "custom patch dir"
help
If your board requires custom patches, add the path to the
directory containing the patches here. The patches must be
named at91bootstrap3-<something>.patch.
Most users may leave this empty
#
# Configuration selection
#
choice
prompt "AT91 Bootstrap 3 configuration"
default BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG
config BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG
bool "Using a defconfig"
config BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG
bool "Using a custom config file"
endchoice
config BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG
string "Defconfig name"
depends on BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG
help
Name of the at91bootstrap3 defconfig file to use, without the
trailing _defconfig. The defconfig is located at
board/<processor>/<board>_defconfig in the at91bootstrap3
tree.
config BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG
help
Path to the at91bootstrap3 configuration file
config BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3
bool "needs host-python3"
help
Enable this option if the at91bootstrap build process needs
Python 3.x to be available on the host. This is needed in
some at91bootstrap configurations to use NAND/PMECC Python
scripts.
endif # BR2_TARGET_AT91BOOTSTRAP3

View File

@ -0,0 +1,4 @@
# Locally calculated
sha256 b6ae5bcaacc5a949f400182e036ae053049638444a3ba8b1dd154ec5f7898d8e at91bootstrap3-v3.10.3.tar.gz
sha256 08c5b95df28be7f2e0439fb2b77fe27524f97c499850641e4540c07ea0b2c25d at91bootstrap3-v4.0.0.tar.gz
sha256 5a3809b1c2ba13b7242572322951311c584419f1f8516f665d6c06f0668d78de LICENSES/MIT.txt

View File

@ -0,0 +1,109 @@
################################################################################
#
# at91bootstrap3
#
################################################################################
AT91BOOTSTRAP3_VERSION = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_VERSION))
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
AT91BOOTSTRAP3_TARBALL = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION))
AT91BOOTSTRAP3_SITE = $(patsubst %/,%,$(dir $(AT91BOOTSTRAP3_TARBALL)))
AT91BOOTSTRAP3_SOURCE = $(notdir $(AT91BOOTSTRAP3_TARBALL))
BR_NO_CHECK_HASH_FOR += $(AT91BOOTSTRAP3_SOURCE)
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT),y)
AT91BOOTSTRAP3_SITE = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL))
AT91BOOTSTRAP3_SITE_METHOD = git
BR_NO_CHECK_HASH_FOR += $(AT91BOOTSTRAP3_SOURCE)
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_SVN),y)
AT91BOOTSTRAP3_SITE = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL))
AT91BOOTSTRAP3_SITE_METHOD = svn
BR_NO_CHECK_HASH_FOR += $(AT91BOOTSTRAP3_SOURCE)
else
AT91BOOTSTRAP3_SITE = $(call github,linux4sam,at91bootstrap,$(AT91BOOTSTRAP3_VERSION))
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION),y)
AT91BOOTSTRAP3_LICENSE = MIT
AT91BOOTSTRAP3_LICENSE_FILES = LICENSES/MIT.txt
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X),y)
AT91BOOTSTRAP3_LICENSE = Atmel License
endif
AT91BOOTSTRAP3_CPE_ID_VENDOR = linux4sam
AT91BOOTSTRAP3_CPE_ID_PRODUCT = at91bootstrap
AT91BOOTSTRAP3_INSTALL_IMAGES = YES
AT91BOOTSTRAP3_INSTALL_TARGET = NO
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3),y)
AT91BOOTSTRAP3_DEPENDENCIES += host-python3
endif
AT91BOOTSTRAP3_CUSTOM_PATCH_DIR = \
$(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_PATCH_DIR))
AT91BOOTSTRAP3_MAKE_OPTS = CROSS_COMPILE=$(TARGET_CROSS) DESTDIR=$(BINARIES_DIR)
ifneq ($(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR),)
define AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES
$(APPLY_PATCHES) $(@D) $(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR) \*.patch
endef
AT91BOOTSTRAP3_POST_PATCH_HOOKS += AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES
endif
define AT91BOOTSTRAP3_BUILD_CMDS
$(MAKE) $(AT91BOOTSTRAP3_MAKE_OPTS) -C $(@D)
endef
define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
cp $(wildcard $(@D)/build/binaries/*.bin $(@D)/binaries/*.bin) $(BINARIES_DIR)
endef
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG),y)
AT91BOOTSTRAP3_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG))_defconfig
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG),y)
AT91BOOTSTRAP3_KCONFIG_FILE = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE))
endif
AT91BOOTSTRAP3_KCONFIG_EDITORS = menuconfig xconfig gconfig
AT91BOOTSTRAP3_KCONFIG_OPTS = $(AT91BOOTSTRAP3_MAKE_OPTS)
# Checks to give errors that the user can understand
# Must be before we call to kconfig-package
ifeq ($(BR_BUILDING),y)
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG),y)
# We must use the user-supplied kconfig value, because
# AT91BOOTSTRAP3_KCONFIG_DEFCONFIG will at least contain
# the trailing _defconfig
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG)),)
$(error No at91bootstrap3 defconfig name specified, check your BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG),y)
ifeq ($(AT91BOOTSTRAP3_KCONFIG_FILE),)
$(error No at91bootstrap3 configuration file specified, check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL)),)
$(error No custom at91bootstrap3 repository URL specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL setting)
endif
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION)),)
$(error No custom at91bootstrap3 repository version specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION)),)
$(error No custom AT91Bootstrap3 tarball specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION setting)
endif # qstrip BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION
endif # BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
endif # BR_BUILDING
$(eval $(kconfig-package))

View File

@ -0,0 +1,22 @@
Disable the automatic installation of at91dataflashboot since it tries
to install things to /tftpboot, which is not possible when not
building as root.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: at91dataflashboot-1.05/Makefile
===================================================================
--- at91dataflashboot-1.05.orig/Makefile
+++ at91dataflashboot-1.05/Makefile
@@ -40,7 +40,7 @@
I=config.h com.h dataflash.h embedded_services.h main.h stdio.h include/AT91RM9200.h include/lib_AT91RM9200.h
-all: clean $(BINNAME) $(LSSNAME) install
+all: clean $(BINNAME) $(LSSNAME)
$(SIZE) $(OUTNAME)
# C objects here

View File

@ -0,0 +1,43 @@
Get at91dataflashboot to build with EABI toolchains, by providing the
__aeabi_uidiv and __aeabi_uidivmod symbols. The code is based on
U-Boot's code.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
_udivsi3.S | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Index: DataflashBoot-1.05/_udivsi3.S
===================================================================
--- DataflashBoot-1.05.orig/_udivsi3.S
+++ DataflashBoot-1.05/_udivsi3.S
@@ -12,8 +12,11 @@
.text
.globl __udivsi3
.type __udivsi3 ,function
+ .globl __aeabi_uidiv
+ .type __aeabi_uidiv ,function
.align 0
__udivsi3 :
+ __aeabi_uidiv:
cmp divisor, #0
beq Ldiv0
mov curbit, #1
@@ -68,6 +71,17 @@
mov r0, #0 @ about as wrong as it could be
ldmia sp!, {pc}
.size __udivsi3 , . - __udivsi3
+
+.globl __aeabi_uidivmod
+__aeabi_uidivmod:
+
+ stmfd sp!, {r0, r1, ip, lr}
+ bl __aeabi_uidiv
+ ldmfd sp!, {r1, r2, ip, lr}
+ mul r3, r0, r2
+ sub r1, r1, r3
+ mov pc, lr
+
/* # 235 "libgcc1.S" */
/* # 320 "libgcc1.S" */
/* # 421 "libgcc1.S" */

View File

@ -0,0 +1,3 @@
config BR2_TARGET_AT91DATAFLASHBOOT
bool "AT91 DataFlashBoot"
depends on BR2_arm && BR2_arm926t

View File

@ -0,0 +1,2 @@
# locally computed
sha256 2cfeb6a9236e1a743c8010f05e504dbc92169ef42d9a6cf7948954a577bfc386 DataflashBoot-1.05.tar.bz2

View File

@ -0,0 +1,28 @@
################################################################################
#
# at91dataflashboot
#
################################################################################
AT91DATAFLASHBOOT_VERSION = 1.05
AT91DATAFLASHBOOT_SOURCE = DataflashBoot-$(AT91DATAFLASHBOOT_VERSION).tar.bz2
AT91DATAFLASHBOOT_SITE = ftp://www.at91.com/pub/buildroot
AT91DATAFLASHBOOT_INSTALL_TARGET = NO
AT91DATAFLASHBOOT_INSTALL_IMAGES = YES
AT91DATAFLASHBOOT_CFLAGS = $(TARGET_CFLAGS) -fno-stack-protector
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
AT91DATAFLASHBOOT_CFLAGS += -marm
endif
define AT91DATAFLASHBOOT_BUILD_CMDS
make -C $(@D) CROSS_COMPILE=$(TARGET_CROSS) \
CFLAGS="$(AT91DATAFLASHBOOT_CFLAGS)"
endef
define AT91DATAFLASHBOOT_INSTALL_IMAGES_CMDS
cp $(@D)/DataflashBoot-$(AT91DATAFLASHBOOT_VERSION).bin $(BINARIES_DIR)
endef
$(eval $(generic-package))

View File

@ -0,0 +1,97 @@
config BR2_TARGET_BAREBOX
bool "Barebox"
help
The Barebox bootloader, formerly known as U-Boot v2.
http://www.barebox.org
if BR2_TARGET_BAREBOX
choice
prompt "version"
help
Select the specific Barebox version you want to use
config BR2_TARGET_BAREBOX_LATEST_VERSION
bool "2022.12.0"
config BR2_TARGET_BAREBOX_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official versions
config BR2_TARGET_BAREBOX_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_BAREBOX_CUSTOM_GIT
bool "Custom Git repository"
endchoice
config BR2_TARGET_BAREBOX_CUSTOM_VERSION_VALUE
string "Barebox version"
depends on BR2_TARGET_BAREBOX_CUSTOM_VERSION
if BR2_TARGET_BAREBOX_CUSTOM_TARBALL
config BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION
string "URL of custom Barebox tarball"
endif
config BR2_TARGET_BAREBOX_VERSION
string
default "2022.12.0" if BR2_TARGET_BAREBOX_LATEST_VERSION
default BR2_TARGET_BAREBOX_CUSTOM_VERSION_VALUE if BR2_TARGET_BAREBOX_CUSTOM_VERSION
default "custom" if BR2_TARGET_BAREBOX_CUSTOM_TARBALL
default BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION if BR2_TARGET_BAREBOX_CUSTOM_GIT
config BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR
string "custom patch dir"
help
If your board requires custom patches, add the path to the
directory containing the patches here. The patches must be
named barebox-<version>-<something>.patch.
Most users may leave this empty
config BR2_TARGET_BAREBOX_NEEDS_OPENSSL
bool "Barebox needs OpenSSL"
help
Select this option if your Barebox board configuration
requires OpenSSL to be available on the host.
config BR2_TARGET_BAREBOX_NEEDS_LIBUSB
bool "Barebox needs LibUSB"
help
Select this option if your Barebox board configuration
requires libUSB to be available on the host.
if BR2_TARGET_BAREBOX_CUSTOM_GIT
config BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL
string "URL of custom Git repository"
config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION
string "Custom Git version"
endif
source "boot/barebox/barebox/Config.in"
menuconfig BR2_TARGET_BAREBOX_AUX
bool "Build barebox with an auxiliary config"
help
Build barebox with an auxiliary configuration.
Useful for building an SPL (Secondary Program Loader) in
addition to the traditional TPL (Tertiary Program Loader),
such as the X-Loader or MLO for Texas Instruments
processors.
if BR2_TARGET_BAREBOX_AUX
source "boot/barebox/barebox-aux/Config.in"
endif
endif

View File

@ -0,0 +1,80 @@
choice
prompt "Barebox configuration"
default BR2_TARGET_BAREBOX_AUX_USE_DEFCONFIG
config BR2_TARGET_BAREBOX_AUX_USE_DEFCONFIG
bool "Using a defconfig"
config BR2_TARGET_BAREBOX_AUX_USE_CUSTOM_CONFIG
bool "Using a custom config file"
endchoice
config BR2_TARGET_BAREBOX_AUX_BOARD_DEFCONFIG
string "board defconfig"
depends on BR2_TARGET_BAREBOX_AUX_USE_DEFCONFIG
help
Name of the board for which Barebox should be built, without
the _defconfig suffix.
config BR2_TARGET_BAREBOX_AUX_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_BAREBOX_AUX_USE_CUSTOM_CONFIG
help
Path to the barebox configuration file
config BR2_TARGET_BAREBOX_AUX_CONFIG_FRAGMENT_FILES
string "Additional configuration fragment files"
help
A space-separated list of configuration fragment files,
that will be merged to the main Barebox configuration file.
config BR2_TARGET_BAREBOX_AUX_IMAGE_FILE
string "Image file names"
help
Space-separated list of barebox images which will be copied to
the images directory.
If left empty, defaults to:
- all images as listed in barebox-flash-images (>= v2015.12.0)
- the image pointed at by barebox-flash-image (>= v2012.10.0)
- barebox.bin for even older barebox versions
In any case, this only influences the artifacts collected by
Buildroot. They will still need to be referenced from image
packages or flashed separately onto the hardware.
config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV
bool "Generate an environment image"
help
Generate a custom environment image. This environment will
contain the variables and scripts to be used at boot by
barebox.
config BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV_PATH
string "Environment path"
depends on BR2_TARGET_BAREBOX_AUX_CUSTOM_ENV
help
Path to the directory containing the custom barebox
environment. Depending on your setup, it will probably be
based on either the content of the defaultenv or
defaultenv-2 directories in the barebox source code, plus
the additions needed. The output will be an image in the
barebox devfs format, stored in the images directory, with
the same name as the directory name given here.
config BR2_TARGET_BAREBOX_AUX_CUSTOM_EMBEDDED_ENV_PATH
string "Embedded environment path"
help
If this option is not empty, it is the path to a custom
embedded barebox environment. This image will be used when
the environment found in the environment sector is
invalid. This option sets the barebox Kconfig option
CONFIG_DEFAULT_ENVIRONMENT_PATH to the specified path. This
way it is possible to use Buildroot variables like
TOPDIR etc. to refer to the custom environment.
Depending on your setup, the custom embedded environment
will probably be based on either the content of the
defaultenv or defaultenv-2 directories in the barebox source
code.

View File

@ -0,0 +1 @@
../barebox.hash

View File

@ -0,0 +1,8 @@
################################################################################
#
# barebox-aux
#
################################################################################
# Instantiate the auxiliary barebox package
$(eval $(barebox-package))

View File

@ -0,0 +1,8 @@
# From https://www.barebox.org/download/barebox-2022.12.0.tar.bz2.md5
md5 e4bf25cbf1e0b0c9a67ee56214617b9c barebox-2022.12.0.tar.bz2
# Locally calculated
sha256 9f570d4ae089560bd6c17b2b7d21cdb6557ecb00612c77ecee72ac47575a6b74 barebox-2022.12.0.tar.bz2
# License files, locally computed
sha256 ab1122aa9f9073ad1ec824edcd970b16a6a7881a34a18fd56c080debb2dca5d4 COPYING

View File

@ -0,0 +1,201 @@
################################################################################
#
# barebox
#
################################################################################
################################################################################
# inner-barebox-package -- generates the KConfig logic and make targets needed
# to support a barebox package. All barebox packages are built from the same
# source (origin, version and patches). The remainder of the package
# configuration is unique to each barebox package.
#
# argument 1 is the uppercase package name (used for variable name-space)
################################################################################
define inner-barebox-package
$(1)_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL),y)
# Handle custom Barebox tarballs as specified by the configuration
$(1)_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
$(1)_SITE = $$(patsubst %/,%,$$(dir $$($(1)_TARBALL)))
$(1)_SOURCE = $$(notdir $$($(1)_TARBALL))
else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
$(1)_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
$(1)_SITE_METHOD = git
# Override the default value of _SOURCE to 'barebox-*' so that it is not
# downloaded a second time for barebox-aux; also alows avoiding the hash
# check:
$(1)_SOURCE = barebox-$$($(1)_VERSION)$$(BR_FMT_VERSION_git).tar.gz
else
# Handle stable official Barebox versions
$(1)_SOURCE = barebox-$$($(1)_VERSION).tar.bz2
$(1)_SITE = https://www.barebox.org/download
endif
$(1)_DL_SUBDIR = barebox
$(1)_DEPENDENCIES = host-lzop
$(1)_LICENSE = GPL-2.0 with exceptions
ifeq ($(BR2_TARGET_BAREBOX_LATEST_VERSION),y)
$(1)_LICENSE_FILES = COPYING
endif
ifeq ($(BR2_TARGET_BAREBOX_NEEDS_OPENSSL),y)
BAREBOX_DEPENDENCIES += host-openssl host-pkgconf
endif
ifeq ($(BR2_TARGET_BAREBOX_NEEDS_LIBUSB),y)
BAREBOX_DEPENDENCIES += host-libusb host-pkgconf
endif
$(1)_CUSTOM_EMBEDDED_ENV_PATH = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH))
ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
define $(1)_APPLY_CUSTOM_PATCHES
$$(APPLY_PATCHES) $$(@D) \
$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
endef
$(1)_POST_PATCH_HOOKS += $(1)_APPLY_CUSTOM_PATCHES
endif
$(1)_INSTALL_IMAGES = YES
ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
$(1)_INSTALL_TARGET = NO
endif
ifeq ($$(NORMALIZED_ARCH),i386)
$(1)_ARCH = x86
else ifeq ($$(NORMALIZED_ARCH),x86_64)
$(1)_ARCH = x86
else ifeq ($$(NORMALIZED_ARCH),powerpc)
$(1)_ARCH = ppc
else ifeq ($$(NORMALIZED_ARCH),arm64)
$(1)_ARCH = arm
else
$(1)_ARCH = $$(NORMALIZED_ARCH)
endif
$(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
$(1)_MAKE_ENV = $$(TARGET_MAKE_ENV)
$(1)_MAKE_ENV += \
PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
PKG_CONFIG_SYSROOT_DIR="/" \
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig"
ifeq ($$(BR2_REPRODUCIBLE),y)
$(1)_MAKE_ENV += \
KBUILD_BUILD_USER=buildroot \
KBUILD_BUILD_HOST=buildroot \
KBUILD_BUILD_TIMESTAMP="$$(shell LC_ALL=C TZ='UTC' date -d @$(SOURCE_DATE_EPOCH))"
endif
ifeq ($$(BR2_TARGET_$(1)_USE_DEFCONFIG),y)
$(1)_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))_defconfig
else ifeq ($$(BR2_TARGET_$(1)_USE_CUSTOM_CONFIG),y)
$(1)_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE))
endif
$(1)_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_CONFIG_FRAGMENT_FILES))
$(1)_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
$(1)_KCONFIG_OPTS = $$($(1)_MAKE_FLAGS)
$(1)_KCONFIG_DEPENDENCIES = \
$(BR2_BISON_HOST_DEPENDENCY) \
$(BR2_FLEX_HOST_DEPENDENCY)
ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
$(1)_ENV_NAME = $$(notdir $$(call qstrip,\
$$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
define $(1)_BUILD_CUSTOM_ENV
$$(@D)/scripts/bareboxenv -s \
$$(call qstrip, $$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)) \
$$(@D)/$$($(1)_ENV_NAME)
endef
define $(1)_INSTALL_CUSTOM_ENV
cp $$(@D)/$$($(1)_ENV_NAME) $$(BINARIES_DIR)
endef
endif
ifneq ($$($(1)_CUSTOM_EMBEDDED_ENV_PATH),)
define $(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH
$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT)
$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)")
endef
endif
define $(1)_KCONFIG_FIXUP_BAREBOXENV
$$(if $$(BR2_TARGET_$(1)_BAREBOXENV),\
$$(call KCONFIG_ENABLE_OPT,CONFIG_BAREBOXENV_TARGET),\
$$(call KCONFIG_DISABLE_OPT,CONFIG_BAREBOXENV_TARGET))
endef
define $(1)_KCONFIG_FIXUP_CMDS
$$($(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH)
$$($(1)_KCONFIG_FIXUP_BAREBOXENV)
endef
define $(1)_BUILD_CMDS
$$($(1)_BUILD_BAREBOXENV_CMDS)
$$($(1)_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
$$($(1)_BUILD_CUSTOM_ENV)
endef
$(1)_IMAGE_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_IMAGE_FILE))
define $(1)_INSTALL_IMAGES_CMDS
if test -n "$$($(1)_IMAGE_FILES)"; then \
cp -L $$(foreach image,$$($(1)_IMAGE_FILES),$$(@D)/$$(image)) $$(BINARIES_DIR) ; \
elif test -e $$(@D)/barebox-flash-images ; then \
cp -L $$(foreach image,$$(shell cat $$(@D)/barebox-flash-images),$$(@D)/$$(image)) $$(BINARIES_DIR) ; \
elif test -h $$(@D)/barebox-flash-image ; then \
cp -L $$(@D)/barebox-flash-image $$(BINARIES_DIR)/barebox.bin ; \
else \
cp $$(@D)/barebox.bin $$(BINARIES_DIR);\
fi
$$($(1)_INSTALL_CUSTOM_ENV)
endef
# Starting with barebox v2020.09.0, the kconfig used calls the
# cross-compiler to check its capabilities. So we need the
# toolchain before we can call the configurators.
$(1)_KCONFIG_DEPENDENCIES += toolchain
ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
define $(1)_INSTALL_TARGET_CMDS
cp $$(@D)/scripts/bareboxenv-target $$(TARGET_DIR)/usr/bin/bareboxenv
endef
endif
# Checks to give errors that the user can understand
# Must be before we call to kconfig-package
ifeq ($$(BR2_TARGET_$(1))$$(BR_BUILDING),yy)
# We must use the user-supplied kconfig value, because
# $(1)_KCONFIG_DEFCONFIG will at least contain the
# trailing _defconfig
ifeq ($$(or $$($(1)_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))),)
$$(error No Barebox config. Check your BR2_TARGET_$(1)_BOARD_DEFCONFIG or BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE settings)
endif
endif
$$(eval $$(kconfig-package))
endef
################################################################################
# barebox-package -- the target generator macro for barebox packages
################################################################################
barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
include boot/barebox/barebox/barebox.mk
include boot/barebox/barebox-aux/barebox-aux.mk
ifeq ($(BR2_TARGET_BAREBOX)$(BR2_TARGET_BAREBOX_LATEST_VERSION),y)
BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
endif

View File

@ -0,0 +1,85 @@
choice
prompt "Barebox configuration"
default BR2_TARGET_BAREBOX_USE_DEFCONFIG
config BR2_TARGET_BAREBOX_USE_DEFCONFIG
bool "Using a defconfig"
config BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG
bool "Using a custom config file"
endchoice
config BR2_TARGET_BAREBOX_BOARD_DEFCONFIG
string "board defconfig"
depends on BR2_TARGET_BAREBOX_USE_DEFCONFIG
help
Name of the board for which Barebox should be built, without
the _defconfig suffix.
config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_BAREBOX_USE_CUSTOM_CONFIG
help
Path to the barebox configuration file
config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
string "Additional configuration fragment files"
help
A space-separated list of configuration fragment files,
that will be merged to the main Barebox configuration file.
config BR2_TARGET_BAREBOX_IMAGE_FILE
string "Image file names"
help
Space-separated list of barebox images which will be copied to
the images directory.
If left empty, defaults to:
- all images as listed in barebox-flash-images (>= v2015.12.0)
- the image pointed at by barebox-flash-image (>= v2012.10.0)
- barebox.bin for even older barebox versions
In any case, this only influences the artifacts collected by
Buildroot. They will still need to be referenced from image
packages or flashed separately onto the hardware.
config BR2_TARGET_BAREBOX_BAREBOXENV
bool "bareboxenv tool in target"
help
Install bareboxenv tool in target.
config BR2_TARGET_BAREBOX_CUSTOM_ENV
bool "Generate an environment image"
help
Generate a custom environment image. This environment will
contain the variables and scripts to be used at boot by
barebox.
config BR2_TARGET_BAREBOX_CUSTOM_ENV_PATH
string "Environment path"
depends on BR2_TARGET_BAREBOX_CUSTOM_ENV
help
Path to the directory containing the custom barebox
environment. Depending on your setup, it will probably be
based on either the content of the defaultenv or
defaultenv-2 directories in the barebox source code, plus
the additions needed. The output will be an image in the
barebox devfs format, stored in the images directory, with
the same name as the directory name given here.
config BR2_TARGET_BAREBOX_CUSTOM_EMBEDDED_ENV_PATH
string "Embedded environment path"
help
If this option is not empty, it is the path to a custom
embedded barebox environment. This image will be used when
the environment found in the environment sector is
invalid. This option sets the barebox Kconfig option
CONFIG_DEFAULT_ENVIRONMENT_PATH to the specified path. This
way it is possible to use Buildroot variables like
TOPDIR etc. to refer to the custom environment.
Depending on your setup, the custom embedded environment
will probably be based on either the content of the
defaultenv or defaultenv-2 directories in the barebox source
code.

View File

@ -0,0 +1 @@
../barebox.hash

View File

@ -0,0 +1,8 @@
################################################################################
#
# barebox
#
################################################################################
# Instantiate the barebox package
$(eval $(barebox-package))

View File

@ -0,0 +1,9 @@
config BR2_TARGET_BEAGLEV_DDRINIT
bool "beaglev-ddrinit"
depends on BR2_riscv
depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
help
This package builds the DDRinit firmware used on the BeagleV
platform.
https://github.com/starfive-tech/beagle_ddrinit

View File

@ -0,0 +1,3 @@
# Locally computed
sha256 08a49355f89fc2cb4f5101183339c9c6f86b722545d0abbc319aab26a511dad7 beaglev-ddrinit-8d6318acfe71e790c983b34448c9abfcfcec3ed8.tar.gz
sha256 284d26192537710910ec1f112ec5f4c981601ae23702391986d6ce0b8ba90813 LICENSE

View File

@ -0,0 +1,28 @@
################################################################################
#
# beaglev-ddrinit
#
################################################################################
# Commit on the 'starfive' branch
BEAGLEV_DDRINIT_VERSION = 8d6318acfe71e790c983b34448c9abfcfcec3ed8
BEAGLEV_DDRINIT_SITE = $(call github,starfive-tech,beagle_ddrinit,$(BEAGLEV_DDRINIT_VERSION))
BEAGLEV_DDRINIT_INSTALL_TARGET = NO
BEAGLEV_DDRINIT_INSTALL_IMAGES = YES
BEAGLEV_DDRINIT_DEPENDENCIES = host-riscv64-elf-toolchain
BEAGLEV_DDRINIT_LICENSE = GPL-2.0+
BEAGLEV_DDRINIT_LICENSE_FILES = LICENSE
define BEAGLEV_DDRINIT_BUILD_CMDS
$(MAKE) -C $(@D)/build \
CROSS_COMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
SUFFIX=buildroot \
GIT_VERSION=$(BEAGLEV_DDRINIT_VERSION)
endef
define BEAGLEV_DDRINIT_INSTALL_IMAGES_CMDS
$(INSTALL) -D -m 0644 $(@D)/build/ddrinit-2133-buildroot.bin.out \
$(BINARIES_DIR)/ddrinit-2133-buildroot.bin.out
endef
$(eval $(generic-package))

View File

@ -0,0 +1,9 @@
config BR2_TARGET_BEAGLEV_SECONDBOOT
bool "beaglev-secondboot"
depends on BR2_riscv
depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain
help
This package builds the SecondBoot firmware used on the
BeagleV platform.
https://github.com/starfive-tech/beagle_secondBoot

View File

@ -0,0 +1,3 @@
# Locally computed
sha256 bf152500e9f7e467bb1dee95a2291f9ecfaaebe1d64b93f6d403cfaf50e540e0 beaglev-secondboot-e17302063c9a4b74475b18ff24dd149c27257354.tar.gz
sha256 284d26192537710910ec1f112ec5f4c981601ae23702391986d6ce0b8ba90813 LICENSE

View File

@ -0,0 +1,28 @@
################################################################################
#
# beaglev-secondboot
#
################################################################################
# Commit on the 'starfive' branch
BEAGLEV_SECONDBOOT_VERSION = e17302063c9a4b74475b18ff24dd149c27257354
BEAGLEV_SECONDBOOT_SITE = $(call github,starfive-tech,beagle_secondBoot,$(BEAGLEV_SECONDBOOT_VERSION))
BEAGLEV_SECONDBOOT_INSTALL_TARGET = NO
BEAGLEV_SECONDBOOT_INSTALL_IMAGES = YES
BEAGLEV_SECONDBOOT_DEPENDENCIES = host-riscv64-elf-toolchain
BEAGLEV_SECONDBOOT_LICENSE = GPL-2.0+
BEAGLEV_SECONDBOOT_LICENSE_FILES = LICENSE
define BEAGLEV_SECONDBOOT_BUILD_CMDS
$(MAKE) -C $(@D)/build \
CROSS_COMPILE=$(HOST_DIR)/bin/riscv64-unknown-elf- \
SUFFIX=buildroot \
GIT_VERSION=$(BEAGLEV_SECONDBOOT_VERSION)
endef
define BEAGLEV_SECONDBOOT_INSTALL_IMAGES_CMDS
$(INSTALL) -D -m 0644 $(@D)/build/bootloader-JH7100-buildroot.bin.out \
$(BINARIES_DIR)/bootloader-JH7100-buildroot.bin.out
endef
$(eval $(generic-package))

View File

@ -0,0 +1,12 @@
config BR2_TARGET_BINARIES_MARVELL
bool "binaries-marvell"
depends on BR2_aarch64
help
Some systems, including Marvell Armada SoC, have a separate
System Control Processor (SCP) for power management, clocks,
reset and system control. ATF Boot Loader stage 2 (BL2) loads
optional SCP_BL2 image into a platform-specific region
of secure memory. This package downloads and installs such
firmware, which is needed to build ATF.
https://github.com/MarvellEmbeddedProcessors/binaries-marvell/

View File

@ -0,0 +1,3 @@
# Locally calculated
sha256 d818c95bcd4d5c026238d6e554151184ed7fea15bce1f861f9068b97b4cd320a binaries-marvell-c5d3ef2b63ba66d8717ecbe679fd2e639cde88ee.tar.gz
sha256 e6d08ef60068ee72c68835001a24eb832dcba27cac0dde0f179dfb428be050ca README.md

View File

@ -0,0 +1,20 @@
################################################################################
#
# binaries-marvell
#
################################################################################
# This is version binaries-marvell-armada-18.12
BINARIES_MARVELL_VERSION = c5d3ef2b63ba66d8717ecbe679fd2e639cde88ee
BINARIES_MARVELL_SITE = $(call github,MarvellEmbeddedProcessors,binaries-marvell,$(BINARIES_MARVELL_VERSION))
BINARIES_MARVELL_LICENSE = GPL-2.0 with freertos-exception-2.0
BINARIES_MARVELL_LICENSE_FILES = README.md
BINARIES_MARVELL_INSTALL_IMAGES = YES
define BINARIES_MARVELL_INSTALL_IMAGES_CMDS
$(INSTALL) -D -m 0644 $(@D)/mrvl_scp_bl2.img $(BINARIES_DIR)/scp-fw.bin
endef
$(eval $(generic-package))

View File

@ -0,0 +1,46 @@
comment "boot-wrapper-aarch64 needs a Linux kernel to be built"
depends on BR2_aarch64
depends on !BR2_LINUX_KERNEL
config BR2_TARGET_BOOT_WRAPPER_AARCH64
bool "boot-wrapper-aarch64"
depends on BR2_aarch64
depends on BR2_LINUX_KERNEL
help
The boot-wrapper-aarch64 is a small bootloader that makes it
possible to start an Aarch64 kernel inside the available
software simulators for the Aarch64 architecture.
git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git
if BR2_TARGET_BOOT_WRAPPER_AARCH64
config BR2_TARGET_BOOT_WRAPPER_AARCH64_DTS
string "Device Tree Source name"
default ""
help
Name of the Device Tree Source file to use to generate the
Device Tree Blob that will be embedded in the image
generated by the boot wrapper. Valid names are the .dts
files from arch/arm64/boot/dts/ in the kernel source
tree. The name must be specified without the .dts suffix.
config BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS
string "Kernel bootargs"
default ""
help
Kernel bootargs to embed inside the image generated by the
boot wrapper.
config BR2_TARGET_BOOT_WRAPPER_AARCH64_PSCI
bool "Boot secondary SMP cores using PSCI"
help
Boot secondary SMP cores using PSCI firmware calls. If
disabled, the spin-table method is used instead.
config BR2_TARGET_BOOT_WRAPPER_AARCH64_GICV3
bool "Enable GICv3 instead of GICv2"
help
Boot using GICv3 instead of GICv2.
endif

View File

@ -0,0 +1,50 @@
################################################################################
#
# boot-wrapper-aarch64
#
################################################################################
BOOT_WRAPPER_AARCH64_VERSION = 9f26a1c1f27bd6b5b66c265114848007fc22e4aa
BOOT_WRAPPER_AARCH64_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git
BOOT_WRAPPER_AARCH64_SITE_METHOD = git
BOOT_WRAPPER_AARCH64_LICENSE = BSD-3-Clause
BOOT_WRAPPER_AARCH64_LICENSE_FILES = LICENSE.txt
BOOT_WRAPPER_AARCH64_DEPENDENCIES = linux
BOOT_WRAPPER_AARCH64_INSTALL_IMAGES = YES
# The Git repository does not have the generated configure script and
# Makefile.
BOOT_WRAPPER_AARCH64_AUTORECONF = YES
BOOT_WRAPPER_AARCH64_DTB = $(LINUX_DIR)/arch/arm64/boot/dts/$(basename $(call qstrip,$(BR2_TARGET_BOOT_WRAPPER_AARCH64_DTS))).dtb
BOOT_WRAPPER_AARCH64_CONF_OPTS = \
--with-kernel-dir=$(LINUX_DIR) \
--with-dtb=$(BOOT_WRAPPER_AARCH64_DTB) \
--with-cmdline=$(BR2_TARGET_BOOT_WRAPPER_AARCH64_BOOTARGS)
ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_PSCI),y)
BOOT_WRAPPER_AARCH64_CONF_OPTS += --enable-psci
else
BOOT_WRAPPER_AARCH64_CONF_OPTS += --disable-psci
endif
ifeq ($(BR2_TARGET_BOOT_WRAPPER_AARCH64_GICV3),y)
BOOT_WRAPPER_AARCH64_CONF_OPTS += --enable-gicv3
endif
# We need to convince the configure script that the Linux kernel tree
# exists, as well as the DTB and the kernel Image. Even though those
# are available on the build machine, the configure script uses
# AC_CHECK_FILE tests, which are always disabled in cross-compilation
# situations.
BOOT_WRAPPER_AARCH64_CONF_ENV = \
$(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR))=yes \
$(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR)$(BOOT_WRAPPER_AARCH64_DTB))=yes \
$(call AUTOCONF_AC_CHECK_FILE_VAL,$(LINUX_DIR)/arch/arm64/boot/Image)=yes
define BOOT_WRAPPER_AARCH64_INSTALL_IMAGES_CMDS
cp $(@D)/linux-system.axf $(BINARIES_DIR)
endef
$(eval $(autotools-package))

View File

@ -0,0 +1 @@
include $(sort $(wildcard boot/*/*.mk))

View File

@ -0,0 +1,150 @@
config BR2_TARGET_EDK2_ARCH_SUPPORTS
bool
default y if BR2_aarch64
default y if BR2_i386
default y if BR2_RISCV_64
default y if BR2_x86_64
config BR2_TARGET_EDK2
bool "EDK2"
depends on BR2_TARGET_EDK2_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
select BR2_PACKAGE_EDK2_PLATFORMS
help
EDK II is a modern, feature-rich, cross-platform firmware
development environment for the UEFI and PI specifications.
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II
if BR2_TARGET_EDK2
choice
prompt "Platform"
default BR2_TARGET_EDK2_PLATFORM_OVMF_I386 if BR2_i386
default BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV if BR2_RISCV_64
default BR2_TARGET_EDK2_PLATFORM_OVMF_X64 if BR2_x86_64
default BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU if BR2_aarch64
config BR2_TARGET_EDK2_PLATFORM_OVMF_I386
bool "i386"
depends on BR2_i386 || BR2_x86_64
help
Platform configuration for a generic i386 target.
This platform will boot from flash address 0x0.
It should therefore be used as the first bootloader.
config BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV
bool "RISC-V"
depends on BR2_RISCV_64
help
Platform configuration for RISC-V QEMU targeting the Virt
machine. This platform will only boot from flash address
0x0. It should therefore be used as the first bootloader.
config BR2_TARGET_EDK2_PLATFORM_OVMF_X64
bool "x86-64"
depends on BR2_x86_64
help
Platform configuration for a generic x86-64 target.
This platform will boot from flash address 0x0.
It should therefore be used as the first bootloader.
config BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU
bool "ARM Virt Qemu (flash)"
depends on BR2_aarch64
help
Platform configuration for QEMU targeting the Virt machine.
This platform will only boot from flash address 0x0.
It should therefore be used as the first bootloader.
config BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL
bool "ARM Virt Qemu (kernel)"
depends on BR2_aarch64
help
Platform configuration for QEMU targeting the Virt machine.
This platform can boot from either flash address 0x0 or via
the Linux boot protocol. It can therefore be loaded by a
previous bootloader like ARM Trusted Firmware or OP-TEE.
config BR2_TARGET_EDK2_PLATFORM_ARM_SGI575
bool "ARM SGI-575"
depends on BR2_aarch64
help
Platform configuration for ARM SGI-575 on ARM's
Fixed Virtual Platform (FVP).
config BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64
bool "ARM VExpress FVP Aarch64"
depends on BR2_aarch64
help
Platform configuration for ARM Versatile Express targeting
the Aarch64 Fixed Virtual Platform (FVP).
config BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX
bool "Socionext DeveloperBox"
depends on BR2_aarch64
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE
depends on !BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
select BR2_PACKAGE_HOST_DTC
select BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP
help
Platform configuration for Socionext SynQuacer DeveloperBox
(SC2A11).
comment "Socionext DeveloperBox depends on ATF not using EDK2 as BL33"
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
config BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN
bool "SolidRun MacchiatoBin"
depends on BR2_aarch64
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE
select BR2_PACKAGE_EDK2_NON_OSI
select BR2_PACKAGE_HOST_DTC
select BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP
help
Platform configuration for the SolidRun MacchiatoBin.
config BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA
bool "QEMU SBSA"
depends on BR2_aarch64
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE
depends on !BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
help
Platform configuration for QEMU targeting the SBSA reference
machine.
comment "QEMU SBSA depends on ATF not using EDK2 as BL33"
depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
endchoice
config BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL
bool "OVMF Debug on Serial"
depends on BR2_ENABLE_DEBUG
depends on BR2_TARGET_EDK2_PLATFORM_OVMF_I386 || \
BR2_TARGET_EDK2_PLATFORM_OVMF_X64
help
When EDK2 OVMF is built with debug, messages are printed to
IO port 0x402. Those messages are not shown in the normal
Qemu emulated serial port. Enabling this option will print
debug messages on the emulated serial port, potentially
mixing messages with UEFI serial console output.
See OVMF README:
https://github.com/tianocore/edk2/blob/master/OvmfPkg/README
config BR2_TARGET_EDK2_FD_NAME
string
default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_I386
default "OVMF" if BR2_TARGET_EDK2_PLATFORM_OVMF_X64
default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU
default "QEMU_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL
default "BL33_AP_UEFI" if BR2_TARGET_EDK2_PLATFORM_ARM_SGI575
default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64
default "FVP_AARCH64_EFI" if BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX
default "ARMADA_EFI" if BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN
endif
comment "EDK2 needs a toolchain w/ gcc >= 5"
depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5

View File

@ -0,0 +1,3 @@
# Locally calculated
sha256 9389ad20bc75f2a8fa9e7c1b1948ef07481c94e96dec57ae2f9f9be9c754f92c edk2-edk2-stable202308-br1.tar.gz
sha256 50ce20c9cfdb0e19ee34fe0a51fc0afe961f743697b068359ab2f862b494df80 License.txt

View File

@ -0,0 +1,187 @@
################################################################################
#
# edk2
#
################################################################################
EDK2_VERSION = edk2-stable202308
EDK2_SITE = https://github.com/tianocore/edk2
EDK2_SITE_METHOD = git
EDK2_LICENSE = BSD-2-Clause-Patent
EDK2_LICENSE_FILES = License.txt
EDK2_CPE_ID_VENDOR = tianocore
EDK2_DEPENDENCIES = edk2-platforms host-python3 host-acpica host-util-linux
EDK2_INSTALL_TARGET = NO
EDK2_INSTALL_IMAGES = YES
ifeq ($(BR2_ENABLE_DEBUG),y)
EDK2_BUILD_TYPE = DEBUG
ifeq ($(BR2_TARGET_EDK2_OVMF_DEBUG_ON_SERIAL),y)
# DEBUG_ON_SERIAL_PORT is only tested to be set, so don't disable it, as
# it would still be set.
EDK2_BUILD_OPTS += -DDEBUG_ON_SERIAL_PORT
endif
else
EDK2_BUILD_TYPE = RELEASE
# DEBUG_ON_SERIAL_PORT is only valid in debug builds, so useless to set
# it (enabled or disabled) on a relase build.
endif
# Build system notes.
#
# The EDK2 build system is rather unique, so here are a few useful notes.
#
# First, builds rely heavily on Git submodules to fetch various dependencies
# into specific directory structures. It might be possible to work around this
# and rely on Buildroot's infrastructure, but using Git submodules greatly
# simplifies this already complicated build system.
#
# Second, the build system is spread across various commands and stages.
# Therefore, all build variables needs to be exported to be available
# accordingly. The first stage will build $(@D)/BaseTools which contains
# various tools and scripts for the host.
#
# Third, where applicable, the dependency direction between EDK2 and
# ARM Trusted Firmware (ATF) will go in different direction for different
# platforms. Most commonly, ATF will depend on EDK2 via the BL33 payload.
# But for some platforms (e.g. QEMU SBSA or DeveloperBox) EDK2 will package
# the ATF images within its own build system. In such cases, intermediary
# "EDK2 packages" will be built in $(EDK2_BUILD_PACKAGES) in order for EDK2
# to be able to use them in subsequent build stages.
#
# For more information about the build setup:
# https://edk2-docs.gitbook.io/edk-ii-build-specification/4_edk_ii_build_process_overview
EDK2_GIT_SUBMODULES = YES
EDK2_BUILD_PACKAGES = $(@D)/Build/Buildroot
EDK2_PACKAGES_PATHS = $(@D) $(EDK2_BUILD_PACKAGES) $(STAGING_DIR)/usr/share/edk2-platforms
ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_I386),y)
EDK2_ARCH = IA32
EDK2_DEPENDENCIES += host-nasm
EDK2_PACKAGE_NAME = OvmfPkg
EDK2_PLATFORM_NAME = OvmfPkgIa32
EDK2_BUILD_DIR = OvmfIa32
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_X64),y)
EDK2_ARCH = X64
EDK2_DEPENDENCIES += host-nasm
EDK2_PACKAGE_NAME = OvmfPkg
EDK2_PLATFORM_NAME = OvmfPkgX64
EDK2_BUILD_DIR = OvmfX64
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU),y)
EDK2_ARCH = AARCH64
EDK2_PACKAGE_NAME = ArmVirtPkg
EDK2_PLATFORM_NAME = ArmVirtQemu
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL),y)
EDK2_ARCH = AARCH64
EDK2_PACKAGE_NAME = ArmVirtPkg
EDK2_PLATFORM_NAME = ArmVirtQemuKernel
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_SGI575),y)
EDK2_ARCH = AARCH64
EDK2_PACKAGE_NAME = Platform/ARM/SgiPkg/Sgi575
EDK2_PLATFORM_NAME = Sgi575
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64),y)
EDK2_ARCH = AARCH64
EDK2_PACKAGE_NAME = Platform/ARM/VExpressPkg
EDK2_PLATFORM_NAME = ArmVExpress-FVP-AArch64
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_SOCIONEXT_DEVELOPERBOX),y)
EDK2_ARCH = AARCH64
EDK2_DEPENDENCIES += host-dtc arm-trusted-firmware
EDK2_PACKAGE_NAME = Platform/Socionext/DeveloperBox
EDK2_PLATFORM_NAME = DeveloperBox
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
EDK2_BUILD_ENV += DTC_PREFIX=$(HOST_DIR)/bin/
EDK2_BUILD_OPTS += -D DO_X86EMU=TRUE
EDK2_PRE_BUILD_HOOKS += EDK2_PRE_BUILD_SOCIONEXT_DEVELOPERBOX
define EDK2_PRE_BUILD_SOCIONEXT_DEVELOPERBOX
mkdir -p $(EDK2_BUILD_PACKAGES)/Platform/Socionext/DeveloperBox
$(ARM_TRUSTED_FIRMWARE_DIR)/tools/fiptool/fiptool create \
--tb-fw $(BINARIES_DIR)/bl31.bin \
--soc-fw $(BINARIES_DIR)/bl31.bin \
--scp-fw $(BINARIES_DIR)/bl31.bin \
$(EDK2_BUILD_PACKAGES)/Platform/Socionext/DeveloperBox/fip_all_arm_tf.bin
endef
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN),y)
EDK2_ARCH = AARCH64
EDK2_DEPENDENCIES += host-dtc arm-trusted-firmware edk2-non-osi
EDK2_PACKAGE_NAME = Platform/SolidRun/Armada80x0McBin
EDK2_PLATFORM_NAME = Armada80x0McBin
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)
EDK2_BUILD_ENV += DTC_PREFIX=$(HOST_DIR)/bin/
EDK2_BUILD_OPTS += -D INCLUDE_TFTP_COMMAND
EDK2_PACKAGES_PATHS += $(STAGING_DIR)/usr/share/edk2-non-osi
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA),y)
EDK2_ARCH = AARCH64
EDK2_DEPENDENCIES += arm-trusted-firmware
EDK2_PACKAGE_NAME = Platform/Qemu/SbsaQemu
EDK2_PLATFORM_NAME = SbsaQemu
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
EDK2_PRE_BUILD_HOOKS += EDK2_PRE_BUILD_QEMU_SBSA
define EDK2_PRE_BUILD_QEMU_SBSA
mkdir -p $(EDK2_BUILD_PACKAGES)/Platform/Qemu/Sbsa
ln -srf $(BINARIES_DIR)/{bl1.bin,fip.bin} $(EDK2_BUILD_PACKAGES)/Platform/Qemu/Sbsa/
endef
else ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_RISCV),y)
EDK2_ARCH = RISCV64
EDK2_PACKAGE_NAME = OvmfPkg/RiscVVirt
EDK2_PLATFORM_NAME = RiscVVirtQemu
EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
endif
EDK2_BASETOOLS_OPTS = \
EXTRA_LDFLAGS="$(HOST_LDFLAGS)" \
EXTRA_OPTFLAGS="$(HOST_CPPFLAGS)"
EDK2_PACKAGES_PATH = $(subst $(space),:,$(strip $(EDK2_PACKAGES_PATHS)))
# EDK2 "build" script internally uses and calls "make", which controls
# its own flags. It is mainly tested while not being a sub-make. In
# order to stay in that configuration, we avoid leaking top-level
# Buildroot make flags into EDK2 build by clearing the MAKEFLAGS
# environment variable.
EDK2_BUILD_ENV += \
MAKEFLAGS= \
WORKSPACE=$(@D) \
PACKAGES_PATH=$(EDK2_PACKAGES_PATH) \
PYTHON_COMMAND=$(HOST_DIR)/bin/python3 \
IASL_PREFIX=$(HOST_DIR)/bin/ \
NASM_PREFIX=$(HOST_DIR)/bin/ \
GCC5_$(EDK2_ARCH)_PREFIX=$(TARGET_CROSS)
EDK2_BUILD_OPTS += \
-t GCC5 \
-n $(BR2_JLEVEL) \
-a $(EDK2_ARCH) \
-b $(EDK2_BUILD_TYPE) \
-p $(EDK2_PACKAGE_NAME)/$(EDK2_PLATFORM_NAME).dsc
define EDK2_BUILD_CMDS
mkdir -p $(EDK2_BUILD_PACKAGES)
export $(EDK2_BUILD_ENV) && \
unset ARCH && \
source $(@D)/edksetup.sh && \
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/BaseTools $(EDK2_BASETOOLS_OPTS) && \
build $(EDK2_BUILD_OPTS) all
endef
define EDK2_INSTALL_IMAGES_CMDS
cp -f $(@D)/Build/$(EDK2_BUILD_DIR)/$(EDK2_BUILD_TYPE)_GCC5/FV/*.fd $(BINARIES_DIR)
endef
$(eval $(generic-package))

View File

@ -0,0 +1,37 @@
From 4d4dae6a52b1749642261a15f5dcc1e3d4150b36 Mon Sep 17 00:00:00 2001
From: Julien Olivain <ju.o@free.fr>
Date: Fri, 22 Dec 2023 19:02:53 +0100
Subject: [PATCH] Add missing grub-core/extra_deps.lst file in release tarball
A file is missing in the grub-2.12 release tarballs (both .gz and .xz).
See [1]. The issue was reported in [2] and fixed upstream in [3].
This patch adds the missing file, on top of the release tarball. This
patch won't apply on upstream git, since the file is present in the
source repository. Since the issue is fixed upstream in [3], it is
expected upcoming releases tarballs will include the file.
The file content was fetched from the upstream git repo:
https://git.savannah.gnu.org/gitweb/?p=grub.git;a=blob_plain;f=grub-core/extra_deps.lst;hb=refs/tags/grub-2.12
[1] https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz
[2] https://lists.gnu.org/archive/html/grub-devel/2023-12/msg00054.html
[3] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
Signed-off-by: Julien Olivain <ju.o@free.fr>
Upstream: Fixed by: https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b835601c7639ed1890f2d3db91900a8506011a8e
---
grub-core/extra_deps.lst | 1 +
1 file changed, 1 insertion(+)
create mode 100644 grub-core/extra_deps.lst
diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
new file mode 100644
index 0000000..f44ad6a
--- /dev/null
+++ b/grub-core/extra_deps.lst
@@ -0,0 +1 @@
+depends bli part_gpt
--
2.43.0

View File

@ -0,0 +1,178 @@
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
default y if BR2_RISCV_64
depends on BR2_USE_MMU
config BR2_TARGET_GRUB2
bool "grub2"
depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS
depends on BR2_USE_WCHAR
select BR2_TARGET_GRUB2_I386_PC if \
!BR2_TARGET_GRUB2_HAS_PTF && \
(BR2_i386 || BR2_x86_64)
select BR2_TARGET_GRUB2_ARM_UBOOT if \
!BR2_TARGET_GRUB2_HAS_PTF && \
BR2_arm
select BR2_TARGET_GRUB2_ARM64_EFI if BR2_aarch64
help
GNU GRUB is a Multiboot boot loader. It was derived from
GRUB, the GRand Unified Bootloader, which was originally
designed and implemented by Erich Stefan Boleyn. GRUB 2 has
replaced what was formerly known as GRUB (i.e. version
0.9x), which has, in turn, become GRUB Legacy.
Amongst others, GRUB2 offers EFI support, which GRUB Legacy
doesn't provide.
The file boot/grub2/grub.cfg is used by default as the Grub
configuration file. It can be overridden using a rootfs
overlay or post-build script.
For additional notes on using Grub 2 with Buildroot, see
boot/grub2/readme.txt
http://www.gnu.org/software/grub/
if BR2_TARGET_GRUB2
config BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
bool
config BR2_TARGET_GRUB2_HAS_EFI_BOOT
bool
config BR2_TARGET_GRUB2_HAS_PTF
bool
config BR2_TARGET_GRUB2_I386_PC
bool "i386-pc"
depends on BR2_i386 || BR2_x86_64
select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
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
select BR2_TARGET_GRUB2_HAS_PTF
select BR2_TARGET_GRUB2_HAS_EFI_BOOT
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
bits EFI BIOS, and this option should be used in this case.
config BR2_TARGET_GRUB2_X86_64_EFI
bool "x86-64-efi"
depends on BR2_x86_64
select BR2_TARGET_GRUB2_HAS_PTF
select BR2_TARGET_GRUB2_HAS_EFI_BOOT
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
select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
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
select BR2_TARGET_GRUB2_HAS_PTF
select BR2_TARGET_GRUB2_HAS_EFI_BOOT
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
select BR2_TARGET_GRUB2_HAS_EFI_BOOT
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.
config BR2_TARGET_GRUB2_RISCV64_EFI
bool "riscv64-efi"
depends on BR2_RISCV_64
select BR2_TARGET_GRUB2_HAS_EFI_BOOT
help
Select this option if the platform you're targetting is a
64bit RISC-V platform and you want to boot Grub 2 as an EFI
application.
if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
comment "Options for the x86 legacy BIOS or ARM U-Boot support"
config BR2_TARGET_GRUB2_BOOT_PARTITION
string "boot partition"
default "hd0,msdos1"
help
Specify the partition where the /boot/grub/grub.cfg file is
located. Use 'hd0,msdos1' for the first partition of the
first disk if using a legacy partition table, or 'hd0,gpt1'
if using GPT partition table.
config BR2_TARGET_GRUB2_BUILTIN_MODULES_PC
string "builtin modules"
default BR2_TARGET_GRUB2_BUILTIN_MODULES if BR2_TARGET_GRUB2_BUILTIN_MODULES != "" # legacy
default "boot linux ext2 fat squash4 part_msdos part_gpt normal biosdisk" if BR2_TARGET_GRUB2_I386_PC
default "linux ext2 fat part_msdos normal" if BR2_TARGET_GRUB2_ARM_UBOOT
config BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC
string "builtin config"
default BR2_TARGET_GRUB2_BUILTIN_CONFIG if BR2_TARGET_GRUB2_BUILTIN_CONFIG != "" # legacy
help
Path to a Grub 2 configuration file that will be embedded
into the Grub image itself. This allows to set the root
device and other configuration parameters, but however menu
entries cannot be described in this embedded configuration.
endif # BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
if BR2_TARGET_GRUB2_HAS_EFI_BOOT
comment "Options for the EFI BIOS or ARM EFI support"
config BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI
string "builtin modules"
default BR2_TARGET_GRUB2_BUILTIN_MODULES if BR2_TARGET_GRUB2_BUILTIN_MODULES != "" # legacy
default "boot linux ext2 fat squash4 part_msdos part_gpt normal efi_gop"
config BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI
string "builtin config"
default BR2_TARGET_GRUB2_BUILTIN_CONFIG if BR2_TARGET_GRUB2_BUILTIN_CONFIG != "" # legacy
help
Path to a Grub 2 configuration file that will be embedded
into the Grub image itself. This allows to set the root
device and other configuration parameters, but however menu
entries cannot be described in this embedded configuration.
endif # BR2_TARGET_GRUB2_HAS_EFI_BOOT
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"
depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS
depends on !BR2_USE_WCHAR

View File

@ -0,0 +1,6 @@
set default="0"
set timeout="5"
menuentry "Buildroot" {
linux /boot/bzImage root=/dev/sda1 rootwait console=tty1
}

View File

@ -0,0 +1,5 @@
# Locally calculated after checking signature
# https://ftp.gnu.org/gnu/grub/grub-2.12.tar.xz.sig
sha256 f3c97391f7c4eaa677a78e090c7e97e6dc47b16f655f04683ebd37bef7fe0faa grub-2.12.tar.xz
# Locally computed:
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING

View File

@ -0,0 +1,197 @@
################################################################################
#
# grub2
#
################################################################################
GRUB2_VERSION = 2.12
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 host-gawk host-grub2
HOST_GRUB2_DEPENDENCIES = host-bison host-flex host-gawk
GRUB2_INSTALL_IMAGES = YES
# CVE-2019-14865 is about a flaw in the grub2-set-bootflag tool, which
# doesn't exist upstream, but is added by the Redhat/Fedora
# packaging. Not applicable to Buildroot.
GRUB2_IGNORE_CVES += CVE-2019-14865
# CVE-2020-15705 is related to a flaw in the use of the
# grub_linuxefi_secure_validate(), which was added by Debian/Ubuntu
# patches. The issue doesn't affect upstream Grub, and
# grub_linuxefi_secure_validate() is not implemented in the grub2
# version available in Buildroot.
GRUB2_IGNORE_CVES += CVE-2020-15705
# vulnerability is specific to the SUSE distribution
GRUB2_IGNORE_CVES += CVE-2021-46705
ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
GRUB2_INSTALL_TARGET = YES
else
GRUB2_INSTALL_TARGET = NO
endif
GRUB2_CPE_ID_VENDOR = gnu
GRUB2_BUILTIN_MODULES_PC = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_PC))
GRUB2_BUILTIN_MODULES_EFI = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI))
GRUB2_BUILTIN_CONFIG_PC = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC))
GRUB2_BUILTIN_CONFIG_EFI = $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI))
GRUB2_BOOT_PARTITION = $(call qstrip,$(BR2_TARGET_GRUB2_BOOT_PARTITION))
GRUB2_IMAGE_i386-pc = $(BINARIES_DIR)/grub.img
GRUB2_CFG_i386-pc = $(TARGET_DIR)/boot/grub/grub.cfg
GRUB2_PREFIX_i386-pc = ($(GRUB2_BOOT_PARTITION))/boot/grub
GRUB2_TARGET_i386-pc = i386
GRUB2_PLATFORM_i386-pc = pc
GRUB2_BUILTIN_CONFIG_i386-pc = $(GRUB2_BUILTIN_CONFIG_PC)
GRUB2_BUILTIN_MODULES_i386-pc = $(GRUB2_BUILTIN_MODULES_PC)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_I386_PC) += i386-pc
GRUB2_IMAGE_i386-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootia32.efi
GRUB2_CFG_i386-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
GRUB2_PREFIX_i386-efi = /EFI/BOOT
GRUB2_TARGET_i386-efi = i386
GRUB2_PLATFORM_i386-efi = efi
GRUB2_BUILTIN_CONFIG_i386-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
GRUB2_BUILTIN_MODULES_i386-efi = $(GRUB2_BUILTIN_MODULES_EFI)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_I386_EFI) += i386-efi
GRUB2_IMAGE_x86_64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootx64.efi
GRUB2_CFG_x86_64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
GRUB2_PREFIX_x86_64-efi = /EFI/BOOT
GRUB2_TARGET_x86_64-efi = x86_64
GRUB2_PLATFORM_x86_64-efi = efi
GRUB2_BUILTIN_CONFIG_x86_64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
GRUB2_BUILTIN_MODULES_x86_64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_X86_64_EFI) += x86_64-efi
GRUB2_IMAGE_arm-uboot = $(BINARIES_DIR)/boot-part/grub/grub.img
GRUB2_CFG_arm-uboot = $(BINARIES_DIR)/boot-part/grub/grub.cfg
GRUB2_PREFIX_arm-uboot = ($(GRUB2_BOOT_PARTITION))/boot/grub
GRUB2_TARGET_arm-uboot = arm
GRUB2_PLATFORM_arm-uboot = uboot
GRUB2_BUILTIN_CONFIG_arm-uboot = $(GRUB2_BUILTIN_CONFIG_PC)
GRUB2_BUILTIN_MODULES_arm-uboot = $(GRUB2_BUILTIN_MODULES_PC)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM_UBOOT) += arm-uboot
GRUB2_IMAGE_arm-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootarm.efi
GRUB2_CFG_arm-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
GRUB2_PREFIX_arm-efi = /EFI/BOOT
GRUB2_TARGET_arm-efi = arm
GRUB2_PLATFORM_arm-efi = efi
GRUB2_BUILTIN_CONFIG_arm-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
GRUB2_BUILTIN_MODULES_arm-efi = $(GRUB2_BUILTIN_MODULES_EFI)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM_EFI) += arm-efi
GRUB2_IMAGE_arm64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootaa64.efi
GRUB2_CFG_arm64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
GRUB2_PREFIX_arm64-efi = /EFI/BOOT
GRUB2_TARGET_arm64-efi = aarch64
GRUB2_PLATFORM_arm64-efi = efi
GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi
GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi
GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
GRUB2_PREFIX_riscv64-efi = /EFI/BOOT
GRUB2_TARGET_riscv64-efi = riscv64
GRUB2_PLATFORM_riscv64-efi = efi
GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
# Grub2 is kind of special: it considers CC, LD and so on to be the
# 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 = \
CPP="$(TARGET_CC) -E" \
TARGET_CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS) -Os" \
TARGET_CFLAGS="$(TARGET_CFLAGS) -Os" \
CPPFLAGS="$(TARGET_CPPFLAGS) -Os -fno-stack-protector" \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS) -Os -fno-stack-protector" \
TARGET_LDFLAGS="$(TARGET_LDFLAGS) -Os" \
TARGET_NM="$(TARGET_NM)" \
TARGET_OBJCOPY="$(TARGET_OBJCOPY)" \
TARGET_STRIP="$(TARGET_CROSS)strip"
HOST_GRUB2_CONF_OPTS = \
--with-platform=none \
--disable-grub-mkfont \
--enable-efiemu=no \
ac_cv_lib_lzma_lzma_code=no \
--enable-device-mapper=no \
--enable-libzfs=no \
--disable-werror
define GRUB2_CONFIGURE_CMDS
$(foreach tuple, $(GRUB2_TUPLES-y), \
@$(call MESSAGE,Configuring $(tuple))
mkdir -p $(@D)/build-$(tuple)
cd $(@D)/build-$(tuple) && \
$(TARGET_CONFIGURE_OPTS) \
$(TARGET_CONFIGURE_ARGS) \
$(GRUB2_CONF_ENV) \
../configure \
--target=$(GRUB2_TARGET_$(tuple)) \
--with-platform=$(GRUB2_PLATFORM_$(tuple)) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--prefix=/ \
--exec-prefix=/ \
--disable-grub-mkfont \
--enable-efiemu=no \
ac_cv_lib_lzma_lzma_code=no \
--enable-device-mapper=no \
--enable-libzfs=no \
--disable-werror
)
endef
define GRUB2_BUILD_CMDS
$(foreach tuple, $(GRUB2_TUPLES-y), \
@$(call MESSAGE,Building $(tuple))
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple)
)
endef
define GRUB2_INSTALL_IMAGES_CMDS
$(foreach tuple, $(GRUB2_TUPLES-y), \
@$(call MESSAGE,Installing $(tuple) to images directory)
mkdir -p $(dir $(GRUB2_IMAGE_$(tuple)))
$(HOST_DIR)/bin/grub-mkimage \
-d $(@D)/build-$(tuple)/grub-core/ \
-O $(tuple) \
-o $(GRUB2_IMAGE_$(tuple)) \
-p "$(GRUB2_PREFIX_$(tuple))" \
$(if $(GRUB2_BUILTIN_CONFIG_$(tuple)), \
-c $(GRUB2_BUILTIN_CONFIG_$(tuple))) \
$(GRUB2_BUILTIN_MODULES_$(tuple))
$(INSTALL) -D -m 0644 boot/grub2/grub.cfg $(GRUB2_CFG_$(tuple))
$(if $(findstring $(GRUB2_PLATFORM_$(tuple)), pc), \
cat $(@D)/build-$(tuple)/grub-core/cdboot.img $(GRUB2_IMAGE_$(tuple)) > \
$(BINARIES_DIR)/grub-eltorito.img
) \
)
endef
ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
define GRUB2_INSTALL_TARGET_CMDS
$(foreach tuple, $(GRUB2_TUPLES-y), \
@$(call MESSAGE,Installing $(tuple) to target directory)
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build-$(tuple) DESTDIR=$(TARGET_DIR) install
)
endef
endif
$(eval $(generic-package))
$(eval $(host-autotools-package))

View File

@ -0,0 +1,192 @@
Notes on using Grub2 for BIOS-based platforms
=============================================
1. Create a disk image
dd if=/dev/zero of=disk.img bs=1M count=32
2. Partition it (either legacy or GPT style partitions work)
cfdisk disk.img
- Create one partition, type Linux, for the root
filesystem. The only constraint is to make sure there
is enough free space *before* the first partition to
store Grub2. Leaving 1 MB of free space is safe.
3. Setup loop device and loop partitions
sudo losetup -f disk.img
sudo partx -a /dev/loop0
4. Prepare the root partition
sudo mkfs.ext3 -L root /dev/loop0p1
sudo mount /dev/loop0p1 /mnt
sudo tar -C /mnt -xf output/images/rootfs.tar
sudo umount /mnt
5. Install Grub2
sudo ./output/host/sbin/grub-bios-setup \
-b ./output/host/lib/grub/i386-pc/boot.img \
-c ./output/images/grub.img -d . /dev/loop0
6. Cleanup loop device
sudo partx -d /dev/loop0
sudo losetup -d /dev/loop0
7. Your disk.img is ready!
Using genimage
--------------
If you use genimage to generate your complete image,
installing Grub can be tricky. Here is how to achieve Grub's
installation with genimage:
partition boot {
in-partition-table = "no"
image = "path_to_boot.img"
offset = 0
size = 512
}
partition grub {
in-partition-table = "no"
image = "path_to_grub.img"
offset = 512
}
The result is not byte to byte identical to what
grub-bios-setup does but it works anyway.
To test your BIOS image in Qemu
-------------------------------
qemu-system-{i386,x86-64} -hda disk.img
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
2. Partition it with GPT partitions
cgdisk disk.img
- Create a first partition, type EF00, for the
bootloader and kernel image
- Create a second partition, type 8300, for the root
filesystem.
3. Setup loop device and loop partitions
sudo losetup -f disk.img
sudo partx -a /dev/loop0
4. Prepare the boot partition
sudo mkfs.vfat -n boot /dev/loop0p1
sudo mount /dev/loop0p1 /mnt
sudo cp -a output/images/efi-part/* /mnt/
sudo cp output/images/bzImage /mnt/
sudo umount /mnt
5. Prepare the root partition
sudo mkfs.ext3 -L root /dev/loop0p2
sudo mount /dev/loop0p2 /mnt
sudo tar -C /mnt -xf output/images/rootfs.tar
sudo umount /mnt
6 Cleanup loop device
sudo partx -d /dev/loop0
sudo losetup -d /dev/loop0
7. Your disk.img is ready!
To test your i386/x86-64 EFI image in Qemu
------------------------------------------
1. Download/install the EFI BIOS for Qemu
You can get it using the edk2 package in Buildroot (installed
in BINARIES_DIR), grab prebuilt images from the unofficial nightly
builds [0], or use one provided by your distribution as OVMF.
[0] https://github.com/retrage/edk2-nightly
2. qemu-system-{i386,x86-64} -bios <path-to-OVMF.fd> -hda disk.img
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
You can get it using the edk2 package in Buildroot (installed
in BINARIES_DIR), grab prebuilt images from the unofficial nightly
builds [1], or use one provided by your distribution as OVMF-aarch64
or AAVMF.
[1] https://github.com/retrage/edk2-nightly
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.

View File

@ -0,0 +1,49 @@
From 4796a1eacc6a5ccb623e7d2e46a5196f8335e496 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Fri, 11 Aug 2023 11:19:49 +0300
Subject: [PATCH] Allow access to low addresses with gcc 12
gcc 12 added a warning that triggers on access to low addresses. Add a
compile option that allows access to lower addresses.
Add the 'cc_option' macro to avoid the compile option when the compiler
does not support it.
This fixes build with TF-A. TF-A added a similar fix in commit
dea23e245fb89.
See some more details in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523
Upstream: https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/pull/42
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Makefile | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Makefile b/Makefile
index 3f0dd89a7381..045284c30cbc 100644
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,10 @@ MV_DDR_VER_CSRC = mv_ddr_build_message.c
# create mv_ddr build message and version string source file
$(shell $(MV_DDR_ROOT)/scripts/localversion.sh $(MV_DDR_ROOT) $(MV_DDR_VER_CSRC) 2> /dev/null)
+define cc_option
+ $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null >/dev/null 2>&1; then echo $(1); fi )
+endef
+
# ******************
# U-BOOT SPL SUPPORT
# ******************
@@ -331,6 +335,7 @@ OBJ_DIR ?= $(MV_DDR_ROOT)
CFLAGS = -DMV_DDR_ATF -DCONFIG_DDR4
CFLAGS += -Wall -Werror -Os -ffreestanding -mlittle-endian -g -gdwarf-2 -nostdinc
CFLAGS += -march=armv8-a -fpie
+CFLAGS += $(call cc_option, --param=min-pagesize=0)
# PLATFORM is set in ble/ble.mk
ifneq ($(findstring a80x0,$(PLATFORM)),)
--
2.40.1

View File

@ -0,0 +1,33 @@
From 53e34e3bff26fcbb7cc14178fa9fc80e7a73d556 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Tue, 11 Oct 2022 16:34:44 +0300
Subject: [PATCH] Makefile: disable stack protection
The Buildroot toolchain might enable stack protection by default. That
breaks linking because ATF does not provide the required __stack_chk
routines.
The mv-ddr-marvell Makefile provides no way to add custom CFLAGS. Patch
Makefile to disable stack protection.
Upstream: not applicable; Buildroot specific
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 045284c30cbc..9641354bcf86 100644
--- a/Makefile
+++ b/Makefile
@@ -336,6 +336,7 @@ CFLAGS = -DMV_DDR_ATF -DCONFIG_DDR4
CFLAGS += -Wall -Werror -Os -ffreestanding -mlittle-endian -g -gdwarf-2 -nostdinc
CFLAGS += -march=armv8-a -fpie
CFLAGS += $(call cc_option, --param=min-pagesize=0)
+CFLAGS += -fno-stack-protector
# PLATFORM is set in ble/ble.mk
ifneq ($(findstring a80x0,$(PLATFORM)),)
--
2.40.1

View File

@ -0,0 +1,10 @@
config BR2_TARGET_MV_DDR_MARVELL
bool "mv-ddr-marvell"
depends on BR2_aarch64
help
Marvell keeps algorithms for DDR training in a separate
repository. This code is not built separately, it is needed
as a dependency to build ATF firmware for Marvell Armada 7040
and 8040 SoCs.
https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell/

View File

@ -0,0 +1,3 @@
# Locally calculated
sha256 16f02232e21a15979b3d9971e28f7e59562484a5c1f99c2b28c248a3b76a63fa mv-ddr-marvell-d5acc10c287e40cc2feeb28710b92e45c93c702c.tar.gz
sha256 907a03943ca940790e97620aca8d46b5b04c653dcf2ab6c66a25238b60cf5635 ddr3_init.c

View File

@ -0,0 +1,13 @@
################################################################################
#
# mv-ddr-marvell
#
################################################################################
# This is the latest commit on mv-ddr-devel as of 20220529
MV_DDR_MARVELL_VERSION = d5acc10c287e40cc2feeb28710b92e45c93c702c
MV_DDR_MARVELL_SITE = $(call github,MarvellEmbeddedProcessors,mv-ddr-marvell,$(MV_DDR_MARVELL_VERSION))
MV_DDR_MARVELL_LICENSE = GPL-2.0+ or LGPL-2.1 with freertos-exception-2.0, BSD-3-Clause, Marvell Commercial
MV_DDR_MARVELL_LICENSE_FILES = ddr3_init.c
$(eval $(generic-package))

View File

@ -0,0 +1,92 @@
config BR2_TARGET_MXS_BOOTLETS
bool "mxs-bootlets"
depends on BR2_arm
depends on BR2_TARGET_BAREBOX || BR2_LINUX_KERNEL || \
BR2_TARGET_UBOOT
help
Stage1 bootloaders for Freescale iMX23/iMX28 SoCs
if BR2_TARGET_MXS_BOOTLETS
choice
prompt "Source"
default BR2_TARGET_MXS_BOOTLETS_FREESCALE
help
Select the location of the bootlets you want to use
config BR2_TARGET_MXS_BOOTLETS_FREESCALE
bool "Freescale 10.12.01 version"
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT
bool "Custom Git repository"
endchoice
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_TARBALL_URL
string "URL of custom bootlets tarball"
depends on BR2_TARGET_MXS_BOOTLETS_CUSTOM_TARBALL
if BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT_URL
string "URL of custom Git repository"
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT_VERSION
string "Custom Git version"
endif
choice
prompt "Bootstream"
help
Select which bootstream to generate
config BR2_TARGET_MXS_BOOTLETS_BAREBOX
bool "Barebox Bootloader"
depends on BR2_TARGET_BAREBOX
config BR2_TARGET_MXS_BOOTLETS_LINUX
bool "Linux Kernel"
depends on BR2_LINUX_KERNEL
config BR2_TARGET_MXS_BOOTLETS_UBOOT
bool "U-boot bootloader"
depends on BR2_TARGET_UBOOT
endchoice
config BR2_TARGET_MXS_BOOTLETS_HAS_IVT
bool "HAB Support"
help
Enable this option if you are building bootlets
for the iMX28 platform that needs to include instructions
for the secure boot mechanism present on these SoCs
choice
prompt "Board"
help
Select the board to build the bootlets for
config BR2_TARGET_MXS_BOOTLETS_STMP37xx
bool "Sigmatel ST-MP3-7xx Board"
config BR2_TARGET_MXS_BOOTLETS_STMP378x
bool "Sigmatel ST-MP3-78x Board"
config BR2_TARGET_MXS_BOOTLETS_IMX28EVK
bool "Freescale iMX28 EVK Board"
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_BOARD
bool "Custom board"
endchoice
config BR2_TARGET_MXS_BOOTLETS_CUSTOM_BOARD_NAME
string "Custom board name"
depends on BR2_TARGET_MXS_BOOTLETS_CUSTOM_BOARD
help
Name of the board to build the bootlets for
endif

View File

@ -0,0 +1,34 @@
// STMP378x ROM command script to load and run U-Boot
sources {
power_prep="./power_prep/power_prep";
sdram_prep="./boot_prep/boot_prep";
barebox="./barebox";
}
section (0) {
//----------------------------------------------------------
// Power Supply initialization
//----------------------------------------------------------
load power_prep;
load ivt (entry = power_prep:_start) > 0x8000;
hab call 0x8000;
//----------------------------------------------------------
// SDRAM initialization
//----------------------------------------------------------
load sdram_prep;
load ivt (entry = sdram_prep:_start) > 0x8000;
hab call 0x8000;
//----------------------------------------------------------
// Load and call u_boot - ELF ARM image
//----------------------------------------------------------
load barebox;
load ivt (entry = barebox:start) > 0x8000;
hab call 0x8000;
}

View File

@ -0,0 +1,2 @@
# locally computed
sha256 63f6068ae36884adef4259bbb1fe2591755718f22c46d0a59d854883dfab1ffc imx-bootlets-src-10.12.01.tar.gz

View File

@ -0,0 +1,106 @@
################################################################################
#
# mxs-bootlets
#
################################################################################
ifeq ($(BR2_TARGET_MXS_BOOTLETS_CUSTOM_TARBALL),y)
MXS_BOOTLETS_TARBALL = $(call qstrip,$(BR2_TARGET_MXS_BOOTLETS_CUSTOM_TARBALL_URL))
MXS_BOOTLETS_SITE = $(patsubst %/,%,$(dir $(MXS_BOOTLETS_TARBALL)))
MXS_BOOTLETS_SOURCE = $(notdir $(MXS_BOOTLETS_TARBALL))
BR_NO_CHECK_HASH_FOR += $(MXS_BOOTLETS_SOURCE)
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT),y)
MXS_BOOTLETS_SITE = $(BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT_URL)
MXS_BOOTLETS_SITE_METHOD = git
MXS_BOOTLETS_VERSION = $(call qstrip,$(BR2_TARGET_MXS_BOOTLETS_CUSTOM_GIT_VERSION))
BR_NO_CHECK_HASH_FOR += $(MXS_BOOTLETS_SOURCE)
else
MXS_BOOTLETS_VERSION = 10.12.01
MXS_BOOTLETS_SITE = http://download.ossystems.com.br/bsp/freescale/source
MXS_BOOTLETS_SOURCE = imx-bootlets-src-$(MXS_BOOTLETS_VERSION).tar.gz
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_STMP37xx),y)
MXS_BOOTLETS_BOARD = stmp37xx_dev
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_STMP378x),y)
MXS_BOOTLETS_BOARD = stmp378x_dev
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_IMX28EVK),y)
MXS_BOOTLETS_BOARD = iMX28_EVK
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_CUSTOM_BOARD),y)
MXS_BOOTLETS_BOARD = $(call qstrip,$(BR2_TARGET_MXS_BOOTLETS_CUSTOM_BOARD_NAME))
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_HAS_IVT),y)
MXS_BOOTLETS_IVT_SUFFIX = _ivt
MXS_BOOTLETS_ELFTOSB_OPTIONS += -f imx28
endif
MXS_BOOTLETS_DEPENDENCIES = host-elftosb
MXS_BOOTLETS_LICENSE = GPL-2.0+
ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y)
MXS_BOOTLETS_DEPENDENCIES += barebox
MXS_BOOTLETS_BOOTDESC = barebox$(MXS_BOOTLETS_IVT_SUFFIX).bd
MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_barebox$(MXS_BOOTLETS_IVT_SUFFIX).sb
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y)
MXS_BOOTLETS_DEPENDENCIES += linux
MXS_BOOTLETS_BOOTDESC = linux$(MXS_BOOTLETS_IVT_SUFFIX).bd
MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_linux$(MXS_BOOTLETS_IVT_SUFFIX).sb
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_UBOOT),y)
MXS_BOOTLETS_DEPENDENCIES += uboot
MXS_BOOTLETS_BOOTDESC = uboot$(MXS_BOOTLETS_IVT_SUFFIX).bd
MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_uboot$(MXS_BOOTLETS_IVT_SUFFIX).sb
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y)
define MXS_BOOTLETS_SED_BAREBOX
sed -i 's,[^ *]barebox.*;,\tbarebox="$(BAREBOX_DIR)/barebox";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y)
define MXS_BOOTLETS_BUILD_LINUX_PREP
BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
$(MAKE1) -C $(@D) linux_prep
endef
define MXS_BOOTLETS_SED_LINUX
sed -i 's,[^ *]linux_prep.*;,\tlinux_prep="$(@D)/linux_prep/output-target/linux_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/zImage";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_UBOOT),y)
define MXS_BOOTLETS_SED_UBOOT
sed -i 's,[^ *]u_boot.*;,\tu_boot="$(UBOOT_DIR)/u-boot";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
define MXS_BOOTLETS_INSTALL_BAREBOX_BOOTDESC
cp boot/mxs-bootlets/barebox_ivt.bd $(@D)/
endef
MXS_BOOTLETS_POST_EXTRACT_HOOKS += MXS_BOOTLETS_INSTALL_BAREBOX_BOOTDESC
define MXS_BOOTLETS_BUILD_CMDS
BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
$(MAKE1) -C $(@D) power_prep
BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
$(MAKE1) -C $(@D) boot_prep
$(MXS_BOOTLETS_BUILD_LINUX_PREP)
sed -i 's,[^ *]power_prep.*;,\tpower_prep="$(@D)/power_prep/power_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
sed -i 's,[^ *]sdram_prep.*;,\tsdram_prep="$(@D)/boot_prep/boot_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
$(MXS_BOOTLETS_SED_BAREBOX)
$(MXS_BOOTLETS_SED_LINUX)
$(MXS_BOOTLETS_SED_UBOOT)
$(HOST_DIR)/bin/elftosb $(MXS_BOOTLETS_ELFTOSB_OPTIONS) \
-z -c $(@D)/$(MXS_BOOTLETS_BOOTDESC) \
-o $(@D)/$(MXS_BOOTLETS_BOOTSTREAM)
endef
define MXS_BOOTLETS_INSTALL_TARGET_CMDS
cp $(@D)/$(MXS_BOOTLETS_BOOTSTREAM) $(BINARIES_DIR)/
endef
$(eval $(generic-package))

View File

@ -0,0 +1,128 @@
config BR2_TARGET_OPENSBI
bool "opensbi"
depends on BR2_riscv
help
OpenSBI aims to provide an open-source and extensible
implementation of the RISC-V SBI specification for a platform
specific firmware (M-mode) and a general purpose OS,
hypervisor or bootloader (S-mode or HS-mode). OpenSBI
implementation can be easily extended by RISC-V platform or
System-on-Chip vendors to fit a particular hadware
configuration.
https://github.com/riscv/opensbi.git
if BR2_TARGET_OPENSBI
choice
prompt "OpenSBI Version"
help
Select the specific OpenSBI version you want to use
config BR2_TARGET_OPENSBI_LATEST_VERSION
bool "1.3"
config BR2_TARGET_OPENSBI_CUSTOM_VERSION
bool "Custom version"
help
This option allows to use a specific official versions
config BR2_TARGET_OPENSBI_CUSTOM_TARBALL
bool "Custom tarball"
config BR2_TARGET_OPENSBI_CUSTOM_GIT
bool "Custom Git repository"
endchoice
config BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE
string "OpenSBI version"
depends on BR2_TARGET_OPENSBI_CUSTOM_VERSION
config BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION
string "URL of custom OpenSBI tarball"
depends on BR2_TARGET_OPENSBI_CUSTOM_TARBALL
if BR2_TARGET_OPENSBI_CUSTOM_GIT
config BR2_TARGET_OPENSBI_CUSTOM_REPO_URL
string "URL of custom repository"
config BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION
string "Custom repository version"
help
Revision to use in the typical format used by Git. E.G. a
sha id, a tag, branch, ..
endif
config BR2_TARGET_OPENSBI_VERSION
string
default "1.3" if BR2_TARGET_OPENSBI_LATEST_VERSION
default BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE \
if BR2_TARGET_OPENSBI_CUSTOM_VERSION
default "custom" if BR2_TARGET_OPENSBI_CUSTOM_TARBALL
default BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION \
if BR2_TARGET_OPENSBI_CUSTOM_GIT
config BR2_TARGET_OPENSBI_PLAT
string "OpenSBI Platform"
default ""
help
Specifies the OpenSBI platform to build. If no platform is
specified only the OpenSBI platform independent static
library libsbi.a is built. If a platform is specified then
the platform specific static library libplatsbi.a and firmware
examples are built.
config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
bool "Install fw_dynamic image"
default y if BR2_TARGET_OPENSBI_PLAT != ""
help
This installs the fw_dynamic image.
config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
bool "Install fw_jump image"
default y if BR2_TARGET_OPENSBI_PLAT != ""
help
This installs the fw_jump image.
config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
bool "Install fw_payload image"
help
This option enables the installation of the fw_paylaod
image.
config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
bool "Include Linux as OpenSBI Payload"
depends on BR2_TARGET_OPENSBI_PLAT != ""
depends on BR2_LINUX_KERNEL
depends on BR2_LINUX_KERNEL_IMAGE
select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
help
Build OpenSBI with the Linux kernel as a Payload.
config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
bool "Include U-Boot as OpenSBI Payload"
depends on BR2_TARGET_OPENSBI_PLAT != ""
depends on BR2_TARGET_UBOOT
select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
help
Build OpenSBI with the U-Boot as a Payload.
config BR2_TARGET_OPENSBI_FW_FDT_PATH
bool "Include U-Boot DTB in OpenSBI Payload"
depends on BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
select BR2_TARGET_UBOOT_FORMAT_DTB
help
Build OpenSBI with FW_FDT_PATH set to
$(BINARIES_DIR)/u-boot.dtb. Note that CONFIG_OF_SEPARATE
must be set in the U-Boot configuration for this file to be
produced.
config BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES
string "Additional build variables"
help
Additional parameters for the build, which will be passed on
the make command line. E.g: BUILD_INFO=1.
endif

View File

@ -0,0 +1,3 @@
# locally computed
sha256 2c0501eb3475f463b15f5b8531996f64604ea49e0e3ed040ecbd1fc27ecd8c5c opensbi-1.3.tar.gz
sha256 82d13fb1bf6bb162629deeea9eb9c117e74548d3b707e478967691fe79a68e21 COPYING.BSD

View File

@ -0,0 +1,92 @@
################################################################################
#
# opensbi
#
################################################################################
OPENSBI_VERSION = $(call qstrip,$(BR2_TARGET_OPENSBI_VERSION))
ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_TARBALL),y)
# Handle custom OpenSBI tarballs as specified by the configuration
OPENSBI_TARBALL = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION))
OPENSBI_SITE = $(patsubst %/,%,$(dir $(OPENSBI_TARBALL)))
OPENSBI_SOURCE = $(notdir $(OPENSBI_TARBALL))
else ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_GIT),y)
OPENSBI_SITE = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_REPO_URL))
OPENSBI_SITE_METHOD = git
else
# Handle official OpenSBI versions
OPENSBI_SITE = $(call github,riscv,opensbi,v$(OPENSBI_VERSION))
endif
OPENSBI_LICENSE = BSD-2-Clause
ifeq ($(BR2_TARGET_OPENSBI_LATEST_VERSION),y)
OPENSBI_LICENSE_FILES = COPYING.BSD
endif
OPENSBI_INSTALL_TARGET = NO
OPENSBI_INSTALL_STAGING = YES
ifeq ($(BR2_TARGET_OPENSBI)$(BR2_TARGET_OPENSBI_LATEST_VERSION),y)
BR_NO_CHECK_HASH_FOR += $(OPENSBI_SOURCE)
endif
OPENSBI_MAKE_ENV = \
CROSS_COMPILE=$(TARGET_CROSS) \
$(call qstrip,$(BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES))
OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
ifneq ($(OPENSBI_PLAT),)
OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)
endif
ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
OPENSBI_DEPENDENCIES += linux
OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/Image"
endif
ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
OPENSBI_DEPENDENCIES += uboot
OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/u-boot.bin"
ifeq ($(BR2_TARGET_OPENSBI_FW_FDT_PATH),y)
OPENSBI_MAKE_ENV += FW_FDT_PATH="$(BINARIES_DIR)/u-boot.dtb"
endif
endif
define OPENSBI_BUILD_CMDS
$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
endef
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
OPENSBI_INSTALL_IMAGES = YES
OPENSBI_FW_IMAGES += dynamic
endif
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
OPENSBI_INSTALL_IMAGES = YES
OPENSBI_FW_IMAGES += jump
endif
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
OPENSBI_INSTALL_IMAGES = YES
OPENSBI_FW_IMAGES += payload
endif
ifneq ($(OPENSBI_PLAT),)
define OPENSBI_INSTALL_IMAGES_CMDS
$(foreach f,$(OPENSBI_FW_IMAGES),\
$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).bin \
$(BINARIES_DIR)/fw_$(f).bin
$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).elf \
$(BINARIES_DIR)/fw_$(f).elf
)
endef
endif
# libsbi.a is not a library meant to be linked in user-space code, but
# with bare metal code, which is why we don't install it in
# $(STAGING_DIR)/usr/lib
define OPENSBI_INSTALL_STAGING_CMDS
$(INSTALL) -m 0644 -D $(@D)/build/lib/libsbi.a $(STAGING_DIR)/usr/share/opensbi/libsbi.a
endef
$(eval $(generic-package))

View File

@ -0,0 +1,56 @@
From 82becbadd5918ed7ad3c2b651ce479084b5feb2a Mon Sep 17 00:00:00 2001
From: Etienne Carriere <etienne.carriere@linaro.org>
Date: Mon, 10 May 2021 15:58:41 +0200
Subject: core: zlib: fix build warning when _LFS64_LARGEFILE is not defined
In zlib, _LFS64_LARGEFILE is expected to be a boolean directive, either
1 (true) or 0 (false). Depending on toolchain version and directives
build may produces warnings (as shown below with gcc 9.3) when the macro
is not defined hence this change to default it to value 0 (false).
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/adler32.c:9:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
CC out/core/lib/zlib/zutil.o
In file included from core/lib/zlib/inftrees.c:7:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/inflate.c:84:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
In file included from core/lib/zlib/zutil.c:9:
core/lib/zlib/zutil.h:196:39: warning: "_LFS64_LARGEFILE" is not defined, evaluates to 0 [-Wundef]
196 | (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
| ^~~~~~~~~~~~~~~~
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
---
core/lib/zlib/zconf.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/core/lib/zlib/zconf.h b/core/lib/zlib/zconf.h
index 0bca18be..a7d13741 100644
--- a/core/lib/zlib/zconf.h
+++ b/core/lib/zlib/zconf.h
@@ -487,6 +487,11 @@ typedef uLong FAR uLongf;
# endif
#endif
+/* Other places expect _LFS64_LARGEFILE to be defined with a valid value */
+#ifndef _LFS64_LARGEFILE
+#define _LFS64_LARGEFILE 0
+#endif
+
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
# define Z_LFS64
#endif
--
2.17.1

View File

@ -0,0 +1,158 @@
config BR2_TARGET_OPTEE_OS
bool "optee_os"
depends on BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A
help
OP-TEE OS provides the secure world boot image and the trust
application development kit of the OP-TEE project. OP-TEE OS
also provides generic trusted application one can embedded
into its system.
http://github.com/OP-TEE/optee_os
if BR2_TARGET_OPTEE_OS
choice
prompt "OP-TEE OS version"
default BR2_TARGET_OPTEE_OS_LATEST if BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
Select the version of OP-TEE OS you want to use
config BR2_TARGET_OPTEE_OS_LATEST
bool "4.0.0"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
select BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
help
Use the latest release tag from the OP-TEE OS official Git
repository.
config BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
bool "Custom tarball"
help
This option allows to specify a URL pointing to an OP-TEE OS
source tarball. This URL can use any protocol recognized by
Buildroot, like http://, ftp://, file:// or scp://.
When pointing to a local tarball using file://, you may want
to use a make variable like $(TOPDIR) to reference the root of
the Buildroot tree.
config BR2_TARGET_OPTEE_OS_CUSTOM_GIT
bool "Custom Git repository"
help
Use a custom version fetched from a Git repository.
endchoice
if BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
config BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION
string "URL of custom OP-TEE OS tarball"
endif
if BR2_TARGET_OPTEE_OS_CUSTOM_GIT
config BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL
string "URL of custom repository"
depends on BR2_TARGET_OPTEE_OS_CUSTOM_GIT
help
Specific location of the reference source tree Git
repository.
config BR2_TARGET_OPTEE_OS_CUSTOM_REPO_VERSION
string "Custom repository version"
depends on BR2_TARGET_OPTEE_OS_CUSTOM_GIT
help
Revision to use in the typical format used by Git, i.e a
SHA1 or a tag.
endif
config BR2_TARGET_OPTEE_OS_VERSION
string
default "4.0.0" if BR2_TARGET_OPTEE_OS_LATEST
default "custom" if BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL
default BR2_TARGET_OPTEE_OS_CUSTOM_REPO_VERSION \
if BR2_TARGET_OPTEE_OS_CUSTOM_GIT
config BR2_TARGET_OPTEE_OS_NEEDS_DTC
bool "OP-TEE OS needs dtc"
select BR2_PACKAGE_HOST_DTC
help
Select this option if your OP-TEE OS platform configuration
requires the Device Tree compiler to be available.
config BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY
bool "OP-TEE OS needs host-python-cryptography"
depends on BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
help
OP-TEE OS version below 3.16 used python-pycryptodomex
package in python scripts. Newer version uses
python-cryptography. Select this option if optee-os needs
python-cryptography to be built.
config BR2_TARGET_OPTEE_OS_CORE
bool "Build core"
default y
help
This option will build and install the OP-TEE core
boot images.
config BR2_TARGET_OPTEE_OS_SDK
bool "Build TA devkit"
default y
help
This option will build and install the OP-TEE development
kit for building OP-TEE trusted application images. It is
installed in the staging directory /lib/optee.
config BR2_TARGET_OPTEE_OS_SERVICES
bool "Build service TAs and libs"
default y
select BR2_TARGET_OPTEE_OS_CORE
help
This option installs the service trusted applications and
trusted shared libraries built from OP-TEE OS source tree.
These are installed in target /lib/optee_armtz directory
as other trusted applications. At runtime OP-TEE OS can
load these from this non-secure filesystem/directory into
the secure world for execution.
config BR2_TARGET_OPTEE_OS_PLATFORM
string "Target platform (mandatory)"
help
Value for the mandated PLATFORM build directive provided to
OP-TEE OS.
config BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR
string "Target platform flavor (optional)"
help
Value for the optional PLATFORM_FLAVOR build directive
provided to OP-TEE OS.
config BR2_TARGET_OPTEE_OS_CUSTOM_DTS_PATH
string "Device Tree Source file paths"
help
Space-separated list of paths to device tree source files
that will be copied to core/arch/arm/dts/ before starting
the build.
To use this device tree source file, the OP-TEE OS
configuration must refer to it with the
CFG_EMBED_DTB_SOURCE_FILE option and no platform flavor
needs to be specified.
config BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES
string "Additional build variables"
help
Additional parameters for the OP-TEE OS build
E.g. 'CFG_TEE_CORE_LOG_LEVEL=3 CFG_UNWIND=y'
config BR2_TARGET_OPTEE_OS_CORE_IMAGES
string "Binary boot images"
default "tee.bin tee-*_v2.bin"
help
Names of generated image files that are installed in the
output images/ directory.
endif # BR2_TARGET_OPTEE_OS

View File

@ -0,0 +1,4 @@
# From https://github.com/OP-TEE/optee_os/archive/4.0.0/optee-os-4.0.0.tar.gz
sha256 2c2c9525b36c96dfad6216520721b8e9663e6cacc61d0108a0c8bffc0ea175f1 optee-os-4.0.0.tar.gz
# Locally computed
sha256 1247ee90858f4037b6cac63cbffddfed435d0d73c631b37d78c1e6e6ab3e5d1a LICENSE

View File

@ -0,0 +1,156 @@
################################################################################
#
# optee-os
#
################################################################################
OPTEE_OS_VERSION = $(call qstrip,$(BR2_TARGET_OPTEE_OS_VERSION))
OPTEE_OS_LICENSE = BSD-2-Clause
ifeq ($(BR2_TARGET_OPTEE_OS_LATEST),y)
OPTEE_OS_LICENSE_FILES = LICENSE
endif
OPTEE_OS_INSTALL_STAGING = YES
OPTEE_OS_INSTALL_IMAGES = YES
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL),y)
OPTEE_OS_TARBALL = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION))
OPTEE_OS_SITE = $(patsubst %/,%,$(dir $(OPTEE_OS_TARBALL)))
OPTEE_OS_SOURCE = $(notdir $(OPTEE_OS_TARBALL))
else ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_GIT),y)
OPTEE_OS_SITE = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL))
OPTEE_OS_SITE_METHOD = git
else
OPTEE_OS_SITE = $(call github,OP-TEE,optee_os,$(OPTEE_OS_VERSION))
endif
ifeq ($(BR2_TARGET_OPTEE_OS):$(BR2_TARGET_OPTEE_OS_LATEST),y:)
BR_NO_CHECK_HASH_FOR += $(OPTEE_OS_SOURCE)
endif
OPTEE_OS_DEPENDENCIES = host-openssl host-python3 host-python-pyelftools
ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_PYTHON_CRYPTOGRAPHY),y)
OPTEE_OS_DEPENDENCIES += host-python-cryptography
else
OPTEE_OS_DEPENDENCIES += host-python-pycryptodomex
endif
ifeq ($(BR2_TARGET_OPTEE_OS_NEEDS_DTC),y)
OPTEE_OS_DEPENDENCIES += host-dtc
endif
# On 64bit targets, OP-TEE OS can be built in 32bit mode, or
# can be built in 64bit mode and support 32bit and 64bit
# trusted applications. Since buildroot currently references
# a single cross compiler, build exclusively in 32bit
# or 64bit mode.
OPTEE_OS_MAKE_OPTS = \
CROSS_COMPILE="$(TARGET_CROSS)" \
CROSS_COMPILE_core="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_arm64="$(TARGET_CROSS)" \
CROSS_COMPILE_ta_arm32="$(TARGET_CROSS)" \
PYTHON3="$(HOST_DIR)/bin/python3"
ifeq ($(BR2_aarch64),y)
OPTEE_OS_MAKE_OPTS += \
CFG_ARM64_core=y \
CFG_USER_TA_TARGETS=ta_arm64
else
OPTEE_OS_MAKE_OPTS += \
CFG_ARM32_core=y
endif
# Get mandatory PLAFORM and optional PLATFORM_FLAVOR and additional
# variables
OPTEE_OS_MAKE_OPTS += PLATFORM=$(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM))
ifneq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR)),)
OPTEE_OS_MAKE_OPTS += PLATFORM_FLAVOR=$(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM_FLAVOR))
endif
OPTEE_OS_MAKE_OPTS += $(call qstrip,$(BR2_TARGET_OPTEE_OS_ADDITIONAL_VARIABLES))
# Requests OP-TEE OS to build from subdirectory out/ of its sourcetree
# root path otherwise the output directory path depends on the target
# platform name.
OPTEE_OS_BUILDDIR_OUT = out
ifeq ($(BR2_aarch64),y)
OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm64
OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm64
endif
ifeq ($(BR2_arm),y)
OPTEE_OS_LOCAL_SDK = $(OPTEE_OS_BUILDDIR_OUT)/export-ta_arm32
OPTEE_OS_SDK = $(STAGING_DIR)/lib/optee/export-ta_arm32
endif
OPTEE_OS_IMAGE_FILES = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CORE_IMAGES))
OPTEE_OS_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_DTS_PATH))
ifeq ($(BR2_TARGET_OPTEE_OS_CORE),y)
define OPTEE_OS_BUILD_CORE
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \
$(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) all
endef
define OPTEE_OS_INSTALL_IMAGES_CORE
mkdir -p $(BINARIES_DIR)
$(foreach f,$(OPTEE_OS_IMAGE_FILES), \
cp -dpf $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/core/$(f)) $(BINARIES_DIR)/
)
endef
endif # BR2_TARGET_OPTEE_OS_CORE
ifeq ($(BR2_TARGET_OPTEE_OS_SERVICES),y)
define OPTEE_OS_INSTALL_TARGET_CMDS
$(if $(wildcard $(@D)/$(OPTEE_OS_BUILDDIR_OUT)/ta/*/*.ta),
$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz \
$(@D)/$(OPTEE_OS_BUILDDIR_OUT)/ta/*/*.ta)
$(if $(wildcard $(@D)/$(OPTEE_OS_LOCAL_SDK)/lib/*.ta),
$(INSTALL) -D -m 444 -t $(TARGET_DIR)/lib/optee_armtz \
$(@D)/$(OPTEE_OS_LOCAL_SDK)/lib/*.ta)
endef
endif # BR2_TARGET_OPTEE_OS_SERVICES
ifeq ($(BR2_TARGET_OPTEE_OS_SDK),y)
define OPTEE_OS_BUILD_SDK
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) O=$(OPTEE_OS_BUILDDIR_OUT) \
$(TARGET_CONFIGURE_OPTS) $(OPTEE_OS_MAKE_OPTS) ta_dev_kit
endef
define OPTEE_OS_INSTALL_STAGING_CMDS
mkdir -p $(OPTEE_OS_SDK)
cp -ardpf $(@D)/$(OPTEE_OS_LOCAL_SDK)/* $(OPTEE_OS_SDK)
endef
endif # BR2_TARGET_OPTEE_OS_SDK
define OPTEE_OS_BUILD_CMDS
$(if $(OPTEE_OS_CUSTOM_DTS_PATH),
cp -f $(OPTEE_OS_CUSTOM_DTS_PATH) $(@D)/core/arch/arm/dts/
)
$(OPTEE_OS_BUILD_CORE)
$(OPTEE_OS_BUILD_SDK)
endef
define OPTEE_OS_INSTALL_IMAGES_CMDS
$(OPTEE_OS_INSTALL_IMAGES_CORE)
$(OPTEE_OS_INSTALL_IMAGES_SERVICES)
endef
ifeq ($(BR2_TARGET_OPTEE_OS)$(BR_BUILDING),yy)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_PLATFORM)),)
$(error No OP-TEE OS platform set. Check your BR2_TARGET_OPTEE_OS_PLATFORM setting)
endif
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION)),)
$(error No tarball location specified. Please check BR2_TARGET_OPTEE_OS_CUSTOM_TARBALL_LOCATION)
endif
endif
ifeq ($(BR2_TARGET_OPTEE_OS_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL)),)
$(error No repository specified. Please check BR2_TARGET_OPTEE_OS_CUSTOM_REPO_URL)
endif
endif
endif # BR2_TARGET_OPTEE_OS && BR2_BUILDING
$(eval $(generic-package))

View File

@ -0,0 +1,17 @@
config BR2_TARGET_S500_BOOTLOADER
bool "s500-bootloader"
depends on BR2_arm
depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
select BR2_HOSTARCH_NEEDS_IA32_LIBS
help
1st level bootloader for Actions Semiconductor S500 SoC.
https://github.com/xapp-le/owl
config BR2_TARGET_S500_BOOTLOADER_BOARD
string "board to configure for"
depends on BR2_TARGET_S500_BOOTLOADER
help
Specify the board to configure the bootloader for.
This should be the name of a directory under s500/boards
containing a suitable bootloader.ini file.

View File

@ -0,0 +1,2 @@
# Locally calculated
sha256 b183024ac69f51ea7befd28d03b2ec35a7280e270405600fb4f37aa91d9c9571 s500-bootloader-a8d7fa1d9a7f353ec4613febf30f4ca99a10a106.tar.gz

View File

@ -0,0 +1,34 @@
################################################################################
#
# s500-bootloader
#
################################################################################
S500_BOOTLOADER_VERSION = a8d7fa1d9a7f353ec4613febf30f4ca99a10a106
S500_BOOTLOADER_SITE = $(call github,xapp-le,owl,$(S500_BOOTLOADER_VERSION))
S500_BOOTLOADER_LICENSE = PROPRIETARY
S500_BOOTLOADER_INSTALL_TARGET = NO
S500_BOOTLOADER_INSTALL_IMAGES = YES
S500_BOOTLOADER_BOARD = $(call qstrip,$(BR2_TARGET_S500_BOOTLOADER_BOARD))
define S500_BOOTLOADER_BUILD_CMDS
cd $(@D) && ./tools/utils/bootloader_pack \
s500/bootloader/bootloader.bin \
s500/boards/$(S500_BOOTLOADER_BOARD)/bootloader.ini \
s500-bootloader.bin
endef
define S500_BOOTLOADER_INSTALL_IMAGES_CMDS
$(INSTALL) -m 0644 -D $(@D)/s500-bootloader.bin \
$(BINARIES_DIR)/s500-bootloader.bin
endef
$(eval $(generic-package))
ifeq ($(BR2_TARGET_S500_BOOTLOADER)$(BR_BUILDING),yy)
# we NEED a board name
ifeq ($(S500_BOOTLOADER_BOARD),)
$(error No s500-bootloader board specified. Check your BR2_TARGET_S500_BOOTLOADER settings)
endif
endif

View File

@ -0,0 +1,25 @@
config BR2_PACKAGE_SHIM_ARCH_SUPPORTS
bool
default y if BR2_aarch64
default y if BR2_arm
default y if BR2_i386
default y if BR2_x86_64
# it includes gnu-efi
depends on BR2_PACKAGE_GNU_EFI_ARCH_SUPPORTS
config BR2_TARGET_SHIM
bool "shim"
depends on BR2_PACKAGE_SHIM_ARCH_SUPPORTS
help
Boot loader to chain-load signed boot loaders under Secure
Boot.
This package provides a minimalist boot loader which allows
verifying signatures of other UEFI binaries against either
the Secure Boot DB/DBX or against a built-in signature
database. Its purpose is to allow a small,
infrequently-changing binary to be signed by the UEFI CA,
while allowing an OS distributor to revision their main
bootloader independently of the CA.
https://github.com/rhboot/shim

View File

@ -0,0 +1,3 @@
# locally computed hash
sha256 a79f0a9b89f3681ab384865b1a46ab3f79d88b11b4ca59aa040ab03fffae80a9 shim-15.8.tar.bz2
sha256 15edf527919ddcb2f514ab9d16ad07ef219e4bb490e0b79560be510f0c159cc2 COPYRIGHT

View File

@ -0,0 +1,38 @@
################################################################################
#
# shim
#
################################################################################
SHIM_VERSION = 15.8
SHIM_SITE = https://github.com/rhboot/shim/releases/download/$(SHIM_VERSION)
SHIM_SOURCE = shim-$(SHIM_VERSION).tar.bz2
SHIM_LICENSE = BSD-2-Clause
SHIM_LICENSE_FILES = COPYRIGHT
SHIM_CPE_ID_VENDOR = redhat
SHIM_INSTALL_TARGET = NO
SHIM_INSTALL_IMAGES = YES
SHIM_CFLAGS = $(TARGET_CFLAGS)
SHIM_MAKE_OPTS = \
ARCH="$(GNU_EFI_PLATFORM)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
DASHJ="-j$(PARALLEL_JOBS)" \
OPTIMIZATIONS="$(SHIM_CFLAGS)"
# shim has some assembly function that is not present in Thumb mode:
# Error: selected processor does not support `mrc p15,0,r2,c9,c13,0' in Thumb mode
# so, we desactivate Thumb mode
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
SHIM_CFLAGS += -marm
endif
define SHIM_BUILD_CMDS
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(SHIM_MAKE_OPTS)
endef
define SHIM_INSTALL_IMAGES_CMDS
$(INSTALL) -m 0755 -t $(BINARIES_DIR) $(@D)/*.efi
endef
$(eval $(generic-package))

View File

@ -0,0 +1,82 @@
From da5cbd1a3b248f2d32281a1766a3d1414c0e8e03 Mon Sep 17 00:00:00 2001
From: Sylvain Gault <sylvain.gault@gmail.com>
Date: Tue, 29 Sep 2015 02:38:25 +0200
Subject: [PATCH] bios: Fix alignment change with gcc 5
The section aligment specified in the ld scripts have to be greater or
equal to those in the .o files generated by gcc.
Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
Tested-by: poma <pomidorabelisima@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com>
---
core/i386/syslinux.ld | 6 +++---
core/x86_64/syslinux.ld | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/i386/syslinux.ld b/core/i386/syslinux.ld
index 7b4e012..7390451 100644
--- a/core/i386/syslinux.ld
+++ b/core/i386/syslinux.ld
@@ -266,7 +266,7 @@ SECTIONS
__text_end = .;
}
- . = ALIGN(16);
+ . = ALIGN(32);
__rodata_vma = .;
__rodata_lma = __rodata_vma + __text_lma - __text_vma;
@@ -361,7 +361,7 @@ SECTIONS
__dynamic_end = .;
}
- . = ALIGN(16);
+ . = ALIGN(32);
__data_vma = .;
__data_lma = __data_vma + __text_lma - __text_vma;
@@ -377,7 +377,7 @@ SECTIONS
__pm_code_dwords = (__pm_code_len + 3) >> 2;
. = ALIGN(128);
-
+
__bss_vma = .;
__bss_lma = .; /* Dummy */
.bss (NOLOAD) : AT (__bss_lma) {
diff --git a/core/x86_64/syslinux.ld b/core/x86_64/syslinux.ld
index 1057112..bf815c4 100644
--- a/core/x86_64/syslinux.ld
+++ b/core/x86_64/syslinux.ld
@@ -266,7 +266,7 @@ SECTIONS
__text_end = .;
}
- . = ALIGN(16);
+ . = ALIGN(32);
__rodata_vma = .;
__rodata_lma = __rodata_vma + __text_lma - __text_vma;
@@ -361,7 +361,7 @@ SECTIONS
__dynamic_end = .;
}
- . = ALIGN(16);
+ . = ALIGN(32);
__data_vma = .;
__data_lma = __data_vma + __text_lma - __text_vma;
@@ -377,7 +377,7 @@ SECTIONS
__pm_code_dwords = (__pm_code_len + 3) >> 2;
. = ALIGN(128);
-
+
__bss_vma = .;
__bss_lma = .; /* Dummy */
.bss (NOLOAD) : AT (__bss_lma) {
--
2.7.4

View File

@ -0,0 +1,30 @@
From 250bf2c921713434627dc7bc8b0918fa0841f9b7 Mon Sep 17 00:00:00 2001
From: Graham Inggs <ginggs@ubuntu.com>
Date: Wed, 5 Apr 2017 22:03:12 +0200
Subject: [PATCH] Disable PIE to avoid FTBFS on amd64
gcc 6.x has PIE support enabled by default, which causes a build issue
with syslinux. This patch disables PIE support in the relevant
syslinux Makefile.
Signed-off-by: Ryan Coe <bluemrp9@gmail.com>
---
gpxe/src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gpxe/src/Makefile b/gpxe/src/Makefile
index cc91d78..077af64 100644
--- a/gpxe/src/Makefile
+++ b/gpxe/src/Makefile
@@ -4,7 +4,7 @@
#
CLEANUP :=
-CFLAGS :=
+CFLAGS := -fno-PIE
ASFLAGS :=
LDFLAGS :=
MAKEDEPS := Makefile
--
2.7.4

View File

@ -0,0 +1,32 @@
From c0287594239d5af2082cac20817f8e8b11a4b1b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Wed, 5 Apr 2017 14:18:09 +0200
Subject: [PATCH] memdisk: Force ld output format to 32-bits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On toolchains where the default output is x86_64, we need to be
consistent with the other .o files
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
memdisk/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/memdisk/Makefile b/memdisk/Makefile
index e6557d8..06613ff 100644
--- a/memdisk/Makefile
+++ b/memdisk/Makefile
@@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm
$(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $<
memdisk_%.o: memdisk_%.bin
- $(LD) -r -b binary -o $@ $<
+ $(LD) --oformat elf32-i386 -r -b binary -o $@ $<
memdisk16.elf: $(OBJS16)
$(LD) -Ttext 0 -o $@ $^
--
2.7.4

View File

@ -0,0 +1,60 @@
From e000251144056c99e390a2a4449d06cbd2a19c0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Wed, 5 Apr 2017 14:25:02 +0200
Subject: [PATCH] utils: Use the host toolchain to build.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The utilities are meant to run on the host machine, hence must be built using
the host toolchain.
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
utils/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/utils/Makefile b/utils/Makefile
index dfe6259..ac91aaa 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -17,8 +17,8 @@
VPATH = $(SRC)
include $(MAKEDIR)/syslinux.mk
-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC)
-LDFLAGS = -O2
+CFLAGS = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC)
+LDFLAGS = $(LDFLAGS_FOR_BUILD) -O2
C_TARGETS = isohybrid gethostip memdiskfind
SCRIPT_TARGETS = mkdiskimage
@@ -35,7 +35,7 @@ ISOHDPFX = $(addprefix $(OBJ)/,../mbr/isohdpfx.bin ../mbr/isohdpfx_f.bin \
all: $(TARGETS)
%.o: %.c
- $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+ $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
mkdiskimage: mkdiskimage.in ../mbr/mbr.bin bin2hex.pl
$(PERL) $(SRC)/bin2hex.pl < $(OBJ)/../mbr/mbr.bin | cat $(SRC)/mkdiskimage.in - > $@
@@ -51,13 +51,13 @@ isohdpfx.c: $(ISOHDPFX) isohdpfxarray.pl
$(PERL) $(SRC)/isohdpfxarray.pl $(ISOHDPFX) > $@
isohybrid: isohybrid.o isohdpfx.o
- $(CC) $(LDFLAGS) -o $@ $^ -luuid
+ $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^ -luuid
gethostip: gethostip.o
- $(CC) $(LDFLAGS) -o $@ $^
+ $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^
memdiskfind: memdiskfind.o
- $(CC) $(LDFLAGS) -o $@ $^
+ $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^
tidy dist:
rm -f *.o .*.d isohdpfx.c
--
2.1.4

View File

@ -0,0 +1,44 @@
From 83e1f00990c25554723609bb549e18b987034317 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Thu, 6 Apr 2017 09:43:46 +0200
Subject: [PATCH] lzo: Use the host toolchain for prepcore
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
lzo/Makefile | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lzo/Makefile b/lzo/Makefile
index 29f1fa6..c016e5a 100644
--- a/lzo/Makefile
+++ b/lzo/Makefile
@@ -11,10 +11,13 @@
## -----------------------------------------------------------------------
VPATH = $(SRC)
-include $(MAKEDIR)/build.mk
+include $(MAKEDIR)/syslinux.mk
INCLUDES += -I$(SRC)/include
+%.o: %.c
+ $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS_FOR_BUILD) $(INCLUDES) -c -o $@ $<
+
LIBOBJS = $(patsubst %.c,%.o,$(subst $(SRC)/,,$(wildcard $(SRC)/src/*.c)))
LIB = lzo.a
BINS = prepcore
@@ -30,7 +33,7 @@ $(LIB) : $(LIBOBJS)
$(RANLIB) $@
prepcore : prepcore.o $(LIB)
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(CC_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $^ $(LIBS)
tidy dist clean spotless:
rm -f $(BINS)
--
2.1.4

View File

@ -0,0 +1,37 @@
From 39274503292a6003b1b0c93f694e34f11e85ea44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Fri, 9 Jun 2017 11:55:14 +0200
Subject: [PATCH] The VPrint definition is now part of the exports of
gnu-efi
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
efi/fio.h | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/efi/fio.h b/efi/fio.h
index 65fff8d..a1bfe68 100644
--- a/efi/fio.h
+++ b/efi/fio.h
@@ -11,15 +11,6 @@
#define MAX_EFI_ARGS 64
#define WS(c16) (c16 == L' ' || c16 == CHAR_TAB)
-/* VPrint is not in export declarations in gnu-efi lib yet
- * although it is a global function; declare it here
- */
-extern UINTN
-VPrint (
- IN CHAR16 *fmt,
- va_list args
- );
-
extern EFI_STATUS efi_errno;
void efi_memcpy(unsigned char *dst, unsigned char *src, size_t len);
--
2.1.4

View File

@ -0,0 +1,37 @@
From 3bd5c2d951421a89f76b2423e5810862f53486c1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Fri, 9 Jun 2017 11:59:43 +0200
Subject: [PATCH] Update the longjump calls to fit the new declaration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
efi/main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/efi/main.c b/efi/main.c
index 208fee4f..71d31a5c 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -10,7 +10,6 @@
#include <syslinux/firmware.h>
#include <syslinux/linux.h>
#include <sys/ansi.h>
-#include <setjmp.h>
#include "efi.h"
#include "fio.h"
@@ -30,7 +29,7 @@ uint32_t timer_irq;
__export uint8_t KbdMap[256];
char aux_seg[256];
-static jmp_buf load_error_buf;
+static jmp_buf *load_error_buf;
static inline EFI_STATUS
efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid, EFI_HANDLE agent,
--
2.13.3

View File

@ -0,0 +1,32 @@
From ca8aaded0c7c3900397029bd9520132b62629308 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Allard?= <benoit.allard@greenbone.net>
Date: Mon, 12 Jun 2017 14:59:16 +0200
Subject: [PATCH] efi/wrapper: build it with the host toolchain.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The wrapper program is executed on the build machine, so it should be
built with CC_FOR_BUILD.
Signed-off-by: Benoît Allard <benoit.allard@greenbone.net>
---
efi/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/efi/Makefile b/efi/Makefile
index d5443bd5..d24d16db 100644
--- a/efi/Makefile
+++ b/efi/Makefile
@@ -79,7 +79,7 @@ syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
# cp $^ $@
wrapper: wrapper.c
- $(CC) $^ -o $@
+ $(CC_FOR_BUILD) $^ -o $@
#
# Build the wrapper app and wrap our .so to produce a .efi
--
2.13.3

View File

@ -0,0 +1,295 @@
From 76946dd67bc856eaf4fe69d0826547a794176f78 Mon Sep 17 00:00:00 2001
From: Sylvain Gault <sylvain.gault@gmail.com>
Date: Tue, 29 Sep 2015 04:45:09 +0200
Subject: [PATCH] bios: Don't try to guess the sections alignment
For the compression / decompression to succeed, the sections layout must
be the same between the virtual memory and load memory. The section
alignment was kept in sync by introducing aligment that should be
greater or equal to the actual section alignment.
This patch compute the load memory addresses of the sections so that
the layout is the same as the virtual memory addresses.
Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
Tested-by: poma <pomidorabelisima@gmail.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Upstream: 0cc9a99e560a2f52bcf052fd85b1efae35ee812f
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
core/i386/syslinux.ld | 63 ++++++++++---------------------------------------
core/x86_64/syslinux.ld | 63 ++++++++++---------------------------------------
2 files changed, 24 insertions(+), 102 deletions(-)
diff --git a/core/i386/syslinux.ld b/core/i386/syslinux.ld
index 73904510..92b75b11 100644
--- a/core/i386/syslinux.ld
+++ b/core/i386/syslinux.ld
@@ -255,10 +255,9 @@ SECTIONS
. = 0x100000;
__pm_code_start = .;
+ __vma_to_lma = __pm_code_lma - __pm_code_start;
- __text_vma = .;
- __text_lma = __pm_code_lma;
- .text : AT(__text_lma) {
+ .text : AT(ADDR(.text) + __vma_to_lma) {
FILL(0x90909090)
__text_start = .;
*(.text)
@@ -266,106 +265,68 @@ SECTIONS
__text_end = .;
}
- . = ALIGN(32);
-
- __rodata_vma = .;
- __rodata_lma = __rodata_vma + __text_lma - __text_vma;
- .rodata : AT(__rodata_lma) {
+ .rodata : AT(ADDR(.rodata) + __vma_to_lma) {
__rodata_start = .;
*(.rodata)
*(.rodata.*)
__rodata_end = .;
}
- . = ALIGN(4);
-
- __ctors_vma = .;
- __ctors_lma = __ctors_vma + __text_lma - __text_vma;
- .ctors : AT(__ctors_lma) {
+ .ctors : AT(ADDR(.ctors) + __vma_to_lma) {
__ctors_start = .;
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__ctors_end = .;
}
- __dtors_vma = .;
- __dtors_lma = __dtors_vma + __text_lma - __text_vma;
- .dtors : AT(__dtors_lma) {
+ .dtors : AT(ADDR(.dtors) + __vma_to_lma) {
__dtors_start = .;
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__dtors_end = .;
}
- . = ALIGN(4);
-
- __dynsym_vma = .;
- __dynsym_lma = __dynsym_vma + __text_lma - __text_vma;
- .dynsym : AT(__dynsym_lma) {
+ .dynsym : AT(ADDR(.dynsym) + __vma_to_lma) {
__dynsym_start = .;
*(.dynsym)
__dynsym_end = .;
}
__dynsym_len = __dynsym_end - __dynsym_start;
- . = ALIGN(4);
-
- __dynstr_vma = .;
- __dynstr_lma = __dynstr_vma + __text_lma - __text_vma;
- .dynstr : AT(__dynstr_lma) {
+ .dynstr : AT(ADDR(.dynstr) + __vma_to_lma) {
__dynstr_start = .;
*(.dynstr)
__dynstr_end = .;
}
__dynstr_len = __dynstr_end - __dynstr_start;
- . = ALIGN(4);
-
- __gnu_hash_vma = .;
- __gnu_hash_lma = __gnu_hash_vma + __text_lma - __text_vma;
- .gnu.hash : AT(__gnu_hash_lma) {
+ .gnu.hash : AT(ADDR(.gnu.hash) + __vma_to_lma) {
__gnu_hash_start = .;
*(.gnu.hash)
__gnu_hash_end = .;
}
- . = ALIGN(4);
-
- __dynlink_vma = .;
- __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
- .dynlink : AT(__dynlink_lma) {
+ .dynlink : AT(ADDR(.dynlink) + __vma_to_lma) {
__dynlink_start = .;
*(.dynlink)
__dynlink_end = .;
}
- . = ALIGN(4);
-
- __got_vma = .;
- __got_lma = __got_vma + __text_lma - __text_vma;
- .got : AT(__got_lma) {
+ .got : AT(ADDR(.got) + __vma_to_lma) {
__got_start = .;
KEEP (*(.got.plt))
KEEP (*(.got))
__got_end = .;
}
- . = ALIGN(4);
-
- __dynamic_vma = .;
- __dynamic_lma = __dynamic_vma + __text_lma - __text_vma;
- .dynamic : AT(__dynamic_lma) {
+ .dynamic : AT(ADDR(.dynamic) + __vma_to_lma) {
__dynamic_start = .;
*(.dynamic)
__dynamic_end = .;
}
- . = ALIGN(32);
-
- __data_vma = .;
- __data_lma = __data_vma + __text_lma - __text_vma;
- .data : AT(__data_lma) {
+ .data : AT(ADDR(.data) + __vma_to_lma) {
__data_start = .;
*(.data)
*(.data.*)
diff --git a/core/x86_64/syslinux.ld b/core/x86_64/syslinux.ld
index bf815c46..70c6e00a 100644
--- a/core/x86_64/syslinux.ld
+++ b/core/x86_64/syslinux.ld
@@ -255,10 +255,9 @@ SECTIONS
. = 0x100000;
__pm_code_start = .;
+ __vma_to_lma = __pm_code_lma - __pm_code_start;
- __text_vma = .;
- __text_lma = __pm_code_lma;
- .text : AT(__text_lma) {
+ .text : AT(ADDR(.text) + __vma_to_lma) {
FILL(0x90909090)
__text_start = .;
*(.text)
@@ -266,106 +265,68 @@ SECTIONS
__text_end = .;
}
- . = ALIGN(32);
-
- __rodata_vma = .;
- __rodata_lma = __rodata_vma + __text_lma - __text_vma;
- .rodata : AT(__rodata_lma) {
+ .rodata : AT(ADDR(.rodata) + __vma_to_lma) {
__rodata_start = .;
*(.rodata)
*(.rodata.*)
__rodata_end = .;
}
- . = ALIGN(4);
-
- __ctors_vma = .;
- __ctors_lma = __ctors_vma + __text_lma - __text_vma;
- .ctors : AT(__ctors_lma) {
+ .ctors : AT(ADDR(.ctors) + __vma_to_lma) {
__ctors_start = .;
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__ctors_end = .;
}
- __dtors_vma = .;
- __dtors_lma = __dtors_vma + __text_lma - __text_vma;
- .dtors : AT(__dtors_lma) {
+ .dtors : AT(ADDR(.dtors) + __vma_to_lma) {
__dtors_start = .;
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__dtors_end = .;
}
- . = ALIGN(4);
-
- __dynsym_vma = .;
- __dynsym_lma = __dynsym_vma + __text_lma - __text_vma;
- .dynsym : AT(__dynsym_lma) {
+ .dynsym : AT(ADDR(.dynsym) + __vma_to_lma) {
__dynsym_start = .;
*(.dynsym)
__dynsym_end = .;
}
__dynsym_len = __dynsym_end - __dynsym_start;
- . = ALIGN(4);
-
- __dynstr_vma = .;
- __dynstr_lma = __dynstr_vma + __text_lma - __text_vma;
- .dynstr : AT(__dynstr_lma) {
+ .dynstr : AT(ADDR(.dynstr) + __vma_to_lma) {
__dynstr_start = .;
*(.dynstr)
__dynstr_end = .;
}
__dynstr_len = __dynstr_end - __dynstr_start;
- . = ALIGN(4);
-
- __gnu_hash_vma = .;
- __gnu_hash_lma = __gnu_hash_vma + __text_lma - __text_vma;
- .gnu.hash : AT(__gnu_hash_lma) {
+ .gnu.hash : AT(ADDR(.gnu.hash) + __vma_to_lma) {
__gnu_hash_start = .;
*(.gnu.hash)
__gnu_hash_end = .;
}
- . = ALIGN(4);
-
- __dynlink_vma = .;
- __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
- .dynlink : AT(__dynlink_lma) {
+ .dynlink : AT(ADDR(.dynlink) + __vma_to_lma) {
__dynlink_start = .;
*(.dynlink)
__dynlink_end = .;
}
- . = ALIGN(4);
-
- __got_vma = .;
- __got_lma = __got_vma + __text_lma - __text_vma;
- .got : AT(__got_lma) {
+ .got : AT(ADDR(.got) + __vma_to_lma) {
__got_start = .;
KEEP (*(.got.plt))
KEEP (*(.got))
__got_end = .;
}
- . = ALIGN(4);
-
- __dynamic_vma = .;
- __dynamic_lma = __dynamic_vma + __text_lma - __text_vma;
- .dynamic : AT(__dynamic_lma) {
+ .dynamic : AT(ADDR(.dynamic) + __vma_to_lma) {
__dynamic_start = .;
*(.dynamic)
__dynamic_end = .;
}
- . = ALIGN(32);
-
- __data_vma = .;
- __data_lma = __data_vma + __text_lma - __text_vma;
- .data : AT(__data_lma) {
+ .data : AT(ADDR(.data) + __vma_to_lma) {
__data_start = .;
*(.data)
*(.data.*)
--
2.13.3

View File

@ -0,0 +1,622 @@
From a14b1b3d3e375d2e8af8804171ef5e52574dbb2a Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa@zytor.com>
Date: Tue, 9 Feb 2016 18:15:50 -0800
Subject: [PATCH] core: Clean up the i386-bios build
Remove symbols and data structures not used in the i386-bios build,
and clean up the linker script so that most internal symbols are
HIDDEN.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Upstream: ff859050fa4e6535cae098dc35d88a265466448d
This patch fixes the following build failure with i386 binutils 2.28.1:
/builds/arnout/buildroot/output/host/bin/i586-buildroot-linux-uclibc-ld -Bsymbolic -pie -E --hash-style=gnu -T
/builds/arnout/buildroot/output/build/syslinux-6.03/core/i386/syslinux.ld -M -o ldlinux.elf ldlinux.o \
--start-group libcom32.a --whole-archive /builds/arnout/buildroot/output/build/syslinux-6.03/bios/com32/lib/libcom32core.a libldlinux.a --end-group -N
--no-omagic \
> ldlinux.map
/builds/arnout/buildroot/output/host/bin/i586-buildroot-linux-uclibc-ld: ldlinux.elf: Not enough room for program headers, try linking with -N
/builds/arnout/buildroot/output/host/bin/i586-buildroot-linux-uclibc-ld: final link failed: Bad value
/builds/arnout/buildroot/output/build/syslinux-6.03/core/Makefile:167: recipe for target 'ldlinux.elf' failed
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
core/extern.inc | 17 +--
core/i386/syslinux.ld | 287 +++++++++++++++++++++++++-------------------------
core/layout.inc | 11 --
3 files changed, 143 insertions(+), 172 deletions(-)
diff --git a/core/extern.inc b/core/extern.inc
index af8eb04c..ce4abfab 100644
--- a/core/extern.inc
+++ b/core/extern.inc
@@ -12,27 +12,17 @@
; hello.c
extern hello
- ;abort.c
- extern abort_load_new
-
; elflink/load_env32.c
extern load_env32, pm_env32_run
- ; memscan.c
- extern highmem_init
-
- extern linux_kernel
-
extern mp1, mp2, mp3, mp4, mp5
- extern hexdump, mydump
+ extern hexdump
extern mem_init
; fs.c
- extern pm_fs_init, pm_searchdir, getfssec, getfsbytes
- extern pm_mangle_name, pm_load_config
- extern pm_open_file, pm_close_file
+ extern pm_fs_init
extern SectorSize, SectorShift
; chdir.c
@@ -41,9 +31,6 @@
; readdir.c
extern opendir, readdir, closedir
- ; newconfig.c
- extern pm_is_config_file
-
; idle.c
extern __idle
diff --git a/core/i386/syslinux.ld b/core/i386/syslinux.ld
index 92b75b11..39198d75 100644
--- a/core/i386/syslinux.ld
+++ b/core/i386/syslinux.ld
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
*
* Copyright 2008-2009 H. Peter Anvin - All Rights Reserved
- * Copyright 2009 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2016 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -12,7 +12,7 @@
* ----------------------------------------------------------------------- */
/*
- * Linker script for the SYSLINUX core
+ * Linker script for the SYSLINUX core when built for i386-bios
*/
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
@@ -26,7 +26,7 @@ SECTIONS
{
/* Prefix structure for the compression program */
. = 0;
- __module_start = .;
+ HIDDEN(__module_start = ABSOLUTE(.));
.prefix : {
*(.prefix)
}
@@ -35,81 +35,82 @@ SECTIONS
. = 0x1000;
.earlybss (NOLOAD) : {
- __earlybss_start = .;
+ HIDDEN(__earlybss_start = .);
*(.earlybss)
- __earlybss_end = .;
+ HIDDEN(__earlybss_end = .);
}
- __earlybss_len = ABSOLUTE(__earlybss_end) - ABSOLUTE(__earlybss_start);
- __earlybss_dwords = (__earlybss_len + 3) >> 2;
+ HIDDEN(__earlybss_len = ABSOLUTE(__earlybss_end) - ABSOLUTE(__earlybss_start));
+ HIDDEN(__earlybss_dwords = (__earlybss_len + 3) >> 2);
. = ALIGN(4);
.bss16 (NOLOAD) : {
- __bss16_start = .;
+ HIDDEN(__bss16_start = .);
*(.bss16)
- __bss16_end = .;
+ HIDDEN(__bss16_end = .);
}
- __bss16_len = ABSOLUTE(__bss16_end) - ABSOLUTE(__bss16_start);
- __bss16_dwords = (__bss16_len + 3) >> 2;
+ HIDDEN(__bss16_len = ABSOLUTE(__bss16_end) - ABSOLUTE(__bss16_start));
+ HIDDEN(__bss16_dwords = (__bss16_len + 3) >> 2);
. = ALIGN(4);
.config : AT (__config_lma) {
- __config_start = .;
+ HIDDEN(__config_start = .);
*(.config)
- __config_end = .;
+ HIDDEN(__config_end = .);
}
- __config_len = ABSOLUTE(__config_end) - ABSOLUTE(__config_start);
- __config_dwords = (__config_len + 3) >> 2;
+ HIDDEN(__config_len = ABSOLUTE(__config_end) - ABSOLUTE(__config_start));
+ HIDDEN(__config_dwords = (__config_len + 3) >> 2);
/* Generated and/or copied code */
. = ALIGN(128); /* Minimum separation from mutable data */
.replacestub : AT (__replacestub_lma) {
- __replacestub_start = .;
+ HIDDEN(__replacestub_start = .);
*(.replacestub)
- __replacestub_end = .;
+ HIDDEN(__replacestub_end = .);
}
- __replacestub_len = ABSOLUTE(__replacestub_end) - ABSOLUTE(__replacestub_start);
- __replacestub_dwords = (__replacestub_len + 3) >> 2;
+ HIDDEN(__replacestub_len = ABSOLUTE(__replacestub_end) - ABSOLUTE(__replacestub_start));
+ HIDDEN(__replacestub_dwords = (__replacestub_len + 3) >> 2);
. = ALIGN(16);
- __gentextnr_lma = .;
+ HIDDEN(__gentextnr_lma = .);
.gentextnr : AT(__gentextnr_lma) {
- __gentextnr_start = .;
+ HIDDEN(__gentextnr_start = .);
*(.gentextnr)
- __gentextnr_end = .;
+ HIDDEN(__gentextnr_end = .);
}
- __gentextnr_len = ABSOLUTE(__gentextnr_end) - ABSOLUTE(__gentextnr_start);
- __gentextnr_dwords = (__gentextnr_len + 3) >> 2;
+ HIDDEN(__gentextnr_len = ABSOLUTE(__gentextnr_end) - ABSOLUTE(__gentextnr_start));
+ HIDDEN(__gentextnr_dwords = (__gentextnr_len + 3) >> 2);
. = STACK_BASE;
.stack16 : AT(STACK_BASE) {
- __stack16_start = .;
+ HIDDEN(__stack16_start = .);
. += STACK_LEN;
- __stack16_end = .;
+ HIDDEN(__stack16_end = .);
}
- __stack16_len = ABSOLUTE(__stack16_end) - ABSOLUTE(__stack16_start);
- __stack16_dwords = (__stack16_len + 3) >> 2;
+ HIDDEN(__stack16_len = ABSOLUTE(__stack16_end) - ABSOLUTE(__stack16_start));
+ HIDDEN(__stack16_dwords = (__stack16_len + 3) >> 2);
/* Initialized sections */
. = 0x7c00;
.init : {
FILL(0x90909090)
- __init_start = .;
+ HIDDEN(__init_start = .);
*(.init)
- __init_end = .;
+ HIDDEN(__init_end = .);
}
- __init_len = ABSOLUTE(__init_end) - ABSOLUTE(__init_start);
- __init_dwords = (__init_len + 3) >> 2;
+ HIDDEN(__init_len = ABSOLUTE(__init_end) - ABSOLUTE(__init_start));
+ HIDDEN(__init_dwords = (__init_len + 3) >> 2);
+ . = ALIGN(4);
.text16 : {
FILL(0x90909090)
- __text16_start = .;
+ HIDDEN(__text16_start = .);
*(.text16)
- __text16_end = .;
+ HIDDEN(__text16_end = .);
}
- __text16_len = ABSOLUTE(__text16_end) - ABSOLUTE(__text16_start);
- __text16_dwords = (__text16_len + 3) >> 2;
+ HIDDEN(__text16_len = ABSOLUTE(__text16_end) - ABSOLUTE(__text16_start));
+ HIDDEN(__text16_dwords = (__text16_len + 3) >> 2);
/*
* .textnr is used for 32-bit code that is used on the code
@@ -118,99 +119,92 @@ SECTIONS
. = ALIGN(16);
.textnr : {
FILL(0x90909090)
- __textnr_start = .;
+ HIDDEN(__textnr_start = .);
*(.textnr)
- __textnr_end = .;
+ HIDDEN(__textnr_end = .);
}
- __textnr_len = ABSOLUTE(__textnr_end) - ABSOLUTE(__textnr_start);
- __textnr_dwords = (__textnr_len + 3) >> 2;
+ HIDDEN(__textnr_len = ABSOLUTE(__textnr_end) - ABSOLUTE(__textnr_start));
+ HIDDEN(__textnr_dwords = (__textnr_len + 3) >> 2);
. = ALIGN(16);
- __bcopyxx_start = .;
+ HIDDEN(__bcopyxx_start = .);
.bcopyxx.text : {
FILL(0x90909090)
- __bcopyxx_text_start = .;
+ HIDDEN(__bcopyxx_text_start = .);
*(.bcopyxx.text)
- __bcopyxx_text_end = .;
+ HIDDEN(__bcopyxx_text_end = .);
}
- __bcopyxx_text_len = ABSOLUTE(__bcopyxx_text_end) - ABSOLUTE(__bcopyxx_text_start);
- __bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2;
+ HIDDEN(__bcopyxx_text_len = ABSOLUTE(__bcopyxx_text_end) - ABSOLUTE(__bcopyxx_text_start));
+ HIDDEN(__bcopyxx_text_dwords = (__bcopyxx_text_len + 3) >> 2);
.bcopyxx.data : {
- __bcopyxx_data_start = .;
+ HIDDEN(__bcopyxx_data_start = .);
*(.bcopyxx.text)
- __bcopyxx_data_end = .;
+ HIDDEN(__bcopyxx_data_end = .);
}
- __bcopyxx_data_len = ABSOLUTE(__bcopyxx_data_end) - ABSOLUTE(__bcopyxx_data_start);
- __bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2;
+ HIDDEN(__bcopyxx_data_len = ABSOLUTE(__bcopyxx_data_end) - ABSOLUTE(__bcopyxx_data_start));
+ HIDDEN(__bcopyxx_data_dwords = (__bcopyxx_data_len + 3) >> 2);
- __bcopyxx_end = .;
- __bcopyxx_len = ABSOLUTE(__bcopyxx_end) - ABSOLUTE(__bcopyxx_start);
- __bcopyxx_dwords = (__bcopyxx_len + 3) >> 2;
+ HIDDEN(__bcopyxx_end = .);
+ HIDDEN(__bcopyxx_len = ABSOLUTE(__bcopyxx_end) - ABSOLUTE(__bcopyxx_start));
+ HIDDEN(__bcopyxx_dwords = (__bcopyxx_len + 3) >> 2);
. = ALIGN(4);
.data16 : {
- __data16_start = .;
+ HIDDEN(__data16_start = .);
*(.data16)
- __data16_end = .;
+ HIDDEN(__data16_end = .);
}
- __data16_len = ABSOLUTE(__data16_end) - ABSOLUTE(__data16_start);
- __data16_dwords = (__data16_len + 3) >> 2;
+ HIDDEN(__data16_len = ABSOLUTE(__data16_end) - ABSOLUTE(__data16_start));
+ HIDDEN(__data16_dwords = (__data16_len + 3) >> 2);
. = ALIGN(4);
- __config_lma = .;
+ HIDDEN(__config_lma = ABSOLUTE(.));
. += SIZEOF(.config);
. = ALIGN(4);
- __replacestub_lma = .;
+ HIDDEN(__replacestub_lma = ABSOLUTE(.));
. += SIZEOF(.replacestub);
/* The 32-bit code loads above the non-progbits sections */
. = ALIGN(16);
- __pm_code_lma = .;
+ HIDDEN(__pm_code_lma = ABSOLUTE(.));
- __high_clear_start = .;
+ HIDDEN(__high_clear_start = .);
. = ALIGN(512);
.adv (NOLOAD) : {
- __adv_start = .;
+ HIDDEN(__adv_start = .);
*(.adv)
- __adv_end = .;
+ HIDDEN(__adv_end = .);
}
- __adv_len = ABSOLUTE(__adv_end) - ABSOLUTE(__adv_start);
- __adv_dwords = (__adv_len + 3) >> 2;
+ HIDDEN(__adv_len = ABSOLUTE(__adv_end) - ABSOLUTE(__adv_start));
+ HIDDEN(__adv_dwords = (__adv_len + 3) >> 2);
/* Late uninitialized sections */
. = ALIGN(4);
.uibss (NOLOAD) : {
- __uibss_start = .;
+ HIDDEN(__uibss_start = .);
*(.uibss)
- __uibss_end = .;
+ HIDDEN(__uibss_end = .);
}
- __uibss_len = ABSOLUTE(__uibss_end) - ABSOLUTE(__uibss_start);
- __uibss_dwords = (__uibss_len + 3) >> 2;
+ HIDDEN(__uibss_len = ABSOLUTE(__uibss_end) - ABSOLUTE(__uibss_start));
+ HIDDEN(__uibss_dwords = (__uibss_len + 3) >> 2);
- _end16 = .;
- __assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow");
+ HIDDEN(_end16 = .);
+ HIDDEN(__assert_end16 = ASSERT(_end16 <= 0x10000, "64K overflow"));
/*
* Special 16-bit segments
*/
-
- . = ALIGN(65536);
- .real_mode (NOLOAD) : {
- *(.real_mode)
- }
- real_mode_seg = core_real_mode >> 4;
-
. = ALIGN(65536);
.xfer_buf (NOLOAD) : {
*(.xfer_buf)
}
- xfer_buf_seg = core_xfer_buf >> 4;
+ HIDDEN(xfer_buf_seg = core_xfer_buf >> 4);
/*
* The auxilliary data segment is used by the 16-bit code
@@ -219,33 +213,33 @@ SECTIONS
. = ALIGN(16);
.auxseg (NOLOAD) : {
- __auxseg_start = .;
+ HIDDEN(__auxseg_start = .);
*(.auxseg)
- __auxseg_end = .;
+ HIDDEN(__auxseg_end = .);
}
- __auxseg_len = ABSOLUTE(__auxseg_end) - ABSOLUTE(__auxseg_start);
- __auxseg_dwords = (__auxseg_len + 3) >> 2;
- aux_seg = __auxseg_start >> 4;
+ HIDDEN(__auxseg_len = ABSOLUTE(__auxseg_end) - ABSOLUTE(__auxseg_start));
+ HIDDEN(__auxseg_dwords = (__auxseg_len + 3) >> 2);
+ HIDDEN(aux_seg = __auxseg_start >> 4);
/*
* Used to allocate lowmem buffers from 32-bit code
*/
.lowmem (NOLOAD) : {
- __lowmem_start = .;
+ HIDDEN(__lowmem_start = .);
*(.lowmem)
- __lowmem_end = .;
+ HIDDEN(__lowmem_end = .);
}
- __lowmem_len = ABSOLUTE(__lowmem_end) - ABSOLUTE(__lowmem_start);
- __lowmem_dwords = (__lowmem_len + 3) >> 2;
+ HIDDEN(__lowmem_len = ABSOLUTE(__lowmem_end) - ABSOLUTE(__lowmem_start));
+ HIDDEN(__lowmem_dwords = (__lowmem_len + 3) >> 2);
- __high_clear_end = .;
+ HIDDEN(__high_clear_end = .);
- __high_clear_len = ABSOLUTE(__high_clear_end) - ABSOLUTE(__high_clear_start);
- __high_clear_dwords = (__high_clear_len + 3) >> 2;
+ HIDDEN(__high_clear_len = ABSOLUTE(__high_clear_end) - ABSOLUTE(__high_clear_start));
+ HIDDEN(__high_clear_dwords = (__high_clear_len + 3) >> 2);
/* Start of the lowmem heap */
. = ALIGN(16);
- __lowmem_heap = .;
+ HIDDEN(__lowmem_heap = .);
/*
* 32-bit code. This is a hack for the moment due to the
@@ -254,136 +248,137 @@ SECTIONS
. = 0x100000;
- __pm_code_start = .;
- __vma_to_lma = __pm_code_lma - __pm_code_start;
+ HIDDEN(__pm_code_start = .);
+ HIDDEN(__vma_to_lma = ABSOLUTE(__pm_code_lma - __pm_code_start));
.text : AT(ADDR(.text) + __vma_to_lma) {
FILL(0x90909090)
- __text_start = .;
+ HIDDEN(__text_start = .);
*(.text)
*(.text.*)
- __text_end = .;
+ HIDDEN(__text_end = .);
}
.rodata : AT(ADDR(.rodata) + __vma_to_lma) {
- __rodata_start = .;
+ HIDDEN(__rodata_start = .);
*(.rodata)
*(.rodata.*)
- __rodata_end = .;
+ HIDDEN(__rodata_end = .);
}
.ctors : AT(ADDR(.ctors) + __vma_to_lma) {
- __ctors_start = .;
+ HIDDEN(__ctors_start = .);
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
- __ctors_end = .;
+ HIDDEN(__ctors_end = .);
}
.dtors : AT(ADDR(.dtors) + __vma_to_lma) {
- __dtors_start = .;
+ HIDDEN(__dtors_start = .);
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
- __dtors_end = .;
+ HIDDEN(__dtors_end = .);
}
.dynsym : AT(ADDR(.dynsym) + __vma_to_lma) {
- __dynsym_start = .;
- *(.dynsym)
- __dynsym_end = .;
+ HIDDEN(__dynsym_start = .);
+ KEEP (*(.dynsym))
+ HIDDEN(__dynsym_end = .);
}
- __dynsym_len = __dynsym_end - __dynsym_start;
+ HIDDEN(__dynsym_len = __dynsym_end - __dynsym_start);
.dynstr : AT(ADDR(.dynstr) + __vma_to_lma) {
- __dynstr_start = .;
- *(.dynstr)
- __dynstr_end = .;
+ HIDDEN(__dynstr_start = .);
+ KEEP (*(.dynstr))
+ HIDDEN(__dynstr_end = .);
}
- __dynstr_len = __dynstr_end - __dynstr_start;
+ HIDDEN(__dynstr_len = __dynstr_end - __dynstr_start);
.gnu.hash : AT(ADDR(.gnu.hash) + __vma_to_lma) {
- __gnu_hash_start = .;
- *(.gnu.hash)
- __gnu_hash_end = .;
+ HIDDEN(__gnu_hash_start = .);
+ KEEP (*(.gnu.hash))
+ HIDDEN(__gnu_hash_end = .);
}
.dynlink : AT(ADDR(.dynlink) + __vma_to_lma) {
- __dynlink_start = .;
- *(.dynlink)
- __dynlink_end = .;
+ HIDDEN(__dynlink_start = .);
+ KEEP (*(.dynlink))
+ HIDDEN(__dynlink_end = .);
}
.got : AT(ADDR(.got) + __vma_to_lma) {
- __got_start = .;
- KEEP (*(.got.plt))
+ HIDDEN(__got_start = .);
KEEP (*(.got))
- __got_end = .;
+ KEEP (*(.got.plt))
+ HIDDEN(__got_end = .);
}
.dynamic : AT(ADDR(.dynamic) + __vma_to_lma) {
- __dynamic_start = .;
- *(.dynamic)
- __dynamic_end = .;
+ HIDDEN(__dynamic_start = .);
+ KEEP (*(.dynamic))
+ HIDDEN(__dynamic_end = .);
}
.data : AT(ADDR(.data) + __vma_to_lma) {
- __data_start = .;
+ HIDDEN(__data_start = .);
*(.data)
*(.data.*)
- __data_end = .;
+ HIDDEN(__data_end = .);
}
- __pm_code_end = .;
- __pm_code_len = ABSOLUTE(__pm_code_end) - ABSOLUTE(__pm_code_start);
- __pm_code_dwords = (__pm_code_len + 3) >> 2;
+ HIDDEN(__pm_code_end = .);
+ HIDDEN(__pm_code_len = ABSOLUTE(__pm_code_end) - ABSOLUTE(__pm_code_start));
+ HIDDEN(__pm_code_dwords = (__pm_code_len + 3) >> 2);
. = ALIGN(128);
- __bss_vma = .;
- __bss_lma = .; /* Dummy */
+ HIDDEN(__bss_vma = .);
+ HIDDEN(__bss_lma = ABSOLUTE(.)); /* Dummy */
.bss (NOLOAD) : AT (__bss_lma) {
- __bss_start = .;
+ HIDDEN(__bss_start = .);
*(.bss)
*(.bss.*)
*(COMMON)
- __bss_end = .;
+ HIDDEN(__bss_end = .);
}
- __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start);
- __bss_dwords = (__bss_len + 3) >> 2;
+ HIDDEN(__bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start));
+ HIDDEN(__bss_dwords = (__bss_len + 3) >> 2);
/* Very large objects which don't need to be zeroed */
- __hugebss_vma = .;
- __hugebss_lma = .; /* Dummy */
+ HIDDEN(__hugebss_vma = .);
+ HIDDEN(__hugebss_lma = ABSOLUTE(.)); /* Dummy */
.hugebss (NOLOAD) : AT (__hugebss_lma) {
- __hugebss_start = .;
+ HIDDEN(__hugebss_start = .);
*(.hugebss)
*(.hugebss.*)
- __hugebss_end = .;
+ HIDDEN(__hugebss_end = .);
}
- __hugebss_len = ABSOLUTE(__hugebss_end) - ABSOLUTE(__hugebss_start);
- __hugebss_dwords = (__hugebss_len + 3) >> 2;
+ HIDDEN(__hugebss_len = ABSOLUTE(__hugebss_end) - ABSOLUTE(__hugebss_start));
+ HIDDEN(__hugebss_dwords = (__hugebss_len + 3) >> 2);
/* XXX: This stack should be unified with the COM32 stack */
- __stack_vma = .;
- __stack_lma = .; /* Dummy */
+ HIDDEN(__stack_vma = .);
+ HIDDEN(__stack_lma = ABSOLUTE(.)); /* Dummy */
.stack (NOLOAD) : AT(__stack_lma) {
- __stack_start = .;
+ HIDDEN(__stack_start = .);
*(.stack)
- __stack_end = .;
+ HIDDEN(__stack_end = .);
}
- __stack_len = ABSOLUTE(__stack_end) - ABSOLUTE(__stack_start);
- __stack_dwords = (__stack_len + 3) >> 2;
+ HIDDEN(__stack_len = ABSOLUTE(__stack_end) - ABSOLUTE(__stack_start));
+ HIDDEN(__stack_dwords = (__stack_len + 3) >> 2);
- _end = .;
+ HIDDEN(_end = .);
/* COM32R and kernels are loaded after our own PM code */
. = ALIGN(65536);
- free_high_memory = .;
+ HIDDEN(free_high_memory = .);
/* Stuff we don't need... */
/DISCARD/ : {
*(.eh_frame)
+ *(.interp)
}
}
diff --git a/core/layout.inc b/core/layout.inc
index 53ca783d..635df537 100644
--- a/core/layout.inc
+++ b/core/layout.inc
@@ -139,17 +139,6 @@ serial_buf_size equ 4096 ; Should be a power of 2
core_xfer_buf resb 65536
;
-; Segment for the real mode code (needed as long as we have a in-kernel
-; loader and/or COM16 support.
-; One symbol for the segment number, one for the absolute address
-;
- extern real_mode_seg
- section .real_mode write nobits align=65536
- global core_real_mode:data hidden
-core_real_mode resb 65536
-comboot_seg equ real_mode_seg ; COMBOOT image loading zone
-
-;
; At the very end, the lowmem heap
;
extern __lowmem_heap
--
2.13.3

View File

@ -0,0 +1,53 @@
From 4df2e7c0ae84bfbdba0ed285c0664aa089b38b7e Mon Sep 17 00:00:00 2001
From: Carlos Santos <casantos@datacom.ind.br>
Date: Sat, 30 Sep 2017 19:49:55 -0300
Subject: [PATCH] extlinux: Use the host toolchain to build.
It is meant to run on the host machine, hence must be built using the
host toolchain.
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
extlinux/Makefile | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/extlinux/Makefile b/extlinux/Makefile
index 02d1db51..5c4baa5a 100644
--- a/extlinux/Makefile
+++ b/extlinux/Makefile
@@ -18,9 +18,9 @@ include $(MAKEDIR)/syslinux.mk
OPTFLAGS = -g -Os
INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller
-CFLAGS = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+CFLAGS = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
$(OPTFLAGS) $(INCLUDES)
-LDFLAGS =
+LDFLAGS = $(LDFLAGS_FOR_BUILD)
SRCS = main.c \
mountinfo.c \
@@ -52,16 +52,16 @@ spotless: clean
installer: extlinux
extlinux: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $^
+ $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^
strip:
$(STRIP) extlinux
%.o: %.c
- $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+ $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
%.i: %.c
- $(CC) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
+ $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
%.s: %.c
- $(CC) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
+ $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
-include .*.d
--
2.13.5

View File

@ -0,0 +1,34 @@
From 1a74985b2a404639b08882c57f3147229605dfd5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 19 Apr 2016 06:50:31 -0400
Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev
These functions are defined in sys/sysmacros.h, so add the include to
main.c. This is already handled correctly in mountinfo.c. Otherwise
we get build failures like:
main.o: In function 'find_device_sysfs':
extlinux/main.c:1131: undefined reference to 'minor'
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Alexander Sverdlin <alexader.sverdlin@gmail.com>
---
extlinux/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/extlinux/main.c b/extlinux/main.c
index a7ebd49..ebff7ea 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -38,6 +38,7 @@
#include <sysexits.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/vfs.h>
--
2.10.5.GIT

View File

@ -0,0 +1,45 @@
From 44a1b42e561b9a257209300e2860b901b100cc17 Mon Sep 17 00:00:00 2001
From: Carlos Santos <casantos@datacom.com.br>
Date: Tue, 26 Feb 2019 08:07:22 -0300
Subject: [PATCH] Fix build with gnu-efi version 3.0.9
Adapt a patch already applied upstream to prevent multiple definitions
of 'memset' and 'memcpy'.
Signed-off-by: Carlos Santos <casantos@datacom.com.br>
(adapted from commit 363d61c4f112b972649b19d67e96b9321f738f00)
---
mk/lib.mk | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mk/lib.mk b/mk/lib.mk
index ceb95bd0..c9b6eaf3 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -186,9 +186,9 @@ MINLIBOBJS = \
# $(LIBVESA_OBJS)
CORELIBOBJS = \
- memcpy.o memset.o memcmp.o printf.o strncmp.o vfprintf.o \
+ memcmp.o printf.o strncmp.o vfprintf.o \
strlen.o vsnprintf.o snprintf.o stpcpy.o strcmp.o strdup.o \
- strcpy.o strncpy.o setjmp.o fopen.o fread.o fread2.o puts.o \
+ strcpy.o strncpy.o fopen.o fread.o fread2.o puts.o \
strtoul.o strntoumax.o strcasecmp.o \
sprintf.o strlcat.o strchr.o strlcpy.o strncasecmp.o ctypes.o \
fputs.o fwrite2.o fwrite.o fgetc.o fclose.o lmalloc.o \
@@ -203,6 +203,11 @@ CORELIBOBJS = \
$(LIBENTRY_OBJS) \
$(LIBMODULE_OBJS)
+ifndef EFI_BUILD
+# For EFI, these are part of gnu-efi
+CORELIBOBJS += setjmp.o memcpy.o memset.o
+endif
+
LDFLAGS = -m elf_$(ARCH) --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld
.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss
--
2.14.5

View File

@ -0,0 +1,47 @@
From beb526ca925983c7da229043790ecd552d910650 Mon Sep 17 00:00:00 2001
From: Christian Stewart <christian@paral.in>
Date: Thu, 4 Apr 2019 23:24:31 -0700
Subject: [PATCH] Fix build with binutils note gnu property section
This fixes the following build error with newer binutils:
objcopy -O binary mbr.elf mbr.bin
perl /build/syslinux/src/syslinux/mbr/checksize.pl mbr.bin
mbr.bin: too big (452 > 440)
Corresponding bug reports:
- https://bugs.archlinux.org/task/60405
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
Strips the .note.gnu.property in the linker scripts for the MBRs.
Signed-off-by: Christian Stewart <christian@paral.in>
---
mbr/i386/mbr.ld | 1 +
mbr/x86_64/mbr.ld | 1 +
2 files changed, 2 insertions(+)
diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld
index d14ba802..53683461 100644
--- a/mbr/i386/mbr.ld
+++ b/mbr/i386/mbr.ld
@@ -70,4 +70,5 @@ SECTIONS
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.note.GNU-stack) }
+ /DISCARD/ : { *(.note.gnu.property) }
}
diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld
index ae27d49a..b8c0d895 100644
--- a/mbr/x86_64/mbr.ld
+++ b/mbr/x86_64/mbr.ld
@@ -69,4 +69,5 @@ SECTIONS
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/DISCARD/ : { *(.note.GNU-stack) }
+ /DISCARD/ : { *(.note.gnu.property) }
}
--
2.21.0

Some files were not shown because too many files have changed in this diff Show More