HomeFreeBSD

Improve U-Boot API detection

Description

Improve U-Boot API detection

Until now, ubldr has been trying to locate the U-Boot API using a hint
address (U-Boot's current stack pointer), aligning it to 1MiB and going
over a 3MiB (or 1MiB in case of MIPS) memory region searching for a
valid API signature.

This change introduces an alternative way of doing this, namely the
following:

  • both U-Boot's bootelf and go commands actually pass argc and argv to the entry point (e.g., ubldr's start function, but they should also be passed over to main() transparently)
  • so, instead of trying to go and look for a valid API signature, we look at the parameters passed to main()
  • if there's an option '-a' with argument, which is a valid hexadecimal unsigned long number (x), we try to verify whether we have a valid API signature at address x. If so - we use it. If not - we fallback to the original way of locating the API signature.

The U-Boot change, which causes the API structure address to be
exported as an environment variable, was committed to mainline U-Boot
as commit 22aa61f707574dd569296f521fcfc46a05f51c48

Reviewed by: andrew, adrian
Approved by: adrian (mentor)
Sponsored by: Smartcom - Bulgaria AD
Differential Revision: https://reviews.freebsd.org/D5492

Details

Provenance
sgalabovAuthored on
Reviewer
andrew
Differential Revision
D5492: Improve U-Boot API detection
Parents
rS296563: Add new IOCTL compat shims for ABI breakage caused by r296510:
Branches
Unknown
Tags
Unknown