path: root/scripts
diff options
authorMasahiro Yamada <>2021-04-24 20:55:53 +0900
committerMasahiro Yamada <>2021-05-02 00:43:34 +0900
commit3787b7da5d3e2c849fe8ffed987922a4e6dd6cfd (patch)
tree27650170b113b1d8716174614d39b9bd254049d5 /scripts
parentc5849b7c206bf36b8ce7079d4777e0a59305ccce (diff)
kbuild: add comment about why cmd_shipped uses 'cat'
cmd_shipped uses 'cat' instead of 'cp' for copying a file. The reason is explained in the commit [1], but it was in the pre-git era. $ touch a $ chmod -w a $ cp a b $ cp a b cp: cannot create regular file 'b': Permission denied Add comments so that you can see the reason without looking into the history. [1]: Signed-off-by: Masahiro Yamada <>
Diffstat (limited to 'scripts')
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 64daf37e874b..c0982b8b2b6d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -252,6 +252,9 @@ quiet_cmd_copy = COPY $@
# Shipped files
# ===========================================================================
+# 'cp' preserves permissions. If you use it to copy a file in read-only srctree,
+# the copy would be read-only as well, leading to an error when executing the
+# rule next time. Use 'cat' instead in order to generate a writable file.
quiet_cmd_shipped = SHIPPED $@
cmd_shipped = cat $< > $@