Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iMX8MP: SDPS LIBUSB_ERROR_TIMEOUT due to UUUBURNXXOEUZX7 tag #416

Open
eghidoli opened this issue Mar 13, 2024 · 10 comments
Open

iMX8MP: SDPS LIBUSB_ERROR_TIMEOUT due to UUUBURNXXOEUZX7 tag #416

eghidoli opened this issue Mar 13, 2024 · 10 comments

Comments

@eghidoli
Copy link

We experienced failures of SDPS boot command for some sizes of binaries.
It fails to load if the tag added by bitbake recipe meta-freescale/classes/uuu_bootloader_tag.bbclass
to the bootloader binary is the only part sent by the last USB transmission.
We think that the bootloader (U-Boot) is already started before the last transmission
and the SDPS endpoint is no longer present (ROM is no longer executing) thus uuu fails.
We solved it by keeping an untagged version of the binary and we use it for uuu.

I guess: since uuu already copes with this footer, probably to handle WIC images,
should we use ScanTerm function to detect this footer at the end of binary and just
remove it in ALL cases, in libuuu?
As a side note: we already know that since MX8QXP uses a different approach to get
container (flag ROM_INFO_HID_ROMAPI missing) and transmit size, it is not affected by this issue.

@eghidoli
Copy link
Author

Relevant pull request in meta-freescale: Freescale/meta-freescale#1764

@dolcini
Copy link

dolcini commented Mar 13, 2024

The issue can be reproduced with NXP i.MX8M Plus, when the loaded binary size is a multiple of 1020 bytes plus the UUUBURNXXOEUZX7 tag trailer that is added at the end.

@nxpfrankli
Copy link
Contributor

Supposed default flash.bin should not have UUUBURNXXOEUZX7 tag. We want to keep " uuu flash.bin " as simple as possible.

@dolcini
Copy link

dolcini commented Mar 13, 2024

Supposed default flash.bin should not have UUUBURNXXOEUZX7 tag. We want to keep " uuu flash.bin " as simple as possible.

At the same time, we should ensure a good user experience IMO.

We did invest quite a lot of resources to debug this issue, because what is happening is that you do a code change in U-Boot, you rebuild, and suddenly, if you are unlucky, uuu start fails in very unexpected ways loading the new binary.

And this is happening exclusively on i.MX8MP (we tested i.MX8MM, i.MX8QM, i.MX8QXP, .... and those are not affected).

The trailer (or tag, whatever you want to call it), was initially added in meta-freescale [1] by your colleague @thochstein. Maybe you can have a sync between the two of you?

[1] Freescale/meta-freescale@92acf99

@nxpfrankli
Copy link
Contributor

Strange!, why our internal daily build have not such problem.

@dolcini
Copy link

dolcini commented Mar 14, 2024

Strange!, why our internal daily build have not such problem.

@nxpfrankli: the binary size needs to be a multiple of 1020 bytes plus the UUUBURNXXOEUZX7 tag, as I wrote in my previous comment.

@eghidoli
Copy link
Author

I agree with @dolcini.
Exactly, since the full tag is around 40 bytes it fails when:
binarysize % 1020 <= 40 (sizeof tag starting from the first U)

@nxpfrankli
Copy link
Contributor

Thanks. I submit tickt to internal yocto team to fix this problem.

thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Apr 18, 2024
The UUU-tagged bootloader causes problems when used outside of the wic
context. See the fixes below.

Restore the default bootloader image to the untagged version and use
the tagged version only in the wic context.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Aug 13, 2024
The UUU tag on the default bootloader image causes problems when the
bootloader is used outside of the Wic context.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged, and only the Wic image will use the tagged
binaries.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Aug 22, 2024
The UUU tag on the default bootloader image causes problems when the
bootloader is used outside of the Wic context.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged, and only the Wic image will use the tagged
binaries.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Sep 9, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Sep 11, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
otavio added a commit to Freescale/meta-freescale that referenced this issue Sep 14, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: #1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
otavio added a commit to Freescale/meta-freescale that referenced this issue Sep 15, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: #1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Sep 15, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Sep 16, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
thochstein added a commit to nxp-upstream/meta-freescale that referenced this issue Sep 16, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: Freescale#1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
github-actions bot pushed a commit to Freescale/meta-freescale that referenced this issue Sep 17, 2024
Using the UUU-tagged bootloader image directly with UUU can cause UUU
to hang. The bootloader image is split on a certain transmit size, and
the hang occurs if the tag does not fit with the final bytes of the
bootloader image and must be split into a new transmit package.

The UUU tag is needed by UUU only in the SD Card image file itself so
that UUU can find the end of the boot partition.

Rework the design so the default bootloader and the default imx-boot
binaries are not tagged.

Also, extend the UUU tagging to fslc so it can gain the same benefit.

Fixes: #1762
Fixes: nxp-imx/mfgtools#416
Co-authored-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
(cherry picked from commit ef8b4c4)
@hiagofranco
Copy link

Hi @nxpfrankli, I have a few questions about this u-boot tag. Is this really necessary to make the binary work with UUU or this is only for performance? In other words, could we drop this tag and add it only to increase the write performance with the .wic image?

Right now this tag ins only being added inside meta-freescale layer, therefore if we manually build this binary and use it, it will not have the tag. This is not an ideal case, since the Yocto binary and should be as close as possible to the manually build binary. My proposal would be to drop this tag for all binaries and, in case we need to increase performance, we document how to add this tag and the user decides if they want to add the tag or not.

@nxpfrankli
Copy link
Contributor

u-boot tag was only used for extract boot-image from wic file. wic is raw image, layout like [MBR boot-image UUUTAG FAT EXT3(ROOTFS). uuu need tag information to get boot-image from big wic file. Some system have SPL or some pad data, which have not indicated in header meta information of boot-image. Yocto should only add UUUTAG after write boot-image into wic image. Yocto should have patch to fix your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants