Message ID | 20231020114236.4129636-5-neal.frager@amd.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [v6,01/10] package/binutils-bare-metal: new package | expand |
On Fri, 20 Oct 2023 12:42:31 +0100 Neal Frager <neal.frager@amd.com> wrote: > This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. > It requires the toolchain-bare-metal package that includes a bare-metal > binutils, gcc and newlib which can be built for the microblaze architecture. > > A patch is required to enable parallel building of the pmufw. This patch has > been submitted upstream internally at AMD / Xilinx and will be included with > the 2023.2 release of the embeddedsw repository. > > Signed-off-by: Neal Frager <neal.frager@amd.com> [Tested on Kria KV260 starter kit] Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Hello, On Fri, 20 Oct 2023 12:42:31 +0100 Neal Frager via buildroot <buildroot@buildroot.org> wrote: > diff --git a/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch > new file mode 100644 > index 0000000000..29c652d6ef > --- /dev/null > +++ b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch > @@ -0,0 +1,115 @@ > +From 23002defd462845db376425a7b7d975f3deba83d Mon Sep 17 00:00:00 2001 > +From: Neal Frager <neal.frager@amd.com> > +Date: Mon, 24 Apr 2023 12:53:25 +0100 > +Subject: [PATCH v1 1/1] pmufw: misc/Makefile: specify sequential Makefiles No patch numbering (1/1). This is normally reported by "make check-package". > +ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION)) > +ZYNQMP_FIRMWARE_SITE = \ > + $(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION)) > +ZYNQMP_FIRMWARE_LICENSE = MIT > +ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt > +ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES > +ZYNQMP_FIRMWARE_INSTALL_TARGET = NO > +ZYNQMP_FIRMWARE_DEPENDENCIES = host-newlib-bare-metal This should be host-toolchain-bare-metal-buildroot. Otherwise your toolchain-bare-metal-buildroot virtual package is useless. Thomas
Hello Thomas, > diff --git > a/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify > -sequential-Makefiles.patch > b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify > -sequential-Makefiles.patch > new file mode 100644 > index 0000000000..29c652d6ef > --- /dev/null > +++ b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-spe > +++ cify-sequential-Makefiles.patch > @@ -0,0 +1,115 @@ > +From 23002defd462845db376425a7b7d975f3deba83d Mon Sep 17 00:00:00 > +2001 > +From: Neal Frager <neal.frager@amd.com> > +Date: Mon, 24 Apr 2023 12:53:25 +0100 > +Subject: [PATCH v1 1/1] pmufw: misc/Makefile: specify sequential > +Makefiles > No patch numbering (1/1). This is normally reported by "make check-package". Ok. Done. > +ZYNQMP_FIRMWARE_VERSION = $(call > +qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION)) > +ZYNQMP_FIRMWARE_SITE = \ > + $(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION)) > +ZYNQMP_FIRMWARE_LICENSE = MIT > +ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt > +ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES ZYNQMP_FIRMWARE_INSTALL_TARGET = > +NO ZYNQMP_FIRMWARE_DEPENDENCIES = host-newlib-bare-metal > This should be host-toolchain-bare-metal-buildroot. Otherwise your toolchain-bare-metal-buildroot virtual package is useless. When I do this, I am stuck with the following message: make: *** No rule to make target 'toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. I also tried with host-toolchain-bare-metal-buildroot: make: *** No rule to make target 'host-toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. I had this problem before which is why I solved it by just bypassing the dependency straight to newlib-bare-metal. Any ideas what the virtual package is missing? Best regards, Neal Frager AMD
Hello Neal, On Tue, 31 Oct 2023 19:07:29 +0000 "Frager, Neal" <neal.frager@amd.com> wrote: > When I do this, I am stuck with the following message: > make: *** No rule to make target 'toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. > > I also tried with host-toolchain-bare-metal-buildroot: > make: *** No rule to make target 'host-toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. > > I had this problem before which is why I solved it by just bypassing the dependency straight to newlib-bare-metal. > > Any ideas what the virtual package is missing? Yann just pointed out to me what is very likely to be the explanation: your toolchain-bare-metal-buildroot.mk is incorrect. It does this: +(eval $(host-virtual-package)) While it should have been: +$(eval $(host-virtual-package)) due to that, this makefile is most likely incorrect from a syntax point of view, and ignored by make when all makefiles are parsed. What I am a bit surprised with, is why you send a patch series that includes this virtual package if you know you couldn't get it to work? Best regards, Thomas
Hi Thomas, > Le 1 nov. 2023 à 10:24, Thomas Petazzoni <thomas.petazzoni@bootlin.com> a écrit : > > Hello Neal, > >> On Tue, 31 Oct 2023 19:07:29 +0000 >> "Frager, Neal" <neal.frager@amd.com> wrote: >> >> When I do this, I am stuck with the following message: >> make: *** No rule to make target 'toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. >> >> I also tried with host-toolchain-bare-metal-buildroot: >> make: *** No rule to make target 'host-toolchain-bare-metal-buildroot', needed by '/buildroot/output/build/zynqmp-firmware-xilinx_v2023.1/.stamp_configured'. Stop. >> >> I had this problem before which is why I solved it by just bypassing the dependency straight to newlib-bare-metal. >> >> Any ideas what the virtual package is missing? > > Yann just pointed out to me what is very likely to be the explanation: > your toolchain-bare-metal-buildroot.mk is incorrect. It does this: > > +(eval $(host-virtual-package)) > > While it should have been: > > +$(eval $(host-virtual-package)) > due to that, this makefile is most likely incorrect from a syntax point > of view, and ignored by make when all makefiles are parsed. Thanks for catching this! I was burning up a lot of time on this issue. > > What I am a bit surprised with, is why you send a patch series that > includes this virtual package if you know you couldn't get it to work? To be honest, I wasn’t sure if it was normal that I could not depend on a virtual package or not. And since the Config.in variables were working properly, I thought everything was correct. Then after several rounds of modifications, I forgot about the issue until trying to get it to work now after your feedback. > > Best regards, > > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com Thanks for your help and review! Best regards, Neal Frager AMD
diff --git a/DEVELOPERS b/DEVELOPERS index 849a5263b5..33d84d4271 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -2198,6 +2198,7 @@ N: Neal Frager <neal.frager@amd.com> F: board/versal/ F: board/zynq/ F: board/zynqmp/ +F: boot/zynqmp-firmware/ F: configs/versal_vck190_defconfig F: configs/zynq_zc706_defconfig F: configs/zynqmp_kria_kv260_defconfig diff --git a/boot/Config.in b/boot/Config.in index e5fdf7ad43..c7478fef2e 100644 --- a/boot/Config.in +++ b/boot/Config.in @@ -24,5 +24,6 @@ source "boot/ti-k3-image-gen/Config.in" source "boot/ti-k3-r5-loader/Config.in" source "boot/uboot/Config.in" source "boot/vexpress-firmware/Config.in" +source "boot/zynqmp-firmware/Config.in" endmenu diff --git a/boot/zynqmp-firmware/Config.in b/boot/zynqmp-firmware/Config.in new file mode 100644 index 0000000000..ce666ca264 --- /dev/null +++ b/boot/zynqmp-firmware/Config.in @@ -0,0 +1,22 @@ +config BR2_TARGET_ZYNQMP_FIRMWARE + bool "zynqmp-firmware" + select BR2_PACKAGE_HOST_TOOLCHAIN_BARE_METAL_BUILDROOT + help + This package builds the PMU Firmware application required + to run U-Boot and Linux in the Zynq MPSoC devices. + +if BR2_TARGET_ZYNQMP_FIRMWARE + +config BR2_TARGET_ZYNQMP_FIRMWARE_VERSION + string "firmware version" + default "xilinx_v2023.1" + help + Release version of zynqmp firmware. + Only versions xilinx_v2022.2 and newer are supported. + +config BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS + string "custom cflags" + help + Adds additional CFLAGS for building zynqmp firmware. + +endif # BR2_TARGET_ZYNQMP_FIRMWARE diff --git a/boot/zynqmp-firmware/xilinx_v2022.2/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch b/boot/zynqmp-firmware/xilinx_v2022.2/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch new file mode 120000 index 0000000000..51cb8a6ae0 --- /dev/null +++ b/boot/zynqmp-firmware/xilinx_v2022.2/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch @@ -0,0 +1 @@ +../xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch \ No newline at end of file diff --git a/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch new file mode 100644 index 0000000000..29c652d6ef --- /dev/null +++ b/boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch @@ -0,0 +1,115 @@ +From 23002defd462845db376425a7b7d975f3deba83d Mon Sep 17 00:00:00 2001 +From: Neal Frager <neal.frager@amd.com> +Date: Mon, 24 Apr 2023 12:53:25 +0100 +Subject: [PATCH v1 1/1] pmufw: misc/Makefile: specify sequential Makefiles + +The BSP_SEQUENTIAL_MAKEFILES variable is not properly assigned and exported +from copy_bsp.sh. + +Because of this, no library is built sequentially even if it was desired to +build them sequentially by assigning to BSP_SEQUENTIAL_MAKEFILES. All the +libraries are built in parallel. + +This patch resolves this issue, so that libraries that must be built +sequentially are indeed built sequentially. + +Signed-off-by: Neal Frager <neal.frager@amd.com> +--- + lib/sw_apps/zynqmp_pmufw/misc/Makefile | 10 +++++++++- + lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh | 7 ------- + lib/sw_apps/zynqmp_pmufw/src/Makefile | 2 ++ + 3 files changed, 11 insertions(+), 8 deletions(-) + +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/Makefile b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +index a773498512..fe2d23c965 100644 +--- a/lib/sw_apps/zynqmp_pmufw/misc/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/misc/Makefile +@@ -7,6 +7,14 @@ PROCESSOR = psu_pmu_0 + LIBRARIES = ${PROCESSOR}/lib/libxil.a + BSP_MAKEFILES := $(wildcard $(PROCESSOR)/libsrc/*/src/Makefile) + SUBDIRS := $(patsubst %/Makefile, %, $(BSP_MAKEFILES)) ++DRIVERS_LIST=../drivers.txt ++SEQUENTIAL_MAKEFILES := $(shell cat ${DRIVERS_LIST}) ++BSP_SEQUENTIAL_MAKEFILES = $(patsubst %, ${PROCESSOR}/libsrc/%/src/Makefile, $(SEQUENTIAL_MAKEFILES)) ++BSP_SEQUENTIAL_MAKEFILES += ${PROCESSOR}/libsrc/xilskey/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES += ${PROCESSOR}/libsrc/xilfpga/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES += ${PROCESSOR}/libsrc/xilsecure/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES += ${PROCESSOR}/libsrc/dppsu/src/Makefile ++BSP_SEQUENTIAL_MAKEFILES += ${PROCESSOR}/libsrc/dpdma/src/Makefile + BSP_PARALLEL_MAKEFILES := $(filter-out $(BSP_SEQUENTIAL_MAKEFILES),$(BSP_MAKEFILES)) + SEQ_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_SEQUENTIAL_MAKEFILES)) + PAR_SUBDIRS := $(patsubst %/Makefile, %, $(BSP_PARALLEL_MAKEFILES)) +@@ -16,7 +24,7 @@ ifneq (,$(findstring win,$(RDI_PLATFORM))) + endif + + all: +- $(MAKE) --no-print-directory seq_libs ++ $(MAKE) -j1 --no-print-directory seq_libs + $(MAKE) -j --no-print-directory par_libs + $(MAKE) --no-print-directory archive + @echo 'Finished building libraries' +diff --git a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +index 197f7af844..ac8dd8249e 100755 +--- a/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh ++++ b/lib/sw_apps/zynqmp_pmufw/misc/copy_bsp.sh +@@ -29,8 +29,6 @@ STANDALONE_DIR=$EMBEDDED_SW_DIR/lib/bsp/standalone/src + # libraries dir + SERVICES_DIR=$EMBEDDED_SW_DIR/lib/sw_services + +-BSP_SEQUENTIAL_MAKEFILES= +- + # creation of BSP folders required + if [ -d $BSP_DIR ]; then + echo "BSP directory already exists" +@@ -55,14 +53,12 @@ cp -r $SERVICES_DIR/xilfpga/src/interface/zynqmp/xilfpga_pcap.c $BSP_DIR/libsrc/ + cp -r $SERVICES_DIR/xilfpga/src/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilfpga/src/interface/zynqmp/*.h $BSP_DIR/include/ + rm -r $BSP_DIR/libsrc/xilfpga/src/interface/ +-BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilfpga/src/Makefile" + mkdir -p $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/Makefile $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/common/all/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/* $BSP_DIR/libsrc/xilsecure/src/ + cp -r $SERVICES_DIR/xilsecure/src/common/all/*.h $BSP_DIR/include/ + cp -r $SERVICES_DIR/xilsecure/src/zynqmp/*.h $BSP_DIR/include/ +-BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilsecure/src/Makefile" + cp -r $SERVICES_DIR/xilskey/ $BSP_DIR/libsrc/ + + # remove the xilskey library files which are not required for PMU +@@ -84,7 +80,6 @@ rm -r $BSP_DIR/libsrc/xilskey/src/include/xilskey_bbram.h + # copy the xilskey library header files to include directory + cp -r $BSP_DIR/libsrc/xilskey/src/*.h $BSP_DIR/include/ + cp -r $BSP_DIR/libsrc/xilskey/src/include/*.h $BSP_DIR/include/ +-BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/xilskey/src/Makefile" + + # copy bsp standalone code + cp -r $STANDALONE_DIR/common/* $BSP_DIR/libsrc/standalone/src/ +@@ -113,7 +108,6 @@ do + if [ $line != "avbuf" ] && [ $line != "video_common" ]; then + cp $WORKING_DIR/x"$line"_g.c $BSP_DIR/libsrc/$line/src/ + fi +- BSP_SEQUENTIAL_MAKEFILES="$BSP_SEQUENTIAL_MAKEFILES $BSP_DIR/libsrc/$line/src/Makefile" + + done < $DRIVERS_LIST + +@@ -136,4 +130,3 @@ cp $STANDALONE_DIR/profile/*.h $BSP_DIR/include/ + + # no inbyte and outbyte present in standalone + cp $WORKING_DIR/inbyte.c $WORKING_DIR/outbyte.c $BSP_DIR/libsrc/standalone/src/ +-export BSP_SEQUENTIAL_MAKEFILES +diff --git a/lib/sw_apps/zynqmp_pmufw/src/Makefile b/lib/sw_apps/zynqmp_pmufw/src/Makefile +index 1750c0a329..8747db5cdf 100644 +--- a/lib/sw_apps/zynqmp_pmufw/src/Makefile ++++ b/lib/sw_apps/zynqmp_pmufw/src/Makefile +@@ -27,6 +27,8 @@ all: $(EXEC) + $(EXEC): $(LIBS) $(OBJS) $(INCLUDES) + $(CC) -o $@ $(OBJS) $(CC_FLAGS) $(CFLAGS) $(LN_FLAGS) $(LIBPATH) $(LSCRIPT) + ++$(OBJS): $(LIBS) ++ + $(LIBS): + echo "Copying BSP files" + ../misc/copy_bsp.sh +-- +2.17.1 + diff --git a/boot/zynqmp-firmware/zynqmp-firmware.hash b/boot/zynqmp-firmware/zynqmp-firmware.hash new file mode 100644 index 0000000000..ee2d656110 --- /dev/null +++ b/boot/zynqmp-firmware/zynqmp-firmware.hash @@ -0,0 +1,3 @@ +# locally computed +sha256 fc0e86027bdba53f5df373bcb38a171d61704db4ff1b4671f3886a87ceec7068 zynqmp-firmware-xilinx_v2022.2.tar.gz +sha256 9850f893113936b9959cc76cc3e9152e30f815ff1acaa4b45f7a60fe3e1836f0 zynqmp-firmware-xilinx_v2023.1.tar.gz diff --git a/boot/zynqmp-firmware/zynqmp-firmware.mk b/boot/zynqmp-firmware/zynqmp-firmware.mk new file mode 100644 index 0000000000..be49cb197d --- /dev/null +++ b/boot/zynqmp-firmware/zynqmp-firmware.mk @@ -0,0 +1,33 @@ +################################################################################ +# +# zynqmp-firmware +# +################################################################################ + +ZYNQMP_FIRMWARE_VERSION = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_VERSION)) +ZYNQMP_FIRMWARE_SITE = \ + $(call github,Xilinx,embeddedsw,$(ZYNQMP_FIRMWARE_VERSION)) +ZYNQMP_FIRMWARE_LICENSE = MIT +ZYNQMP_FIRMWARE_LICENSE_FILES = license.txt +ZYNQMP_FIRMWARE_INSTALL_IMAGES = YES +ZYNQMP_FIRMWARE_INSTALL_TARGET = NO +ZYNQMP_FIRMWARE_DEPENDENCIES = host-newlib-bare-metal + +CUSTOM_CFLAGS = $(call qstrip,$(BR2_TARGET_ZYNQMP_FIRMWARE_CUSTOM_CFLAGS)) +ZYNQMP_CFLAGS = "-Os -flto -ffat-lto-objects $(CUSTOM_CFLAGS)" + +define ZYNQMP_FIRMWARE_BUILD_CMDS + $(MAKE) -C $(@D)/lib/sw_apps/zynqmp_pmufw/src \ + COMPILER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \ + ARCHIVER=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc-ar \ + CC=$(HOST_DIR)/bin/microblazeel-xilinx-elf-gcc \ + CFLAGS=$(ZYNQMP_CFLAGS) +endef + +PMUFW_PATH = $(@D)/lib/sw_apps/zynqmp_pmufw/src/executable.elf + +define ZYNQMP_FIRMWARE_INSTALL_IMAGES_CMDS + $(INSTALL) -D -m 0755 $(PMUFW_PATH) $(BINARIES_DIR)/pmufw.elf +endef + +$(eval $(generic-package))
This patch adds a new boot firmware to buildroot for building the zynqmp pmufw. It requires the toolchain-bare-metal package that includes a bare-metal binutils, gcc and newlib which can be built for the microblaze architecture. A patch is required to enable parallel building of the pmufw. This patch has been submitted upstream internally at AMD / Xilinx and will be included with the 2023.2 release of the embeddedsw repository. Signed-off-by: Neal Frager <neal.frager@amd.com> --- V1->V2: - builds a bare-metal gcc toolchain instead of requiring an external microblaze toolchain V2->V3: - corrected custom cflags option - added support for xilinx_v2022.2 version - added zynqmp-firmware.hash V3->V4: - no changes V4->V5: - reduced all lines to <80 chars V5->V6: - migrated to toolchain-bare-metal-buildroot --- DEVELOPERS | 1 + boot/Config.in | 1 + boot/zynqmp-firmware/Config.in | 22 ++++ ...akefile-specify-sequential-Makefiles.patch | 1 + ...akefile-specify-sequential-Makefiles.patch | 115 ++++++++++++++++++ boot/zynqmp-firmware/zynqmp-firmware.hash | 3 + boot/zynqmp-firmware/zynqmp-firmware.mk | 33 +++++ 7 files changed, 176 insertions(+) create mode 100644 boot/zynqmp-firmware/Config.in create mode 120000 boot/zynqmp-firmware/xilinx_v2022.2/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch create mode 100644 boot/zynqmp-firmware/xilinx_v2023.1/0001-pmufw-misc-Makefile-specify-sequential-Makefiles.patch create mode 100644 boot/zynqmp-firmware/zynqmp-firmware.hash create mode 100644 boot/zynqmp-firmware/zynqmp-firmware.mk