Skip to contentSkip to conversation

bootwrapper: build multiple cuImages

PATCH Superseded Grant Likely 3 participants 5 messages Feb 6, 2008 PowerPC

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

Important note: This patch adds two new zImage targets; zImage.dtb.% and zImage.dtb.initrd.% for zImages with embedded dtb files. Currently there are 5 platforms which require this: ps3, ep405, mpc885ads, ep88xc, adder875-redboot and ep8248e. This patch *changes the zImage filenames* for those platforms. ie. 'zImage.ps3' is now 'zImage.dtb.ps3'.

This new zImage.dtb targets were added so that the .dts file could be part of the dependancies list for building them.

---
v3: I think this patch is complete. Renamed zImage.dtb.% targets to zImage-dtb.% to avoid make choosing the wrong rule if the dts file is missing. Please test to make sure nothing is broken. I'd like to see this one get picked up for .25

v2: This version fixes some bugs and adds new zImage.dtb and zImage.initrd.dtb targets.

v1: 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             |  130 ++++++++++++++++++++------------
 arch/powerpc/boot/cuboot-hpc2.c        |   48 ------------
 arch/powerpc/boot/cuboot-mpc7448hpc2.c |   48 ++++++++++++
 arch/powerpc/boot/wrapper              |   23 ++++++
 6 files changed, 155 insertions(+), 122 deletions(-)
arch/powerpc/Kconfig +0 -19
index 2bf2f3f..4903796 100644
@@ -415,25 +415,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 +81 -49

183 lines not on this page · raw message

arch/powerpc/boot/cuboot-mpc7448hpc2.c renamed from arch/powerpc/boot/cuboot-hpc2.c +0 -0
similarity index 100%
rename from arch/powerpc/boot/cuboot-hpc2.c
rename to arch/powerpc/boot/cuboot-mpc7448hpc2.c
arch/powerpc/boot/wrapper +23 -0
index 763a0c4..c317815 100755
@@ -158,6 +158,29 @@ 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*|*-storcenter)
+        platformo=$object/cuboot-pq2.o
+        ;;
+    *-mpc824*)
+        platformo=$object/cuboot-824x.o
+        ;;
+    *-mpc83*)
+        platformo=$object/cuboot-83xx.o
+        ;;
+    *-tqm8541|*-mpc8560*|*-tqm8560|*-tqm8555*)
+        platformo=$object/cuboot-85xx-cpm2.o
+        ;;
+    *-mpc85*)
+        platformo=$object/cuboot-85xx.o
+        ;;
+    esac
     ;;
 ps3)
     platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o"
#1 lore raw
Quoted 33 lines · Grant Likely
arch/powerpc/boot/Makefile +13 -15
-ifneq ($(CONFIG_DEVICE_TREE),"")
-image-$(CONFIG_PPC_8xx)			+= cuImage.8xx
-image-$(CONFIG_PPC_EP88XC)		+= zImage.ep88xc
-image-$(CONFIG_EP405)			+= zImage.ep405
-image-$(CONFIG_8260)			+= cuImage.pq2
-image-$(CONFIG_EP8248E)			+= zImage.ep8248e
-image-$(CONFIG_PPC_MPC52xx)		+= cuImage.52xx
-image-$(CONFIG_STORCENTER)		+= cuImage.824x
-image-$(CONFIG_PPC_83xx)		+= cuImage.83xx
-image-$(CONFIG_PPC_85xx)		+= cuImage.85xx
-ifeq ($(CONFIG_CPM2),y)
-image-$(CONFIG_PPC_85xx)		+= cuImage.85xx-cpm2
-endif
-image-$(CONFIG_MPC7448HPC2)		+= cuImage.hpc2
+#
+# Targets which embed a device tree blob
+#
+# Theses are default targets to build images which embed device tree blobs.
+# They are only required on boards which do not have FDT support in firmware.
+# Boards with newish u-boot firmare can use the uImage target above
+#
+
+# Board ports in arch/powerpc/platform/40x/Kconfig
+image-$(CONFIG_EP405)			+= zImage-dtb.ep405
+image-$(CONFIG_WALNUT)			+= treeImage.walnut
+
+# Board ports in arch/powerpc/platform/44x/Kconfig
 image-$(CONFIG_EBONY)			+= treeImage.ebony cuImage.ebony
 image-$(CONFIG_BAMBOO)			+= treeImage.bamboo cuImage.bamboo
 image-$(CONFIG_SEQUOIA)			+= cuImage.sequoia
 image-$(CONFIG_RAINIER)			+= cuImage.rainier
-image-$(CONFIG_WALNUT)			+= treeImage.walnut
 image-$(CONFIG_TAISHAN)			+= cuImage.taishan

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

Quoted 10 lines
arch/powerpc/boot/Makefile +3 -4
 image-$(CONFIG_KATMAI)			+= cuImage.katmai
 image-$(CONFIG_WARP)			+= cuImage.warp
-endif
 
-ifneq ($(CONFIG_REDBOOT),"")
-image-$(CONFIG_PPC_8xx)			+= zImage.redboot-8xx
-endif
+# Board ports in arch/powerpc/platform/8xx/Kconfig
+image-$(CONFIG_PPC_MPC86XADS)		+= cuImage.mpc866ads
+image-$(CONFIG_PPC_MPC885ADS)		+= zImage-dtb.mpc885ads

mpc885ads is cuImage.

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

Quoted 2 lines
arch/powerpc/boot/Makefile +2 -0
+# Board ports in arch/powerpc/platform/83xx/Kconfig
+image-$(CONFIG_MPC8313_RDB)		+= cuImage.mpc8313erdb

I don't think we need cuImage for this board (no pre-device-tree u-boot).

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

Quoted 3 lines
arch/powerpc/boot/Makefile +3 -0
+image-$(CONFIG_MPC837x_MDS)		+= cuImage.mpc8377_mds \
+					   cuImage.mpc8378_mds \
+					   cuImage.mpc8379_mds

I really hope we don't need cuImage for these. :-)

I wish CONFIG_BOARD_FOO could be annotated with properties such as image
name and bootwrapper platform, rather than having to maintain
separate lists... Oh well.

-Scott

#2 lore raw
Quoted 8 lines · Scott Wood

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

Quoted 6 lines
arch/powerpc/boot/Makefile +3 -3
-ifneq ($(CONFIG_REDBOOT),"")
-image-$(CONFIG_PPC_8xx)                      += zImage.redboot-8xx
-endif
+# Board ports in arch/powerpc/platform/8xx/Kconfig
+image-$(CONFIG_PPC_MPC86XADS)                += cuImage.mpc866ads
+image-$(CONFIG_PPC_MPC885ADS)                += zImage-dtb.mpc885ads

mpc885ads is cuImage.

Fixed

Quoted 5 lines

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

Quoted 3 lines
arch/powerpc/boot/Makefile +2 -0
+# Board ports in arch/powerpc/platform/83xx/Kconfig
+image-$(CONFIG_MPC8313_RDB)          += cuImage.mpc8313erdb

I don't think we need cuImage for this board (no pre-device-tree u-boot).

removed

Quoted 6 lines

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

Quoted 4 lines
arch/powerpc/boot/Makefile +3 -0
+image-$(CONFIG_MPC837x_MDS)          += cuImage.mpc8377_mds \
+                                        cuImage.mpc8378_mds \
+                                        cuImage.mpc8379_mds

I really hope we don't need cuImage for these. :-)

removed

Quoted 4 lines

I wish CONFIG_BOARD_FOO could be annotated with properties such as image
name and bootwrapper platform, rather than having to maintain
separate lists... Oh well.

Me too. Fortunately this is probably only an issue for images which require an embedded dtb. Images that get their device trees from elsewhere can follow the lead of CONFIG_DEFAULT_UIMAGE. Over time this issue will diminish.

Thanks for the feedback

Cheers,
g.

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

arch/powerpc/boot/cuboot-mpc7448hpc2.c

Quoted 4 lines · Grant Likely
arch/powerpc/boot/cuboot-mpc7448hpc2.c renamed from arch/powerpc/boot/cuboot-hpc2.c +0 -0
similarity index 100%
rename from arch/powerpc/boot/cuboot-hpc2.c
rename to arch/powerpc/boot/cuboot-mpc7448hpc2.c

This is not a proper patch.

No rule to make target `arch/powerpc/boot/cuboot-mpc7448hpc2.c

#4 lore raw
Quoted 10 lines · Geoff Levand

arch/powerpc/boot/cuboot-mpc7448hpc2.c

Quoted 4 lines · Grant Likely
arch/powerpc/boot/cuboot-mpc7448hpc2.c renamed from arch/powerpc/boot/cuboot-hpc2.c +0 -0
similarity index 100%
rename from arch/powerpc/boot/cuboot-hpc2.c
rename to arch/powerpc/boot/cuboot-mpc7448hpc2.c

This is not a proper patch.

No rule to make target `arch/powerpc/boot/cuboot-mpc7448hpc2.c

I've dropped the -M flag from git-format-patch for v4 of the patch. You should have it any moment now.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.