Skip to content

Commit da02cc4

Browse files
committed
modules/coreboot: make sure coreboot/board dir artifacts are wiped on each build to be rebuilt
Signed-off-by: Thierry Laurion <[email protected]>
1 parent eeb0b0f commit da02cc4

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

modules/coreboot

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ CONFIG_COREBOOT_CONFIG ?= config/coreboot-$(BOARD).config
130130
CONFIG_COREBOOT_LOCALVERSION ?= "$(BRAND_NAME)-$(HEADS_GIT_VERSION)"
131131
CONFIG_COREBOOT_SMBIOS_PRODUCT_NAME ?= $(BOARD)
132132

133-
# Ensure that touching the config file will force a rebuild
134-
$(build)/$(coreboot_dir)/.configured: $(CONFIG_COREBOOT_CONFIG)
135-
136133
# Select the coreboot version to use for the toolchain
137134
ifeq "$($(coreboot_module)_toolchain)" ""
138135
# Use the same module
@@ -144,34 +141,29 @@ modules-y += $(coreboot_toolchain_module)
144141
# The toolchain module won't build anything for this board, we just need
145142
# the module prepped so we can hook up the toolchain target
146143
$(coreboot_toolchain_module)_output := .nobuild
147-
$(coreboot-toolchain_module)_configure := echo -e 'all:\n\ttouch .nobuild' > Makefile.nobuild
148-
$(coreboot-toolchain_module)_target := -f Makefile.nobuild
144+
$(coreboot_toolchain_module)_configure := echo -e 'all:\n\ttouch .nobuild' > Makefile.nobuild
145+
$(coreboot_toolchain_module)_target := -f Makefile.nobuild
149146
endif
150147

151-
$(coreboot_module)_configure := \
152-
mkdir -p "$(build)/$(coreboot_dir)"; \
153-
$(call install_config,$(pwd)/$(CONFIG_COREBOOT_CONFIG),$(build)/$(coreboot_dir)/.config); \
154-
sed -i '/^CONFIG_LOCALVERSION/d' $(build)/$(coreboot_dir)/.config; \
155-
echo 'CONFIG_LOCALVERSION=$(CONFIG_COREBOOT_LOCALVERSION)' >> $(build)/$(coreboot_dir)/.config; \
156-
sed -i '/^CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME/d' $(build)/$(coreboot_dir)/.config; \
157-
echo 'CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="$(CONFIG_COREBOOT_SMBIOS_PRODUCT_NAME)"' >> $(build)/$(coreboot_dir)/.config; \
158-
if [ ! -z "$(CONFIG_COREBOOT_SMBIOS_MANUFACTURER)" ]; then \
159-
sed -i '/^CONFIG_MAINBOARD_SMBIOS_MANUFACTURER/d' $(build)/$(coreboot_dir)/.config; \
160-
echo 'CONFIG_MAINBOARD_SMBIOS_MANUFACTURER="$(CONFIG_COREBOOT_SMBIOS_MANUFACTURER)"' >> $(build)/$(coreboot_dir)/.config; \
161-
fi; \
162-
$(MAKE) olddefconfig \
163-
-C "$(build)/$(coreboot_base_dir)" \
164-
obj="$(build)/$(coreboot_dir)" \
165-
DOTCONFIG="$(build)/$(coreboot_dir)/.config" \
166-
BUILD_TIMELESS=1 \
148+
# Define COREBOOT_TOOLCHAIN_DIR based on the resolved toolchain module
149+
COREBOOT_TOOLCHAIN_DIR := $(build)/$($(coreboot_toolchain_module)_base_dir)
150+
151+
# Ensure that touching the config file will force a rebuild
152+
$(build)/$(coreboot_dir)/.configured: $(CONFIG_COREBOOT_CONFIG) $(COREBOOT_TOOLCHAIN_DIR)/.heads-toolchain
153+
@echo "DEBUG: Triggering coreboot configuration for $(coreboot_dir)";
154+
$(coreboot_module)_configure
155+
@touch $@
167156

168157
# Create a dependency from coreboot to the toolchain. Use .heads-toolchain to
169158
# mark that the toolchain was built.
170-
COREBOOT_TOOLCHAIN_DIR=$(build)/$($(coreboot_toolchain_module)_base_dir)
171159
$(COREBOOT_TOOLCHAIN_DIR)/.heads-toolchain: $(COREBOOT_TOOLCHAIN_DIR)/.canary
172-
$(MAKE) -C "$(build)/$($(coreboot_toolchain_module)_base_dir)" CPUS=$(CPUS) "crossgcc-$(COREBOOT_TARGET)" \
160+
@echo "DEBUG: Building coreboot toolchain in $(COREBOOT_TOOLCHAIN_DIR)";
161+
$(MAKE) -C "$(COREBOOT_TOOLCHAIN_DIR)" CPUS=$(CPUS) "crossgcc-$(COREBOOT_TARGET)" \
173162
$($(coreboot_toolchain_module)_toolchain_build_args)
174-
touch "$@"
163+
@touch "$@"
164+
165+
# Ensure the toolchain module is included in the build process
166+
modules-y += $(coreboot_toolchain_module)
175167

176168
$(build)/$(coreboot_dir)/.configured: $(COREBOOT_TOOLCHAIN_DIR)/.heads-toolchain
177169

0 commit comments

Comments
 (0)