* [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files [not found] <mailman.4777.1529627642.16495.buildroot@busybox.net> @ 2018-07-09 19:07 ` Joel Carlson 2018-07-10 21:54 ` Luca Ceresoli 2018-07-09 19:39 ` [Buildroot] [PATCH v4 2/3] uboot: zynqmp: generate SPL image with PMUFW binary Joel Carlson 1 sibling, 1 reply; 6+ messages in thread From: Joel Carlson @ 2018-07-09 19:07 UTC (permalink / raw) To: buildroot Hello, I've been using the v3 form of your patches to get our Zynqmp board booting. This morning I upgraded our U-Boot from v2018.05 to v2018.07, and on my 2018.05 buildroot branch I removed the v3 patches and applied the v4 ones. I had a few issues with this patch. On 06/21/2018 03:26 PM, Luca Ceresoli <luca@lucaceresoli.net> wrote: <snip> > diff --git a/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch > new file mode 100644 > index 000000000000..ab8108ee0c6a > --- /dev/null > +++ b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch > @@ -0,0 +1,175 @@ > +From 4c9d54ab5a41d65000c8d249b6fb1b76056f1812 Mon Sep 17 00:00:00 2001 > +From: Luca Ceresoli<luca@lucaceresoli.net> > +Date: Wed, 20 Jun 2018 12:11:50 +0200 > +Subject: [PATCH] arm/arm64: zynq/zynqmp: pass the PS init file as a kconfig > + variable > + > +U-Boot needs to link ps7_init_gpl.c on Zynq or psu_init_gpl.c on > +ZynqMP (PS init for short). The current logic to locate this file for > +both platforms is: > + > + 1. if a board-specific file exists in > + board/xilinx/zynq[mp]/$(CONFIG_DEFAULT_DEVICE_TREE)/ps?_init_gpl.c > + then use it > + 2. otherwise use board/xilinx/zynq/ps?_init_gpl.c > + > +In the latter case the file does not exist in the U-Boot sources and > +must be copied in the source tree from the outside before starting the > +build. This is typical when it is generated from Xilinx tools while > +developing a custom hardware. However making sure that a > +board-specific file is_not_ found (and used) requires some trickery > +such as removing or overwriting all PS init files (e.g.: the current > +meta-xilinx yocto layer [0]). > + > +This generates a few problems: > + > + * if the source tree is shared among different out-of-tree builds, > + they will pollute (and potentially corrupt) each other > + * the source tree cannot be read-only > + * any buildsystem must add a command to copy the PS init file binary > + * overwriting or deleting files in the source tree is ugly as hell > + > +Simplify usage by allowing to pass the path to the desired PS init > +file in kconfig variable XILINX_PS_INIT_FILE. It can be an absolute > +path or relative to $(srctree). If the variable is set, the > +user-specified file will always be used without being copied > +around. If the the variable is left empty, for backward compatibility > +fall back to the old behaviour. > + > +Since the issue is the same for Zynq and ZynqMP, add one kconfig > +variable in a common place and use it for both. > + > +Also use the new kconfig help text to document all the ways to give > +U-Boot the PS init file. > + > +Build-tested with all combinations of: > + - platform: zynq or zynqmp > + - PS init file: from XILINX_PS_INIT_FILE (absolute, relative path, > + non-existing), in-tree board-specific, in board/xilinx/zynq[mp]/ > + - building in-tree, in subdir, in other directory > + > +[0]https://github.com/Xilinx/meta-xilinx/blob/b2f74cc7fe5c4881589d5e440a17cb51fc66a7ab/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc#L9 > + > +Signed-off-by: Luca Ceresoli<luca@lucaceresoli.net> > +Cc: Albert Aribaud<albert.u.boot@aribaud.net> > +Cc: Michal Simek<michal.simek@xilinx.com> > +Cc: Nathan Rossi<nathan@nathanrossi.com> > +Submitted upstream:https://patchwork.ozlabs.org/patch/932392/ (slightly adapted to fix conflicts) > +--- > + arch/arm/Kconfig | 1 + > + board/xilinx/Kconfig | 41 +++++++++++++++++++++++++++++++++++++++++ > + board/xilinx/zynq/Makefile | 10 +++++++++- > + board/xilinx/zynqmp/Makefile | 10 +++++++++- > + 4 files changed, 60 insertions(+), 2 deletions(-) > + create mode 100644 board/xilinx/Kconfig > + > +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > +index 22234cde2ab6..e04979d0ef7e 100644 > +--- a/arch/arm/Kconfig > ++++ b/arch/arm/Kconfig > +@@ -1293,4 +1293,5 @@ source "board/technologic/ts4600/Kconfig" > + source "board/vscom/baltos/Kconfig" > + source "board/woodburn/Kconfig" > + source "board/work-microwave/work_92105/Kconfig" > ++source "board/xilinx/Kconfig" This patch does not apply with U-Boot 2018.07 - I don't know which version of U-Boot it is desired to maintain compatibility against. But it was a pretty small change to make it apply again, just adding: > source "board/xilinx/zynqmp/Kconfig" below the line the patch adds. <snip> > diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk > index 03bd7ea743ed..e4571a6ccf9f 100644 > --- a/boot/uboot/uboot.mk > +++ b/boot/uboot/uboot.mk > @@ -274,6 +274,17 @@ define UBOOT_INSTALL_IMAGES_CMDS > $(BINARIES_DIR)/boot.scr) > endef > > +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) > + > +ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) > +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT > + $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ > + $(@D)/.config) I think you should get rid of the "$(TOPDIR)/" part and let the user specify it as part of BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE if needed. My psu_init files are in a path that I reference via BR2_EXTERNAL, so having $(TOPDIR) prepended messed up the path to my files. > +endef > +endif > + > +endif # BR2_TARGET_UBOOT_ZYNQMP > + > define UBOOT_INSTALL_OMAP_IFT_IMAGE > cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/ > endef > @@ -323,6 +334,10 @@ UBOOT_DEPENDENCIES += host-mkpimage > UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE > endif > > +define UBOOT_KCONFIG_FIXUP_CMDS > + $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) > +endef > + > ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y) > ifeq ($(BR_BUILDING),y) > ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),) > -- 2.7.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files 2018-07-09 19:07 ` [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files Joel Carlson @ 2018-07-10 21:54 ` Luca Ceresoli 2018-07-11 2:48 ` Joel Carlson 0 siblings, 1 reply; 6+ messages in thread From: Luca Ceresoli @ 2018-07-10 21:54 UTC (permalink / raw) To: buildroot Hi Joel, On 09/07/2018 21:07, Joel Carlson wrote: > Hello, > > I've been using the v3 form of your patches to get our Zynqmp board > booting. This morning I upgraded our U-Boot from v2018.05 to v2018.07, > and on my 2018.05 buildroot branch I removed the v3 patches and applied > the v4 ones. I had a few issues with this patch. Good to know this work is useful to somebody! Thank you for your report, see below my comments. > On 06/21/2018 03:26 PM, Luca Ceresoli <luca@lucaceresoli.net> wrote: > > <snip> >> diff --git >> a/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch >> b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch >> >> new file mode 100644 >> index 000000000000..ab8108ee0c6a >> --- /dev/null >> +++ >> b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch >> >> @@ -0,0 +1,175 @@ >> +From 4c9d54ab5a41d65000c8d249b6fb1b76056f1812 Mon Sep 17 00:00:00 2001 >> +From: Luca Ceresoli<luca@lucaceresoli.net> >> +Date: Wed, 20 Jun 2018 12:11:50 +0200 >> +Subject: [PATCH] arm/arm64: zynq/zynqmp: pass the PS init file as a >> kconfig >> + variable >> + >> +U-Boot needs to link ps7_init_gpl.c on Zynq or psu_init_gpl.c on >> +ZynqMP (PS init for short). The current logic to locate this file for >> +both platforms is: >> + >> + 1. if a board-specific file exists in >> +??? board/xilinx/zynq[mp]/$(CONFIG_DEFAULT_DEVICE_TREE)/ps?_init_gpl.c >> +??? then use it >> + 2. otherwise use board/xilinx/zynq/ps?_init_gpl.c >> + >> +In the latter case the file does not exist in the U-Boot sources and >> +must be copied in the source tree from the outside before starting the >> +build. This is typical when it is generated from Xilinx tools while >> +developing a custom hardware. However making sure that a >> +board-specific file is_not_? found (and used) requires some trickery >> +such as removing or overwriting all PS init files (e.g.: the current >> +meta-xilinx yocto layer [0]). >> + >> +This generates a few problems: >> + >> + * if the source tree is shared among different out-of-tree builds, >> +?? they will pollute (and potentially corrupt) each other >> + * the source tree cannot be read-only >> + * any buildsystem must add a command to copy the PS init file binary >> + * overwriting or deleting files in the source tree is ugly as hell >> + >> +Simplify usage by allowing to pass the path to the desired PS init >> +file in kconfig variable XILINX_PS_INIT_FILE. It can be an absolute >> +path or relative to $(srctree). If the variable is set, the >> +user-specified file will always be used without being copied >> +around. If the the variable is left empty, for backward compatibility >> +fall back to the old behaviour. >> + >> +Since the issue is the same for Zynq and ZynqMP, add one kconfig >> +variable in a common place and use it for both. >> + >> +Also use the new kconfig help text to document all the ways to give >> +U-Boot the PS init file. >> + >> +Build-tested with all combinations of: >> + - platform: zynq or zynqmp >> + - PS init file: from XILINX_PS_INIT_FILE (absolute, relative path, >> +?? non-existing), in-tree board-specific, in board/xilinx/zynq[mp]/ >> + - building in-tree, in subdir, in other directory >> + >> +[0]https://github.com/Xilinx/meta-xilinx/blob/b2f74cc7fe5c4881589d5e440a17cb51fc66a7ab/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc#L9 >> >> + >> +Signed-off-by: Luca Ceresoli<luca@lucaceresoli.net> >> +Cc: Albert Aribaud<albert.u.boot@aribaud.net> >> +Cc: Michal Simek<michal.simek@xilinx.com> >> +Cc: Nathan Rossi<nathan@nathanrossi.com> >> +Submitted upstream:https://patchwork.ozlabs.org/patch/932392/? >> (slightly adapted to fix conflicts) >> +--- >> + arch/arm/Kconfig???????????? |? 1 + >> + board/xilinx/Kconfig???????? | 41 >> +++++++++++++++++++++++++++++++++++++++++ >> + board/xilinx/zynq/Makefile?? | 10 +++++++++- >> + board/xilinx/zynqmp/Makefile | 10 +++++++++- >> + 4 files changed, 60 insertions(+), 2 deletions(-) >> + create mode 100644 board/xilinx/Kconfig >> + >> +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >> +index 22234cde2ab6..e04979d0ef7e 100644 >> +--- a/arch/arm/Kconfig >> ++++ b/arch/arm/Kconfig >> +@@ -1293,4 +1293,5 @@ source "board/technologic/ts4600/Kconfig" >> + source "board/vscom/baltos/Kconfig" >> + source "board/woodburn/Kconfig" >> + source "board/work-microwave/work_92105/Kconfig" >> ++source "board/xilinx/Kconfig" > > This patch does not apply with U-Boot 2018.07 - I don't know which > version of U-Boot it is desired to maintain compatibility against. But > it was a pretty small change to make it apply again, just adding: >> source "board/xilinx/zynqmp/Kconfig" > below the line the patch adds. Yes, IIRC that's the only relevant difference between this patch and the one that got applied (https://patchwork.ozlabs.org/patch/933198/). However supporting a more recent version of U-Boot will probably require an extra work that I'd rather leave as a future improvement. BTW, how are you building your PMU firmware? > <snip> >> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk >> index 03bd7ea743ed..e4571a6ccf9f 100644 >> --- a/boot/uboot/uboot.mk >> +++ b/boot/uboot/uboot.mk >> @@ -274,6 +274,17 @@ define UBOOT_INSTALL_IMAGES_CMDS >> ????????????? $(BINARIES_DIR)/boot.scr) >> ? endef >> ? +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) >> + >> +ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) >> +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT >> +??? $(call >> KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call >> qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ >> +?????????? $(@D)/.config) > > I think you should get rid of the "$(TOPDIR)/" part and let the user > specify it as part of BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE if needed. > My psu_init files are in a path that I reference via BR2_EXTERNAL, so > having $(TOPDIR) prepended messed up the path to my files. Uhm, my mistake, as I've never user BR2_EXTERNAL I tend to forget to test it... Sorry about that. Since the kconfig option we're setting here will be evaulated during the build process, which will happen in another directory ($O/build/uboot-*/), I chose to tranform that path to an absolute one using $TOPDIR. But as you noticed this is not a correct solution. At first sight we should rather copy the file in a proper place (sysroot or $O/build/uboot-*/) and then point the kconfig option to that path. I'll have a look to this, as well as to your comments to patch 2. Bye, -- Luca ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files 2018-07-10 21:54 ` Luca Ceresoli @ 2018-07-11 2:48 ` Joel Carlson 2018-07-11 21:17 ` Luca Ceresoli 0 siblings, 1 reply; 6+ messages in thread From: Joel Carlson @ 2018-07-11 2:48 UTC (permalink / raw) To: buildroot Hello, I just want to note that I was initially setup for message digests on the mailing list (and am now set to get individual messages). I had to do some copying and pasting trying to make it look like I was replying to the original patch email, but it looks like I lost something such that patchwork doesn't append these email responses to it. So a link to the original just for the sake of relating things for other readers: https://patchwork.ozlabs.org/patch/932962/ On 2018-07-10 15:54, Luca Ceresoli wrote: > Hi Joel, > > On 09/07/2018 21:07, Joel Carlson wrote: >> Hello, >> >> I've been using the v3 form of your patches to get our Zynqmp board >> booting. This morning I upgraded our U-Boot from v2018.05 to v2018.07, >> and on my 2018.05 buildroot branch I removed the v3 patches and applied >> the v4 ones. I had a few issues with this patch. > > Good to know this work is useful to somebody! Very useful for anybody that wants to boot zynqmp without relying on Xilinx's workflow! I was very happy when I found your initial patches. <snip> >>> +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >>> +index 22234cde2ab6..e04979d0ef7e 100644 >>> +--- a/arch/arm/Kconfig >>> ++++ b/arch/arm/Kconfig >>> +@@ -1293,4 +1293,5 @@ source "board/technologic/ts4600/Kconfig" >>> + source "board/vscom/baltos/Kconfig" >>> + source "board/woodburn/Kconfig" >>> + source "board/work-microwave/work_92105/Kconfig" >>> ++source "board/xilinx/Kconfig" >> >> This patch does not apply with U-Boot 2018.07 - I don't know which >> version of U-Boot it is desired to maintain compatibility against. But >> it was a pretty small change to make it apply again, just adding: >>> source "board/xilinx/zynqmp/Kconfig" >> below the line the patch adds. > > Yes, IIRC that's the only relevant difference between this patch and the > one that got applied (https://patchwork.ozlabs.org/patch/933198/). > However supporting a more recent version of U-Boot will probably require > an extra work that I'd rather leave as a future improvement. That's fair enough. Pretty easy for me to keep my own modified patch for 2018.07. > BTW, how are you building your PMU firmware? I'm actually using your zynqmp-pmufw-builder tool on github. =) With the changes: - I check out the embeddedsw submodule to the xilinx-v2018.1 tag - I had to then tweak the 0001 patch a little - I modify build.sh to add some extra flags to reduce the size (or else it overflows its available memory - I got these flags from how Xilinx compiles it) - I think my pm_cfg_obj.c is the default one from Xilinx for 2018.1 > >> <snip> >>> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk >>> index 03bd7ea743ed..e4571a6ccf9f 100644 >>> --- a/boot/uboot/uboot.mk >>> +++ b/boot/uboot/uboot.mk >>> @@ -274,6 +274,17 @@ define UBOOT_INSTALL_IMAGES_CMDS >>> ????????????? $(BINARIES_DIR)/boot.scr) >>> ? endef >>> ? +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) >>> + >>> +ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) >>> +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT >>> +??? $(call >>> KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call >>> qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ >>> +?????????? $(@D)/.config) >> >> I think you should get rid of the "$(TOPDIR)/" part and let the user >> specify it as part of BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE if needed. >> My psu_init files are in a path that I reference via BR2_EXTERNAL, so >> having $(TOPDIR) prepended messed up the path to my files. > > Uhm, my mistake, as I've never user BR2_EXTERNAL I tend to forget to > test it... Sorry about that. > > Since the kconfig option we're setting here will be evaulated during the > build process, which will happen in another directory > ($O/build/uboot-*/), I chose to tranform that path to an absolute one > using $TOPDIR. > > But as you noticed this is not a correct solution. At first sight we > should rather copy the file in a proper place (sysroot or > $O/build/uboot-*/) and then point the kconfig option to that path. I'll > have a look to this, as well as to your comments to patch 2. This did work for me using a $(BR2_EXTERNAL_MY_BSP_PATH) variable in the value once I simply removed '$(TOPDIR)'. Though I did not test using $(TOPDIR) within the variable value, but I think that should still work. But I suppose copying it into uboot's build folder might seem more appropriate than paths to elsewhere on the system. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files 2018-07-11 2:48 ` Joel Carlson @ 2018-07-11 21:17 ` Luca Ceresoli 0 siblings, 0 replies; 6+ messages in thread From: Luca Ceresoli @ 2018-07-11 21:17 UTC (permalink / raw) To: buildroot Hi Joel, On 11/07/2018 04:48, Joel Carlson wrote: [...] >> BTW, how are you building your PMU firmware? > > I'm actually using your zynqmp-pmufw-builder tool on github. =) Oh, cool! :) > With the changes: > - I check out the embeddedsw submodule to the xilinx-v2018.1 tag > - I had to then tweak the 0001 patch a little > - I modify build.sh to add some extra flags to reduce the size (or else > it overflows its available memory - I got these flags from how Xilinx > compiles it) > - I think my pm_cfg_obj.c is the default one from Xilinx for 2018.1 The changes you made to reduce the size and support more recent versions would be useful to other people, would you like to contribute them to zynqmp-pmufw-builder? This would ultimately improve the quality of ZynqMP support in Buildroot as well. As this is quite off topic here, feel free to just send me patches or a github PR, or t contact me directly for any question. >>> <snip> >>>> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk >>>> index 03bd7ea743ed..e4571a6ccf9f 100644 >>>> --- a/boot/uboot/uboot.mk >>>> +++ b/boot/uboot/uboot.mk >>>> @@ -274,6 +274,17 @@ define UBOOT_INSTALL_IMAGES_CMDS >>>> ?????????????? $(BINARIES_DIR)/boot.scr) >>>> ?? endef >>>> ?? +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) >>>> + >>>> +ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) >>>> +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT >>>> +??? $(call >>>> KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call >>>> qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ >>>> +?????????? $(@D)/.config) >>> >>> I think you should get rid of the "$(TOPDIR)/" part and let the user >>> specify it as part of BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE if needed. >>> My psu_init files are in a path that I reference via BR2_EXTERNAL, so >>> having $(TOPDIR) prepended messed up the path to my files. >> >> Uhm, my mistake, as I've never user BR2_EXTERNAL I tend to forget to >> test it... Sorry about that. >> >> Since the kconfig option we're setting here will be evaulated during the >> build process, which will happen in another directory >> ($O/build/uboot-*/), I chose to tranform that path to an absolute one >> using $TOPDIR. >> >> But as you noticed this is not a correct solution. At first sight we >> should rather copy the file in a proper place (sysroot or >> $O/build/uboot-*/) and then point the kconfig option to that path. I'll >> have a look to this, as well as to your comments to patch 2. > > This did work for me using a $(BR2_EXTERNAL_MY_BSP_PATH) variable in the > value once I simply removed '$(TOPDIR)'. Though I did not test using > $(TOPDIR) within the variable value, but I think that should still work. > But I suppose copying it into uboot's build folder might seem more > appropriate than paths to elsewhere on the system. Well, perhaps using TOPDIR in the variable would work, but it would be rather ugly and different from other Buildroot settings. Copying looks like the best solution at the moment. Regards, -- Luca ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 2/3] uboot: zynqmp: generate SPL image with PMUFW binary [not found] <mailman.4777.1529627642.16495.buildroot@busybox.net> 2018-07-09 19:07 ` [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files Joel Carlson @ 2018-07-09 19:39 ` Joel Carlson 1 sibling, 0 replies; 6+ messages in thread From: Joel Carlson @ 2018-07-09 19:39 UTC (permalink / raw) To: buildroot Hello, On 06/21/2018 03:26 PM, Luca Ceresoli <luca@lucaceresoli.net> wrote: <snip> > diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk > index e4571a6ccf9f..59b3fe07881d 100644 > --- a/boot/uboot/uboot.mk > +++ b/boot/uboot/uboot.mk > @@ -276,6 +276,17 @@ endef > > ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) > > +UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW)) > + > +ifneq ($(UBOOT_ZYNQMP_PMUFW),) > +UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW) > +BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW)) > +define UBOOT_ZYNQMP_KCONFIG_PMUFW > + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))", \ > + $(@D)/.config) > +endef > +endif What I thought would be ideal for me is to store my generated pmufw.bin file in our own local repo that is a BR2_EXTERNAL. I wanted to then just pass the path to this file using $(BR2_EXTERNAL_MY_REPO_PATH). But referencing a local file for something via *_EXTRA_DOWNLOADS doesn't seem to work when the supplied argument is a local path to the file. I don't know if I was doing something wrong or misunderstanding the dl-wrapper and other associated code. But I ended up modifying the changes here to look like this: > +ifneq ($(UBOOT_ZYNQMP_PMUFW),) > +ifneq (file,$(firstword $(subst ://, ,$(UBOOT_ZYNQMP_PMUFW)))) > +UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW) > +BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW)) > +define UBOOT_ZYNQMP_KCONFIG_PMUFW > + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))", \ > + $(@D)/.config) > +endef > +else > +define UBOOT_ZYNQMP_KCONFIG_PMUFW > + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(lastword $(subst ://, ,$(UBOOT_ZNYQMP_PMUFW)))", \ > + $(@D)/.config) > +endef > +endif Then I can set my BR2_TARGET_UBOOT_ZYNQMP_PMUFW value to "file://$(BR2_EXTERNAL_MY_REPO_PATH)/path/to/my/pmufw.bin" and it will work appropriately. I'm not sure if that's best to put as part of this, so I guess I'm seeking input on that. > + > ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) > define UBOOT_ZYNQMP_KCONFIG_PSU_INIT > $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ > @@ -335,6 +346,7 @@ UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE > endif > > define UBOOT_KCONFIG_FIXUP_CMDS > + $(UBOOT_ZYNQMP_KCONFIG_PMUFW) > $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) > endef ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 0/3] Add Xilinx ZynqMP and ZCU106 board support @ 2018-06-21 21:26 Luca Ceresoli 2018-06-21 21:26 ` [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files Luca Ceresoli 0 siblings, 1 reply; 6+ messages in thread From: Luca Ceresoli @ 2018-06-21 21:26 UTC (permalink / raw) To: buildroot Hi, this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it. The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs. This v4 addresses the comments received to v3 by Thomas. The main concern raised was that the code in v3 was copying some files into the U-Boot source tree before compilation, so the build would find them. This could not be done any better without changing the U-Boot source code, and so I fixed it in the U-Boot makefiles in the first place. With those changes to U-Boot, the Buildroot code has become a lot leaner, now almost trivial. The first 2 paches in my v3 series have already been applied. Patch 1 allows to pass an externally-supplied init file to U-Boot, which is needed to boot boards not supported in the U-Boot source code, or on the same boards but with a different configuration. Instead of copying the user-provided file inside the U-Boot source as in v3, I applied a patch (submitted upstream) so U-Boot is able to build that file without any copy. The next issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it at runtime is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, U-Boot obtains a pre-built binary using EXTRA_DOWNLOADS. This is added in patch 2. Until v3, the PMUFW had to be copied inside the U-Boot source. With a patch, now upstream, it is now possible to avoid the copy. With all these in place, patch 5 just adds the defconfig and board files. Luca Luca Ceresoli (3): uboot: zynqmp: allow to use custom psu_init files uboot: zynqmp: generate SPL image with PMUFW binary configs: add Xilinx ZCU106 board (ZynqMP SoC) DEVELOPERS | 2 + board/zynqmp/genimage.cfg | 28 ++++ ...1-arm64-zynqmp-zcu106-fix-SPL-MMC-booting.patch | 53 +++++++ .../0002-arm64-zynqmp-Enable-booting-to-ATF.patch | 115 ++++++++++++++ ...p-accept-an-absolute-path-for-PMUFW_INIT_.patch | 68 ++++++++ ...ynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch | 175 +++++++++++++++++++++ board/zynqmp/post-image.sh | 13 ++ board/zynqmp/readme.txt | 51 ++++++ boot/uboot/Config.in | 47 ++++++ boot/uboot/uboot.mk | 27 ++++ configs/zynqmp_zcu106_defconfig | 34 ++++ 11 files changed, 613 insertions(+) create mode 100644 board/zynqmp/genimage.cfg create mode 100644 board/zynqmp/patches/uboot/0001-arm64-zynqmp-zcu106-fix-SPL-MMC-booting.patch create mode 100644 board/zynqmp/patches/uboot/0002-arm64-zynqmp-Enable-booting-to-ATF.patch create mode 100644 board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch create mode 100644 board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch create mode 100755 board/zynqmp/post-image.sh create mode 100644 board/zynqmp/readme.txt create mode 100644 configs/zynqmp_zcu106_defconfig -- 2.7.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files 2018-06-21 21:26 [Buildroot] [PATCH v4 0/3] Add Xilinx ZynqMP and ZCU106 board support Luca Ceresoli @ 2018-06-21 21:26 ` Luca Ceresoli 0 siblings, 0 replies; 6+ messages in thread From: Luca Ceresoli @ 2018-06-21 21:26 UTC (permalink / raw) To: buildroot U-Boot SPL configures pinmuxes, clocks and other low-level devices. On the Xilinx ZynqMP SoCs the code to do this resides in a file called psu_init_gpl.c which is initially generated by the Xilinx development tools. Add an option to pass these files from the outside (e.g. in the board files). For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig using BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version where the patch is already applied. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> --- Changes v3 -> v4: - don't copy the psu_init file(s) in the source tree, point to its path (which needs a patch sent upstream to work) - depend on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG (Thomas) - point to the file, not the directory Changes v2 -> v3: - Add a bool option to show/hidw all ZynqMP-specific config knobs - Move this patch before "uboot: zynqmp: generate SPL image with PMUFW binary" - Reword Config.in text Changes v1 -> v2: - split from a larger patch doing 2 things - document the option of having psu_init_gpl.c without .h --- ...ynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch | 175 +++++++++++++++++++++ boot/uboot/Config.in | 33 ++++ boot/uboot/uboot.mk | 15 ++ 3 files changed, 223 insertions(+) create mode 100644 board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch diff --git a/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch new file mode 100644 index 000000000000..ab8108ee0c6a --- /dev/null +++ b/board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch @@ -0,0 +1,175 @@ +From 4c9d54ab5a41d65000c8d249b6fb1b76056f1812 Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli <luca@lucaceresoli.net> +Date: Wed, 20 Jun 2018 12:11:50 +0200 +Subject: [PATCH] arm/arm64: zynq/zynqmp: pass the PS init file as a kconfig + variable + +U-Boot needs to link ps7_init_gpl.c on Zynq or psu_init_gpl.c on +ZynqMP (PS init for short). The current logic to locate this file for +both platforms is: + + 1. if a board-specific file exists in + board/xilinx/zynq[mp]/$(CONFIG_DEFAULT_DEVICE_TREE)/ps?_init_gpl.c + then use it + 2. otherwise use board/xilinx/zynq/ps?_init_gpl.c + +In the latter case the file does not exist in the U-Boot sources and +must be copied in the source tree from the outside before starting the +build. This is typical when it is generated from Xilinx tools while +developing a custom hardware. However making sure that a +board-specific file is _not_ found (and used) requires some trickery +such as removing or overwriting all PS init files (e.g.: the current +meta-xilinx yocto layer [0]). + +This generates a few problems: + + * if the source tree is shared among different out-of-tree builds, + they will pollute (and potentially corrupt) each other + * the source tree cannot be read-only + * any buildsystem must add a command to copy the PS init file binary + * overwriting or deleting files in the source tree is ugly as hell + +Simplify usage by allowing to pass the path to the desired PS init +file in kconfig variable XILINX_PS_INIT_FILE. It can be an absolute +path or relative to $(srctree). If the variable is set, the +user-specified file will always be used without being copied +around. If the the variable is left empty, for backward compatibility +fall back to the old behaviour. + +Since the issue is the same for Zynq and ZynqMP, add one kconfig +variable in a common place and use it for both. + +Also use the new kconfig help text to document all the ways to give +U-Boot the PS init file. + +Build-tested with all combinations of: + - platform: zynq or zynqmp + - PS init file: from XILINX_PS_INIT_FILE (absolute, relative path, + non-existing), in-tree board-specific, in board/xilinx/zynq[mp]/ + - building in-tree, in subdir, in other directory + +[0] https://github.com/Xilinx/meta-xilinx/blob/b2f74cc7fe5c4881589d5e440a17cb51fc66a7ab/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc#L9 + +Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> +Cc: Albert Aribaud <albert.u.boot@aribaud.net> +Cc: Michal Simek <michal.simek@xilinx.com> +Cc: Nathan Rossi <nathan@nathanrossi.com> +Submitted upstream: https://patchwork.ozlabs.org/patch/932392/ (slightly adapted to fix conflicts) +--- + arch/arm/Kconfig | 1 + + board/xilinx/Kconfig | 41 +++++++++++++++++++++++++++++++++++++++++ + board/xilinx/zynq/Makefile | 10 +++++++++- + board/xilinx/zynqmp/Makefile | 10 +++++++++- + 4 files changed, 60 insertions(+), 2 deletions(-) + create mode 100644 board/xilinx/Kconfig + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 22234cde2ab6..e04979d0ef7e 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1293,4 +1293,5 @@ source "board/technologic/ts4600/Kconfig" + source "board/vscom/baltos/Kconfig" + source "board/woodburn/Kconfig" + source "board/work-microwave/work_92105/Kconfig" ++source "board/xilinx/Kconfig" + source "board/zipitz2/Kconfig" + + source "arch/arm/Kconfig.debug" +diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig +new file mode 100644 +index 000000000000..aa3fa061edef +--- /dev/null ++++ b/board/xilinx/Kconfig +@@ -0,0 +1,41 @@ ++# Copyright (c) 2018, Luca Ceresoli <luca@lucaceresoli.net> ++# ++# SPDX-License-Identifier: GPL-2.0 ++ ++if ARCH_ZYNQ || ARCH_ZYNQMP ++ ++config XILINX_PS_INIT_FILE ++ string "Zynq/ZynqMP PS init file(s) location" ++ help ++ On Zynq and ZynqMP U-Boot SPL (or U-Boot proper if ++ ZYNQMP_PSU_INIT_ENABLED is set) is responsible for some ++ basic initializations, such as enabling peripherals and ++ configuring pinmuxes. The PS init file (called ++ psu_init_gpl.c on ZynqMP, ps7_init_gpl.c for Zynq-7000) ++ contains the code for such initializations. ++ ++ U-Boot contains PS init files for some boards, but each of ++ them describes only one specific configuration. Users of a ++ different board, or needing a different configuration, can ++ generate custom files using the Xilinx development tools. ++ ++ There are three ways to give a PS init file to U-Boot: ++ ++ 1. Set this variable to the path, either relative to the ++ source tree or absolute, where the psu_init_gpl.c or ++ ps7_init_gpl.c file is located. U-Boot will build this ++ file. ++ ++ 2. If you leave an empty string here, U-Boot will use ++ board/xilinx/zynq/$(CONFIG_DEFAULT_DEVICE_TREE)/ps7_init_gpl.c ++ for Zynq-7000, or ++ board/xilinx/zynqmp/$(CONFIG_DEFAULT_DEVICE_TREE)/psu_init_gpl.c ++ for ZynqMP. ++ ++ 3. If the above file does not exist, U-Boot will use ++ board/xilinx/zynq/ps7_init_gpl.c for Zynq-7000, or ++ board/xilinx/zynqmp/psu_init_gpl.c for ZynqMP. This file ++ is not provided by U-Boot, you have to copy it there ++ before the build. ++ ++endif +diff --git a/board/xilinx/zynq/Makefile b/board/xilinx/zynq/Makefile +index 5a76a26720cd..03ad5f0532ee 100644 +--- a/board/xilinx/zynq/Makefile ++++ b/board/xilinx/zynq/Makefile +@@ -5,10 +5,18 @@ + + obj-y := board.o + +-hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) ++ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"") ++PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE)) ++init-objs := ps_init_gpl.o ++spl/board/xilinx/zynq/ps_init_gpl.o board/xilinx/zynq/ps_init_gpl.o: $(PS_INIT_FILE) ++ $(CC) $(c_flags) -I $(srctree)/$(src) -c -o $@ $^ ++endif + ++ifeq ($(init-objs),) ++hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) + init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/ps7_init_gpl.c),\ + $(hw-platform-y)/ps7_init_gpl.o) ++endif + + ifeq ($(init-objs),) + ifneq ($(wildcard $(srctree)/$(src)/ps7_init_gpl.c),) +diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile +index 05ccd25dcef3..960b81fc5853 100644 +--- a/board/xilinx/zynqmp/Makefile ++++ b/board/xilinx/zynqmp/Makefile +@@ -5,10 +5,18 @@ + + obj-y := zynqmp.o + +-hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) ++ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"") ++PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE)) ++init-objs := ps_init_gpl.o ++spl/board/xilinx/zynqmp/ps_init_gpl.o board/xilinx/zynqmp/ps_init_gpl.o: $(PS_INIT_FILE) ++ $(CC) $(c_flags) -I $(srctree)/$(src) -c -o $@ $^ ++endif + ++ifeq ($(init-objs),) ++hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) + init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/psu_init_gpl.c),\ + $(hw-platform-y)/psu_init_gpl.o) ++endif + + ifeq ($(init-objs),) + ifneq ($(wildcard $(srctree)/$(src)/psu_init_gpl.c),) +-- +2.7.4 + diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index 482711ca6410..b8bff9949e3d 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -365,6 +365,39 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE for u-boot-dtb.img file so this U-Boot format is required to be set. +config BR2_TARGET_UBOOT_ZYNQMP + bool "Boot on the Xilinx ZynqMP SoCs" + depends on BR2_aarch64 + help + Enable options specific to the Xilinx ZynqMP family of SoCs. + +if BR2_TARGET_UBOOT_ZYNQMP + +config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE + string "Custom psu_init_gpl file" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + On ZynqMP the booloader is responsible for some basic + initializations, such as enabling peripherals and + configuring pinmuxes. The psu_init_gpl.c file (and, + optionally, psu_init_gpl.h) contains the code for such + initializations. + + Although U-Boot contains psu_init_gpl.c files for some + boards, each of them describes only one specific + configuration. Users of a different board, or needing a + different configuration, can generate custom files using the + Xilinx development tools. + + Set this variable to the path to your psu_init_gpl.c + file. psu_init_gpl.h, if needed, should be in the same + directory. U-Boot will build and link the user-provided file + instead of the built-in one. + + Leave empty to use the files provided by U-Boot. + +endif + config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC bool "CRC image for Altera SoC FPGA (mkpimage)" depends on BR2_arm diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index 03bd7ea743ed..e4571a6ccf9f 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -274,6 +274,17 @@ define UBOOT_INSTALL_IMAGES_CMDS $(BINARIES_DIR)/boot.scr) endef +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) + +ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)),) +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT + $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(TOPDIR)/$(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE))", \ + $(@D)/.config) +endef +endif + +endif # BR2_TARGET_UBOOT_ZYNQMP + define UBOOT_INSTALL_OMAP_IFT_IMAGE cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/ endef @@ -323,6 +334,10 @@ UBOOT_DEPENDENCIES += host-mkpimage UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE endif +define UBOOT_KCONFIG_FIXUP_CMDS + $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) +endef + ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y) ifeq ($(BR_BUILDING),y) ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),) -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-11 21:17 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <mailman.4777.1529627642.16495.buildroot@busybox.net> 2018-07-09 19:07 ` [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files Joel Carlson 2018-07-10 21:54 ` Luca Ceresoli 2018-07-11 2:48 ` Joel Carlson 2018-07-11 21:17 ` Luca Ceresoli 2018-07-09 19:39 ` [Buildroot] [PATCH v4 2/3] uboot: zynqmp: generate SPL image with PMUFW binary Joel Carlson 2018-06-21 21:26 [Buildroot] [PATCH v4 0/3] Add Xilinx ZynqMP and ZCU106 board support Luca Ceresoli 2018-06-21 21:26 ` [Buildroot] [PATCH v4 1/3] uboot: zynqmp: allow to use custom psu_init files Luca Ceresoli
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.