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

aarch64/riscv64: make the microkit loader relocatable #220

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

Conversation

alwin-joshy
Copy link
Contributor

@alwin-joshy alwin-joshy commented Sep 20, 2024

This allows a microkit image to be loaded anywhere in memory at which point it will relocate itself to the LOADER_LINK_ADDRESS. These changes are based on the elfloader from seL4/seL4_tools.

Changes include:

  • crt0.s was changed to crt0.S and compiled with gcc to pass in LINK_ADDRESS
  • memmove and memcpy implementations were added
  • loader_data was changed to include a size field. This is the size of loader_data, the list of regions, and the regions themselves. These also need to be relocated to ensure that everything works correctly

Tested on: imx8mm with LOADER_LINK_ADDRESS = 0x41000000 and uboot load address parameter set to 0x42000000

@alwin-joshy
Copy link
Contributor Author

Added support for RISC-V. Tested on star64 by loading image at address 0x70000000 (LOADER_LINK_ADDRESS is 0x60000000)

@alwin-joshy alwin-joshy changed the title aarch64: make the microkit loader relocatable aarch64/riscv64: make the microkit loader relocatable Oct 28, 2024
Copy link
Collaborator

@Ivan-Velickovic Ivan-Velickovic left a comment

Choose a reason for hiding this comment

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

This would be great to get in before the next release. Main thing that would be good to change is to have the loader print if it is relocating itself and to where within memory it is relocating itself. This kind of thing tends to be fragile and so its good to print that info in debug mode.

So, the first thing the loader should do is still jump to main where it decides whether it needs to relocate itself or not, and print appropriately.

@alwin-joshy alwin-joshy force-pushed the relocatable branch 2 times, most recently from c6c2dd7 to a9beb22 Compare February 4, 2025 02:01
This allows a microkit image to be loaded anywhere in memory at which
point it will relocate itself to the LOADER_LINK_ADDRESS. These changes
are based on the elfloader from seL4/seL4_tools.

Changes include:

* crt0.s was changed to crt0.S and compiled with gcc to pass in
  LINK_ADDRESS
* memmove and memcpy implementations were added
* loader_data was changed to include a size field. This is the size
  of loader_data, the list of regions, and the regions themselves.
  These also need to be relocated to ensure that everything works
  correctly

Signed-off-by: Alwin Joshy <[email protected]>
This allows a microkit image to be loaded anywhere in memory at which
point it will relocate itself to the LOADER_LINK_ADDRESS. These changes
are based on the elfloader from seL4/seL4_tools.

See previous commit for more details.

Signed-off-by: Alwin Joshy <[email protected]>
With the changes to seL4 regarding reserving the SBI region
properly [1] it means we can no longer use 0x80200000
as a loader link address for this platform.

[1]: seL4/seL4@cf3a64b

Signed-off-by: Ivan Velickovic <[email protected]>
Signed-off-by: Ivan Velickovic <[email protected]>
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