bootwrapper: build multiple cuImages
PATCH v4 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.
---
v4: removed mpc837x_mds and mpc8313erdb cuimages and changed mpc885ads to a cuImage
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.
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 | 126 ++++++++++++++++++++------------ arch/powerpc/boot/cuboot-hpc2.c | 48 ------------ arch/powerpc/boot/cuboot-mpc7448hpc2.c | 48 ++++++++++++ arch/powerpc/boot/wrapper | 23 ++++++ 6 files changed, 151 insertions(+), 122 deletions(-)
arch/powerpc/Kconfig +0 -19
@@ -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
@@ -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 +77 -49
179 lines not on this page · raw message
arch/powerpc/boot/cuboot-hpc2.c deleted +0 -48
48 lines not on this page · raw message
arch/powerpc/boot/cuboot-mpc7448hpc2.c new file +48 -0
48 lines not on this page · raw message
arch/powerpc/boot/wrapper +23 -0
@@ -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"
make zImage.initrd failure (was: Re: [PATCH v4] [POWERPC] bootwrapper: build multiple cuImages)
Hi Grant,
Quoted 39 lines · Grant Likely
From: Grant Likely <[email protected]>
Currently, the kernel uses
CONFIG_DEVICE_TREEto 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 builtThis 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.
Signed-off-by Grant Likely <[email protected]>---
v4: removedmpc837x_mdsand mpc8313erdb cuimages and changed mpc885ads to a cuImagev3: 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.
Quoted 6 lines
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.
Fuse-san discovered we can no longer do `make zImage.initrd' when building for PS3:
| WRAP arch/powerpc/boot/zImage.initrd-dtb.ps3 | ppu-ld: arch/powerpc/boot/initrd-dtb.ps3.o: No such file: No such file or directory | make[3]: *** [arch/powerpc/boot/zImage.initrd-dtb.ps3] Error 1 | make[2]: *** [zImage.initrd] Error 2 | make[1]: *** [sub-make] Error 2 | make: *** [all] Error 2
It can easily be reproduced using `make ps3_defconfig; make zImage.initrd'.
There seem to be two problems:
1. Before this patch, the generated build target was zImage.initrd.ps3'. After this patch, the generated build target is zImage.initrd-dtb.ps3'. Now initrd-dtb.ps3' is passed to the boot wrapper as the platform' parameter, which of course no longer matches the `ps3' test case in the boot wrapper script.
The patch below works around this problem, but I don't think it's the proper fix.
arch/powerpc/boot/wrapper +1 -1
@@ -182,7 +182,7 @@ cuboot*) ;; esac ;; -ps3) +*ps3) platformo="$object/ps3-head.o $object/ps3-hvcall.o $object/ps3.o" lds=$object/zImage.ps3.lds gzip=
Review
Quoted 12 lines
# 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) $(dts)(quoted diff) +4
-3- $(call if_changed,wrap,$*,$(dts),,$(obj)/ramdisk.image.gz) +$(obj)/zImage.initrd.%: vmlinux $(wrapperbits) + $(call if_changed,wrap,$*,,,$(obj)/ramdisk.image.gz) -$(obj)/zImage.%: vmlinux $(wrapperbits) $(dts) - $(call if_changed,wrap,$*,$(dts)) +$(obj)/zImage.%: vmlinux $(wrapperbits) + $(call if_changed,wrap,$*)
2. The generated build target `zImage.initrd-dtb.ps3' matches both rules, and of course the wrong one (the second one) is chosen by make, causing the ramdisk image not to be included.
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453 Fax: +32 (0)2 700 8622 E-mail: [email protected] Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V. Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619