Skip to content

Conversation

@dlech
Copy link
Member

@dlech dlech commented Jul 5, 2025

This cleans up some stuff related to using u-boot on the EV3 and updates to the latest mainline u-boot (with some Pybricks modifications).

dlech added 3 commits July 4, 2025 16:28
This script is meant to be run as an executable.

Not all systems will have python, so we should explicitly use python3.
Do not truncate u-boot.bin to 256KiB. This could cause crashes or other
undefined behavior. Instead, just fail with an error message.
Change the uImage type to standalone, not Linux kernel. Technically it
isn't u-boot either, but there isn't any other better option for the
OS selection.
@coveralls
Copy link

coveralls commented Jul 5, 2025

Coverage Status

coverage: 57.091%. remained the same
when pulling 65e5120 on dlech:ev3-u-boot-fixes
into a556fdb on pybricks:master.

@dlech dlech force-pushed the ev3-u-boot-fixes branch 2 times, most recently from 79efaa1 to 1fec940 Compare July 5, 2025 04:02
dlech added 3 commits July 4, 2025 23:17
Download u-boot.bin instead of committing it to the repository. We
should not be committing binary blobs to source control. instead,
we can commit the SHA256 checksum to ensure we are getting what we
expect and only download the file when needed.
The entry point address in the uImage was hardcoded to 0xC0008000, but
the actual entry point address is determined by the linker. It was just
by luck that the entry point was close to the load address and there
weren't any jumps between, so it eventually got to the entry point after
executing some random code.

Instead, we can scrape the entry point address from the ELF file using
`readelf`, which will adapt to any changes. For good measure, we also
scrape the load address, which is also determined by the linker script.
There was lots of trailing whitespace and one comment was misaligned.
@dlech dlech force-pushed the ev3-u-boot-fixes branch from 1fec940 to 65e5120 Compare July 5, 2025 04:17
@dlech dlech merged commit 77c2da2 into pybricks:master Jul 5, 2025
17 checks passed
@dlech dlech deleted the ev3-u-boot-fixes branch July 5, 2025 04:44

if len(uboot_blob) > UBOOT_MAX_SIZE:
print("u-boot file is bigger than expected. Using only the first 256KiB.")
uboot_blob = uboot_blob[:UBOOT_MAX_SIZE]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was initially used to use the original LEGO firmware as a source to extract u-boot. But if we have a proper u-boot now, we should indeed no longer need it.

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

Successfully merging this pull request may close these issues.

3 participants