aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--arch/sandbox/dts/Makefile2
-rw-r--r--cmd/Kconfig1
-rw-r--r--common/Kconfig1
-rw-r--r--common/spl/Kconfig.tpl1
-rw-r--r--configs/ge_b1x5v2_defconfig1
-rw-r--r--configs/microblaze-generic_defconfig1
-rw-r--r--configs/qemu-ppce500_defconfig1
-rw-r--r--drivers/sysreset/Kconfig4
-rw-r--r--dts/Makefile4
-rw-r--r--test/py/tests/test_cleanup_build.py105
-rw-r--r--tools/.gitignore1
-rw-r--r--tools/Makefile66
-rw-r--r--tools/env/.gitignore1
14 files changed, 153 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index 813ad3e6732..8d9aef464d0 100644
--- a/Makefile
+++ b/Makefile
@@ -2152,7 +2152,7 @@ CHANGELOG:
# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR) \
- $(foreach d, spl tpl, $(patsubst %,$d/%, \
+ $(foreach d, spl tpl vpl, $(patsubst %,$d/%, \
$(filter-out include, $(shell ls -1 $d 2>/dev/null))))
CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
@@ -2167,7 +2167,7 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
idbloader-spi.img lib/efi_loader/helloworld_efi.S
# Directories & files removed with 'make mrproper'
-MRPROPER_DIRS += include/config include/generated spl tpl \
+MRPROPER_DIRS += include/config include/generated spl tpl vpl \
.tmp_objdiff doc/output include/asm
# Remove include/asm symlink created by U-Boot before v2014.01
diff --git a/arch/sandbox/dts/Makefile b/arch/sandbox/dts/Makefile
index b6a88479b22..f810b4752f5 100644
--- a/arch/sandbox/dts/Makefile
+++ b/arch/sandbox/dts/Makefile
@@ -18,4 +18,4 @@ PHONY += dtbs
dtbs: $(addprefix $(obj)/, $(dtb-y))
@:
-clean-files := *.dtb
+clean-files := *.dtb *.dtbo
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 02e54f1e50f..c1941849f98 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1228,6 +1228,7 @@ config LOADS_ECHO
config CMD_SAVES
bool "saves - Save a file over serial in S-Record format"
+ depends on CMD_LOADS
help
Provides a way to save a binary file using the Motorola S-Record
format over the serial line.
diff --git a/common/Kconfig b/common/Kconfig
index bbabadb35e1..42baca20a61 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -256,6 +256,7 @@ config SYS_CONSOLE_OVERWRITE_ROUTINE
config SYS_CONSOLE_ENV_OVERWRITE
bool "Update environment variables during console init"
+ depends on SYS_CONSOLE_IS_IN_ENV
help
The console environment variables (stdout, stdin, stderr) can be
used to determine the correct console devices on start-up. This
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index 1874f9db4f9..3d6cf1e59f3 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -43,6 +43,7 @@ config TPL_FRAMEWORK
config TPL_BANNER_PRINT
bool "Enable output of the TPL banner 'U-Boot TPL ...'"
+ depends on DEBUG_UART && TPL_SERIAL
default y
help
If this option is enabled, TPL will print the banner with version
diff --git a/configs/ge_b1x5v2_defconfig b/configs/ge_b1x5v2_defconfig
index faa22f93924..b3b69a642a4 100644
--- a/configs/ge_b1x5v2_defconfig
+++ b/configs/ge_b1x5v2_defconfig
@@ -14,6 +14,7 @@ CONFIG_ENV_SECT_SIZE=0x10000
# CONFIG_GE_RTC is not set
CONFIG_MX6QDL=y
CONFIG_TARGET_GE_B1X5V2=y
+CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="imx6dl-b1x5v2"
CONFIG_SPL_TEXT_BASE=0x00908000
CONFIG_SPL_SERIAL=y
diff --git a/configs/microblaze-generic_defconfig b/configs/microblaze-generic_defconfig
index 6aa1d03e5b6..589da3226da 100644
--- a/configs/microblaze-generic_defconfig
+++ b/configs/microblaze-generic_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYS_MALLOC_LEN=0xc0000
CONFIG_SYS_MALLOC_F_LEN=0x400
CONFIG_NR_DRAM_BANKS=1
CONFIG_ENV_SIZE=0x20000
+CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="microblaze-generic"
CONFIG_SYS_PROMPT="U-Boot-mONStR> "
CONFIG_SPL_SERIAL=y
diff --git a/configs/qemu-ppce500_defconfig b/configs/qemu-ppce500_defconfig
index 105b937efae..5f0746e4e27 100644
--- a/configs/qemu-ppce500_defconfig
+++ b/configs/qemu-ppce500_defconfig
@@ -1,6 +1,7 @@
CONFIG_PPC=y
CONFIG_TEXT_BASE=0xf00000
CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="qemu-ppce500"
CONFIG_SYS_MONITOR_LEN=524288
CONFIG_SYS_CLK_FREQ=33000000
diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index 03f7fdd5978..bdbe2a95364 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -61,14 +61,14 @@ endif
config POWEROFF_GPIO
bool "Enable support for GPIO poweroff driver"
- select DM_GPIO
+ depends on DM_GPIO
help
Support for system poweroff using a GPIO pin. This can be used
for systems having a single GPIO to trigger a system poweroff.
config SYSRESET_GPIO
bool "Enable support for GPIO reset driver"
- select DM_GPIO
+ depends on DM_GPIO
help
Reset support via GPIO pin connected reset logic. This is used for
example on Microblaze where reset logic can be controlled via GPIO
diff --git a/dts/Makefile b/dts/Makefile
index cb311138295..3437e54033d 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -63,4 +63,6 @@ spl_dtbs: $(obj)/dt-$(SPL_NAME).dtb
clean-files := dt.dtb.S
# Let clean descend into dts directories
-subdir- += ../arch/arm/dts ../arch/microblaze/dts ../arch/mips/dts ../arch/sandbox/dts ../arch/x86/dts ../arch/powerpc/dts ../arch/riscv/dts
+subdir- += ../arch/arc/dts ../arch/arm/dts ../arch/m68k/dts ../arch/microblaze/dts \
+ ../arch/mips/dts ../arch/nios2/dts ../arch/powerpc/dts ../arch/riscv/dts \
+ ../arch/sandbox/dts ../arch/sh/dts ../arch/x86/dts ../arch/xtensa/dts
diff --git a/test/py/tests/test_cleanup_build.py b/test/py/tests/test_cleanup_build.py
new file mode 100644
index 00000000000..5206ff73ec7
--- /dev/null
+++ b/test/py/tests/test_cleanup_build.py
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Tobias Deiminger <tdmg@linutronix.de>
+
+"""Test for unexpected leftovers after make clean"""
+
+import itertools
+import os
+import pathlib
+import shutil
+import sys
+
+import pytest
+
+# pylint: disable=redefined-outer-name
+
+
+@pytest.fixture
+def tmp_copy_of_builddir(u_boot_config, tmp_path):
+ """For each test, provide a temporary copy of the initial build directory."""
+ shutil.copytree(
+ u_boot_config.build_dir,
+ tmp_path,
+ symlinks=True,
+ dirs_exist_ok=True,
+ )
+ return tmp_path
+
+
+@pytest.fixture(scope="module")
+def run_make(u_boot_log):
+ """Provide function to run and log make without connecting to u-boot console."""
+ runner = u_boot_log.get_runner("make", sys.stdout)
+
+ def _run_make(build_dir, target):
+ cmd = ["make", f"O={build_dir}", target]
+ runner.run(cmd)
+
+ yield _run_make
+ runner.close()
+
+
+@pytest.fixture(scope="module")
+def most_generated_files():
+ """Path.glob style patterns to describe what should be removed by 'make clean'."""
+ return (
+ "**/*.c",
+ "**/*.dtb",
+ "**/*.dtbo",
+ "**/*.o",
+ "**/*.py",
+ "**/*.pyc",
+ "**/*.so",
+ "**/*.srec",
+ "u-boot*",
+ "[svt]pl/u-boot*",
+ )
+
+
+@pytest.fixture(scope="module")
+def all_generated_files(most_generated_files):
+ """Path.glob style patterns to describe what should be removed by 'make mrproper'."""
+ return most_generated_files + (".config", "**/*.h")
+
+
+def find_files(search_dir, include_patterns, exclude_dirs=None):
+ """Find files matching include_patterns, unless it's in one of exclude_dirs.
+
+ include_patterns -- Path.glob style pattern relative to search dir
+ exclude_dir -- directories to exclude, expected relative to search dir
+ """
+ matches = []
+ exclude_dirs = [] if exclude_dirs is None else exclude_dirs
+ for abs_path in itertools.chain.from_iterable(
+ pathlib.Path(search_dir).glob(pattern) for pattern in include_patterns
+ ):
+ if abs_path.is_dir():
+ continue
+ rel_path = pathlib.Path(os.path.relpath(abs_path, search_dir))
+ if not any(
+ rel_path.is_relative_to(exclude_dir) for exclude_dir in exclude_dirs
+ ):
+ matches.append(rel_path)
+ return matches
+
+
+def test_clean(run_make, tmp_copy_of_builddir, most_generated_files):
+ """Test if 'make clean' deletes most generated files."""
+ run_make(tmp_copy_of_builddir, "clean")
+ leftovers = find_files(
+ tmp_copy_of_builddir,
+ most_generated_files,
+ exclude_dirs=["scripts", "test/overlay"],
+ )
+ assert not leftovers, f"leftovers: {', '.join(map(str, leftovers))}"
+
+
+def test_mrproper(run_make, tmp_copy_of_builddir, all_generated_files):
+ """Test if 'make mrproper' deletes current configuration and all generated files."""
+ run_make(tmp_copy_of_builddir, "mrproper")
+ leftovers = find_files(
+ tmp_copy_of_builddir,
+ all_generated_files,
+ exclude_dirs=["test/overlay"],
+ )
+ assert not leftovers, f"leftovers: {', '.join(map(str, leftovers))}"
diff --git a/tools/.gitignore b/tools/.gitignore
index cda3ea628c3..941d38de212 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -34,6 +34,7 @@
/relocate-rela
/spl_size_limit
/sunxi-spl-image-builder
+/tools/generated/**/*.c
/update_octeon_header
/version.h
/xway-swap-bytes
diff --git a/tools/Makefile b/tools/Makefile
index a0cd87ff93a..3d0c4b0dd6a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -48,20 +48,20 @@ hostprogs-$(CONFIG_VIDEO_LOGO) += bmp_logo
HOSTCFLAGS_bmp_logo.o := -pedantic
hostprogs-$(BUILD_ENVCRC) += envcrc
-envcrc-objs := envcrc.o lib/crc32.o env/embedded.o lib/sha1.o
+envcrc-objs := envcrc.o generated/lib/crc32.o generated/env/embedded.o generated/lib/sha1.o
hostprogs-$(CONFIG_CMD_NET) += gen_eth_addr
HOSTCFLAGS_gen_eth_addr.o := -pedantic
hostprogs-$(CONFIG_CMD_NET) += gen_ethaddr_crc
-gen_ethaddr_crc-objs := gen_ethaddr_crc.o lib/crc8.o
+gen_ethaddr_crc-objs := gen_ethaddr_crc.o generated/lib/crc8.o
HOSTCFLAGS_gen_ethaddr_crc.o := -pedantic
hostprogs-$(CONFIG_CMD_LOADS) += img2srec
HOSTCFLAGS_img2srec.o := -pedantic
hostprogs-y += mkenvimage
-mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
+mkenvimage-objs := mkenvimage.o os_support.o generated/lib/crc32.o
hostprogs-y += dumpimage mkimage
hostprogs-$(CONFIG_TOOLS_LIBCRYPTO) += fit_info fit_check_sign
@@ -71,30 +71,30 @@ ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST)$(CONFIG_FWU_MDATA_GPT_BLK),)
hostprogs-y += file2include
endif
-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
+FIT_OBJS-y := fit_common.o fit_image.o image-host.o generated/boot/image-fit.o
+FIT_SIG_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := image-sig-host.o generated/boot/image-fit-sig.o
+FIT_CIPHER_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := generated/boot/image-cipher.o
# The following files are synced with upstream DTC.
# Use synced versions from scripts/dtc/libfdt/.
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)
-RSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/rsa/, \
+RSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix generated/lib/rsa/, \
rsa-sign.o rsa-verify.o \
rsa-mod-exp.o)
-ECDSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/ecdsa/, ecdsa-libcrypto.o)
+ECDSA_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix generated/lib/ecdsa/, ecdsa-libcrypto.o)
-AES_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix lib/aes/, \
+AES_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := $(addprefix generated/lib/aes/, \
aes-encrypt.o aes-decrypt.o)
# Cryptographic helpers and image types that depend on openssl/libcrypto
LIBCRYPTO_OBJS-$(CONFIG_TOOLS_LIBCRYPTO) := \
- lib/fdt-libcrypto.o \
+ generated/lib/fdt-libcrypto.o \
sunxi_toc0.o
-ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
+ROCKCHIP_OBS = generated/lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o
# common objs for dumpimage and mkimage
dumpimage-mkimage-objs := aisimage.o \
@@ -102,20 +102,20 @@ dumpimage-mkimage-objs := aisimage.o \
$(FIT_OBJS-y) \
$(FIT_SIG_OBJS-y) \
$(FIT_CIPHER_OBJS-y) \
- boot/fdt_region.o \
- boot/bootm.o \
- lib/crc32.o \
+ generated/boot/fdt_region.o \
+ generated/boot/bootm.o \
+ generated/lib/crc32.o \
default_image.o \
- lib/fdtdec_common.o \
- lib/fdtdec.o \
- boot/image.o \
- boot/image-host.o \
+ generated/lib/fdtdec_common.o \
+ generated/lib/fdtdec.o \
+ generated/boot/image.o \
+ generated/boot/image-host.o \
imagetool.o \
imximage.o \
imx8image.o \
imx8mimage.o \
kwbimage.o \
- lib/md5.o \
+ generated/lib/md5.o \
lpc32xximage.o \
mxsimage.o \
omapimage.o \
@@ -128,12 +128,12 @@ dumpimage-mkimage-objs := aisimage.o \
$(ROCKCHIP_OBS) \
socfpgaimage.o \
sunxi_egon.o \
- lib/crc16-ccitt.o \
- lib/hash-checksum.o \
- lib/sha1.o \
- lib/sha256.o \
- lib/sha512.o \
- common/hash.o \
+ generated/lib/crc16-ccitt.o \
+ generated/lib/hash-checksum.o \
+ generated/lib/sha1.o \
+ generated/lib/sha256.o \
+ generated/lib/sha512.o \
+ generated/common/hash.o \
ublimage.o \
zynqimage.o \
zynqmpimage.o \
@@ -213,7 +213,7 @@ HOSTCFLAGS_mxsboot.o := -pedantic
hostprogs-$(CONFIG_ARCH_SUNXI) += mksunxiboot
hostprogs-$(CONFIG_ARCH_SUNXI) += sunxi-spl-image-builder
-sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o lib/bch.o
+sunxi-spl-image-builder-objs := sunxi-spl-image-builder.o generated/lib/bch.o
hostprogs-$(CONFIG_NETCONSOLE) += ncb
@@ -221,16 +221,16 @@ hostprogs-$(CONFIG_ARCH_KIRKWOOD) += kwboot
hostprogs-$(CONFIG_ARCH_MVEBU) += kwboot
hostprogs-y += proftool
-proftool-objs = proftool.o lib/abuf.o
+proftool-objs = proftool.o generated/lib/abuf.o
hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
hostprogs-$(CONFIG_RISCV) += prelink-riscv
hostprogs-$(CONFIG_ARCH_OCTEON) += update_octeon_header
-update_octeon_header-objs := update_octeon_header.o lib/crc32.o
+update_octeon_header-objs := update_octeon_header.o generated/lib/crc32.o
hostprogs-y += fdtgrep
-fdtgrep-objs += $(LIBFDT_OBJS) boot/fdt_region.o fdtgrep.o
+fdtgrep-objs += $(LIBFDT_OBJS) generated/boot/fdt_region.o fdtgrep.o
ifneq ($(TOOLS_ONLY),y)
hostprogs-y += spl_size_limit
@@ -251,7 +251,7 @@ HOSTLDLIBS_mkeficapsule += \
$(shell pkg-config --libs uuid 2> /dev/null || echo "-luuid")
hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule
-mkfwumdata-objs := mkfwumdata.o lib/crc32.o
+mkfwumdata-objs := mkfwumdata.o generated/lib/crc32.o
HOSTLDLIBS_mkfwumdata += -luuid
hostprogs-$(CONFIG_TOOLS_MKFWUMDATA) += mkfwumdata
@@ -266,12 +266,12 @@ HOSTCFLAGS_sha256.o := -pedantic
HOSTCFLAGS_sha512.o := -pedantic -DCONFIG_SHA512 -DCONFIG_SHA384
quiet_cmd_wrap = WRAP $@
-cmd_wrap = echo "\#include <../$(patsubst $(obj)/%,%,$@)>" >$@
+cmd_wrap = echo "\#include <../$(patsubst $(obj)/generated/%,%,$@)>" >$@
-$(obj)/boot/%.c $(obj)/common/%.c $(obj)/env/%.c $(obj)/lib/%.c:
+$(obj)/generated/%.c:
$(call cmd,wrap)
-clean-dirs := lib common
+clean-dirs := generated
always := $(hostprogs-y)
diff --git a/tools/env/.gitignore b/tools/env/.gitignore
index 8d28b2b70be..804abacc6e4 100644
--- a/tools/env/.gitignore
+++ b/tools/env/.gitignore
@@ -1,3 +1,2 @@
-embedded.c
fw_printenv
fw_printenv_unstripped