Enable usage of SDP for i.MX6 Sabre Auto Boards
v2 cover Enable usage of SDP for i.MX6 Sabre Auto Boards
Being able to upload u-boot over USB is rather useful, so ideally this functionality should be enabled by the default config for these boards. Currently however no USB support is built into the SPL nor is SDP enabled for i.MX6 Sabre Auto boards.
This round only has the patches needed for SDP support, the somewhat unrelated fixes have been been sent seperately (but without the u-boot image will fail to boot). And ofcourse fixes the build problem reported by Fabio.
The first patch drops SPL DM support as there is no way to fit that *and* USB support in at the momenT.
The seconds patch enabled USB & SPL SDP support for the board.
Patch three adds support for loading FIT images over SDP as that is what is in use for the Sabre auto's main u-boot image.
Patchset tested by using uuu with the following configuration:
``` uuu_version 1.2 SDP: boot -f SPL SDPU: write -f u-boot-dtb.img -addr 0x10000000 SDPU: jump -addr 0x10000000 SDPU: done ```
Changes in v2:
- Fix build with CMD_USB_SDP
- Add SoB from Frieder Schrempf
Frieder Schrempf (1):
usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Sjoerd Simons (2):
mx6sabreauto: Remove CONFIG_SPL_DM to decrease the SPL size
mx6sabreauto: Enable SPL SDP support
common/spl/spl_sdp.c | 12 +++++--- configs/mx6sabreauto_defconfig | 4 ++- drivers/usb/gadget/f_sdp.c | 53 ++++++++++++++++++++++++++++++---- include/sdp.h | 9 +++++- 4 files changed, 66 insertions(+), 12 deletions(-)
Signature · 1 line
2.20.1
PATCH v2 1/3 mx6sabreauto: Remove CONFIG_SPL_DM to decrease the SPL size
The i.mx6 SPL binary cannot be bigger then 68K, while with the current defconfig for sabreauto it's only about 56K as soon as USB support gets added the size will overflows.
---
Changes in v2: None
configs/mx6sabreauto_defconfig | 1 - 1 file changed, 1 deletion(-)
configs/mx6sabreauto_defconfig +0 -1
@@ -55,7 +55,6 @@ CONFIG_MULTI_DTB_FIT=y CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -CONFIG_SPL_DM=y CONFIG_DFU_MMC=y CONFIG_DFU_SF=y CONFIG_DM_GPIO=y
Signature · 1 line
2.20.1
PATCH v2 1/3 mx6sabreauto: Remove CONFIG_SPL_DM to decrease the SPL size
Quoted 6 lines · Sjoerd Simons
The i.mx6 SPL binary cannot be bigger then 68K, while with the current defconfig for sabreauto it's only about 56K as soon as USB support gets added the size will overflows.
Signed-off-by Sjoerd Simons <[email protected]>
PATCH v2 1/3 mx6sabreauto: Remove CONFIG_SPL_DM to decrease the SPL size
In reply to Sjoerd SimonsQuoted 5 lines
The i.mx6 SPL binary cannot be bigger then 68K, while with the current defconfig for sabreauto it's only about 56K as soon as USB support gets added the size will overflows.
Signed-off-by Sjoerd Simons <[email protected]>Reviewed-by Fabio Estevam <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 2/3 mx6sabreauto: Enable SPL SDP support
In reply to Sjoerd SimonsTo allow loading u-boot over USB enable SDP support in the SPL.
---
Changes in v2: None
configs/mx6sabreauto_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/mx6sabreauto_defconfig +3 -0
@@ -26,6 +26,9 @@ CONFIG_SPL_SEPARATE_BSS=y CONFIG_SPL_FIT_IMAGE_TINY=y CONFIG_SPL_FS_EXT4=y CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET=y +CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y
Signature · 1 line
2.20.1
PATCH v2 2/3 mx6sabreauto: Enable SPL SDP support
Quoted 4 lines · Sjoerd Simons
To allow loading u-boot over USB enable SDP support in the SPL.
Signed-off-by Sjoerd Simons <[email protected]>
PATCH v2 2/3 mx6sabreauto: Enable SPL SDP support
In reply to Sjoerd SimonsQuoted 3 lines
To allow loading u-boot over USB enable SDP support in the SPL.
Signed-off-by Sjoerd Simons <[email protected]>Reviewed-by Fabio Estevam <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Sjoerd SimonsFrom: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
---
Changes in v2:
- Fix build with CMD_USB_SDP
- Add SoB from Frieder Schrempf
common/spl/spl_sdp.c | 12 ++++++--- drivers/usb/gadget/f_sdp.c | 53 +++++++++++++++++++++++++++++++++----- include/sdp.h | 9 ++++++- 3 files changed, 63 insertions(+), 11 deletions(-)
common/spl/spl_sdp.c +8 -4
@@ -25,10 +25,14 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image,return -ENODEV ; } -/* This command typically does not return but jumps to an image */ -sdp_handle (controller_index); -pr_err ("SDP ended\n" ); +/* +* This command either loads a legacy image, jumps and never returns, +* or it loads a FIT image and returns it to be handled by the SPL +* code. +*/ + ret =spl_sdp_handle (controller_index, spl_image); +debug ("SDP ended\n" ); -return -EINVAL ; +return ret; }SPL_LOAD_IMAGE_METHOD ("USB SDP" ,0 ,BOOT_DEVICE_BOARD , spl_sdp_load_image);
drivers/usb/gadget/f_sdp.c +47 -6
83 lines not on this page · raw message
include/sdp.h +8 -1
@@ -10,6 +10,13 @@#define __SDP_H_int sdp_init (int controller_index); -void sdp_handle (int controller_index); + +#ifdef CONFIG_SPL_BUILD +#include <spl.h> + +int spl_sdp_handle (int controller_index,struct spl_image_info *spl_image); +#else +int sdp_handle (int controller_index); +#endif #endif /* __SDP_H_ */
Signature · 1 line
2.20.1
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Sjoerd,
Quoted 9 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
Signed-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>
Unfortunately, it still fails with imx_usb_loader due to the lack of IVT.
Secure boot also needs IVT, so we need to find a way to insert IVT in the FIT image.
Tested with UUU and it worked, so this is progress :-)
Thanks
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 14 lines · Fabio Estevam
Hi Sjoerd,
Quoted 9 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in
the SPLSigned-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>
Quoted 7 lines
Unfortunately, it still fails with
imx_usb_loaderdue to the lack of IVT.Secure boot also needs IVT, so we need to find a way to insert IVT in the FIT image.
Tested with UUU and it worked, so this is progress :-)
Small steps right; Ooi what imx_usb_loader configuration/commands are you using to test this? (I find its config rather tricky to grasp).
One of the next things I will need to look at is actually secure boot.. That said why does imx_usb_loader if the board isn't locked?
Quoted 3 lines
Tested-by Fabio Estevam <[email protected]>Thanks
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 2 lines · Sjoerd Simons
Small steps right; Ooi what
imx_usb_loaderconfiguration/commands are you using to test this? (I find its config rather tricky to grasp).
I simply run:
sudo ./imx_usb SPL
and then
sudo ./imx_usb u-boot-dtb.img
I suggest you to try U-Boot 2019.01 on a mx6sabreauto first.
U-Boot 2019.01 is prior to the DM / fit conversion and loading SPL + u-boot.img with the method above works fine.
Quoted 2 lines
One of the next things I will need to look at is actually secure boot.. That said why does
imx_usb_loaderif the board isn't locked?
Not sure what you mean by locked.
We have been using imx_usb_loader for a long time. After DM / fit comvesion the IVT piece is not added into the final .img.
From the main Makefile:
ifdef CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.logCLEAN_FILES += u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log endif
we can see that the ivt is not added for the CONFIG_SPL_LOAD_FIT case.
I tried to change this logic, but so far was not able to make it work.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 11 lines · Fabio Estevam
Quoted 3 lines · Sjoerd Simons
Small steps right; Ooi what
imx_usb_loaderconfiguration/commands are
you using to test this? (I find its config rather tricky to grasp).I simply run:
sudo ./imx_usb SPL
Quoted 8 lines
and then
sudo ./imx_usb u-boot-dtb.img
I suggest you to try U-Boot 2019.01 on a mx6sabreauto first.
U-Boot 2019.01 is prior to the DM / fit conversion and loading SPL + u-boot.img with the method above works fine.
Right; I've used that method on a fair few boards but none of those use FIT.
For loading the SPL mx6_usb_sdp_spl.conf of imx_usb_loader has:hid,uboot_header,1024,0x10000000,1G,0x00907000,0x31000
So my guess was that it was simply failing as a fit image doesn't have a uboot header ;). I did have a quick look at seeing how to convince imx_usb_loader to upload a FIT image, but failed to do so (hence my question). uuu turned to be simpler to get to comply :)
Quoted 5 lines
Quoted 3 lines
One of the next things I will need to look at is actually secure boot..
That said why doesimx_usb_loaderif the board isn't locked?Not sure what you mean by locked.
Sorry closing the device would be the right jargon for i.mx. My point really is, isn't it something to be fixed in imx_usb_loader if it can't upload unsigned FIT images rather then in u-boot?
Quoted 24 lines
We have been using
imx_usb_loaderfor a long time. After DM / fit comvesion the IVT piece is not added into the final .img.From the main
Makefile:ifdef
CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T
firmware_ivt-C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
CLEAN_FILES+= u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u- boot.imx.log
endif
Quoted 5 lines
we can see that the ivt is not added for the
CONFIG_SPL_LOAD_FITcase.I tried to change this logic, but so far was not able to make it work.
Right; Thanks for the pointer
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 3 lines · Sjoerd Simons
Sorry closing the device would be the right jargon for i.mx. My point really is, isn't it something to be fixed in
imx_usb_loaderif it can't upload unsigned FIT images rather then in u-boot?
Yes, I think imx_usb_loader needs to be fixed to load FIT images.
However, since the current FIT format for i.MX6 does not contain an IVT, this would cause issues when running secure boot.
So in my opinion if we could change the i.MX6 FIT format to also add an IVT, then I think we could fix the imx_usb_loader and secure boot issues.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Fabio EstevamHi Fabio, Sjoerd
Quoted 9 lines
Quoted 3 lines · Sjoerd Simons
Small steps right; Ooi what
imx_usb_loaderconfiguration/commands are you using to test this? (I find its config rather tricky to grasp).I simply run:
Quoted 8 lines
sudo ./imx_usb SPL
and then
sudo ./imx_usb u-boot-dtb.img
I suggest you to try U-Boot 2019.01 on a mx6sabreauto first.
Test HW: i.MX6Q Display5 factory setup.
However, one thing puzzles me - the VID / PID used.When I run uuu (mfgtools: SHA1: 13d187304f4faa473d2141409419c5b6f052addb):
I see that "Build in config" has following VID/PID:
SDPU: SPL 0x0525 0xb4a4 [0x0000..0x04ff] [1]
SDPV: SPL1 0x0525 0xb4a4 [0x0500..0x9998]
SDPU: SPL 0x0525 0xb4a4 [0x9999..0x9999]But to make the SDPU command working I had to adjust it to be similar to sabreauto (CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5). Those match to "FB" (fastboot?).
Is this a bug or just the "Build in config" information is outdated? With VID/PID set as for [1] (and as we use SDPU command, not FB), the uuu doesn't connect to loaded SPL.
To make it working (on host):
cat << EOF > display5_recovery.lstuuu_version 1.2.135
SDP: boot -f /srv/tftp/SPL
SDPU: write -f /srv/tftp/u-boot-dtb.img -addr 0x10000000
SDPU: jump -addr 0x10000000
SDPU: done
EOF
sudo ./uuu/uuu display5_recovery.lst
Quoted 30 lines
U-Boot 2019.01 is prior to the DM / fit conversion and loading SPL + u-boot.img with the method above works fine.
Quoted 3 lines
One of the next things I will need to look at is actually secure boot.. That said why does
imx_usb_loaderif the board isn't locked?Not sure what you mean by locked.
We have been using
imx_usb_loaderfor a long time. After DM / fit comvesion the IVT piece is not added into the final .img.From the main
Makefile:ifdef
CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T
firmware_ivt-C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.logCLEAN_FILES+= u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log endif
Quoted 4 lines
we can see that the ivt is not added for the
CONFIG_SPL_LOAD_FITcase.I tried to change this logic, but so far was not able to make it work.
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/27394673/attachment.sig>
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 34 lines · Lukasz Majewski
Hi Fabio, Sjoerd
Quoted 9 lines
Quoted 3 lines · Sjoerd Simons
Small steps right; Ooi what
imx_usb_loaderconfiguration/commands are you using to test this? (I find its config rather tricky to grasp).I simply run:
Quoted 8 lines
sudo ./imx_usb SPL
and then
sudo ./imx_usb u-boot-dtb.img
I suggest you to try U-Boot 2019.01 on a mx6sabreauto first.
Tested-by Lukasz Majewski <[email protected]>Test HW: i.MX6Q Display5 factory setup.
However, one thing puzzles me - the VID / PID used.When I run uuu (mfgtools: SHA1:
13d187304f4faa473d2141409419c5b6f052addb):I see that "Build in config" has following VID/PID:
SDPU: SPL 0x0525 0xb4a4 [0x0000..0x04ff] [1] SDPV: SPL1 0x0525 0xb4a4 [0x0500..0x9998] SDPU: SPL 0x0525 0xb4a4 [0x9999..0x9999]
Quoted 8 lines
But to make the SDPU command working I had to adjust it to be similar to sabreauto (
CONFIG_USB_GADGET_VENDOR_NUM=0x0525CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5). Those match to "FB" (fastboot?).Is this a bug or just the "Build in config" information is outdated? With VID/PID set as for [1] (and as we use SDPU command, not FB), the uuu doesn't connect to loaded SPL.
So u-boot for the spl does (arch/arm/mach-imx/spl.c):
```
int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
{
put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff, &dev->idProduct);``
Iotw with CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 in the config when in the SPL the product will be 0xb4a4, which uuu recognizes.
Once in the main u-boot image in principle you shoudl be able to use FB:, however it doesn't seem FB: ucmd is supported for mainline u- boot so...
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Sjoerd,
Quoted 44 lines · Lukasz Majewski
Quoted 34 lines
Hi Fabio, Sjoerd
Quoted 9 lines
Quoted 3 lines · Sjoerd Simons
Small steps right; Ooi what
imx_usb_loaderconfiguration/commands are you using to test this? (I find its config rather tricky to grasp).I simply run:
Quoted 8 lines
sudo ./imx_usb SPL
and then
sudo ./imx_usb u-boot-dtb.img
I suggest you to try U-Boot 2019.01 on a mx6sabreauto first.
Tested-by Lukasz Majewski <[email protected]>Test HW: i.MX6Q Display5 factory setup.
However, one thing puzzles me - the VID / PID used.When I run uuu (mfgtools: SHA1:
13d187304f4faa473d2141409419c5b6f052addb):I see that "Build in config" has following VID/PID:
SDPU: SPL 0x0525 0xb4a4 [0x0000..0x04ff] [1] SDPV: SPL1 0x0525 0xb4a4 [0x0500..0x9998] SDPU: SPL 0x0525 0xb4a4 [0x9999..0x9999]Quoted 8 lines
But to make the SDPU command working I had to adjust it to be similar to sabreauto (
CONFIG_USB_GADGET_VENDOR_NUM=0x0525CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5). Those match to "FB" (fastboot?).Is this a bug or just the "Build in config" information is outdated? With VID/PID set as for [1] (and as we use SDPU command, not FB), the uuu doesn't connect to loaded SPL.
Quoted 6 lines
So u-boot for the spl does (
arch/arm/mach-imx/spl.c):
```
int g_dnl_bind_fixup(structusb_device_descriptor*dev, const char*name) { put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM + 0xfff,
&dev->idProduct); ``
Ach... Right.
Thanks for pointing this out.
Quoted 8 lines
Iotw with
CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5in the config when in the SPL the product will be0xb4a4, which uuu recognizes.Once in the main u-boot image in principle you shoudl be able to use
FB:, however it doesn't seemFB: ucmdis supported for mainline u- boot so...
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190605/a27a41ae/attachment.sig>
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Fabio EstevamQuoted 27 lines · Fabio Estevam
On Tue, Jun 4, 2019 at 5:41 PM Sjoerd Simons
<[email protected]> wrote:We have been using
imx_usb_loaderfor a long time. After DM / fit comvesion the IVT piece is not added into the final .img.From the main
Makefile:ifdef
CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T
firmware_ivt-C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
CLEAN_FILES+= u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u- boot.imx.log
endif
Quoted 5 lines
we can see that the ivt is not added for the
CONFIG_SPL_LOAD_FITcase.I tried to change this logic, but so far was not able to make it work.
So when looking through how secure boot can work from the SPL i can accross e246bfcfe. Which explains the u-boot SPL expect a signed fit image with roughly the following layout:
--------------------------------------------------
| | | | | | | | | FIT | FIT | FIT | | U-BOOT | ATF | U-BOOT | | FDT | IVT | CSF | | nodtb.bin | | DTB | | | | | | | | |
--------------------------------------------------
The code aligns the IVT at 0x1000 and the standard CSF size is0x2000. So one has to set CONFIG_FIT_EXTERNAL_OFFSET=0x3000 (assuming the FIT FDT <= 0x1000 bytes) to make CONFIG_SECURE_BOOT work in this setup (even if HAB is off and the image isn't signed). Otherwise the SPL won't pick up the correct location for all the external data.
Seems a bit ugly that the start offset of the external data can't be introspected from the fdt blob, but oh well.
The way this seems to work for i.mx8 is that the SECOND_LOADER command sticks in a IVT header into the fit image. I assume some other tooling can then stick the CSF data in the appropriate place (anyone have a pointer?).
Now i guess the first question becomes whether the i.mx6 should follow the same layout. And if so how to integrate it properly (teach mkimage about handling firmware_ivt for fit images?).
Relatedly i was looking for a good description of using HAB for loading the OS in FIT images, but failed to find a good document. pointers welcome.
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Sjoerd,
Adding Breno in case he has some insights.
Quoted 69 lines · Sjoerd Simons
Quoted 27 lines · Fabio Estevam
On Tue, Jun 4, 2019 at 5:41 PM Sjoerd Simons
<[email protected]> wrote:We have been using
imx_usb_loaderfor a long time. After DM / fit comvesion the IVT piece is not added into the final .img.From the main
Makefile:ifdef
CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T
firmware_ivt-C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
CLEAN_FILES+= u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u- boot.imx.log
endifQuoted 5 lines
we can see that the ivt is not added for the
CONFIG_SPL_LOAD_FITcase.I tried to change this logic, but so far was not able to make it work.
So when looking through how secure boot can work from the SPL i can accross
e246bfcfe. Which explains the u-boot SPL expect a signed fit image with roughly the following layout:--------------------------------------------------
| | | | | | | | | FIT | FIT | FIT | | U-BOOT | ATF | U-BOOT | | FDT | IVT | CSF | | nodtb.bin | | DTB | | | | | | | | |--------------------------------------------------
The code aligns the IVT at
0x1000and the standard CSF size is0x2000. So one has to setCONFIG_FIT_EXTERNAL_OFFSET=0x3000(assuming the FIT FDT <=0x1000bytes) to makeCONFIG_SECURE_BOOTwork in this setup (even if HAB is off and the image isn't signed). Otherwise the SPL won't pick up the correct location for all the external data.Seems a bit ugly that the start offset of the external data can't be introspected from the fdt blob, but oh well.
The way this seems to work for i.mx8 is that the
SECOND_LOADERcommand sticks in a IVT header into the fit image. I assume some other tooling can then stick the CSF data in the appropriate place (anyone have a pointer?).Now i guess the first question becomes whether the i.mx6 should follow the same layout. And if so how to integrate it properly (teach mkimage about handling
firmware_ivtfor fit images?).Relatedly i was looking for a good description of using HAB for loading the OS in FIT images, but failed to find a good document. pointers welcome.
--
Sjoerd Simons
Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Sjoerd SimonsHi Sjoerd,
Em seg, 17 de jun de 2019 Ã s 11:26, Sjoerd Simons <[email protected]> escreveu:
Quoted 49 lines · Fabio Estevam
Quoted 27 lines
On Tue, Jun 4, 2019 at 5:41 PM Sjoerd Simons
<[email protected]> wrote:We have been using
imx_usb_loaderfor a long time. After DM / fit comvesion the IVT piece is not added into the final .img.From the main
Makefile:ifdef
CONFIG_SPL_LOAD_FIT
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) else
MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T
firmware_ivt-C none -O u-boot \(quoted diff) +0
-2-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
CLEAN_FILES+= u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u- boot.imx.log
endifQuoted 5 lines
we can see that the ivt is not added for the
CONFIG_SPL_LOAD_FITcase.I tried to change this logic, but so far was not able to make it work.
So when looking through how secure boot can work from the SPL i can accross
e246bfcfe. Which explains the u-boot SPL expect a signed fit image with roughly the following layout:--------------------------------------------------
| | | | | | | | | FIT | FIT | FIT | | U-BOOT | ATF | U-BOOT | | FDT | IVT | CSF | | nodtb.bin | | DTB | | | | | | | | |--------------------------------------------------
The code aligns the IVT at
0x1000and the standard CSF size is0x2000. So one has to setCONFIG_FIT_EXTERNAL_OFFSET=0x3000(assuming the FIT FDT <=0x1000bytes) to makeCONFIG_SECURE_BOOTwork in this setup (even if HAB is off and the image isn't signed). Otherwise the SPL won't pick up the correct location for all the external data.
Quoted 8 lines
Seems a bit ugly that the start offset of the external data can't be introspected from the fdt blob, but oh well.
The way this seems to work for i.mx8 is that the
SECOND_LOADERcommand sticks in a IVT header into the fit image. I assume some other tooling can then stick the CSF data in the appropriate place (anyone have a pointer?).
Thanks for looking at this issue.
We are using similar structure in NXP U-Boot for i.MX8M devices, you can use dd tool as explained in document below:
https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4/guides/mx8m_mx8mm_secure_boot.txt?h=imx_v2018.03_4.14.98_2.0.0_ga#n301
Quoted 4 lines
Now i guess the first question becomes whether the i.mx6 should follow the same layout. And if so how to integrate it properly (teach mkimage about handling
firmware_ivtfor fit images?).
IMHO we should follow the same layout as in i.MX8M, as far as I know in NXP BSP this is handled by imx-mkimage tool:
https://source.codeaurora.org/external/imx/imx-mkimage/?h=imx_4.14.98_2.0.0_ga
Perhaps we can try similar with mkimage tool included in upstream U-Boot?
Quoted 4 lines
Relatedly i was looking for a good description of using HAB for loading the OS in FIT images, but failed to find a good document. pointers welcome.
For HAB API usage you can take a look in HABv4 RVT Guidelines and Recommendations application note:
https://www.nxp.com/docs/en/application-note/AN12263.pdf
The U-Boot docs in NXP BSP U-Boot also provides an overview:
https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4?h=imx_v2018.03_4.14.98_2.0.0_ga
Thanks,
Breno Lima
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hey,
Quoted 12 lines · Breno Matheus Lima
Quoted 11 lines
Seems a bit ugly that the start offset of the external data can't be
introspected from the fdt blob, but oh well.The way this seems to work for i.mx8 is that the
SECOND_LOADERcommand
sticks in a IVT header into the fit image. I assume some other tooling
can then stick the CSF data in the appropriate place (anyone have a pointer?).
Quoted 5 lines
Thanks for looking at this issue.
We are using similar structure in NXP U-Boot for i.MX8M devices, you can use dd tool as explained in document below:
https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4/guides/mx8m_mx8mm_secure_boot.txt?h=imx_v2018.03_4.14.98_2.0.0_ga#n301
THat's a quite useful document indeed to explain the mx8m setup a bit more; Would be lovely to get that in upstream u-boot!
Though from what i can tell mx8m secure boot isn't there yet upstream, at least judging by the fact there is no correct definition of the RVT base address for those upstream yet ;)
Quoted 7 lines
Quoted 6 lines
Now i guess the first question becomes whether the i.mx6 should follow
the same layout. And if so how to integrate it properly (teach mkimage
about handlingfirmware_ivtfor fit images?).
Quoted 6 lines
IMHO we should follow the same layout as in i.MX8M, as far as I know in NXP BSP this is handled by imx-mkimage tool:
https://source.codeaurora.org/external/imx/imx-mkimage/?h=imx_4.14.98_2.0.0_gaPerhaps we can try similar with mkimage tool included in upstream U- Boot?
Right i'd hope the i.mx8m specific bits in u-boot already do that as well; but for i.MX6 those are overkill since there isn't one big flash.bin but two seperate bits of data (Though from the documentation it feels like that might be the case for i.mx8 as well? As there doesn't seem to be a reason apart from flashing convenience to put the SPL and the u-boot images in one big file)
Quoted 6 lines
Quoted 5 lines
Relatedly i was looking for a good description of using HAB for loading
the OS in FIT images, but failed to find a good document. pointers welcome.
Quoted 6 lines
For HAB API usage you can take a look in HABv4 RVT Guidelines and Recommendations application note:
https://www.nxp.com/docs/en/application-note/AN12263.pdfThe U-Boot docs in NXP BSP U-Boot also provides an overview:
https://source.codeaurora.org/external/imx/uboot-imx/tree/doc/imx/habv4?h=imx_v2018.03_4.14.98_2.0.0_ga
Right all those assume you're using a (z)Image with the IVT/CSF appended; None of those describe a conventional layout for a FIT image.
Signature · 2 lines
Sjoerd Simons Collabora Ltd.
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Fabio EstevamHi Fabio,
Quoted 10 lines
Hi Sjoerd,
Quoted 6 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
Quoted 6 lines
Quoted 3 lines
Signed-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>Unfortunately, it still fails with
imx_usb_loaderdue to the lack of IVT.
I do observe another issue - one of my "factory" board setup is not using (till now) OF_CONFIG.
Without u-boot.img being a FitImage wrapped, the imx_usb_loader works correctly (with current mainline).
After this change I do see the issue with imx_usb_loader. Unfortunately, applying this patch doesn't help.
I will investigate this issue further tomorrow.
Quoted 6 lines
Secure boot also needs IVT, so we need to find a way to insert IVT in the FIT image.
Tested with UUU and it worked, so this is progress :-)
Quoted 7 lines
Tested-by Fabio Estevam <[email protected]>Thanks
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190604/c7c25801/attachment.sig>
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Sjoerd SimonsHi Marek,
Quoted 9 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
Signed-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>
Does this look good to you?
Could we have this for 2019.09? It fixes the loading of U-Boot via SDP on i.MX6 when using FIT image.
Thanks
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Quoted 11 lines · Fabio Estevam
Hi Marek,
Quoted 6 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
Quoted 7 lines
Quoted 3 lines
Signed-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>Does this look good to you?
Could we have this for 2019.09? It fixes the loading of U-Boot via SDP
Ops, I meant 2019.07 :-)
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Fabio EstevamHi Fabio,
Quoted 7 lines · Fabio Estevam
Hi Marek,
Quoted 3 lines · Sjoerd Simons
From: Frieder Schrempf <[email protected]>
Quoted 9 lines
Quoted 6 lines
Add support for loading u-boot FIT images over the USB SDP protocol in the SPL
Signed-off-by Frieder Schrempf <[email protected]>[Various build fixes]Signed-off-by Sjoerd Simons <[email protected]>Does this look good to you?
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Stefano
Quoted 2 lines
Could we have this for 2019.09? It fixes the loading of U-Boot via SDP on i.MX6 when using FIT image.
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Stefano,
Quoted 2 lines · Stefano Babic
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Lukasz reported an issue initially, but after adjusting the VID / PID he managed to get it to work.
Lukasz, please confirm.
Thanks
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Fabio, Stefano,
Quoted 11 lines
Hi Stefano,
Quoted 2 lines · Stefano Babic
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Lukasz reported an issue initially, but after adjusting the VID / PID he managed to get it to work.
Lukasz, please confirm.
I can confirm that I made it working on v2019-rc3 (on display5) after adjusting VID/PID with NXP's 'uuu' utility to recovery i.MX6Q board.
Quoted 2 lines
Thanks
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190611/02a1a693/attachment.sig>
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Lukasz and Stefano,
Quoted 10 lines · Lukasz Majewski
Hi Fabio, Stefano,
Quoted 7 lines
Hi Stefano,
Quoted 2 lines · Stefano Babic
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Quoted 7 lines
Quoted 4 lines
Lukasz reported an issue initially, but after adjusting the VID / PID he managed to get it to work.
Lukasz, please confirm.
I can confirm that I made it working on v2019-rc3 (on display5) after adjusting VID/PID with NXP's 'uuu' utility to recovery i.MX6Q board.
Do you think this one could be applied?
Without it, I can not load a fit image via USB on imx6sabresd.
Thanks
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Fabio, Stefano,
Quoted 17 lines
Hi Lukasz and Stefano,
Quoted 13 lines · Lukasz Majewski
Hi Fabio, Stefano,
Quoted 10 lines
Hi Stefano,
Quoted 2 lines · Stefano Babic
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Lukasz reported an issue initially, but after adjusting the VID / PID he managed to get it to work.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Lukasz, please confirm.
I can confirm that I made it working on v2019-rc3 (on display5) after adjusting VID/PID with NXP's 'uuu' utility to recovery i.MX6Q board.
Do you think this one could be applied?
This patch seems to be already applied to master branch of U-Boot:
SHA1: 2c72ead7387404eba16c556d2f204c52c36c27f9
Quoted 4 lines
Without it, I can not load a fit image via USB on imx6sabresd.
Thanks
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190722/16a8c332/attachment.sig>
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
Hi Lukasz,
Quoted 2 lines · Lukasz Majewski
This patch seems to be already applied to master branch of U-Boot:
SHA1:2c72ead7387404eba16c556d2f204c52c36c27f9
Excellent! Thanks
PATCH v2 3/3 usb: gadget: f_sdp: Allow SPL to load and boot FIT via SDP
In reply to Fabio EstevamHi Fabio,
Quoted 16 lines · Fabio Estevam
Hi Lukasz and Stefano,
Quoted 13 lines · Lukasz Majewski
Hi Fabio, Stefano,
Quoted 10 lines
Hi Stefano,
Quoted 2 lines · Stefano Babic
I have no comments, but from the discussion I felt there are still some issues and I left it over.
Lukasz reported an issue initially, but after adjusting the VID / PID he managed to get it to work.
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Lukasz, please confirm.
I can confirm that I made it working on v2019-rc3 (on display5) after adjusting VID/PID with NXP's 'uuu' utility to recovery i.MX6Q board.
Do you think this one could be applied?
Without it, I can not load a fit image via USB on imx6sabresd.
This is my mistake, sorry. I supposed I have applied, something went wrong. I check it, thanks for remind.
Regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================