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

BIOS: Add BOOTP support #2070

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

m-byte
Copy link
Contributor

@m-byte m-byte commented Sep 12, 2024

Here are a few commits that enable BOOTP support in BIOS.

With this, it is possible to set IPs and filename from a server/computer. This simplifies usage of multiple devices in the same network.

Signed-off-by: Matthias Breithaupt <[email protected]>
By moving from platform dependent types like `unsigned int` to
cross-platform types like `uint32_t`, the behavior will remain as
expected even on different platforms/compilers.

I got some warnings when compiling for the simulator that hinted at a
potential problem with the previous code.

Signed-off-by: Matthias Breithaupt <[email protected]>
This adds support for UDP broadcasts and a helper function to get the
currently set IP. These changes are required for BOOTP support.

Signed-off-by: Matthias Breithaupt <[email protected]>
This adds BOOTP support as per RFC 951 and RFC 1532. Since most recent
BOOTP servers seem to require the magic cookie defined in RFC 1533, this
is also included.

N.b.: the secs field is set to the uptime, even though RFC 1532
specifies this as the time since the first BOOTREQUEST. Since the BIOS
usually won't be running for that long and the field is often ignored by
servers, this felt like a reasonable compromise.

Signed-off-by: Matthias Breithaupt <[email protected]>
This changes netboot to first try getting IPs and filename via BOOTP. If
`netboot` is run multiple times, the assigned values are cached.
To update this cache, a new command `bootp` has been added that will
always make a new request to the BOOTP server. After updating the cache,
`netboot` can be run again.

Signed-off-by: Matthias Breithaupt <[email protected]>
@m-byte
Copy link
Contributor Author

m-byte commented Sep 12, 2024

@enjoy-digital

@enjoy-digital
Copy link
Owner

Thanks @m-byte, this looks very interesting. I haven't yet closely looked at the code, but by default, do we still have the previous behavior with static IPs and no requirement for a BOOTP server on the other side? If not, I would prefer keeping it and enabling BOOTP through a build parameter.

@m-byte
Copy link
Contributor Author

m-byte commented Sep 13, 2024

@enjoy-digital it falls back to previous behavior after 3 failed attempts, with a relatively short time between those attempts (relative to the tftp timeout).

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.

2 participants