@@ -894,8 +894,25 @@ $(board_build)/$(CB_OUTPUT_BASENAME)-gpg-injected.rom: $(board_build)/$(CB_OUTPU
894
894
" $( board_build) /$( CB_OUTPUT_FILE_GPG_INJ) " " $( PUBKEY_ASC) "
895
895
896
896
897
+
897
898
# Dev cycles helpers:
899
+
900
+ # Helper function to overwrite coreboot git repo's .canary file with a bogus commit (.canary checked for matching commit on build)
901
+ # TODO: Implement a cleaner solution to ensure files created by patches are properly deleted instead of requiring manual intervention.
902
+ define overwrite_canary_if_coreboot_git
903
+ @echo "Checking for coreboot directory: build/${CONFIG_TARGET_ARCH}/coreboot-$(CONFIG_COREBOOT_VERSION ) "
904
+ if [ -d "build/${CONFIG_TARGET_ARCH}/coreboot-$(CONFIG_COREBOOT_VERSION ) " ] && \
905
+ [ -d "build/${CONFIG_TARGET_ARCH}/coreboot-$(CONFIG_COREBOOT_VERSION ) /.git" ]; then \
906
+ echo "INFO: Recreating .canary file for 'build/${CONFIG_TARGET_ARCH}/coreboot-$(CONFIG_COREBOOT_VERSION ) ' with placeholder."; \
907
+ echo BOGUS_COMMIT_ID > "build/${CONFIG_TARGET_ARCH}/coreboot-$(CONFIG_COREBOOT_VERSION ) /.canary"; \
908
+ echo "NOTE: If a patch fails to apply, some files might need to be deleted manually to resolve conflicts."; \
909
+ else \
910
+ echo "INFO: Coreboot directory or .git not found, skipping .canary overwrite."; \
911
+ fi
912
+ endef
913
+
898
914
real.clean :
915
+ @echo " Cleaning build artifacts and install directories, leaving crossgcc intact."
899
916
for dir in \
900
917
$(module_dirs ) \
901
918
$(kernel_headers ) \
@@ -905,15 +922,19 @@ real.clean:
905
922
fi ; \
906
923
done
907
924
cd install && rm -rf -- *
925
+ $(call overwrite_canary_if_coreboot_git)
926
+
908
927
real.gitclean :
909
928
@echo " Cleaning the repository using Git ignore file as a base..."
910
929
@echo " This will wipe everything not in the Git tree, but keep downloaded coreboot forks (detected as Git repos)."
911
930
git clean -fxd
931
+ $(call overwrite_canary_if_coreboot_git)
912
932
913
933
real.gitclean_keep_packages :
914
934
@echo " Cleaning the repository using Git ignore file as a base..."
915
935
@echo " This will wipe everything not in the Git tree, but keep the 'packages' directory."
916
936
git clean -fxd -e " packages"
937
+ $(call overwrite_canary_if_coreboot_git)
917
938
918
939
real.remove_canary_files-extract_patch_rebuild_what_changed :
919
940
@echo " Removing 'canary' files to force Heads to restart building board configurations..."
@@ -925,9 +946,11 @@ real.remove_canary_files-extract_patch_rebuild_what_changed:
925
946
@echo " Only a minimal time is needed for rebuilding, which is also good for your SSD."
926
947
@echo " *** USE THIS APPROACH FIRST ***"
927
948
find ./build/ -type f -name " .canary" -print -delete
928
- find ./install/* /* -print -exec rm -rf {} +
949
+ find ./install/* /* -print -exec rm -rf {} + 2> /dev/null || true
950
+ $(call overwrite_canary_if_coreboot_git)
929
951
930
952
real.gitclean_keep_packages_and_build :
931
953
@echo " Cleaning the repository using Git ignore file as a base..."
932
954
@echo " This will wipe everything not in the Git tree, but keep the 'packages' and 'build' directories."
933
955
git clean -fxd -e " packages" -e " build"
956
+ $(call overwrite_canary_if_coreboot_git)
0 commit comments