Skip to contentSkip to conversation

bootwrapper: build multiple cuImages

RFC Superseded Grant Likely 5 participants 7 messages Jan 31, 2008 PowerPC

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 bootwrapper: build multiple cuImages

From: Grant Likely <[email protected]>

Currently, the kernel uses CONFIG_DEVICE_TREE to wrap a kernel image with a fdt blob which means for any given configuration only one dts file can be selected and so support for only one board can be built

This patch moves the selection of the default .dts file out of the kernel config and into the bootwrapper makefile. The makefile chooses which images to build based on the kernel config and the dts source file name is taken directly from the image name. For example "cuImage.ebony" will use "ebony.dts" as the device tree source file.

In addition, this patch allows a specific image to be requested from the command line by adding "cuImage.%" and "treeImage.%" targets to the list of valid built targets in arch/powerpc/Makefile. This allows the default dts selection to be overridden.

Another advantage to this change is it allows a single defconfig to be supplied for all boards using the same chip family and only differing in the device tree.

---

Please review and comment. I have not exhaustively tested this patch and I'm sure to have missed some boards. However, I think the concept is sound and will be a good change.
---

 arch/powerpc/Kconfig       |   19 -------
 arch/powerpc/Makefile      |    9 +--
 arch/powerpc/boot/Makefile |  123 ++++++++++++++++++++++++++++++++------------
 arch/powerpc/boot/wrapper  |   20 +++++++
 4 files changed, 112 insertions(+), 59 deletions(-)
arch/powerpc/Kconfig +0 -19
index 5e10838..5c205c7 100644
@@ -407,25 +407,6 @@ config WANT_DEVICE_TREE
 	bool
 	default n
 
-config DEVICE_TREE
-	string "Static device tree source file"
-	depends on WANT_DEVICE_TREE
-	help
-	  This specifies the device tree source (.dts) file to be
-	  compiled and included when building the bootwrapper.  If a
-	  relative filename is given, then it will be relative to
-	  arch/powerpc/boot/dts.  If you are not using the bootwrapper,
-	  or do not need to build a dts into the bootwrapper, this
-	  field is ignored.
-
-	  For example, this is required when building a cuImage target
-	  for an older U-Boot, which cannot pass a device tree itself.
-	  Such a kernel will not work with a newer U-Boot that tries to
-	  pass a device tree (unless you tell it not to).  If your U-Boot
-	  does not mention a device tree in "help bootm", then use the
-	  cuImage target and specify a device tree here.  Otherwise, use
-	  the uImage target and leave this field blank.
-
 endmenu
 
 config ISA_DMA_API
arch/powerpc/Makefile +3 -6
index f70df9b..6845482 100644
@@ -151,14 +151,11 @@ core-$(CONFIG_XMON)		+= arch/powerpc/xmon/
 drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
 
 # Default to zImage, override when needed
-defaultimage-y			:= zImage
-defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage
-KBUILD_IMAGE := $(defaultimage-y)
-all: $(KBUILD_IMAGE)
+all: zImage
 
 CPPFLAGS_vmlinux.lds	:= -Upowerpc
 
-BOOT_TARGETS = zImage zImage.initrd uImage
+BOOT_TARGETS = zImage zImage.initrd uImage treeImage.% cuImage.%
 
 PHONY += $(BOOT_TARGETS)
 
@@ -180,7 +177,7 @@ define archhelp
 endef
 
 install: vdso_install
-	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
+	$(Q)$(MAKE) $(build)=$(boot) install
 
 vdso_install:
 ifeq ($(CONFIG_PPC64),y)
arch/powerpc/boot/Makefile +89 -34

175 lines not on this page · raw message

arch/powerpc/boot/wrapper +20 -0
index 763a0c4..b70ec6a 100755
@@ -158,6 +158,26 @@ miboot|uboot)
 cuboot*)
     binary=y
     gzip=
+    case "$platform" in
+    *-mpc885ads|*-adder875*|*-ep88xc)
+        platformo=$object/cuboot-8xx.o
+        ;;
+    *5200*|*-motionpro)
+        platformo=$object/cuboot-52xx.o
+        ;;
+    *-pq2fads|*-ep8248e|*-mpc8272*)
+        platformo=$object/cuboot-pq2.o
+        ;;
+    *-mpc824*)
+        platformo=$object/cuboot-824x.o
+        ;;
+    *-mpc83*)
+        platformo=$object/cuboot-83xx.o
+        ;;
+    *-mpc85*)
+        platformo=$object/cuboot-85xx.o
+        ;;
+    esac
     ;;
 ps3)
     platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
#1 lore raw

I like the spirit... It does seem like the compiled in device tree is specified in the wrong place.
Comments inline.

Quoted 2 lines

-----Original Message-----
From: =

linuxppc-dev-bounces+stephen.neuendorffer=3Dxilinx.com@ozlabs.org [mailto:linuxppc-dev-

Quoted 1 line

[email protected]] On Behalf Of =

Grant
Likely

Quoted 2 lines

Sent: Wednesday, January 30, 2008 4:34 PM
To: [email protected]; [email protected];

[email protected]; [email protected]

Quoted 9 lines

Subject: [RFC] [POWERPC] bootwrapper: build multiple cuImages =20
From: Grant Likely <[email protected]>
=20
Currently, the kernel uses CONFIG_DEVICE_TREE to wrap a kernel image with a fdt blob which means for any given configuration only one dts file can be selected and so support for only one board can be built =20
This patch moves the selection of the default .dts file out of the

kernel

Quoted 3 lines

config and into the bootwrapper makefile. The makefile chooses which images to build based on the kernel config and the dts source file name is taken directly from the image name. For example

"cuImage.ebony"

Quoted 3 lines

will use "ebony.dts" as the device tree source file.
=20
In addition, this patch allows a specific image to be requested from

the

Quoted 1 line

command line by adding "cuImage.%" and "treeImage.%" targets to the

list

Quoted 1 line

of valid built targets in arch/powerpc/Makefile. This allows the

default

Quoted 4 lines

dts selection to be overridden.
=20
Another advantage to this change is it allows a single defconfig to be supplied for all boards using the same chip family and only differing

in

Quoted 11 lines

the device tree.
=20

=20
---
=20
Please review and comment. I have not exhaustively tested this patch and I'm sure to have missed some boards. However, I think the concept is sound and will be a good change.
---
=20

Quoted 3 lines
 arch/powerpc/Kconfig       |   19 -------
 arch/powerpc/Makefile      |    9 +--
 arch/powerpc/boot/Makefile |  123

++++++++++++++++++++++++++++++++------------

Quoted 16 lines
 arch/powerpc/boot/wrapper  |   20 +++++++
 4 files changed, 112 insertions(+), 59 deletions(-)

=20

arch/powerpc/Kconfig +0 -0
index 5e10838..5c205c7 100644
@@ -407,25 +407,6 @@ config WANT_DEVICE_TREE
 	bool
 	default n

=20

arch/powerpc/Kconfig +0 -5
-config DEVICE_TREE
-	string "Static device tree source file"
-	depends on WANT_DEVICE_TREE
-	help
-	  This specifies the device tree source (.dts) file to be

arch/powerpc/Kconfig config WANT_DEVICE_TREE

Quoted 10 lines
arch/powerpc/Kconfig +0 -10
-	  compiled and included when building the bootwrapper.  If a
-	  relative filename is given, then it will be relative to
-	  arch/powerpc/boot/dts.  If you are not using the bootwrapper,
-	  or do not need to build a dts into the bootwrapper, this
-	  field is ignored.
-
-	  For example, this is required when building a cuImage target
-	  for an older U-Boot, which cannot pass a device tree itself.
-	  Such a kernel will not work with a newer U-Boot that tries to
-	  pass a device tree (unless you tell it not to).  If your

U-Boot

arch/powerpc/Makefile core-$(CONFIG_XMON) +=3D

Quoted 12 lines
arch/powerpc/Kconfig +0 -4
-	  does not mention a device tree in "help bootm", then use the
-	  cuImage target and specify a device tree here.  Otherwise, use
-	  the uImage target and leave this field blank.
-
 endmenu

=20
config ISA_DMA_API

arch/powerpc/Makefile +0 -0
index f70df9b..6845482 100644
@@ -151,14 +151,11 @@ core-$(CONFIG_XMON)		+=3D

arch/powerpc/xmon/

arch/powerpc/boot/Makefile targets +=3D $(patsubst

Quoted 30 lines
arch/powerpc/Makefile +0 -0
 drivers-$(CONFIG_OPROFILE)	+=3D arch/powerpc/oprofile/

=20
# Default to zImage, override when needed

arch/powerpc/Makefile +1 -4
-defaultimage-y			:=3D zImage
-defaultimage-$(CONFIG_DEFAULT_UIMAGE) :=3D uImage
-KBUILD_IMAGE :=3D $(defaultimage-y)
-all: $(KBUILD_IMAGE)
+all: zImage

=20
CPPFLAGS_vmlinux.lds :=3D -Upowerpc
=20

arch/powerpc/Makefile +1 -1
-BOOT_TARGETS =3D zImage zImage.initrd uImage
+BOOT_TARGETS =3D zImage zImage.initrd uImage treeImage.% cuImage.%

=20
PHONY +=3D $(BOOT_TARGETS)
=20

arch/powerpc/Makefile +0 -0
@@ -180,7 +177,7 @@ define archhelp
 endef

=20
install: vdso_install

arch/powerpc/Makefile +1 -1
-	$(Q)$(MAKE) $(build)=3D$(boot) BOOTIMAGE=3D$(KBUILD_IMAGE) install
+	$(Q)$(MAKE) $(build)=3D$(boot) install

=20
vdso_install:
ifeq ($(CONFIG_PPC64),y)

arch/powerpc/boot/Makefile +0 -0
index b36f911..7173abe 100644
@@ -123,6 +123,8 @@ targets		+=3D $(patsubst

$(obj)/%,%,$(obj-boot) wrapper.a)

arch/powerpc/boot/Makefile targets +=3D $(patsubst · line 124

Quoted 2 lines
arch/powerpc/boot/Makefile +0 -0
 extra-y		:=3D $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
 		   $(obj)/zImage.lds $(obj)/zImage.coff.lds

$(obj)/zImage.ps3.lds

arch/powerpc/boot/Makefile

Quoted 5 lines

=20

arch/powerpc/boot/Makefile +2 -0
+dtstree		:=3D $(srctree)/$(src)/dts
+
 wrapper		:=3D$(srctree)/$(src)/wrapper
 wrapperbits	:=3D $(extra-y) $(addprefix $(obj)/,addnote hack-coff

mktree dtc) \

arch/powerpc/boot/Makefile image-$(CONFIG_PPC_PRPMC2800) +=3D

Quoted 2 lines
arch/powerpc/boot/Makefile +0 -0
 			$(wrapper) FORCE
@@ -191,26 +193,67 @@ image-$(CONFIG_PPC_PRPMC2800)		+=3D

zImage.prpmc2800

arch/powerpc/boot/Makefile image-$(CONFIG_PPC_PRPMC2800) += zImage.prpmc2800

Quoted 10 lines
arch/powerpc/boot/Makefile +0 -0
 image-$(CONFIG_PPC_ISERIES)		+=3D zImage.iseries
 image-$(CONFIG_DEFAULT_UIMAGE)		+=3D uImage

=20

arch/powerpc/boot/Makefile +4 -3
-ifneq ($(CONFIG_DEVICE_TREE),"")
-image-$(CONFIG_PPC_8xx)			+=3D cuImage.8xx
-image-$(CONFIG_PPC_EP88XC)		+=3D zImage.ep88xc
+#
+# Targets which embed a device tree blob
+#
+# Theses are default targets to build images which embed device tree

blobs.

Quoted 1 line

+# They are only required on boards which do not have FDT support in

firmware.

Quoted 6 lines
arch/powerpc/boot/Makefile +4 -1
+# Boards with newish u-boot firmare can use the uImage target above
+#
+
+# Board ports in arch/powerpc/platform/40x/Kconfig
 image-$(CONFIG_EP405)			+=3D zImage.ep405
-image-$(CONFIG_8260)			+=3D cuImage.pq2

arch/powerpc/boot/Makefile

Quoted 10 lines
arch/powerpc/boot/Makefile +3 -6
-image-$(CONFIG_EP8248E)			+=3D zImage.ep8248e
-image-$(CONFIG_PPC_MPC52xx)		+=3D cuImage.52xx
-image-$(CONFIG_STORCENTER)		+=3D cuImage.824x
-image-$(CONFIG_PPC_83xx)		+=3D cuImage.83xx
-image-$(CONFIG_PPC_85xx)		+=3D cuImage.85xx
-image-$(CONFIG_MPC7448HPC2)		+=3D cuImage.hpc2
+image-$(CONFIG_WALNUT)			+=3D treeImage.walnut
+
+# Board ports in arch/powerpc/platform/44x/Kconfig
 image-$(CONFIG_EBONY)			+=3D treeImage.ebony

cuImage.ebony

Quoted 1 line

image-$(CONFIG_BAMBOO) +=3D treeImage.bamboo

cuImage.bamboo

Quoted 6 lines

image-$(CONFIG_SEQUOIA) +=3D cuImage.sequoia
image-$(CONFIG_RAINIER) +=3D cuImage.rainier

arch/powerpc/boot/Makefile +0 -1
-image-$(CONFIG_WALNUT)			+=3D treeImage.walnut
 image-$(CONFIG_TAISHAN)			+=3D cuImage.taishan
 image-$(CONFIG_KATMAI)			+=3D cuImage.katmai
 image-$(CONFIG_WARP)			+=3D cuImage.warp

arch/powerpc/boot/Makefile

Quoted 10 lines
arch/powerpc/boot/Makefile +9 -1
-endif
+
+# Board ports in arch/powerpc/platform/8xx/Kconfig
+image-$(CONFIG_PPC_MPC86XADS)		+=3D zImage.mpc866ads
+image-$(CONFIG_PPC_MPC885ADS)		+=3D zImage.mpc885ads
+image-$(CONFIG_PPC_EP88XC)		+=3D zImage.ep88xc
+image-$(CONFIG_PPC_ADDER875)		+=3D cuImage.adder875-uboot
+
+# Board ports in arch/powerpc/platform/52xx/Kconfig
+image-$(CONFIG_PPC_LITE5200)		+=3D cuImage.lite5200

cuImage.lite5200b

Quoted 40 lines
arch/powerpc/boot/Makefile +32 -0
+
+# Board ports in arch/powerpc/platform/82xx/Kconfig
+image-$(CONFIG_MPC8272_ADS)		+=3D cuImage.mpc8272ads
+image-$(CONFIG_PQ2FADS)			+=3D cuImage.pq2fads
+image-$(CONFIG_EP8248E)			+=3D zImage.ep8248e
+
+# Board ports in arch/powerpc/platform/83xx/Kconfig
+image-$(CONFIG_MPC8313_RDB)		+=3D cuImage.mpc8313erdb
+image-$(CONFIG_MPC832x_MDS)		+=3D cuImage.mpc832x_mds
+image-$(CONFIG_MPC832x_RDB)		+=3D cuImage.mpc832x_rdb
+image-$(CONFIG_MPC834x_ITX)		+=3D cuImage.mpc8349emitx \
+					   cuImage.mpc8349emitxgp
+image-$(CONFIG_MPC834x_MDS)		+=3D cuImage.mpc834x_mds
+image-$(CONFIG_MPC836x_MDS)		+=3D cuImage.mpc836x_mds
+image-$(CONFIG_MPC837x_MDS)		+=3D cuImage.mpc8377_mds \
+					   cuImage.mpc8378_mds \
+					   cuImage.mpc8379_mds
+
+# Board ports in arch/powerpc/platform/83xx/Kconfig
+image-$(CONFIG_MPC8540_ADS)		+=3D cuImage.mpc8540ads
+image-$(CONFIG_MPC8560_ADS)		+=3D cuImage.mpc8560ads
+image-$(CONFIG_MPC85xx_CDS)		+=3D cuImage.mpc8541cds \
+					   cuImage.mpc8548cds \
+					   cuImage.mpc8555cds
+image-$(CONFIG_MPC85xx_MDS)		+=3D cuImage.mpc8568mds
+image-$(CONFIG_MPC85xx_DS)		+=3D cuImage.mpc8544ds \
+					   cuImage.mpc8572ds
+
+# Board ports in arch/powerpc/platform/embedded6xx/Kconfig
+image-$(CONFIG_STORCENTER)		+=3D cuImage.storcenter
+image-$(CONFIG_PPC_PRPMC2800)		+=3D cuImage.prpmc2800
+image-$(CONFIG_MPC7448HPC2)		+=3D cuImage.mpc7448hpc2

=20
ifneq ($(CONFIG_REDBOOT),"")
image-$(CONFIG_PPC_8xx) +=3D zImage.redboot-8xx

arch/powerpc/boot/Makefile +0 -0
@@ -230,24 +273,14 @@ targets	+=3D $(image-y) $(initrd-y)

=20
$(addprefix $(obj)/, $(initrd-y)): $(obj)/ramdisk.image.gz
=20

arch/powerpc/boot/Makefile +0 -1
-# If CONFIG_WANT_DEVICE_TREE is set and CONFIG_DEVICE_TREE isn't an

arch/powerpc/boot/Makefile targets += $(image-y) $(initrd-y)

Quoted 10 lines
arch/powerpc/boot/Makefile +0 -9
-# empty string, define 'dts' to be path to the dts
-# CONFIG_DEVICE_TREE will have "" around it, make sure to strip them
-ifeq ($(CONFIG_WANT_DEVICE_TREE),y)
-ifneq ($(CONFIG_DEVICE_TREE),"")
-dts =3D $(if $(shell echo $(CONFIG_DEVICE_TREE) | grep '^/'),\
-	,$(srctree)/$(src)/dts/)$(CONFIG_DEVICE_TREE:"%"=3D%)
-endif
-endif
-
 # Don't put the ramdisk on the pattern rule; when its missing make

will try

Quoted 1 line
 # the pattern rule with less dependencies that also matches (even

with the

Quoted 10 lines
 # hard dependency listed).
-$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) $(dts)
arch/powerpc/boot/Makefile +2 -1
-	$(call if_changed,wrap,$*,$(dts),,$(obj)/ramdisk.image.gz)
+$(obj)/zImage.initrd.%: vmlinux $(wrapperbits)
+	$(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz)

=20
-$(obj)/zImage.%: vmlinux $(wrapperbits) $(dts)

arch/powerpc/boot/Makefile +2 -1
-	$(call if_changed,wrap,$*,$(dts))
+$(obj)/zImage.%: vmlinux $(wrapperbits)
+	$(call if_changed,wrap,$*)
Quoted 2 lines

=20
# This cannot be in the root of $(src) as the zImage rule always adds

a $(obj)

Quoted 4 lines
 # prefix
arch/powerpc/boot/Makefile +0 -0
@@ -259,22 +292,42 @@ $(obj)/zImage.iseries: vmlinux

=20
$(obj)/zImage.ps3: vmlinux $(wrapper) $(wrapperbits)

$(srctree)/$(src)/dts/ps3.dts

Quoted 5 lines
arch/powerpc/boot/Makefile +1 -1
 	$(STRIP) -s -R .comment $< -o vmlinux.strip
-	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
+	$(call cmd,wrap,ps3,$(dtstree)/ps3.dts,,)

=20
$(obj)/zImage.initrd.ps3: vmlinux $(wrapper) $(wrapperbits)

$(srctree)/$(src)/dts/ps3.dts

arch/powerpc/boot/Makefile

Quoted 2 lines

$(obj)/ramdisk.image.gz

arch/powerpc/boot/Makefile +0 -1
-	$(call

cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 6 lines
arch/powerpc/boot/Makefile +6 -0
+	$(call cmd,wrap,ps3,$(dtstree)/ps3.dts,,$(obj)/ramdisk.image.gz)
+
+zImage.ep405: vmlinux $(wrapperbits) $(dtstree)/ep405.dts
+	$(call if_changed,wrap,$*,$(dtstree)/ep405.dts)
+zImage.initrd.ep405: vmlinux $(wrapperbits) $(dtstree)/ep405.dts
+	$(call

if_changed,wrap,$*,$(dtstree)/ep405.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 4 lines
arch/powerpc/boot/Makefile +4 -0
+
+zImage.mpc866ads: vmlinux $(wrapperbits) $(dtstree)/mpc866ads.dts
+	$(call if_changed,wrap,$*,$(dtstree)/mpc866ads.dts)
+zImage.initrd.mpc866ads: vmlinux $(wrapperbits)

$(dtstree)/mpc866ads.dts

arch/powerpc/boot/Makefile

Quoted 1 line
arch/powerpc/boot/Makefile +1 -0
+	$(call

if_changed,wrap,$*,$(dtstree)/mpc866ads.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 4 lines
arch/powerpc/boot/Makefile +4 -0
+
+zImage.mpc885ads: vmlinux $(wrapperbits) $(dtstree)/mpc885ads.dts
+	$(call if_changed,wrap,$*,$(dtstree)/mpc885ads.dts)
+zImage.initrd.mpc885ads: vmlinux $(wrapperbits)

$(dtstree)/mpc885ads.dts

arch/powerpc/boot/Makefile

Quoted 1 line
arch/powerpc/boot/Makefile +1 -0
+	$(call

if_changed,wrap,$*,$(dtstree)/mpc885ads.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 5 lines
arch/powerpc/boot/Makefile +5 -0
+
+zImage.ep88xc: vmlinux $(wrapperbits) $(dtstree)/ep88xc.dts
+	$(call if_changed,wrap,$*,$(dtstree)/ep88xc.dts)
+zImage.initrd.ep88xc: vmlinux $(wrapperbits) $(dtstree)/ep88xc.dts
+	$(call

if_changed,wrap,$*,$(dtstree)/ep88xc.dts,,$(obj)/ramdisk.image.gz)

It seems like all you've done here is expand out the $(obj)/zImage.% rule?, but now the $* has nothing to match to? I don't think this works.

How about just:
$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) %.dts

	$(call if_changed,wrap,$*,$*.dts,,$(obj)/ramdisk.image.gz)

Which would handle the default case of platform code for each dts.

Then for cases where you have a multiplatform target, you'd have something like
$(obj)/zImage.initrd.virtex.%: vmlinux $(wrapperbits) %.dts

	$(call if_changed,wrap,virtex,$*.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile

Quoted 11 lines

=20
$(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
=20
-$(obj)/cuImage.%: vmlinux $(dts) $(wrapperbits)

arch/powerpc/boot/Makefile +2 -1
-	$(call if_changed,wrap,cuboot-$*,$(dts))
+$(obj)/cuImage.%: vmlinux $(dtstree)/%.dts $(wrapperbits)
+	$(call if_changed,wrap,cuboot-$*,$(dtstree)/$*.dts)

=20
-$(obj)/treeImage.initrd.%: vmlinux $(dts) $(wrapperbits)

arch/powerpc/boot/Makefile +0 -1
-	$(call

if_changed,wrap,treeboot-$*,$(dts),,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile

Quoted 2 lines

+$(obj)/treeImage.initrd.%: vmlinux $(dtstree)/%.dts $(wrapperbits)

arch/powerpc/boot/Makefile +1 -0
+	$(call

if_changed,wrap,treeboot-$*,$(dtstree)/$*.dts,,$(obj)/ramdisk.image.gz)

Quoted 16 lines

=20
-$(obj)/treeImage.%: vmlinux $(dts) $(wrapperbits)

arch/powerpc/boot/Makefile +2 -1
-	$(call if_changed,wrap,treeboot-$*,$(dts))
+$(obj)/treeImage.%: vmlinux $(dtstree)/%.dts $(wrapperbits)
+	$(call if_changed,wrap,treeboot-$*,$(dtstree)/$*.dts)

=20
# If there isn't a platform selected then just strip the vmlinux. ifeq (,$(image-y))

arch/powerpc/boot/Makefile +0 -0
@@ -283,8 +336,10 @@ endif

=20
$(obj)/zImage: $(addprefix $(obj)/, $(image-y))

arch/powerpc/boot/Makefile +2 -0
 	@rm -f $@; ln $< $@
+	@echo target images: $(image-y)
 $(obj)/zImage.initrd:	$(addprefix $(obj)/, $(initrd-y))
 	@rm -f $@; ln $< $@
+	@echo target images: $(initrd-y)
Quoted 3 lines

=20
install: $(CONFIGURE) $(addprefix $(obj)/, $(image-y))
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux

System.map "$(INSTALL_PATH)" $<

Quoted 21 lines
arch/powerpc/boot/wrapper +13 -0
index 763a0c4..b70ec6a 100755
@@ -158,6 +158,26 @@ miboot|uboot)
 cuboot*)
     binary=3Dy
     gzip=3D
+    case "$platform" in
+    *-mpc885ads|*-adder875*|*-ep88xc)
+        platformo=3D$object/cuboot-8xx.o
+        ;;
+    *5200*|*-motionpro)
+        platformo=3D$object/cuboot-52xx.o
+        ;;
+    *-pq2fads|*-ep8248e|*-mpc8272*)
+        platformo=3D$object/cuboot-pq2.o
+        ;;
+    *-mpc824*)
+        platformo=3D$object/cuboot-824x.o
+        ;;

arch/powerpc/boot/wrapper miboot|uboot) · line 183

Quoted 10 lines
arch/powerpc/boot/wrapper +7 -0
+    *-mpc83*)
+        platformo=3D$object/cuboot-83xx.o
+        ;;
+    *-mpc85*)
+        platformo=3D$object/cuboot-85xx.o
+        ;;
+    esac
     ;;
 ps3)
     platformo=3D"$object/ps3-head.o $object/ps3-hvcall.o =

$object/ps3.o"

I'm not particularly fond of making the wrapper smarter... It seems like the wrapper should be stupid and the logic about what to include done in the Makefile or in Kconfig. Also, it seems like a strange place to explicitly encode the dependency between the name of the dts file and the platform code.

Steve

Quoted 5 lines

=20
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

#2 lore raw
Quoted 3 lines · Stephen Neuendorffer

I like the spirit... It does seem like the compiled in device tree is specified in the wrong place.

heh, thanks. :-)

Quoted 20 lines

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 3 lines
arch/powerpc/boot/Makefile +3 -0
+zImage.mpc866ads: vmlinux $(wrapperbits) $(dtstree)/mpc866ads.dts
+     $(call if_changed,wrap,$*,$(dtstree)/mpc866ads.dts)
+zImage.initrd.mpc866ads: vmlinux $(wrapperbits)

$(dtstree)/mpc866ads.dts

Quoted 1 line

+ $(call

if_changed,wrap,$*,$(dtstree)/mpc866ads.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 4 lines
arch/powerpc/boot/Makefile +4 -0
+
+zImage.mpc885ads: vmlinux $(wrapperbits) $(dtstree)/mpc885ads.dts
+     $(call if_changed,wrap,$*,$(dtstree)/mpc885ads.dts)
+zImage.initrd.mpc885ads: vmlinux $(wrapperbits)

$(dtstree)/mpc885ads.dts

Quoted 1 line

+ $(call

if_changed,wrap,$*,$(dtstree)/mpc885ads.dts,,$(obj)/ramdisk.image.gz)

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux

Quoted 5 lines
arch/powerpc/boot/Makefile +5 -0
+
+zImage.ep88xc: vmlinux $(wrapperbits) $(dtstree)/ep88xc.dts
+     $(call if_changed,wrap,$*,$(dtstree)/ep88xc.dts)
+zImage.initrd.ep88xc: vmlinux $(wrapperbits) $(dtstree)/ep88xc.dts
+     $(call

if_changed,wrap,$*,$(dtstree)/ep88xc.dts,,$(obj)/ramdisk.image.gz)

Quoted 3 lines

It seems like all you've done here is expand out the $(obj)/zImage.% rule?, but now the $* has nothing to match to? I don't think this works.

Oops, that's a mistake. $* should have been replaced.

Quoted 4 lines

How about just:
$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) %.dts

        $(call if_changed,wrap,$*,$*.dts,,$(obj)/ramdisk.image.gz)

mpc866ads, mpc885ads and ep88xc are oddities in that they build zImages with embedded device tree blobs. Most zImages don't do that and zImage* is an overloaded target. Only the three boards above have .dts files that should be included. Doing it this way matches the method used for the ps3 zImages.

Consider for instance when zImage.chrp is built. With the rule above, the wrapper would go looking for chrp.dts and fail when it couldn't find it. The old rule works because dts is set to nothing if CONFIG_DEVICE_TREE is not set and the wrapper just passes over the dts processing commands.

I could change the wrapper to just skip dts files that don't exist, but I don't think that is the right behavior either. Then you'll have inconsistent behavior when files are present/absent and there are cases (like the three boards above) where we *want* the wrapper to fail if the dts file is missing.

One option would be to add two new targets: zImage.dtb.% and zImage.initrd.dtb.%, but I'm not sure if it is a good idea.

Quoted 7 lines

Which would handle the default case of platform code for each dts.

Then for cases where you have a multiplatform target, you'd have something like
$(obj)/zImage.initrd.virtex.%: vmlinux $(wrapperbits) %.dts

        $(call if_changed,wrap,virtex,$*.dts,,$(obj)/ramdisk.image.gz)

cuImage is already an example of exactly this, except for the mapping between cuImage-*.c and .dts files. Also, I think the '.virtex' in the above example is superfluous. The .dts file itself discribes the platform as a virtex platform.

However, specifically for the virtex, we still need something like:
zImage.raw.% or elfImage.%. (I'd like to avoid overloading zImage even more, so 'elfImage' or something like it is probably the better choice).

Quoted 29 lines
Quoted 29 lines
arch/powerpc/boot/wrapper +20 -0
index 763a0c4..b70ec6a 100755
@@ -158,6 +158,26 @@ miboot|uboot)
 cuboot*)
     binary=y
     gzip=
+    case "$platform" in
+    *-mpc885ads|*-adder875*|*-ep88xc)
+        platformo=$object/cuboot-8xx.o
+        ;;
+    *5200*|*-motionpro)
+        platformo=$object/cuboot-52xx.o
+        ;;
+    *-pq2fads|*-ep8248e|*-mpc8272*)
+        platformo=$object/cuboot-pq2.o
+        ;;
+    *-mpc824*)
+        platformo=$object/cuboot-824x.o
+        ;;
+    *-mpc83*)
+        platformo=$object/cuboot-83xx.o
+        ;;
+    *-mpc85*)
+        platformo=$object/cuboot-85xx.o
+        ;;
+    esac
     ;;
Quoted 8 lines

arch/powerpc/boot/wrapper miboot|uboot) · line 183

Quoted 2 lines
arch/powerpc/boot/wrapper +0 -0
 ps3)
     platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"

I'm not particularly fond of making the wrapper smarter... It seems like the wrapper should be stupid and the logic about what to include done in the Makefile or in Kconfig. Also, it seems like a strange place to explicitly encode the dependency between the name of the dts file and the platform code.

No; I'm not totally sold on this approach either, but there is already precedence in the wrapper and I can't think of a cleaner or easier place to map dts files to cuboot-* objects.

Thanks for the comments

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#5 lore raw
In reply to Grant Likely

Hi Grant,

Quoted 9 lines

Currently, the kernel uses CONFIG_DEVICE_TREE to wrap a kernel image with a fdt blob which means for any given configuration only one dts file can be selected and so support for only one board can be built

This patch moves the selection of the default .dts file out of the kernel config and into the bootwrapper makefile. The makefile chooses which images to build based on the kernel config and the dts source file name is taken directly from the image name. For example "cuImage.ebony" will use "ebony.dts" as the device tree source file.

Cool stuff. This should be the last step to enable multiplatform builds on 8xx etc. as Arndt asked a few days ago ;)

Thanks,
Jochen

#3 lore raw
In reply to Grant Likely
Quoted 2 lines · Grant Likely

mpc866ads, mpc885ads and ep88xc are oddities in that they build zImages with embedded device tree blobs.

What about ep8248e? And the mpc8xxads boards use cuImage, not zImage.

Quoted 2 lines

One option would be to add two new targets: zImage.dtb.% and zImage.initrd.dtb.%, but I'm not sure if it is a good idea.

I'd much prefer that over having several lines per board in the makefile.

-Scott

#4 lore raw
Quoted 5 lines · Scott Wood
Quoted 2 lines · Grant Likely

mpc866ads, mpc885ads and ep88xc are oddities in that they build zImages with embedded device tree blobs.

What about ep8248e? And the mpc8xxads boards use cuImage, not zImage.

Oops, those are just mistakes. I can fix them

Quoted 5 lines
Quoted 3 lines

One option would be to add two new targets: zImage.dtb.% and zImage.initrd.dtb.%, but I'm not sure if it is a good idea.

I'd much prefer that over having several lines per board in the makefile.

Okay, I can change that.

Another option is to modify the wrapper to specifically look for targets which need the dtb. At the moment, that list includes ps3, ep8248e, mpc885ads and ep88xc. All four could be using a common build target.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#6 lore raw
In reply to Grant Likely
Quoted 2 lines · Grant Likely
arch/powerpc/boot/Makefile +0 -0

...

Quoted 1 line

$(obj)/zImage.ps3: vmlinux $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts

Seems like this could use $(dtstree).

arch/powerpc/boot/Makefile $(obj)/zImage.iseries: vmlinux · line 297

Quoted 5 lines
arch/powerpc/boot/Makefile +1 -1
 	$(STRIP) -s -R .comment $< -o vmlinux.strip
-	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
+	$(call cmd,wrap,ps3,$(dtstree)/ps3.dts,,)
 
 $(obj)/zImage.initrd.ps3: vmlinux  $(wrapper) $(wrapperbits) $(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz

Same here.

Quoted 2 lines
arch/powerpc/boot/Makefile +1 -1
-	$(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)
+	$(call cmd,wrap,ps3,$(dtstree)/ps3.dts,,$(obj)/ramdisk.image.gz)