2018-05-06 21:58:06 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0+
|
2002-07-20 20:14:13 +00:00
|
|
|
#
|
2006-09-01 17:49:50 +00:00
|
|
|
# (C) Copyright 2000-2006
|
2002-07-20 20:14:13 +00:00
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
# A note on target vs host configuration:
|
|
|
|
#
|
|
|
|
# Host tools can be used across multiple targets, or different configurations
|
|
|
|
# of the same target. Thus, host tools must be able to handle any combination
|
|
|
|
# of target configurations. To prevent having different variations of the same
|
|
|
|
# tool, the tool build options may not depend on target configuration.
|
|
|
|
#
|
|
|
|
# Some linux distributions package these utilities as u-boot-tools, and it
|
|
|
|
# would be unmaintainable to have a different tool variation for each
|
|
|
|
# arch or configuration.
|
|
|
|
#
|
|
|
|
# A couple of simple rules:
|
|
|
|
#
|
|
|
|
# 1) Do not use target CONFIG_* options to enable or disable features in host
|
|
|
|
# tools. Only use the configs from tools/Kconfig
|
|
|
|
# 2) It's okay to use target configs to disable building specific tools.
|
|
|
|
# That's as long as the features of those tools aren't modified.
|
|
|
|
#
|
|
|
|
|
2010-01-21 09:03:22 +00:00
|
|
|
# Enable all the config-independent tools
|
|
|
|
ifneq ($(HOST_TOOLS_ALL),)
|
2020-05-06 12:02:40 +00:00
|
|
|
CONFIG_ARCH_KIRKWOOD = y
|
2010-08-15 04:03:19 +00:00
|
|
|
CONFIG_CMD_LOADS = y
|
2010-01-21 09:03:22 +00:00
|
|
|
CONFIG_CMD_NET = y
|
|
|
|
CONFIG_NETCONSOLE = y
|
2016-11-10 12:13:23 +00:00
|
|
|
CONFIG_ARCH_SUNXI = y
|
2010-01-21 09:03:22 +00:00
|
|
|
endif
|
|
|
|
|
2014-02-04 08:24:39 +00:00
|
|
|
subdir-$(HOST_TOOLS_ALL) += gdb
|
|
|
|
|
2011-06-19 08:27:39 +00:00
|
|
|
# Merge all the different vars for envcrc into one
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
|
|
|
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
2022-12-02 21:42:17 +00:00
|
|
|
BUILD_ENVCRC ?= $(ENVCRC-y)
|
2011-06-19 08:27:39 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params
|
2014-05-19 12:23:40 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
|
|
|
|
HOSTCFLAGS_bmp_logo.o := -pedantic
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2022-12-02 21:42:17 +00:00
|
|
|
hostprogs-$(BUILD_ENVCRC) += envcrc
|
2017-08-03 18:21:49 +00:00
|
|
|
envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
|
|
|
|
HOSTCFLAGS_gen_eth_addr.o := -pedantic
|
2009-03-13 23:54:34 +00:00
|
|
|
|
2016-11-25 15:30:32 +00:00
|
|
|
hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
|
|
|
|
gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
|
|
|
|
HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
|
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_CMD_LOADS) += img2srec
|
|
|
|
HOSTCFLAGS_img2srec.o := -pedantic
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-y += mkenvimage
|
|
|
|
mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-y += dumpimage mkimage
|
2021-07-14 22:05:47 +00:00
|
|
|
hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fit_info fit_check_sign
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2022-10-21 12:46:05 +00:00
|
|
|
ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST)$(CONFIG_FWU_MDATA_GPT_BLK),)
|
|
|
|
hostprogs-y += file2include
|
|
|
|
endif
|
tools: provide a tool to convert a binary file to an include
For testing EFI disk management we need an in-memory image of
a disk.
The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.
#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }
As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-17 19:16:09 +00:00
|
|
|
|
2021-10-14 18:47:54 +00:00
|
|
|
FIT_OBJS-y := fit_common.o fit_image.o image-host.o boot/image-fit.o
|
|
|
|
FIT_SIG_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := image-sig-host.o boot/image-fit-sig.o
|
|
|
|
FIT_CIPHER_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := boot/image-cipher.o
|
2017-05-27 13:38:19 +00:00
|
|
|
|
2017-10-17 13:30:18 +00:00
|
|
|
# The following files are synced with upstream DTC.
|
|
|
|
# Use synced versions from scripts/dtc/libfdt/.
|
2020-04-16 09:30:17 +00:00
|
|
|
LIBFDT_OBJS := $(addprefix libfdt/, fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o \
|
|
|
|
fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o)
|
2017-05-27 13:38:17 +00:00
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
RSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/rsa/, \
|
2021-02-19 18:45:10 +00:00
|
|
|
rsa-sign.o rsa-verify.o \
|
2015-01-23 10:31:50 +00:00
|
|
|
rsa-mod-exp.o)
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
ECDSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/ecdsa/, ecdsa-libcrypto.o)
|
2021-02-19 18:45:12 +00:00
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
AES_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/aes/, \
|
2019-12-18 17:25:42 +00:00
|
|
|
aes-encrypt.o aes-decrypt.o)
|
2019-12-18 17:25:41 +00:00
|
|
|
|
2022-03-18 05:00:43 +00:00
|
|
|
# Cryptographic helpers and image types that depend on openssl/libcrypto
|
|
|
|
LIBCRYPTO_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := \
|
|
|
|
lib/fdt-libcrypto.o \
|
|
|
|
sunxi_toc0.o
|
2021-02-19 18:45:11 +00:00
|
|
|
|
2015-12-29 12:22:43 +00:00
|
|
|
ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
|
2015-08-30 22:55:24 +00:00
|
|
|
|
2014-02-04 08:24:10 +00:00
|
|
|
# common objs for dumpimage and mkimage
|
|
|
|
dumpimage-mkimage-objs := aisimage.o \
|
2014-05-19 12:23:39 +00:00
|
|
|
atmelimage.o \
|
2019-05-03 20:37:05 +00:00
|
|
|
$(FIT_OBJS-y) \
|
2014-02-04 08:24:10 +00:00
|
|
|
$(FIT_SIG_OBJS-y) \
|
2019-12-18 17:25:41 +00:00
|
|
|
$(FIT_CIPHER_OBJS-y) \
|
2021-10-14 18:47:54 +00:00
|
|
|
boot/fdt_region.o \
|
|
|
|
boot/bootm.o \
|
2014-06-06 05:04:32 +00:00
|
|
|
lib/crc32.o \
|
2014-02-04 08:24:10 +00:00
|
|
|
default_image.o \
|
2014-06-22 04:33:29 +00:00
|
|
|
lib/fdtdec_common.o \
|
2014-06-06 05:04:32 +00:00
|
|
|
lib/fdtdec.o \
|
2021-10-14 18:47:54 +00:00
|
|
|
boot/image.o \
|
|
|
|
boot/image-host.o \
|
2014-02-04 08:24:10 +00:00
|
|
|
imagetool.o \
|
|
|
|
imximage.o \
|
2018-10-16 04:50:30 +00:00
|
|
|
imx8image.o \
|
2018-11-20 10:19:36 +00:00
|
|
|
imx8mimage.o \
|
2014-02-04 08:24:10 +00:00
|
|
|
kwbimage.o \
|
2014-06-06 05:04:32 +00:00
|
|
|
lib/md5.o \
|
2015-03-31 09:40:49 +00:00
|
|
|
lpc32xximage.o \
|
2014-02-04 08:24:10 +00:00
|
|
|
mxsimage.o \
|
|
|
|
omapimage.o \
|
|
|
|
os_support.o \
|
|
|
|
pblimage.o \
|
2014-05-14 02:45:00 +00:00
|
|
|
pbl_crc32.o \
|
2016-09-26 07:08:06 +00:00
|
|
|
vybridimage.o \
|
2018-03-12 09:46:04 +00:00
|
|
|
stm32image.o \
|
2015-08-30 22:55:24 +00:00
|
|
|
$(ROCKCHIP_OBS) \
|
2014-03-06 02:40:50 +00:00
|
|
|
socfpgaimage.o \
|
2018-12-20 01:15:18 +00:00
|
|
|
sunxi_egon.o \
|
2022-04-12 09:20:40 +00:00
|
|
|
lib/crc16-ccitt.o \
|
2021-02-19 18:45:10 +00:00
|
|
|
lib/hash-checksum.o \
|
2014-06-06 05:04:32 +00:00
|
|
|
lib/sha1.o \
|
|
|
|
lib/sha256.o \
|
2020-04-16 05:36:52 +00:00
|
|
|
lib/sha512.o \
|
2015-01-23 10:31:58 +00:00
|
|
|
common/hash.o \
|
2014-02-04 08:24:10 +00:00
|
|
|
ublimage.o \
|
2015-11-17 12:56:56 +00:00
|
|
|
zynqimage.o \
|
2016-04-27 12:03:29 +00:00
|
|
|
zynqmpimage.o \
|
2018-04-13 12:18:52 +00:00
|
|
|
zynqmpbif.o \
|
2021-02-19 18:45:11 +00:00
|
|
|
$(LIBCRYPTO_OBJS-y) \
|
2014-02-04 08:24:10 +00:00
|
|
|
$(LIBFDT_OBJS) \
|
2016-07-11 14:09:48 +00:00
|
|
|
gpimage.o \
|
|
|
|
gpimage-common.o \
|
2018-11-15 02:07:49 +00:00
|
|
|
mtk_image.o \
|
2022-09-09 12:00:21 +00:00
|
|
|
mtk_nand_headers.o \
|
2021-02-19 18:45:12 +00:00
|
|
|
$(ECDSA_OBJS-y) \
|
2019-12-18 17:25:41 +00:00
|
|
|
$(RSA_OBJS-y) \
|
|
|
|
$(AES_OBJS-y)
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
dumpimage-objs := $(dumpimage-mkimage-objs) dumpimage.o
|
|
|
|
mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o
|
|
|
|
fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o
|
|
|
|
fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o
|
tools: provide a tool to convert a binary file to an include
For testing EFI disk management we need an in-memory image of
a disk.
The tool file2include converts a file to a C include. The file
is separated into strings of 8 bytes. Only the non-zero strings
are written to the include. The output format has been designed
to maintain readability.
#define EFI_ST_DISK_IMG { 0x00010000, { \
{0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \
{0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \
{0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \
{0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \
...
{0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \
{0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \
{0, NULL} } }
As the disk image needed for testing contains mostly zeroes a high
compression ratio can be attained.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-17 19:16:09 +00:00
|
|
|
file2include-objs := file2include.o
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_TOOLS_LIBCRYPTO),)
|
2023-02-01 20:19:46 +00:00
|
|
|
# Add CFG_MXS into host CFLAGS, so we can check whether or not register
|
2014-02-04 08:24:10 +00:00
|
|
|
# the mxsimage support within tools/mxsimage.c .
|
2023-02-01 20:19:46 +00:00
|
|
|
HOSTCFLAGS_mxsimage.o += -DCFG_MXS
|
2014-02-04 08:24:10 +00:00
|
|
|
endif
|
|
|
|
|
2021-07-14 22:05:47 +00:00
|
|
|
ifdef CONFIG_TOOLS_LIBCRYPTO
|
2014-02-04 08:24:10 +00:00
|
|
|
# This affects include/image.h, but including the board config file
|
|
|
|
# is tricky, so manually define this options here.
|
|
|
|
HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE
|
2021-07-14 22:05:47 +00:00
|
|
|
HOST_EXTRACFLAGS += -DCONFIG_FIT_SIGNATURE_MAX_SIZE=0xffffffff
|
2019-12-18 17:25:41 +00:00
|
|
|
HOST_EXTRACFLAGS += -DCONFIG_FIT_CIPHER
|
|
|
|
endif
|
|
|
|
|
2014-06-05 07:41:49 +00:00
|
|
|
# MXSImage needs LibSSL
|
2021-07-14 22:05:47 +00:00
|
|
|
ifneq ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_TOOLS_LIBCRYPTO),)
|
2019-04-10 22:58:49 +00:00
|
|
|
HOSTCFLAGS_kwbimage.o += \
|
|
|
|
$(shell pkg-config --cflags libssl libcrypto 2> /dev/null || echo "")
|
2020-03-27 15:46:27 +00:00
|
|
|
HOSTLDLIBS_mkimage += \
|
2015-05-16 16:36:15 +00:00
|
|
|
$(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto")
|
2016-02-16 22:29:28 +00:00
|
|
|
|
|
|
|
# OS X deprecate openssl in favour of CommonCrypto, supress deprecation
|
|
|
|
# warnings on those systems
|
|
|
|
ifeq ($(HOSTOS),darwin)
|
|
|
|
HOSTCFLAGS_mxsimage.o += -Wno-deprecated-declarations
|
|
|
|
HOSTCFLAGS_image-sig.o += -Wno-deprecated-declarations
|
|
|
|
HOSTCFLAGS_rsa-sign.o += -Wno-deprecated-declarations
|
|
|
|
endif
|
2014-06-05 07:41:49 +00:00
|
|
|
endif
|
|
|
|
|
2017-09-24 03:14:33 +00:00
|
|
|
HOSTCFLAGS_fit_image.o += -DMKIMAGE_DTC=\"$(CONFIG_MKIMAGE_DTC_PATH)\"
|
2017-06-25 07:43:33 +00:00
|
|
|
|
2020-03-27 15:46:27 +00:00
|
|
|
HOSTLDLIBS_dumpimage := $(HOSTLDLIBS_mkimage)
|
|
|
|
HOSTLDLIBS_fit_info := $(HOSTLDLIBS_mkimage)
|
|
|
|
HOSTLDLIBS_fit_check_sign := $(HOSTLDLIBS_mkimage)
|
2014-06-05 07:41:49 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_EXYNOS5250) += mkexynosspl
|
|
|
|
hostprogs-$(CONFIG_EXYNOS5420) += mkexynosspl
|
|
|
|
HOSTCFLAGS_mkexynosspl.o := -pedantic
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2022-03-02 10:49:21 +00:00
|
|
|
HOSTCFLAGS_kwboot.o += -pthread
|
2022-07-20 10:31:35 +00:00
|
|
|
HOSTLDLIBS_kwboot += -pthread
|
|
|
|
HOSTLDLIBS_kwboot += \
|
|
|
|
$(shell pkg-config --libs tinfo 2> /dev/null || echo "-ltinfo")
|
2022-03-02 10:49:21 +00:00
|
|
|
|
2014-12-16 05:02:38 +00:00
|
|
|
ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
|
2014-11-11 01:00:22 +00:00
|
|
|
hostprogs-$(CONFIG_X86) += ifdtool
|
|
|
|
|
2019-07-08 19:18:20 +00:00
|
|
|
ifwitool-objs := ifwitool.o
|
|
|
|
hostprogs-$(CONFIG_X86)$(CONFIG_SANDBOX) += ifwitool
|
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_MX23) += mxsboot
|
|
|
|
hostprogs-$(CONFIG_MX28) += mxsboot
|
|
|
|
HOSTCFLAGS_mxsboot.o := -pedantic
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2016-10-13 08:49:35 +00:00
|
|
|
hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
|
2017-02-27 17:22:02 +00:00
|
|
|
hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
|
|
|
|
sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
|
2014-05-05 10:52:30 +00:00
|
|
|
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-$(CONFIG_NETCONSOLE) += ncb
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2020-05-06 12:02:40 +00:00
|
|
|
hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot
|
2015-12-21 12:56:33 +00:00
|
|
|
hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
|
2014-06-06 11:46:44 +00:00
|
|
|
hostprogs-y += proftool
|
|
|
|
hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
|
2017-12-26 05:55:56 +00:00
|
|
|
hostprogs-$(CONFIG_RISCV) += prelink-riscv
|
2009-03-13 23:54:34 +00:00
|
|
|
|
2020-11-30 12:14:23 +00:00
|
|
|
hostprogs-$(CONFIG_ARCH_OCTEON) += update_octeon_header
|
|
|
|
update_octeon_header-objs := update_octeon_header.o lib/crc32.o
|
|
|
|
|
2015-06-23 21:38:28 +00:00
|
|
|
hostprogs-y += fdtgrep
|
2021-10-14 18:47:54 +00:00
|
|
|
fdtgrep-objs += $(LIBFDT_OBJS) boot/fdt_region.o fdtgrep.o
|
2015-06-23 21:38:28 +00:00
|
|
|
|
2019-05-24 20:07:04 +00:00
|
|
|
ifneq ($(TOOLS_ONLY),y)
|
|
|
|
hostprogs-y += spl_size_limit
|
|
|
|
endif
|
|
|
|
|
MIPS: Stop building position independent code
U-Boot has up until now built with -fpic for the MIPS architecture,
producing position independent code which uses indirection through a
global offset table, making relocation fairly straightforward as it
simply involves patching up GOT entries.
Using -fpic does however have some downsides. The biggest of these is
that generated code is bloated in various ways. For example, function
calls are indirected through the GOT & the t9 register:
8f998064 lw t9,-32668(gp)
0320f809 jalr t9
Without -fpic the call is simply:
0f803f01 jal be00fc04 <puts>
This is more compact & faster (due to the lack of the load & the
dependency the jump has on its result). It is also easier to read &
debug because the disassembly shows what function is being called,
rather than just an offset from gp which would then have to be looked up
in the ELF to discover the target function.
Another disadvantage of -fpic is that each function begins with a
sequence to calculate the value of the gp register, for example:
3c1c0004 lui gp,0x4
279c3384 addiu gp,gp,13188
0399e021 addu gp,gp,t9
Without using -fpic this sequence no longer appears at the start of each
function, reducing code size considerably.
This patch switches U-Boot from building with -fpic to building with
-fno-pic, in order to gain the benefits described above. The cost of
this is an extra step during the build process to extract relocation
data from the ELF & write it into a new .rel section in a compact
format, plus the added complexity of dealing with multiple types of
relocation rather than the single type that applied to the GOT. The
benefit is smaller, cleaner, more debuggable code. The relocate_code()
function is reimplemented in C to handle the new relocation scheme,
which also makes it easier to read & debug.
Taking maltael_defconfig as an example the size of u-boot.bin built
using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
2.24.90) shrinks from 254KiB to 224KiB.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: u-boot@lists.denx.de
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tested-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
2017-06-19 18:53:47 +00:00
|
|
|
hostprogs-$(CONFIG_MIPS) += mips-relocs
|
|
|
|
|
2019-11-13 00:44:53 +00:00
|
|
|
hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler
|
|
|
|
HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include
|
|
|
|
|
2022-07-20 10:31:33 +00:00
|
|
|
HOSTCFLAGS_mkeficapsule.o += \
|
2022-08-06 11:22:53 +00:00
|
|
|
$(shell pkg-config --cflags gnutls 2> /dev/null || echo "")
|
|
|
|
HOSTCFLAGS_mkeficapsule.o += \
|
|
|
|
$(shell pkg-config --cflags uuid 2> /dev/null || echo "")
|
|
|
|
HOSTLDLIBS_mkeficapsule += \
|
|
|
|
$(shell pkg-config --libs gnutls 2> /dev/null || echo "-lgnutls")
|
2022-07-20 10:31:33 +00:00
|
|
|
HOSTLDLIBS_mkeficapsule += \
|
2022-08-06 11:22:53 +00:00
|
|
|
$(shell pkg-config --libs uuid 2> /dev/null || echo "-luuid")
|
2022-02-09 10:10:34 +00:00
|
|
|
hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule
|
2020-11-30 09:12:15 +00:00
|
|
|
|
2014-02-04 08:24:10 +00:00
|
|
|
# We build some files with extra pedantic flags to try to minimize things
|
|
|
|
# that won't build on some weird host compiler -- though there are lots of
|
|
|
|
# exceptions for files that aren't complaint.
|
|
|
|
HOSTCFLAGS_crc32.o := -pedantic
|
2016-11-25 15:30:31 +00:00
|
|
|
HOSTCFLAGS_crc8.o := -pedantic
|
2014-02-04 08:24:10 +00:00
|
|
|
HOSTCFLAGS_md5.o := -pedantic
|
|
|
|
HOSTCFLAGS_sha1.o := -pedantic
|
2014-03-03 11:19:25 +00:00
|
|
|
HOSTCFLAGS_sha256.o := -pedantic
|
2020-04-16 05:36:52 +00:00
|
|
|
HOSTCFLAGS_sha512.o := -pedantic -DCONFIG_SHA512 -DCONFIG_SHA384
|
2014-02-04 08:24:10 +00:00
|
|
|
|
2014-06-06 05:04:32 +00:00
|
|
|
quiet_cmd_wrap = WRAP $@
|
2014-10-30 02:06:11 +00:00
|
|
|
cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
|
2014-06-06 05:04:32 +00:00
|
|
|
|
2021-10-14 18:47:54 +00:00
|
|
|
$(obj)/boot/%.c $(obj)/common/%.c $(obj)/env/%.c $(obj)/lib/%.c:
|
2014-06-06 05:04:32 +00:00
|
|
|
$(call cmd,wrap)
|
|
|
|
|
|
|
|
clean-dirs := lib common
|
|
|
|
|
2014-02-04 08:24:10 +00:00
|
|
|
always := $(hostprogs-y)
|
2013-06-13 22:10:02 +00:00
|
|
|
|
2022-11-28 08:41:22 +00:00
|
|
|
# Host tool to dump the currently configured default environment,
|
|
|
|
# build it on demand, i.e. not add it to 'always'.
|
|
|
|
hostprogs-y += printinitialenv
|
|
|
|
|
2009-03-13 23:54:35 +00:00
|
|
|
# Generated LCD/video logo
|
2014-02-04 08:24:24 +00:00
|
|
|
LOGO_H = $(objtree)/include/bmp_logo.h
|
|
|
|
LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h
|
2009-03-13 23:54:35 +00:00
|
|
|
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_H)
|
2011-10-20 23:04:20 +00:00
|
|
|
LOGO-$(CONFIG_VIDEO_LOGO) += $(LOGO_DATA_H)
|
2009-03-13 23:54:34 +00:00
|
|
|
|
2013-05-27 12:18:43 +00:00
|
|
|
# Generic logo
|
2009-03-13 23:54:34 +00:00
|
|
|
ifeq ($(LOGO_BMP),)
|
2014-02-04 08:24:24 +00:00
|
|
|
LOGO_BMP= $(srctree)/$(src)/logos/denx.bmp
|
2013-05-27 12:18:43 +00:00
|
|
|
|
|
|
|
# Use board logo and fallback to vendor
|
2014-03-03 09:40:56 +00:00
|
|
|
ifneq ($(wildcard $(srctree)/$(src)/logos/$(BOARD).bmp),)
|
2014-02-04 08:24:24 +00:00
|
|
|
LOGO_BMP= $(srctree)/$(src)/logos/$(BOARD).bmp
|
2013-05-27 12:18:43 +00:00
|
|
|
else
|
2014-03-03 09:40:56 +00:00
|
|
|
ifneq ($(wildcard $(srctree)/$(src)/logos/$(VENDOR).bmp),)
|
2014-02-04 08:24:24 +00:00
|
|
|
LOGO_BMP= $(srctree)/$(src)/logos/$(VENDOR).bmp
|
2009-03-13 23:54:34 +00:00
|
|
|
endif
|
2011-07-16 10:26:50 +00:00
|
|
|
endif
|
2009-03-13 23:54:34 +00:00
|
|
|
|
2013-05-27 12:18:43 +00:00
|
|
|
endif # !LOGO_BMP
|
|
|
|
|
2002-07-20 20:14:13 +00:00
|
|
|
#
|
|
|
|
# Use native tools and options
|
2009-03-13 23:54:51 +00:00
|
|
|
# Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
|
2013-07-30 22:26:11 +00:00
|
|
|
# Define _GNU_SOURCE to obtain the getline prototype from stdio.h
|
2002-07-20 20:14:13 +00:00
|
|
|
#
|
2018-01-21 10:19:18 +00:00
|
|
|
HOST_EXTRACFLAGS += -include $(srctree)/include/compiler.h \
|
kconfig: switch to Kconfig
This commit enables Kconfig.
Going forward, we use Kconfig for the board configuration.
mkconfig will never be used. Nor will include/config.mk be generated.
Kconfig must be adjusted for U-Boot because our situation is
a little more complicated than Linux Kernel.
We have to generate multiple boot images (Normal, SPL, TPL)
from one source tree.
Each image needs its own configuration input.
Usage:
Run "make <board>_defconfig" to do the board configuration.
It will create the .config file and additionally spl/.config, tpl/.config
if SPL, TPL is enabled, respectively.
You can use "make config", "make menuconfig" etc. to create
a new .config or modify the existing one.
Use "make spl/config", "make spl/menuconfig" etc. for spl/.config
and do likewise for tpl/.config file.
The generic syntax of configuration targets for SPL, TPL is:
<target_image>/<config_command>
Here, <target_image> is either 'spl' or 'tpl'
<config_command> is 'config', 'menuconfig', 'xconfig', etc.
When the configuration is done, run "make".
(Or "make <board>_defconfig all" will do the configuration and build
in one time.)
For futher information of how Kconfig works in U-Boot,
please read the comment block of scripts/multiconfig.py.
By the way, there is another item worth remarking here:
coexistence of Kconfig and board herder files.
Prior to Kconfig, we used C headers to define a set of configs.
We expect a very long term to migrate from C headers to Kconfig.
Two different infractructure must coexist in the interim.
In our former configuration scheme, include/autoconf.mk was generated
for use in makefiles.
It is still generated under include/, spl/include/, tpl/include/ directory
for the Normal, SPL, TPL image, respectively.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Simon Glass <sjg@chromium.org>
2014-07-30 05:08:17 +00:00
|
|
|
$(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
|
2018-03-02 22:13:42 +00:00
|
|
|
-I$(srctree)/scripts/dtc/libfdt \
|
2014-03-11 02:05:20 +00:00
|
|
|
-I$(srctree)/tools \
|
2010-10-07 19:51:12 +00:00
|
|
|
-DUSE_HOSTCC \
|
2013-07-30 22:26:11 +00:00
|
|
|
-D__KERNEL_STRICT_NAMES \
|
2021-10-11 15:11:41 +00:00
|
|
|
-D_GNU_SOURCE
|
2008-02-29 15:00:24 +00:00
|
|
|
|
2017-01-30 02:12:08 +00:00
|
|
|
__build: $(LOGO-y)
|
2002-07-20 20:14:13 +00:00
|
|
|
|
2014-02-04 08:24:24 +00:00
|
|
|
$(LOGO_H): $(obj)/bmp_logo $(LOGO_BMP)
|
|
|
|
$(obj)/bmp_logo --gen-info $(LOGO_BMP) > $@
|
2011-10-20 23:04:20 +00:00
|
|
|
|
2022-10-18 13:46:31 +00:00
|
|
|
ifeq ($(CONFIG_VIDEO),y)
|
2019-06-13 03:12:38 +00:00
|
|
|
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
|
|
|
|
$(obj)/bmp_logo --gen-bmp $(LOGO_BMP) > $@
|
|
|
|
else
|
2014-02-04 08:24:24 +00:00
|
|
|
$(LOGO_DATA_H): $(obj)/bmp_logo $(LOGO_BMP)
|
|
|
|
$(obj)/bmp_logo --gen-data $(LOGO_BMP) > $@
|
2019-06-13 03:12:38 +00:00
|
|
|
#endif
|
|
|
|
endif
|
2014-02-04 08:24:39 +00:00
|
|
|
|
|
|
|
# Let clean descend into subdirs
|
|
|
|
subdir- += env
|
2014-03-03 02:06:19 +00:00
|
|
|
|
|
|
|
ifneq ($(CROSS_BUILD_TOOLS),)
|
2017-03-13 08:43:16 +00:00
|
|
|
override HOSTCC = $(CC)
|
2019-05-01 13:08:25 +00:00
|
|
|
override HOSTCFLAGS = $(CFLAGS)
|
2014-03-03 02:06:19 +00:00
|
|
|
|
|
|
|
quiet_cmd_crosstools_strip = STRIP $^
|
|
|
|
cmd_crosstools_strip = $(STRIP) $^; touch $@
|
|
|
|
$(obj)/.strip: $(call objectify,$(filter $(always),$(hostprogs-y)))
|
|
|
|
$(call cmd,crosstools_strip)
|
|
|
|
|
|
|
|
always += .strip
|
|
|
|
endif
|
|
|
|
clean-files += .strip
|