kbuild: unify cmd_copy and cmd_shipped
Subsystems (5)
PATCH 1/1 kbuild: unify cmd_copy and cmd_shipped
cmd_copy and cmd_shipped have similar functionality. The difference is that cmd_copy uses 'cp' while cmd_shipped 'cat'.
Unify them into cmd_copy because this macro name is more intuitive.
Going forward, cmd_copy will use 'cat' to avoid the permission issue. I also thought of 'cp --no-preserve=mode' but this option is not mentioned in the POSIX spec [1], so I am keeping the 'cat' command.
[1]: https://pubs.opengroup.org/onlinepubs/009695299/utilities/cp.html
---
arch/microblaze/boot/Makefile | 2 +- arch/microblaze/boot/dts/Makefile | 2 +- fs/unicode/Makefile | 2 +- scripts/Makefile.lib | 12 ++++-------- usr/Makefile | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-)
arch/microblaze/boot/Makefile +1 -1
@@ -29,7 +29,7 @@ $(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE $(call if_changed,uimage) $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE - $(call if_changed,shipped) + $(call if_changed,copy) $(obj)/simpleImage.$(DTB).strip: vmlinux FORCE $(call if_changed,strip)
arch/microblaze/boot/dts/Makefile +1 -1
@@ -12,7 +12,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb - $(call if_changed,shipped) + $(call if_changed,copy) endif endif
fs/unicode/Makefile +1 -1
@@ -31,7 +31,7 @@ $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE else $(obj)/utf8data.c: $(src)/utf8data.c_shipped FORCE - $(call if_changed,shipped) + $(call if_changed,copy) endif
scripts/Makefile.lib +4 -8
@@ -246,20 +246,16 @@ $(foreach m, $(notdir $1), \ $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) endef -quiet_cmd_copy = COPY $@ - cmd_copy = cp $< $@ - -# Shipped files +# Copy a file # =========================================================================== # '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 $< > $@ +quiet_cmd_copy = COPY $@ + cmd_copy = cat $< > $@ $(obj)/%: $(src)/%_shipped - $(call cmd,shipped) + $(call cmd,copy) # Commands useful for building a boot image # ===========================================================================
usr/Makefile +2 -2
@@ -3,7 +3,7 @@ # kbuild file for usr/ - including initramfs image # -compress-y := shipped +compress-y := copy compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma
@@ -37,7 +37,7 @@ endif # .cpio.*, use it directly as an initramfs, and avoid double compression. ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) cpio-data := $(ramfs-input) -compress-y := shipped +compress-y := copy endif endif
Signature · 1 line
2.32.0
Quoted 52 lines · Masahiro Yamada
cmd_copyandcmd_shippedhave similar functionality. The difference is thatcmd_copyuses 'cp' whilecmd_shipped'cat'.Unify them into
cmd_copybecause this macro name is more intuitive.Going forward,
cmd_copywill use 'cat' to avoid the permission issue. I also thought of 'cp --no-preserve=mode' but this option is not mentioned in the POSIX spec [1], so I am keeping the 'cat' command.[1]: https://pubs.opengroup.org/onlinepubs/009695299/utilities/cp.html
Signed-off-by Masahiro Yamada <[email protected]>---
arch/microblaze/boot/Makefile | 2 +- arch/microblaze/boot/dts/Makefile | 2 +- fs/unicode/Makefile | 2 +- scripts/Makefile.lib | 12 ++++-------- usr/Makefile | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-)arch/microblaze/boot/Makefile +1
-1@@ -29,7 +29,7 @@ $(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE $(call if_changed,uimage) $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE - $(call if_changed,shipped) + $(call if_changed,copy) $(obj)/simpleImage.$(DTB).strip: vmlinux FORCE $(call if_changed,strip)arch/microblaze/boot/dts/Makefile +1
-1@@ -12,7 +12,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb - $(call if_changed,shipped) + $(call if_changed,copy) endif endiffs/unicode/Makefile +0
-0
fs/unicode/Makefile $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE · line 33
Quoted 3 lines
fs/unicode/Makefile +0
-0@@ -31,7 +31,7 @@ $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE else $(obj)/utf8data.c: $(src)/utf8data.c_shipped FORCE
do we want to retitle the _shipped suffix for this file to _copy now, too? fs/unicode/Makefile:11fs/unicode/Makefile:33fs/unicode/Makefile:34
Either way
Quoted 59 lines
fs/unicode/Makefile +1
-1- $(call if_changed,shipped) + $(call if_changed,copy) endifscripts/Makefile.lib +4
-8@@ -246,20 +246,16 @@ $(foreach m, $(notdir $1), \ $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) endef -quiet_cmd_copy = COPY $@ - cmd_copy = cp $< $@ - -# Shipped files +# Copy a file # =========================================================================== # '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 $< > $@ +quiet_cmd_copy = COPY $@ + cmd_copy = cat $< > $@ $(obj)/%: $(src)/%_shipped - $(call cmd,shipped) + $(call cmd,copy) # Commands useful for building a boot image # ===========================================================================usr/Makefile +2
-3@@ -3,7 +3,7 @@ # kbuild file for usr/ - including initramfs image # -compress-y := shipped +compress-y := copy compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma@@ -37,7 +37,7 @@ endif # .cpio.*, use it directly as an initramfs, and avoid double compression. ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) cpio-data := $(ramfs-input) -compress-y := shipped +compress-y := copy endif endif --2.32.0
Signature · 2 lines
Thanks, ~Nick Desaulniers
Gabriel Krisman Bertazi
Reviewed-byQuoted 55 lines · Nick Desaulniers
Quoted 54 lines · Masahiro Yamada
cmd_copyandcmd_shippedhave similar functionality. The difference is thatcmd_copyuses 'cp' whilecmd_shipped'cat'.Unify them into
cmd_copybecause this macro name is more intuitive.Going forward,
cmd_copywill use 'cat' to avoid the permission issue. I also thought of 'cp --no-preserve=mode' but this option is not mentioned in the POSIX spec [1], so I am keeping the 'cat' command.[1]: https://pubs.opengroup.org/onlinepubs/009695299/utilities/cp.html
Signed-off-by Masahiro Yamada <[email protected]>---
arch/microblaze/boot/Makefile | 2 +- arch/microblaze/boot/dts/Makefile | 2 +- fs/unicode/Makefile | 2 +- scripts/Makefile.lib | 12 ++++-------- usr/Makefile | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-)arch/microblaze/boot/Makefile +1
-1@@ -29,7 +29,7 @@ $(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE $(call if_changed,uimage) $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE - $(call if_changed,shipped) + $(call if_changed,copy) $(obj)/simpleImage.$(DTB).strip: vmlinux FORCE $(call if_changed,strip)arch/microblaze/boot/dts/Makefile +1
-1@@ -12,7 +12,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb - $(call if_changed,shipped) + $(call if_changed,copy) endif endiffs/unicode/Makefile +0
-0@@ -31,7 +31,7 @@ $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE else
Quoted 6 lines
fs/unicode/Makefile $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE · line 33
Quoted 1 line
fs/unicode/Makefile +0
-0$(obj)/utf8data.c: $(src)/utf8data.c_shipped FORCEdo we want to retitle the
_shippedsuffix for this file to_copynow, too?fs/unicode/Makefile:11fs/unicode/Makefile:33fs/unicode/Makefile:34
I think _copy doesn't convey the sense that this is distributed with the kernel tree, even though it is also generated from in-tree sources. Even if that is not the original sense of _shipped (is it?), it makes sense to me that way, but _copy doesn't.
The patch looks good to me, though.
Quoted 63 lines
Either way
Reviewed-by Nick Desaulniers <[email protected]>Quoted 59 lines
fs/unicode/Makefile +1
-1- $(call if_changed,shipped) + $(call if_changed,copy) endifscripts/Makefile.lib +4
-8@@ -246,20 +246,16 @@ $(foreach m, $(notdir $1), \ $(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s))))))) endef -quiet_cmd_copy = COPY $@ - cmd_copy = cp $< $@ - -# Shipped files +# Copy a file # =========================================================================== # '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 $< > $@ +quiet_cmd_copy = COPY $@ + cmd_copy = cat $< > $@ $(obj)/%: $(src)/%_shipped - $(call cmd,shipped) + $(call cmd,copy) # Commands useful for building a boot image # ===========================================================================usr/Makefile +2
-3@@ -3,7 +3,7 @@ # kbuild file for usr/ - including initramfs image # -compress-y := shipped +compress-y := copy compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma@@ -37,7 +37,7 @@ endif # .cpio.*, use it directly as an initramfs, and avoid double compression. ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2) cpio-data := $(ramfs-input) -compress-y := shipped +compress-y := copy endif endif --2.32.0
Signature · 1 line
Gabriel Krisman Bertazi
Quoted 65 lines · Gabriel Krisman Bertazi
Quoted 55 lines · Nick Desaulniers
Quoted 54 lines · Masahiro Yamada
cmd_copyandcmd_shippedhave similar functionality. The difference is thatcmd_copyuses 'cp' whilecmd_shipped'cat'.Unify them into
cmd_copybecause this macro name is more intuitive.Going forward,
cmd_copywill use 'cat' to avoid the permission issue. I also thought of 'cp --no-preserve=mode' but this option is not mentioned in the POSIX spec [1], so I am keeping the 'cat' command.[1]: https://pubs.opengroup.org/onlinepubs/009695299/utilities/cp.html
Signed-off-by Masahiro Yamada <[email protected]>---
arch/microblaze/boot/Makefile | 2 +- arch/microblaze/boot/dts/Makefile | 2 +- fs/unicode/Makefile | 2 +- scripts/Makefile.lib | 12 ++++-------- usr/Makefile | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-)arch/microblaze/boot/Makefile +1
-1@@ -29,7 +29,7 @@ $(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE $(call if_changed,uimage) $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE - $(call if_changed,shipped) + $(call if_changed,copy) $(obj)/simpleImage.$(DTB).strip: vmlinux FORCE $(call if_changed,strip)arch/microblaze/boot/dts/Makefile +1
-1@@ -12,7 +12,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb - $(call if_changed,shipped) + $(call if_changed,copy) endif endiffs/unicode/Makefile +0
-0@@ -31,7 +31,7 @@ $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE elseQuoted 6 lines
fs/unicode/Makefile $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE · line 33
Quoted 1 line
fs/unicode/Makefile +0
-0$(obj)/utf8data.c: $(src)/utf8data.c_shipped FORCEdo we want to retitle the
_shippedsuffix for this file to_copynow, too?fs/unicode/Makefile:11fs/unicode/Makefile:33fs/unicode/Makefile:34
Quoted 11 lines
I think
_copydoesn't convey the sense that this is distributed with the kernel tree, even though it is also generated from in-tree sources. Even if that is not the original sense of_shipped(is it?), it makes sense to me that way, but_copydoesn't.The patch looks good to me, though.
Reviewed-by Gabriel Krisman Bertazi <[email protected]>Quoted 1 line
I only renamed the action part (cmd_shipped -> cmd_copy) because I thought it was clearer.
Actually I do not get the sense of _shipped pretty much, but I think we can keep the file suffix part (utf8data.c_shipped) as is.
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 11 lines · Masahiro Yamada
Quoted 8 lines · Gabriel Krisman Bertazi
Quoted 5 lines · Nick Desaulniers
Quoted 4 lines · Masahiro Yamada
cmd_copyandcmd_shippedhave similar functionality. The difference is thatcmd_copyuses 'cp' whilecmd_shipped'cat'.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Unify them into
cmd_copybecause this macro name is more intuitive.Going forward,
cmd_copywill use 'cat' to avoid the permission issue. I also thought of 'cp --no-preserve=mode' but this option is not mentioned in the POSIX spec [1], so I am keeping the 'cat' command.[1]: https://pubs.opengroup.org/onlinepubs/009695299/utilities/cp.html
Signed-off-by Masahiro Yamada <[email protected]>
Applied to linux-kbuild.
Quoted 71 lines
Quoted 49 lines
Quoted 42 lines
Quoted 42 lines
---
arch/microblaze/boot/Makefile | 2 +- arch/microblaze/boot/dts/Makefile | 2 +- fs/unicode/Makefile | 2 +- scripts/Makefile.lib | 12 ++++-------- usr/Makefile | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-)arch/microblaze/boot/Makefile +1
-1@@ -29,7 +29,7 @@ $(obj)/simpleImage.$(DTB).ub: $(obj)/simpleImage.$(DTB) FORCE $(call if_changed,uimage) $(obj)/simpleImage.$(DTB).unstrip: vmlinux FORCE - $(call if_changed,shipped) + $(call if_changed,copy) $(obj)/simpleImage.$(DTB).strip: vmlinux FORCE $(call if_changed,strip)arch/microblaze/boot/dts/Makefile +1
-1@@ -12,7 +12,7 @@ $(obj)/linked_dtb.o: $(obj)/system.dtb # Generate system.dtb from $(DTB).dtb ifneq ($(DTB),system) $(obj)/system.dtb: $(obj)/$(DTB).dtb - $(call if_changed,shipped) + $(call if_changed,copy) endif endiffs/unicode/Makefile +0
-0@@ -31,7 +31,7 @@ $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE elseQuoted 6 lines
fs/unicode/Makefile $(obj)/utf8data.c: $(obj)/mkutf8data $(filter %.txt, $(cmd_utf8data)) FORCE · line 33
Quoted 1 line
fs/unicode/Makefile +0
-0$(obj)/utf8data.c: $(src)/utf8data.c_shipped FORCEdo we want to retitle the
_shippedsuffix for this file to_copynow, too?fs/unicode/Makefile:11fs/unicode/Makefile:33fs/unicode/Makefile:34Quoted 11 lines
I think
_copydoesn't convey the sense that this is distributed with the kernel tree, even though it is also generated from in-tree sources. Even if that is not the original sense of_shipped(is it?), it makes sense to me that way, but_copydoesn't.The patch looks good to me, though.
Reviewed-by Gabriel Krisman Bertazi <[email protected]>Quoted 1 line
I only renamed the action part (
cmd_shipped->cmd_copy) because I thought it was clearer.Actually I do not get the sense of
_shippedpretty much, but I think we can keep the file suffix part (utf8data.c_shipped) as is.--
Best Regards
Masahiro Yamada
Signature · 2 lines
Best Regards Masahiro Yamada