Initial Commit

- initial default booting image
This commit is contained in:
2026-11-06 20:45:42 +01:00
commit b8783708ae
15201 changed files with 602532 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
From ab8b54cfc9d3fddba297c343a2d8dea9dbe20017 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
Date: Tue, 4 Aug 2015 22:13:20 +0200
Subject: [PATCH] drop configh from tools
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We need to build u-boot tools without a board configuration for the target.
fw_env just uses config.h to define the default environment of the created
image, so it really isn't mandatory.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
[Jörg Krause: update for version 2015.07]
Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
[Romain: update for version 2017.05
after commit 9d80b49a671c9922931adcd823aab0ed319a42d1]
Signed-off-by: Romain Naour <romain.naour@gmail.com>
[Pierre-Jean: update for version 2019.04]
Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
---
tools/env/fw_env_private.h | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/tools/env/fw_env_private.h b/tools/env/fw_env_private.h
index 86be16d..3c62ac4 100644
--- a/tools/env/fw_env_private.h
+++ b/tools/env/fw_env_private.h
@@ -4,17 +4,6 @@
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
-/* Pull in the current config to define the default environment */
-#include <linux/kconfig.h>
-
-#ifndef __ASSEMBLY__
-#define __ASSEMBLY__ /* get only #defines from config.h */
-#include <config.h>
-#undef __ASSEMBLY__
-#else
-#include <config.h>
-#endif
-
/*
* To build the utility with the static configuration
* comment out the next line.
--
2.9.4

View File

@@ -0,0 +1,34 @@
From 3b89170333ef0fdfffee14751ce3e1d66d7dfa00 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Tue, 14 Sep 2021 19:08:02 +0200
Subject: [PATCH] tools/Makefile: fix {C,LD}FLAGS with CROSS_BUILD_TOOLS
When CROSS_BUILD_TOOLS is set, set KBUILD_HOST{CF,LD}FLAGS to
{C,LD}FLAGS otherwise CC will be used with HOST{C,LD}FLAGS which seems
wrong.
It should be noted that, for an unknown reason, overriding
HOST{C,LD}FLAGS don't work.
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
tools/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/Makefile b/tools/Makefile
index 4a86321f64..98bb92990d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -316,7 +316,8 @@ subdir- += env
ifneq ($(CROSS_BUILD_TOOLS),)
override HOSTCC = $(CC)
-override HOSTCFLAGS = $(CFLAGS)
+override KBUILD_HOSTCFLAGS = $(CFLAGS)
+override KBUILD_HOSTLDFLAGS = $(LDFLAGS)
quiet_cmd_crosstools_strip = STRIP $^
cmd_crosstools_strip = $(STRIP) $^; touch $@
--
2.33.0

View File

@@ -0,0 +1,115 @@
config BR2_PACKAGE_UBOOT_TOOLS
bool "u-boot tools"
help
Companion tools for Das U-Boot bootloader.
http://www.denx.de/wiki/U-Boot/WebHome
if BR2_PACKAGE_UBOOT_TOOLS
config BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT
bool "Flattened Image Tree (FIT) support"
depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_DTC
select BR2_PACKAGE_DTC_PROGRAMS
help
Enables support for Flattened Image Tree (FIT).
This option allows to boot the new uImage structure,
Flattened Image Tree. FIT is formally a FDT, which can include
images of various types (kernel, FDT blob, ramdisk, etc.)
in a single blob. To boot this new uImage structure,
pass the address of the blob to the "bootm" command.
comment "u-boot tools FIT support needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS
if BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT
config BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT
bool "FIT signature verification support"
select BR2_PACKAGE_OPENSSL
help
Enables support for FIT Signature Verification.
Flat Image Trees (FIT) supports hashing of images so that
these hashes can be checked on loading. This protects
against corruption of the image. However it does not prevent
the substitution of one image for another.
The signature feature allows the hash to be signed with a
private key such that it can be verified using a public key
later. Provided that the private key is kept secret and the
public key is stored in a non-volatile place, any image can
be verified in this way.
Enabling this option pulls in a dependency on libssl and
libcrypto, and possibly GPL/OpenSSL licensing
incompatibility issues.
config BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN
bool "fit_check_sign"
depends on BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT
help
Install the fit_check_sign tool on the target system
The fit_check_sign tool from Das U-Boot bootloader, which
allows FIT image signature validation on target system.
endif
config BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE
bool "mkimage"
help
Install the mkimage tool on the target system
The mkimage tool from Das U-Boot bootloader, which allows
generation of U-Boot images in various formats.
config BR2_PACKAGE_UBOOT_TOOLS_MKEFICAPSULE
bool "mkeficapsule"
depends on !BR2_STATIC_LIBS # gnutls, p11-kit
depends on BR2_TOOLCHAIN_HAS_THREADS # p11-kit
depends on BR2_USE_MMU # p11-kit
depends on BR2_USE_WCHAR # gnutls
select BR2_PACKAGE_GNUTLS
select BR2_PACKAGE_P11_KIT
help
Install the mkeficapsule tool on the target system
The mkeficapsule tool from Das U-Boot bootloader, which allows
generation of UEFI capsule binaries.
comment "mkeficapsule support needs a toolchain w/ wchar, threads, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS \
|| BR2_STATIC_LIBS
config BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE
bool "mkenvimage"
help
Install the mkenvimage tool on the target system
The mkenvimage tool from Das U-Boot bootloader, which allows
generation of a valid binary environment image from a text
file describing the key=value pairs of the environment.
config BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
bool "fw_printenv"
default y
help
Install the fw_printenv / fw_setenv tools on the target system
The fw_printenv and fw_setenv tools from Das U-Boot
bootloader, which allows access to the U-Boot environment
from Linux.
config BR2_PACKAGE_UBOOT_TOOLS_DUMPIMAGE
bool "dumpimage"
help
Install the dumpimage tool on the target system
The dumpimage tool from Das U-Boot bootloader, which allows
extraction of data from U-Boot images.
endif

View File

@@ -0,0 +1,111 @@
config BR2_PACKAGE_HOST_UBOOT_TOOLS
bool "host u-boot tools"
help
Companion tools for Das U-Boot bootloader.
http://www.denx.de/wiki/U-Boot/WebHome
if BR2_PACKAGE_HOST_UBOOT_TOOLS
config BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT
bool "Flattened Image Tree (FIT) support"
select BR2_PACKAGE_HOST_DTC
help
Enables support for Flattened Image Tree (FIT).
This option allows to boot the new uImage structure,
Flattened Image Tree. FIT is formally a FDT, which can include
images of various types (kernel, FDT blob, ramdisk, etc.)
in a single blob. To boot this new uImage structure,
pass the address of the blob to the "bootm" command.
if BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT
config BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT
bool "FIT signature verification support"
help
Enables support for FIT Signature Verification.
Flat Image Trees (FIT) supports hashing of images so that
these hashes can be checked on loading. This protects
against corruption of the image. However it does not prevent
the substitution of one image for another.
The signature feature allows the hash to be signed with a
private key such that it can be verified using a public key
later. Provided that the private key is kept secret and the
public key is stored in a non-volatile place, any image can
be verified in this way.
endif # BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT
config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
bool "Environment image"
help
Generate a valid binary environment image from a text file
describing the key=value pairs of the environment.
This option can be useful to build environment configurations
as part of a Linux / rootfs only defconfig instead of using
post scripts. This supports a hardware use case of a single
bootloader only defconfig but multiple Linux / rootfs
defconfigs with different boot environments.
The environment image will be called uboot-env.bin.
if BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
string "Source files for environment"
default BR2_TARGET_UBOOT_ENVIMAGE_SOURCE if BR2_TARGET_UBOOT_ENVIMAGE_SOURCE != "" # legacy
help
Text files describing the environment. Files should have
lines of the form var=value, one per line. Blank lines and
lines starting with a # are ignored.
Multiple source files are concatenated in the order listed.
Leave empty to generate image from compiled-in env if a U-boot
target build is configured (BR2_TARGET_UBOOT)
config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE
string "Size of environment"
default BR2_TARGET_UBOOT_ENVIMAGE_SIZE if BR2_TARGET_UBOOT_ENVIMAGE_SIZE != "" # legacy
help
Size of envronment, can be prefixed with 0x for hexadecimal
values.
config BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_REDUNDANT
bool "Environment has two copies"
help
Some platforms define in their U-Boot configuration that the
U-Boot environment should be duplicated in two locations (for
extra safety). Check your U-Boot configuration for the
CONFIG_ENV_ADDR_REDUND and CONFIG_ENV_OFFSET_REDUND settings
to see if this is the case for your platform.
If it is the case, then you should enable this option to
ensure that the U-Boot environment image generated by
Buildroot is compatible with the "redundant environment"
mechanism of U-Boot.
endif # BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
config BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT
bool "Generate a U-Boot boot script"
help
Generate a U-Boot boot script, given a file listing U-Boot
commands to be executed at boot time. The generated boot
script will be called 'boot.scr'.
if BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT
config BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE
string "U-Boot boot script source"
default BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE if BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE != "" # legacy
help
Source file to generate the U-Boot boot script.
endif # BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT
endif # BR2_PACKAGE_HOST_UBOOT_TOOLS

View File

@@ -0,0 +1,3 @@
# Locally computed:
sha256 78e8bfc382fe388f9b55aa1daf8c563522a037779b5d4c349d1415e381f1243e u-boot-2026.07.tar.bz2
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 Licenses/gpl-2.0.txt

View File

@@ -0,0 +1,264 @@
################################################################################
#
# uboot-tools
#
################################################################################
UBOOT_TOOLS_VERSION = 2026.07
UBOOT_TOOLS_SOURCE = u-boot-$(UBOOT_TOOLS_VERSION).tar.bz2
UBOOT_TOOLS_SITE = https://ftp.denx.de/pub/u-boot
UBOOT_TOOLS_LICENSE = GPL-2.0+
UBOOT_TOOLS_LICENSE_FILES = Licenses/gpl-2.0.txt
UBOOT_TOOLS_CPE_ID_VENDOR = denx
UBOOT_TOOLS_CPE_ID_PRODUCT = u-boot
UBOOT_TOOLS_INSTALL_STAGING = YES
# u-boot 2020.01+ needs make 4.0+
UBOOT_TOOLS_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY)
HOST_UBOOT_TOOLS_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY) host-gnutls
# the available hash algorithms and the way to enable them are the
# same for host and target
UBOOT_TOOLS_HASH_ALGOS = CRC16 CRC32 MD5 SHA1 SHA256 SHA384 SHA512
define UBOOT_TOOLS_ENABLE_HASH_ALGOS
$(foreach hash,$(UBOOT_TOOLS_HASH_ALGOS),\
echo '#define CONFIG_TOOLS_$(hash) 1' >> $(@D)/include/generated/autoconf.h
)
endef
define UBOOT_TOOLS_CONFIGURE_CMDS
mkdir -p $(@D)/include/config
echo "#include <linux/kconfig.h>" > $(@D)/include/config.h
touch $(@D)/include/config/auto.conf
mkdir -p $(@D)/include/generated
$(if $(BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT),$(UBOOT_TOOLS_ENABLE_HASH_ALGOS))
$(if $(BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT),echo '#define CONFIG_TOOLS_FIT_PRINT 1' >> $(@D)/include/generated/autoconf.h)
echo $(if $(BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),'#define CONFIG_FIT_SIGNATURE 1') >> $(@D)/include/generated/autoconf.h
mkdir -p $(@D)/include/asm
touch $(@D)/include/asm/linkage.h
endef
UBOOT_TOOLS_MAKE_OPTS = CROSS_COMPILE="$(TARGET_CROSS)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
HOSTCFLAGS="$(HOST_CFLAGS)" \
STRIP=$(TARGET_STRIP)
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FIT_SUPPORT),y)
UBOOT_TOOLS_MAKE_OPTS += CONFIG_FIT=y CONFIG_MKIMAGE_DTC_PATH=dtc
UBOOT_TOOLS_DEPENDENCIES += dtc
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),y)
UBOOT_TOOLS_MAKE_OPTS += CONFIG_FIT_SIGNATURE=y CONFIG_FIT_SIGNATURE_MAX_SIZE=0x10000000
UBOOT_TOOLS_DEPENDENCIES += openssl host-pkgconf
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKEFICAPSULE),y)
UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_MKEFICAPSULE=y
UBOOT_TOOLS_DEPENDENCIES += gnutls
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FIT_CHECK_SIGN),y)
define UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN
$(INSTALL) -m 0755 -D $(@D)/tools/fit_check_sign $(TARGET_DIR)/usr/bin/fit_check_sign
endef
endif
define UBOOT_TOOLS_BUILD_CMDS
$(TARGET_MAKE_ENV) $(BR2_MAKE) -C $(@D) $(UBOOT_TOOLS_MAKE_OPTS) \
CROSS_BUILD_TOOLS=y tools-only
$(TARGET_MAKE_ENV) $(BR2_MAKE) -C $(@D) $(UBOOT_TOOLS_MAKE_OPTS) \
envtools no-dot-config-targets=envtools
endef
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKIMAGE),y)
define UBOOT_TOOLS_INSTALL_MKIMAGE
$(INSTALL) -m 0755 -D $(@D)/tools/mkimage $(TARGET_DIR)/usr/bin/mkimage
endef
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKEFICAPSULE),y)
define UBOOT_TOOLS_INSTALL_MKEFICAPSULE
$(INSTALL) -m 0755 -D $(@D)/tools/mkeficapsule $(TARGET_DIR)/usr/bin/mkeficapsule
endef
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_MKENVIMAGE),y)
define UBOOT_TOOLS_INSTALL_MKENVIMAGE
$(INSTALL) -m 0755 -D $(@D)/tools/mkenvimage $(TARGET_DIR)/usr/bin/mkenvimage
endef
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV),y)
define UBOOT_TOOLS_INSTALL_FWPRINTENV
$(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv $(TARGET_DIR)/usr/sbin/fw_printenv
ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
endef
endif
ifeq ($(BR2_PACKAGE_UBOOT_TOOLS_DUMPIMAGE),y)
define UBOOT_TOOLS_INSTALL_DUMPIMAGE
$(INSTALL) -m 0755 -D $(@D)/tools/dumpimage $(TARGET_DIR)/usr/sbin/dumpimage
endef
endif
define UBOOT_TOOLS_INSTALL_STAGING_CMDS
$(INSTALL) -D -m 0755 $(@D)/tools/env/lib.a $(STAGING_DIR)/usr/lib/libubootenv.a
$(INSTALL) -D -m 0644 $(@D)/tools/env/fw_env.h $(STAGING_DIR)/usr/include/fw_env.h
endef
define UBOOT_TOOLS_INSTALL_TARGET_CMDS
$(UBOOT_TOOLS_INSTALL_MKIMAGE)
$(UBOOT_TOOLS_INSTALL_MKEFICAPSULE)
$(UBOOT_TOOLS_INSTALL_MKENVIMAGE)
$(UBOOT_TOOLS_INSTALL_FWPRINTENV)
$(UBOOT_TOOLS_INSTALL_DUMPIMAGE)
$(UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN)
endef
# host-uboot-tools
define HOST_UBOOT_TOOLS_CONFIGURE_CMDS
mkdir -p $(@D)/include/config
echo "#include <linux/kconfig.h>" > $(@D)/include/config.h
touch $(@D)/include/config/auto.conf
mkdir -p $(@D)/include/generated
touch $(@D)/include/generated/autoconf.h
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT),$(UBOOT_TOOLS_ENABLE_HASH_ALGOS))
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT),echo '#define CONFIG_TOOLS_FIT_PRINT 1' >> $(@D)/include/generated/autoconf.h)
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),echo '#define CONFIG_TOOLS_IMAGE_PRE_LOAD 1' >> $(@D)/include/generated/autoconf.h)
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),echo '#define CONFIG_TOOLS_RSASSA_PSS 1' >> $(@D)/include/generated/autoconf.h)
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),echo '#define CONFIG_TOOLS_FIT_SIGNATURE 1' >> $(@D)/include/generated/autoconf.h)
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),echo '#define CONFIG_TOOLS_FIT_SIGNATURE_MAX_SIZE 0x10000000' >> $(@D)/include/generated/autoconf.h)
mkdir -p $(@D)/include/asm
touch $(@D)/include/asm/linkage.h
endef
HOST_UBOOT_TOOLS_MAKE_OPTS = HOSTCC="$(HOSTCC)" \
HOSTCFLAGS="$(HOST_CFLAGS)" \
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
CONFIG_TOOLS_MKEFICAPSULE=y
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT),y)
HOST_UBOOT_TOOLS_MAKE_OPTS += CONFIG_FIT=y CONFIG_MKIMAGE_DTC_PATH=dtc
HOST_UBOOT_TOOLS_DEPENDENCIES += host-dtc
endif
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SIGNATURE_SUPPORT),y)
HOST_UBOOT_TOOLS_MAKE_OPTS += CONFIG_TOOLS_LIBCRYPTO=y CONFIG_FIT_SIGNATURE=y
HOST_UBOOT_TOOLS_DEPENDENCIES += host-openssl
define HOST_UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN
$(INSTALL) -m 0755 -D $(@D)/tools/fit_check_sign $(HOST_DIR)/bin/fit_check_sign
endef
endif
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE),y)
UBOOT_TOOLS_GENERATE_ENV_FILE = $(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE))
# If BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is left empty, we
# will use the default environment provided in the U-Boot build
# directory as boot-env-defaults.txt, which requires having uboot as a
# dependency.
# If BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE is not empty, is
# might be referring to a file within the U-Boot source tree, so we
# also need to have uboot as a dependency.
ifeq ($(BR2_TARGET_UBOOT),y)
HOST_UBOOT_TOOLS_DEPENDENCIES += uboot
# Handle the case where BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE
# is left empty, use the default U-Boot environment.
ifeq ($(UBOOT_TOOLS_GENERATE_ENV_FILE),)
UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-defaults.txt
define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
CROSS_COMPILE="$(TARGET_CROSS)" \
$(UBOOT_SRCDIR)/scripts/get_default_envs.sh \
$(UBOOT_SRCDIR) \
> $(UBOOT_TOOLS_GENERATE_ENV_FILE)
endef
endif # UBOOT_TOOLS_GENERATE_ENV_FILE
endif # BR2_TARGET_UBOOT
ifeq ($(BR_BUILDING),y)
ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE)),)
$(error Please provide U-Boot environment size (BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE setting))
endif
# If U-Boot is not available, ENVIMAGE_SOURCE must be provided by user,
# otherwise it is optional because the default can be taken from U-Boot
ifeq ($(BR2_TARGET_UBOOT),)
ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE)),)
$(error Please provide U-Boot environment file (BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE setting))
endif
endif #BR2_TARGET_UBOOT
endif #BR_BUILDING
define HOST_UBOOT_TOOLS_GENERATE_ENVIMAGE
$(HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS)
cat $(UBOOT_TOOLS_GENERATE_ENV_FILE) | \
$(@D)/tools/mkenvimage -s $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE) \
$(if $(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_REDUNDANT),-r) \
$(if $(filter "BIG",$(BR2_ENDIAN)),-b) \
-o $(@D)/tools/uboot-env.bin \
-
endef
define HOST_UBOOT_TOOLS_INSTALL_ENVIMAGE
$(INSTALL) -m 0755 -D $(@D)/tools/uboot-env.bin $(BINARIES_DIR)/uboot-env.bin
endef
endif #BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE
ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT),y)
ifeq ($(BR_BUILDING),y)
ifeq ($(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE)),)
$(error Please define a source file for U-Boot boot script (BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE setting))
endif
endif #BR_BUILDING
define HOST_UBOOT_TOOLS_GENERATE_BOOT_SCRIPT
$(@D)/tools/mkimage -C none -A $(MKIMAGE_ARCH) -T script \
-d $(call qstrip,$(BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE)) \
$(@D)/tools/boot.scr
endef
define HOST_UBOOT_TOOLS_INSTALL_BOOT_SCRIPT
$(INSTALL) -m 0755 -D $(@D)/tools/boot.scr $(BINARIES_DIR)/boot.scr
endef
endif #BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT
define HOST_UBOOT_TOOLS_BUILD_CMDS
$(BR2_MAKE1) -C $(@D) $(HOST_UBOOT_TOOLS_MAKE_OPTS) tools-only
$(BR2_MAKE1) -C $(@D) $(HOST_UBOOT_TOOLS_MAKE_OPTS) envtools no-dot-config-targets=envtools
$(HOST_UBOOT_TOOLS_GENERATE_ENVIMAGE)
$(HOST_UBOOT_TOOLS_GENERATE_BOOT_SCRIPT)
endef
define HOST_UBOOT_TOOLS_INSTALL_CMDS
$(INSTALL) -m 0755 -D $(@D)/tools/mkimage $(HOST_DIR)/bin/mkimage
$(INSTALL) -m 0755 -D $(@D)/tools/mkeficapsule $(HOST_DIR)/bin/mkeficapsule
$(INSTALL) -m 0755 -D $(@D)/tools/mkenvimage $(HOST_DIR)/bin/mkenvimage
$(INSTALL) -m 0755 -D $(@D)/tools/dumpimage $(HOST_DIR)/bin/dumpimage
$(HOST_UBOOT_TOOLS_INSTALL_FIT_CHECK_SIGN)
$(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv $(HOST_DIR)/bin/fw_printenv
ln -sf fw_printenv $(HOST_DIR)/bin/fw_setenv
$(HOST_UBOOT_TOOLS_INSTALL_ENVIMAGE)
$(HOST_UBOOT_TOOLS_INSTALL_BOOT_SCRIPT)
endef
$(eval $(generic-package))
$(eval $(host-generic-package))
# Convenience variables for other mk files that make use of mkimage
MKIMAGE = $(HOST_DIR)/bin/mkimage
# mkimage supports alpha arc arm arm64 blackfin ia64 invalid m68k microblaze mips mips64 nds32 or1k powerpc riscv s390 sandbox sh sparc sparc64 x86 x86_64 xtensa
# NORMALIZED_ARCH can be arm64 arc arm blackfin m68k microblaze mips powerpc sh sparc i386 x86_64 xtensa
# For i386, we need to convert
# For openrisc, we need to convert
# For others, we'll just keep NORMALIZED_ARCH
ifeq ($(NORMALIZED_ARCH),i386)
MKIMAGE_ARCH = x86
else ifeq ($(NORMALIZED_ARCH),openrisc)
MKIMAGE_ARCH = or1k
else
MKIMAGE_ARCH = $(NORMALIZED_ARCH)
endif