All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile
@ 2016-11-21 10:14 Michael Ellerman
  2016-11-21 10:14 ` [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-11-21 10:14 UTC (permalink / raw)
  To: linuxppc-dev

Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.

Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.

In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.

Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.

Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.

Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.

Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 617dece67924..c3f700ab5cef 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -275,16 +275,16 @@ zImage: relocs_check
 endif
 
 $(BOOT_TARGETS1): vmlinux
-	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 $(BOOT_TARGETS2): vmlinux
-	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
 
 bootwrapper_install:
-	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
 %.dtb: scripts
-	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
 # Used to create 'merged defconfigs'
 # To use it $(call) it with the first argument as the base defconfig
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE
  2016-11-21 10:14 [PATCH 1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
@ 2016-11-21 10:14 ` Michael Ellerman
  2016-11-22  0:33   ` Andrew Donnellan
  2016-11-21 10:14 ` [PATCH 3/3] powerpc/boot: Fix rebuild when changing kernel endian Michael Ellerman
  2016-11-29 12:58 ` [1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
  2 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2016-11-21 10:14 UTC (permalink / raw)
  To: linuxppc-dev

From: Michael Ellerman <michael@ka3.ozlabs.ibm.com>

If we're using if_changed then we must depend on FORCE, so that
if_changed gets a chance to check if something changed.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/boot/Makefile | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index eae2dc8bc218..7f3faa6255a8 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -356,17 +356,17 @@ $(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
 # Don't put the ramdisk on the pattern rule; when its missing make will try
 # the pattern rule with less dependencies that also matches (even with the
 # hard dependency listed).
-$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
+$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) FORCE
 	$(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)
 
-$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits)
+$(addprefix $(obj)/, $(sort $(filter zImage.%, $(image-y)))): vmlinux $(wrapperbits) FORCE
 	$(call if_changed,wrap,$(subst $(obj)/zImage.,,$@))
 
 # dtbImage% - a dtbImage is a zImage with an embedded device tree blob
-$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb
+$(obj)/dtbImage.initrd.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
 	$(call if_changed,wrap,$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
-$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
+$(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb FORCE
 	$(call if_changed,wrap,$*,,$(obj)/$*.dtb)
 
 # This cannot be in the root of $(src) as the zImage rule always adds a $(obj)
@@ -374,31 +374,31 @@ $(obj)/dtbImage.%: vmlinux $(wrapperbits) $(obj)/%.dtb
 $(obj)/vmlinux.strip: vmlinux
 	$(STRIP) -s -R .comment $< -o $@
 
-$(obj)/uImage: vmlinux $(wrapperbits)
+$(obj)/uImage: vmlinux $(wrapperbits) FORCE
 	$(call if_changed,wrap,uboot)
 
-$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/uImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
-$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/uImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,uboot-$*,,$(obj)/$*.dtb)
 
-$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/cuImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
-$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/cuImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,cuboot-$*,,$(obj)/$*.dtb)
 
-$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/simpleImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
-$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/simpleImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,simpleboot-$*,,$(obj)/$*.dtb)
 
-$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/treeImage.initrd.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb,$(obj)/ramdisk.image.gz)
 
-$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits)
+$(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) FORCE
 	$(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb)
 
 # Rule to build device tree blobs
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] powerpc/boot: Fix rebuild when changing kernel endian
  2016-11-21 10:14 [PATCH 1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
  2016-11-21 10:14 ` [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE Michael Ellerman
@ 2016-11-21 10:14 ` Michael Ellerman
  2016-11-29 12:58 ` [1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-11-21 10:14 UTC (permalink / raw)
  To: linuxppc-dev

From: Michael Ellerman <michael@ka3.ozlabs.ibm.com>

Now that we don't set ARCH incorrectly when calling the boot Makefile,
we can use the generic cpp_lds_S rule for converting our zImage.lds.S
into zImage.lds.

The main advantage of using the generic rule is that it correctly uses
if_changed, which means we correctly regenerate the linker script when
switching endian. Fixing that means we are finally able to build one
endian and then rebuild the other endian without requiring to clean
between builds.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/boot/Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 7f3faa6255a8..1d41d5a9d05e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -171,10 +171,6 @@ $(addprefix $(obj)/,$(libfdt) $(libfdtheader)): $(obj)/%: $(srctree)/scripts/dtc
 $(obj)/empty.c:
 	$(Q)touch $@
 
-$(obj)/zImage.lds: $(obj)/%: $(srctree)/$(src)/%.S
-	$(CROSS32CC) $(cpp_flags) -E -Wp,-MD,$(depfile) -P -Upowerpc \
-		-D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
-
 $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
 	$(Q)cp $< $@
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE
  2016-11-21 10:14 ` [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE Michael Ellerman
@ 2016-11-22  0:33   ` Andrew Donnellan
  2016-11-22  6:06     ` Michael Ellerman
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Donnellan @ 2016-11-22  0:33 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev

On 21/11/16 21:14, Michael Ellerman wrote:
> From: Michael Ellerman <michael@ka3.ozlabs.ibm.com>

Not the most publicly resolvable of domains :)

-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan@au1.ibm.com  IBM Australia Limited

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE
  2016-11-22  0:33   ` Andrew Donnellan
@ 2016-11-22  6:06     ` Michael Ellerman
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-11-22  6:06 UTC (permalink / raw)
  To: Andrew Donnellan, linuxppc-dev

Andrew Donnellan <andrew.donnellan@au1.ibm.com> writes:

> On 21/11/16 21:14, Michael Ellerman wrote:
>> From: Michael Ellerman <michael@ka3.ozlabs.ibm.com>
>
> Not the most publicly resolvable of domains :)

Fudge. Will fix before committing :}

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile
  2016-11-21 10:14 [PATCH 1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
  2016-11-21 10:14 ` [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE Michael Ellerman
  2016-11-21 10:14 ` [PATCH 3/3] powerpc/boot: Fix rebuild when changing kernel endian Michael Ellerman
@ 2016-11-29 12:58 ` Michael Ellerman
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-11-29 12:58 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev

On Mon, 2016-11-21 at 10:14:33 UTC, Michael Ellerman wrote:
> Back in 2005 when the ppc/ppc64 merge started, we used to build the
> kernel code in arch/powerpc but use the boot code from arch/ppc or
> arch/ppc64 depending on whether we were building for 32 or 64-bit.
> 
> Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
> OLDARCH was ppc or ppc64.
> 
> In commit 20f629549b30 ("powerpc: Make building the boot image work for
> both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
> using an ifeq check, because the two Makefiles took different targets,
> and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
> the 32-bit case.
> 
> Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
> to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
> and dropped the ppc case, but kept passing ARCH=ppc64 to
> arch/powerpc/boot/Makefile.
> 
> Since then there have been several more boot targets added, all of which
> have copied the ARCH=ppc64 setting, such that now we have four targets
> using it.
> 
> Currently it seems that nothing actually uses the ARCH value, but that's
> basically just luck, and in particular it prevents us from using the
> generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
> buried and cremated.
> 
> Fix it by dropping the setting of ARCH completely, the correct value is
> exported by the top level Makefile.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Series applied to powerpc next.

https://git.kernel.org/powerpc/c/1196d7aaebf6cdad619310fe283422

cheers

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-29 12:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 10:14 [PATCH 1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman
2016-11-21 10:14 ` [PATCH 2/3] powerpc/boot: All uses of if_changed should depend on FORCE Michael Ellerman
2016-11-22  0:33   ` Andrew Donnellan
2016-11-22  6:06     ` Michael Ellerman
2016-11-21 10:14 ` [PATCH 3/3] powerpc/boot: Fix rebuild when changing kernel endian Michael Ellerman
2016-11-29 12:58 ` [1/3] powerpc: Stop passing ARCH=ppc64 to boot Makefile Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.