Skip to contentSkip to conversation

kheaders: Have cpio unconditionally replace files

PATCH In review Daniel Mentz 2 participants 2 messages Apr 13, 2022 – Apr 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kheaders: Have cpio unconditionally replace files

For out-of-tree builds, this script invokes cpio twice to copy header files from the srctree and subsequently from the objtree. According to a comment in the script, there might be situations in which certain files already exist in the destination directory when header files are copied from the objtree:

"The second CPIO can complain if files already exist which can happen with out of tree builds having stale headers in srctree. Just silence CPIO for now."

GNU cpio might simply print a warning like "newer or same age version exists", but toybox cpio exits with a non-zero exit code unless the command line option "-u" is specified.

To improve compatibility with toybox cpio, add the command line option "-u" to unconditionally replace existing files in the destination directory.

---
 kernel/gen_kheaders.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/gen_kheaders.sh +1 -1
index 1966a749e0d9..0c78e64f747d 100755
@@ -74,7 +74,7 @@ fi
 # of tree builds having stale headers in srctree. Just silence CPIO for now.
 for f in $dir_list;
 	do find "$f" -name "*.h";
-done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
+done | cpio --quiet -pdu $cpio_dir >/dev/null 2>&1
 
 # Remove comments except SDPX lines
 find $cpio_dir -type f -print0 |
Signature · 1 line
2.36.0.rc0.470.gd361397f0d-goog
#1 lore raw
Quoted 15 lines · Daniel Mentz

For out-of-tree builds, this script invokes cpio twice to copy header files from the srctree and subsequently from the objtree. According to a comment in the script, there might be situations in which certain files already exist in the destination directory when header files are copied from the objtree:

"The second CPIO can complain if files already exist which can happen with out of tree builds having stale headers in srctree. Just silence CPIO for now."

GNU cpio might simply print a warning like "newer or same age version exists", but toybox cpio exits with a non-zero exit code unless the command line option "-u" is specified.

Quoted 6 lines

To improve compatibility with toybox cpio, add the command line option "-u" to unconditionally replace existing files in the destination directory.

---

Applied to linux-kbuild.
Thanks.

Quoted 19 lines
 kernel/gen_kheaders.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/gen_kheaders.sh +1 -2
index 1966a749e0d9..0c78e64f747d 100755
@@ -74,7 +74,7 @@ fi
 # of tree builds having stale headers in srctree. Just silence CPIO for now.
 for f in $dir_list;
        do find "$f" -name "*.h";
-done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
+done | cpio --quiet -pdu $cpio_dir >/dev/null 2>&1
 
 # Remove comments except SDPX lines
 find $cpio_dir -type f -print0 |
--

2.36.0.rc0.470.gd361397f0d-goog

Signature · 2 lines
Best Regards
Masahiro Yamada