Skip to contentSkip to conversation

mips: decompressor: do not copy source files while building

PATCH In review Masahiro Yamada 3 participants 11 messages Nov 5, 2021 – Nov 11, 2021 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: decompressor: do not copy source files while building

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)			   += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-	$(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-	$(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-	$(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +5 -0
index eb630ee287c3..c534fe1eac16 100755
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
 	do
 		rm -f arch/arm/boot/compressed/${f}
 	done
+
+	for f in uart-ath79.c ashldi3.c bswapsi.c
+	do
+		rm -f arch/mips/boot/compressed/${f}
+	done
 fi
Signature · 1 line
2.30.2
#1 lore raw

Hi Masahiro,

Quoted 5 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

What did you base this patch on?

It does not apply cleanly here. It tries to create ashldi3.c and bswapsi.c, which already exist.

Cheers,
-Paul

Quoted 92 lines

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -0
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += 

$(obj)/uart-alchemy.o
vmlinuzobjs-$(CONFIG_ATH79) += $(obj)/uart-ath79.o
endif

arch/mips/boot/compressed/Makefile +0 -12
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-	$(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-	$(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-	$(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +5 -1
index eb630ee287c3..c534fe1eac16 100755
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
 	do
 		rm -f arch/arm/boot/compressed/${f}
 	done
+
+	for f in uart-ath79.c ashldi3.c bswapsi.c
+	do
+		rm -f arch/mips/boot/compressed/${f}
+	done
 fi
--

2.30.2

#2 lore raw
Quoted 9 lines · Paul Cercueil

Hi Masahiro,

Quoted 4 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Quoted 7 lines
Quoted 1 line

Do similar for mips to clean up the Makefile and .gitignore.

What did you base this patch on?

It does not apply cleanly here. It tries to create ashldi3.c and bswapsi.c, which already exist.

Please remove them manually
before 'git am'.

Signature · 2 lines
Best Regards
Masahiro Yamada
Tested-by
#3 lore raw

Hi,

Quoted 14 lines · Masahiro Yamada
Quoted 13 lines · Paul Cercueil

Hi Masahiro,

Quoted 1 line · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify

libfdt

Quoted 1 line

builds") stated, copying source files during the build time may

not

Quoted 3 lines

end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

Quoted 8 lines
Quoted 5 lines

What did you base this patch on?

It does not apply cleanly here. It tries to create ashldi3.c and bswapsi.c, which already exist.

Please remove them manually
before 'git am'.

That works. I thought these files were staged in git.

Cheers,
-Paul

#4 lore raw
In reply to Masahiro Yamada
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)		   += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)			   += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-	$(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-	$(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-	$(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
 	do
 		rm -f arch/arm/boot/compressed/${f}
 	done
+
+	for f in uart-ath79.c ashldi3.c bswapsi.c
+	do
+		rm -f arch/mips/boot/compressed/${f}
+	done

hmm, isn't this the wrong action now that these files have been added to git ?

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#5 lore raw
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

           ...

fi

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

So, only the generated files are removed.

Signature · 2 lines
Best Regards
Masahiro Yamada
#6 lore raw
Quoted 106 lines · Masahiro Yamada
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

Quoted 8 lines
           ...

fi

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

So, only the generated files are removed.

but there aren't copied/generated any longer or I'm missing someting ?

Anyway I've applied your patch to mips-next with changes to also cover

https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#7 lore raw
Quoted 112 lines · Thomas Bogendoerfer
Quoted 110 lines · Masahiro Yamada
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

           ...

fi

Quoted 6 lines
Quoted 4 lines

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

So, only the generated files are removed.

but there aren't copied/generated any longer or I'm missing someting ?

People do "git pull" without cleaning the tree. (and we should not require users to do "make clean")

[1] ashldi3.c and bswapsi.c will be remaining in the build directory, which were generated by an older commit

[2] ashldi3.c and bswapsi.c will be added to the
source tree when people pull this commit

[1] takes precedence over [2].

So, old files will be compiled. This is a problem.

That's why I am removing [1] for O= builds.

Quoted 10 lines

Anyway I've applied your patch to mips-next with changes to also cover

https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]

Signature · 2 lines
Best Regards
Masahiro Yamada
#8 lore raw
In reply to Thomas Bogendoerfer
Quoted 115 lines · Thomas Bogendoerfer
Quoted 113 lines · Masahiro Yamada
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

           ...

fi

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

Quoted 8 lines
Quoted 1 line

So, only the generated files are removed.

but there aren't copied/generated any longer or I'm missing someting ?

Anyway I've applied your patch to mips-next with changes to also cover

https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/

Your conversion is wrong.

The original code:

$(obj)/bswapdi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE

        $(call if_changed,shipped)

copied mips-specific library code
(arch/mips/lib/bswapdi.c)

Now, you do

#include "../../../../lib/ashldi3.c"

, which wraps the generic library code
(lib/ashldi3.c)

Signature · 2 lines
Best Regards
Masahiro Yamada
#9 lore raw
Quoted 139 lines · Masahiro Yamada
Quoted 115 lines · Thomas Bogendoerfer
Quoted 113 lines · Masahiro Yamada
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

           ...

fi

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

Quoted 8 lines
Quoted 1 line

So, only the generated files are removed.

but there aren't copied/generated any longer or I'm missing someting ?

Anyway I've applied your patch to mips-next with changes to also cover

https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/

Your conversion is wrong.

The original code:

$(obj)/bswapdi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE

        $(call if_changed,shipped)

copied mips-specific library code
(arch/mips/lib/bswapdi.c)

Quoted 6 lines

Now, you do

#include "../../../../lib/ashldi3.c"

, which wraps the generic library code
(lib/ashldi3.c)

arch/mips/boot/compressed/bswapdi.c in my tree is

arch/mips/boot/compressed/bswapdi.c new file +2 -0
new file mode 100644
index 000000000000..acb28aebb025
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapdi.c"

which looks correct to me.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#10 lore raw
Quoted 159 lines · Thomas Bogendoerfer
Quoted 139 lines · Masahiro Yamada
Quoted 115 lines · Thomas Bogendoerfer
Quoted 113 lines · Masahiro Yamada
Quoted 98 lines · Thomas Bogendoerfer
Quoted 84 lines · Masahiro Yamada

As commit 7ae4a78daacf ("ARM: 8969/1: decompressor: simplify libfdt builds") stated, copying source files during the build time may not end up with as clean code as expected.

Do similar for mips to clean up the Makefile and .gitignore.

---

 arch/mips/boot/compressed/.gitignore   |  3 ---
 arch/mips/boot/compressed/Makefile     | 12 ------------
 arch/mips/boot/compressed/ashldi3.c    |  2 ++
 arch/mips/boot/compressed/bswapsi.c    |  2 ++
 arch/mips/boot/compressed/uart-ath79.c |  2 ++
 scripts/remove-stale-files             |  5 +++++
 6 files changed, 11 insertions(+), 15 deletions(-)
 delete mode 100644 arch/mips/boot/compressed/.gitignore
 create mode 100644 arch/mips/boot/compressed/ashldi3.c
 create mode 100644 arch/mips/boot/compressed/bswapsi.c
 create mode 100644 arch/mips/boot/compressed/uart-ath79.c
arch/mips/boot/compressed/.gitignore deleted +0 -3
deleted file mode 100644
index d358395614c9..000000000000
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-ashldi3.c
-bswapsi.c
arch/mips/boot/compressed/Makefile +0 -12
index 3548b3b45269..e6584dab2360 100644
@@ -50,20 +50,8 @@ vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY)            += $(obj)/uart-alchemy.o
 vmlinuzobjs-$(CONFIG_ATH79)                     += $(obj)/uart-ath79.o
 endif
 
-extra-y += uart-ath79.c
-$(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
-     $(call cmd,shipped)
-
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o
 
-extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
-     $(call if_changed,shipped)
-
-extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
-     $(call if_changed,shipped)
-
 targets := $(notdir $(vmlinuzobjs-y))
 
 targets += vmlinux.bin
arch/mips/boot/compressed/ashldi3.c new file +2 -0
new file mode 100644
index 000000000000..f7bf6a7aae31
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../../../lib/ashldi3.c"
arch/mips/boot/compressed/bswapsi.c new file +2 -0
new file mode 100644
index 000000000000..fdb9c6476904
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapsi.c"
arch/mips/boot/compressed/uart-ath79.c new file +2 -0
new file mode 100644
index 000000000000..d686820921be
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../ath79/early_printk.c"
scripts/remove-stale-files +0 -0
index eb630ee287c3..c534fe1eac16 100755

scripts/remove-stale-files if [ -n "${building_out_of_srctree}" ]; then · line 35

Quoted 8 lines
scripts/remove-stale-files +5 -0
@@ -28,4 +28,9 @@ if [ -n "${building_out_of_srctree}" ]; then
      do
              rm -f arch/arm/boot/compressed/${f}
      done
+
+     for f in uart-ath79.c ashldi3.c bswapsi.c
+     do
+             rm -f arch/mips/boot/compressed/${f}
+     done

hmm, isn't this the wrong action now that these files have been added to git ?

Quoted 1 line

Thomas.

Please note that the entire code block is enclosed by:

if [ -n "${building_out_of_srctree}" ]; then

           ...

fi

"building_out_of_srctree" is set when you are doing out-of-tree build (O=<output-dir>).

Quoted 8 lines
Quoted 1 line

So, only the generated files are removed.

but there aren't copied/generated any longer or I'm missing someting ?

Anyway I've applied your patch to mips-next with changes to also cover

https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/

Your conversion is wrong.

The original code:

$(obj)/bswapdi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE

        $(call if_changed,shipped)

copied mips-specific library code
(arch/mips/lib/bswapdi.c)

Quoted 6 lines

Now, you do

#include "../../../../lib/ashldi3.c"

, which wraps the generic library code
(lib/ashldi3.c)

arch/mips/boot/compressed/bswapdi.c in my tree is

arch/mips/boot/compressed/bswapdi.c new file +2 -0
new file mode 100644
index 000000000000..acb28aebb025
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include "../../lib/bswapdi.c"
Quoted 3 lines

which looks correct to me.

Thomas.

My bad - I read the code wrongly.

Yes, the code is correct.

Sorry for that.

Signature · 2 lines
Best Regards
Masahiro Yamada