1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 1) #!/bin/sh
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 2)
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 3) set -e
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 4)
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 5) # When you move, remove or rename generated files, you probably also update
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 6) # .gitignore and cleaning rules in the Makefile. This is the right thing
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 7) # to do. However, people usually do 'git pull', 'git bisect', etc. without
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 8) # running 'make clean'. Then, the stale generated files are left over, often
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 9) # causing build issues.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 10) #
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 11) # Also, 'git status' shows such stale build artifacts as untracked files.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 12) # What is worse, some people send a wrong patch to get them back to .gitignore
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 13) # without checking the commit history.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 14) #
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 15) # So, when you (re)move generated files, please move the cleaning rules from
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 16) # the Makefile to this script. This is run before Kbuild starts building
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 17) # anything, so people will not be annoyed by such garbage files.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 18) #
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 19) # This script is not intended to grow endlessly. Rather, it is a temporary scrap
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 20) # yard. Stale files stay in this file for a while (for some release cycles?),
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 21) # then will be really dead and removed from the code base entirely.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 22)
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 23) # These were previously generated source files. When you are building the kernel
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 24) # with O=, make sure to remove the stale files in the output tree. Otherwise,
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 25) # the build system wrongly compiles the stale ones.
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 26) if [ -n "${building_out_of_srctree}" ]; then
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 27) for f in fdt_rw.c fdt_ro.c fdt_wip.c fdt.c
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 28) do
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 29) rm -f arch/arm/boot/compressed/${f}
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 30) done
1476fee5c53e2 (Masahiro Yamada 2021-04-25 16:07:12 +0900 31) fi