All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
@ 2019-12-02 20:03 Julien Olivain
  2019-12-16 21:57 ` Thomas Petazzoni
  2019-12-17 20:37 ` [Buildroot] [PATCH v2 " Julien Olivain
  0 siblings, 2 replies; 6+ messages in thread
From: Julien Olivain @ 2019-12-02 20:03 UTC (permalink / raw)
  To: buildroot

When using u-boot.bin, u-boot is using its builtin dtb which may not
be suitable for all cases. For TechNexion Pico Pi i.MX8M and
i.MX8MMini, this break the USB and UMS commands. Since those boards
does not have SD card slots, a recovery serial download is needed at
every update.

Using u-boot-nodtb.bin now fixes this issue.

Signed-off-by: Julien Olivain <juju@cotds.org>
---
 board/freescale/common/imx/imx8-bootloader-prepare.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/common/imx/imx8-bootloader-prepare.sh b/board/freescale/common/imx/imx8-bootloader-prepare.sh
index df528b0df5..cbf741af30 100755
--- a/board/freescale/common/imx/imx8-bootloader-prepare.sh
+++ b/board/freescale/common/imx/imx8-bootloader-prepare.sh
@@ -10,14 +10,14 @@ main ()
 
 	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
 		cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ATF_LOAD_ADDR=0x00910000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
+		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot-nodtb.bin ATF_LOAD_ADDR=0x00910000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
 		${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
 		rm -f ${BINARIES_DIR}/u-boot.its
 
 		${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx8-boot-sd.bin
 	elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
 		cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ATF_LOAD_ADDR=0x00920000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
+		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot-nodtb.bin ATF_LOAD_ADDR=0x00920000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
 		${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
 		rm -f ${BINARIES_DIR}/u-boot.its
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
  2019-12-02 20:03 [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M Julien Olivain
@ 2019-12-16 21:57 ` Thomas Petazzoni
  2019-12-17 20:26   ` Julien Olivain
  2019-12-17 20:37 ` [Buildroot] [PATCH v2 " Julien Olivain
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-16 21:57 UTC (permalink / raw)
  To: buildroot

Hello Julien,

+Fabio in Cc.

On Mon,  2 Dec 2019 21:03:33 +0100
Julien Olivain <juju@cotds.org> wrote:

> When using u-boot.bin, u-boot is using its builtin dtb which may not
> be suitable for all cases. For TechNexion Pico Pi i.MX8M and
> i.MX8MMini, this break the USB and UMS commands. Since those boards
> does not have SD card slots, a recovery serial download is needed at
> every update.

Could you give more details? If it doesn't use a built-in DTB, which
DTB gets used?

How does using the built-in DTB breaks USB and UMS ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
  2019-12-16 21:57 ` Thomas Petazzoni
@ 2019-12-17 20:26   ` Julien Olivain
  0 siblings, 0 replies; 6+ messages in thread
From: Julien Olivain @ 2019-12-17 20:26 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

I will send an updated version of the patch with more details in
the commit log.

On 2019-12-16 22:57, Thomas Petazzoni wrote:
> Hello Julien,
> 
> +Fabio in Cc.
> 
> On Mon,  2 Dec 2019 21:03:33 +0100
> Julien Olivain <juju@cotds.org> wrote:
> 
>> When using u-boot.bin, u-boot is using its builtin dtb which may not
>> be suitable for all cases. For TechNexion Pico Pi i.MX8M and
>> i.MX8MMini, this break the USB and UMS commands. Since those boards
>> does not have SD card slots, a recovery serial download is needed at
>> every update.
> 
> Could you give more details? If it doesn't use a built-in DTB, which
> DTB gets used?

Basically, without this patch, the U-Boot DTB is included twice (once in
builtin u-boot.bin image, and a second time in the boot FIT image).

> How does using the built-in DTB breaks USB and UMS ?

Since the second correct DTB is ignored, the default embedded one
is used, which is for another board (fsl-imx8mm-evk), which produce
some initialization errors on non-EVK boards.

> Thanks,
> 
> Thomas

Best regards,

Julien.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
  2019-12-02 20:03 [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M Julien Olivain
  2019-12-16 21:57 ` Thomas Petazzoni
@ 2019-12-17 20:37 ` Julien Olivain
  2019-12-24 13:34   ` Thomas Petazzoni
  2019-12-25 21:55   ` Peter Korsgaard
  1 sibling, 2 replies; 6+ messages in thread
From: Julien Olivain @ 2019-12-17 20:37 UTC (permalink / raw)
  To: buildroot

In board/freescale/common/imx/imx8-bootloader-prepare.sh, when
invoking mkimage_fit_atf.sh, the U-Boot DTB is passed as parameter, to
be included in the FIT image. This parameter usually comes from
BR2_ROOTFS_POST_SCRIPT_ARGS config option. The variable
BL33=u-boot.bin set in the invocation uses the u-boot image which is
including its embedded DTB. This means the U-Boot DTB is included
twice.

The upstream script mkimage_fit_atf.sh plus its Buildroot patch are
meant to use by default the nodtb variant and use the DTB in a
separate image. See [1] and [2].

The U-Boot default DTB which will be included in u-boot.bin image is
selected with U-Boot CONFIG_DEFAULT_DEVICE_TREE, or DEVICE_TREE
variable when invoking "make". If one of those option is not aligned
to the BR2_ROOTFS_POST_SCRIPT_ARGS config option, it's possible the
two included U-Boot DTBs are different. If such case happens, the
built-in DTB is always used, regardless of the other one, selected
with BR2_ROOTFS_POST_SCRIPT_ARGS.

For example, this case happens for TechNexion Pico Pi i.MX8M and
i.MX8MMini. Since the U-Boot defconfig assumes the nodtb version will
be used, it does not set the default DTB. The u-boot.bin will include
the fsl-imx8mm-evk instead. Including the wrong board DTB breaks the
USB and UMS commands (and possibly others). Since those boards does
not have SD card slots, a recovery serial download is needed at every
update.

This patch make sure that only the separate U-Boot DTB will be
included in the FIT image by using the nodtb variant.

[1] https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8M/mkimage_fit_atf.sh?h=rel_imx_4.14.98_2.0.0_ga#n35
[2] https://git.busybox.net/buildroot/tree/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch?h=2019.11#n42

Signed-off-by: Julien Olivain <juju@cotds.org>
---
Changes v1 -> v2:
  - Add more details in the commit log
---
 board/freescale/common/imx/imx8-bootloader-prepare.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/common/imx/imx8-bootloader-prepare.sh b/board/freescale/common/imx/imx8-bootloader-prepare.sh
index df528b0df5..cbf741af30 100755
--- a/board/freescale/common/imx/imx8-bootloader-prepare.sh
+++ b/board/freescale/common/imx/imx8-bootloader-prepare.sh
@@ -10,14 +10,14 @@ main ()
 
 	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
 		cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ATF_LOAD_ADDR=0x00910000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
+		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot-nodtb.bin ATF_LOAD_ADDR=0x00910000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
 		${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
 		rm -f ${BINARIES_DIR}/u-boot.its
 
 		${HOST_DIR}/bin/mkimage_imx8 -fit -signed_hdmi ${BINARIES_DIR}/signed_hdmi_imx8m.bin -loader ${BINARIES_DIR}/u-boot-spl-ddr.bin 0x7E1000 -second_loader ${BINARIES_DIR}/u-boot.itb 0x40200000 0x60000 -out ${BINARIES_DIR}/imx8-boot-sd.bin
 	elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
 		cat ${BINARIES_DIR}/u-boot-spl.bin ${BINARIES_DIR}/lpddr4_pmu_train_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
-		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot.bin ATF_LOAD_ADDR=0x00920000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
+		BL31=${BINARIES_DIR}/bl31.bin BL33=${BINARIES_DIR}/u-boot-nodtb.bin ATF_LOAD_ADDR=0x00920000 ${HOST_DIR}/bin/mkimage_fit_atf.sh ${UBOOT_DTB} > ${BINARIES_DIR}/u-boot.its
 		${HOST_DIR}/bin/mkimage -E -p 0x3000 -f ${BINARIES_DIR}/u-boot.its ${BINARIES_DIR}/u-boot.itb
 		rm -f ${BINARIES_DIR}/u-boot.its
 
-- 
2.23.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
  2019-12-17 20:37 ` [Buildroot] [PATCH v2 " Julien Olivain
@ 2019-12-24 13:34   ` Thomas Petazzoni
  2019-12-25 21:55   ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-24 13:34 UTC (permalink / raw)
  To: buildroot

On Tue, 17 Dec 2019 21:37:12 +0100
Julien Olivain <juju@cotds.org> wrote:

> In board/freescale/common/imx/imx8-bootloader-prepare.sh, when
> invoking mkimage_fit_atf.sh, the U-Boot DTB is passed as parameter, to
> be included in the FIT image. This parameter usually comes from
> BR2_ROOTFS_POST_SCRIPT_ARGS config option. The variable
> BL33=u-boot.bin set in the invocation uses the u-boot image which is
> including its embedded DTB. This means the U-Boot DTB is included
> twice.
> 
> The upstream script mkimage_fit_atf.sh plus its Buildroot patch are
> meant to use by default the nodtb variant and use the DTB in a
> separate image. See [1] and [2].
> 
> The U-Boot default DTB which will be included in u-boot.bin image is
> selected with U-Boot CONFIG_DEFAULT_DEVICE_TREE, or DEVICE_TREE
> variable when invoking "make". If one of those option is not aligned
> to the BR2_ROOTFS_POST_SCRIPT_ARGS config option, it's possible the
> two included U-Boot DTBs are different. If such case happens, the
> built-in DTB is always used, regardless of the other one, selected
> with BR2_ROOTFS_POST_SCRIPT_ARGS.
> 
> For example, this case happens for TechNexion Pico Pi i.MX8M and
> i.MX8MMini. Since the U-Boot defconfig assumes the nodtb version will
> be used, it does not set the default DTB. The u-boot.bin will include
> the fsl-imx8mm-evk instead. Including the wrong board DTB breaks the
> USB and UMS commands (and possibly others). Since those boards does
> not have SD card slots, a recovery serial download is needed at every
> update.
> 
> This patch make sure that only the separate U-Boot DTB will be
> included in the FIT image by using the nodtb variant.
> 
> [1] https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8M/mkimage_fit_atf.sh?h=rel_imx_4.14.98_2.0.0_ga#n35
> [2] https://git.busybox.net/buildroot/tree/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch?h=2019.11#n42
> 
> Signed-off-by: Julien Olivain <juju@cotds.org>
> ---
> Changes v1 -> v2:
>   - Add more details in the commit log
> ---
>  board/freescale/common/imx/imx8-bootloader-prepare.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Many thanks for the extended commit log! Applied to master. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M
  2019-12-17 20:37 ` [Buildroot] [PATCH v2 " Julien Olivain
  2019-12-24 13:34   ` Thomas Petazzoni
@ 2019-12-25 21:55   ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2019-12-25 21:55 UTC (permalink / raw)
  To: buildroot

>>>>> "Julien" == Julien Olivain <juju@cotds.org> writes:

 > In board/freescale/common/imx/imx8-bootloader-prepare.sh, when
 > invoking mkimage_fit_atf.sh, the U-Boot DTB is passed as parameter, to
 > be included in the FIT image. This parameter usually comes from
 > BR2_ROOTFS_POST_SCRIPT_ARGS config option. The variable
 > BL33=u-boot.bin set in the invocation uses the u-boot image which is
 > including its embedded DTB. This means the U-Boot DTB is included
 > twice.

 > The upstream script mkimage_fit_atf.sh plus its Buildroot patch are
 > meant to use by default the nodtb variant and use the DTB in a
 > separate image. See [1] and [2].

 > The U-Boot default DTB which will be included in u-boot.bin image is
 > selected with U-Boot CONFIG_DEFAULT_DEVICE_TREE, or DEVICE_TREE
 > variable when invoking "make". If one of those option is not aligned
 > to the BR2_ROOTFS_POST_SCRIPT_ARGS config option, it's possible the
 > two included U-Boot DTBs are different. If such case happens, the
 > built-in DTB is always used, regardless of the other one, selected
 > with BR2_ROOTFS_POST_SCRIPT_ARGS.

 > For example, this case happens for TechNexion Pico Pi i.MX8M and
 > i.MX8MMini. Since the U-Boot defconfig assumes the nodtb version will
 > be used, it does not set the default DTB. The u-boot.bin will include
 > the fsl-imx8mm-evk instead. Including the wrong board DTB breaks the
 > USB and UMS commands (and possibly others). Since those boards does
 > not have SD card slots, a recovery serial download is needed at every
 > update.

 > This patch make sure that only the separate U-Boot DTB will be
 > included in the FIT image by using the nodtb variant.

 > [1] https://source.codeaurora.org/external/imx/imx-mkimage/tree/iMX8M/mkimage_fit_atf.sh?h=rel_imx_4.14.98_2.0.0_ga#n35
 > [2] https://git.busybox.net/buildroot/tree/package/imx-mkimage/0001-add-support-for-overriding-bl32-and-bl33-not-only-bl.patch?h=2019.11#n42

 > Signed-off-by: Julien Olivain <juju@cotds.org>
 > ---
 > Changes v1 -> v2:
 >   - Add more details in the commit log

Committed to 2019.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-25 21:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 20:03 [Buildroot] [PATCH 1/1] board/freescale/common/imx: use nodtb variant in uboot images for 8M Julien Olivain
2019-12-16 21:57 ` Thomas Petazzoni
2019-12-17 20:26   ` Julien Olivain
2019-12-17 20:37 ` [Buildroot] [PATCH v2 " Julien Olivain
2019-12-24 13:34   ` Thomas Petazzoni
2019-12-25 21:55   ` Peter Korsgaard

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.