Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33447
Change subject: Documentation: Explain SimpleELF ......................................................................
Documentation: Explain SimpleELF
Explain coreboot's SELF format.
Change-Id: Ia217af7d39505393ed9324fbe53b4ca7f3069e2e Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/lib/payloads/index.md A Documentation/lib/payloads/selfboot.md M Documentation/payloads.md 3 files changed, 44 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/33447/1
diff --git a/Documentation/lib/payloads/index.md b/Documentation/lib/payloads/index.md index 44daef1..b8eca8c 100644 --- a/Documentation/lib/payloads/index.md +++ b/Documentation/lib/payloads/index.md @@ -6,6 +6,10 @@ coreboot supports multiple payloads, depending on the architecture of the selected mainboard.
+## SimpleELF + +- [SimpleELF format](selfboot.md) + ## FIT
- [uImage.FIT support](fit.md) diff --git a/Documentation/lib/payloads/selfboot.md b/Documentation/lib/payloads/selfboot.md new file mode 100644 index 0000000..62a4393 --- /dev/null +++ b/Documentation/lib/payloads/selfboot.md @@ -0,0 +1,28 @@ +# Simple ELF standard + +coreboot is able to use static linked ELF binaries as payload. +To reduce complexity the ELF binaries are converted to coreboot's SimpleELF +(SELF) format. +The payload is therefore split into multiple sections by `cbfstool` at +build time, each having a unique loading address and possible compression. + +## SELF loader +The SELF loader implementation can be found in `src/lib/selfboot.c`. +It decompresses the SELF sections and places them in memory. + +If the payload overlaps with the loading stage (*RAMSTAGE*) and +`CONFIG_RELOCATABLE_RAMSTAGE` is selected, the loading stage is moved to another +location in RAM. + +SELF payloads are **never** relocatable and will always be placed at the +address they specify. If it's not possible to load the payload at the specified +address, the system won't boot. + +### Calling conventions +The SELF payload is called with a pointer to the coreboot tables as first +argument. + +**Note:** The only exception is made on [RISC-V] which does use the *HARTID* +and a pointer to the *FDT* as arguments. + +[RISC-V]: ../../arch/riscv/index.md diff --git a/Documentation/payloads.md b/Documentation/payloads.md index b1eae61..650818e 100644 --- a/Documentation/payloads.md +++ b/Documentation/payloads.md @@ -7,6 +7,12 @@ There is various software in that space that is either explicitly written as payload or can be made to work as one.
+## ELF + +Executable and linking format (ELF) compatible static linked binaries can be +loaded as payload. +ELF binaries are loaded through the [SELF] boot mechanism. + ## SeaBIOS
[SeaBIOS](https://www.seabios.org) is an open source implementation of @@ -14,6 +20,7 @@ since. While originally written for emulators such as QEMU, it can be made to work as a coreboot payload and all the necessary code is in SeaBIOS' mainline code. +SeaBIOS is loaded through the [SELF] boot mechanism.
## Tianocore
@@ -40,3 +47,8 @@ firmware project drivers that often reinvent the wheel) and the ability to define boot policy with familiar tools, no matter if those are shell scripts or compiled userland programs written in C, Go or other programming languages. + +On x86 platforms Linux is loaded through the [SELF] boot mechanism, by adding a +*tampoline code* at the start of the kernel. + +[SELF]: lib/payloads/selfboot.md
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 1:
(1 comment)
When I think of SELF documentation, I think of the stuff in https://review.coreboot.org/cgit/coreboot.git/tree/Documentation/cbfs.txt#n3..., which still has a lot more details about the actual format than you have here. Shouldn't this be integrated there instead?
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... PS1, Line 23: argument. I don't think this is true on x86, the coreboot table address is still hardcoded there.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 1:
Patch Set 1:
(1 comment)
When I think of SELF documentation, I think of the stuff in https://review.coreboot.org/cgit/coreboot.git/tree/Documentation/cbfs.txt#n3..., which still has a lot more details about the actual format than you have here. Shouldn't this be integrated there instead?
The document hasn't been converted to markdown and won't show in our current documentation. Looking at it, it's very technical and might not give a high level overview at first sight.
Once it has been converted to markdown I would reference it as 'in detail' documentation.
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/33447/1/Documentation/payloads.md File Documentation/payloads.md:
https://review.coreboot.org/#/c/33447/1/Documentation/payloads.md@52 PS1, Line 52: tampoline trampoline
Hello Kyösti Mälkki, Aaron Durbin, ron minnich, Lee Leahy, build bot (Jenkins), Ting Shen, Philipp Hug, Xiang Wang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33447
to look at the new patch set (#2).
Change subject: Documentation: Explain SimpleELF ......................................................................
Documentation: Explain SimpleELF
Give a high level view about the mechanism. As CBFS.txt hasn't been converted to markdown it's not referenced here. Once it has been converted, it can give developers detailed information about SELF.
Change-Id: Ia217af7d39505393ed9324fbe53b4ca7f3069e2e Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/lib/payloads/index.md A Documentation/lib/payloads/selfboot.md M Documentation/payloads.md 3 files changed, 44 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/33447/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 2:
(1 comment)
I've tried to convert the CBFS documentation to markdown, but it's very, very old.
https://review.coreboot.org/#/c/33447/1/Documentation/payloads.md File Documentation/payloads.md:
https://review.coreboot.org/#/c/33447/1/Documentation/payloads.md@52 PS1, Line 52: tampoline
trampoline
Done
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/33447/2/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/2/Documentation/lib/payloads/selfboot.... PS2, Line 3: static statically
Hello Kyösti Mälkki, Aaron Durbin, ron minnich, Lee Leahy, build bot (Jenkins), Ting Shen, Philipp Hug, Xiang Wang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33447
to look at the new patch set (#3).
Change subject: Documentation: Explain SimpleELF ......................................................................
Documentation: Explain SimpleELF
Give a high level view about the mechanism. As CBFS.txt hasn't been converted to markdown it's not referenced here. Once it has been converted, it can give developers detailed information about SELF.
Change-Id: Ia217af7d39505393ed9324fbe53b4ca7f3069e2e Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M Documentation/lib/payloads/index.md A Documentation/lib/payloads/selfboot.md M Documentation/payloads.md 3 files changed, 48 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/47/33447/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... PS1, Line 23: argument.
I don't think this is true on x86, the coreboot table address is still hardcoded there.
True, but looks looks like a bug to me. Is there any historic reason not to pass the argument?
https://review.coreboot.org/#/c/33447/2/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/2/Documentation/lib/payloads/selfboot.... PS2, Line 3: static
statically
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/33447/3/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/3/Documentation/lib/payloads/selfboot.... PS3, Line 1: Simple ELF In the commit message and the text, you spell it without a space. I prefer the spelling *with* space though.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/#/c/33447/1/Documentation/lib/payloads/selfboot.... PS1, Line 23: argument.
True, but looks looks like a bug to me. […]
It's not really a bug, just an architecture-dependent detail.
x86 was the first architecture and the coreboot table was found at a hardcoded address there historically. When we added Arm support, we couldn't really hardcode an address because on Arm every SoC has their own address map and you can't make architecture-wide assumptions about the physical memory layout (e.g. that 0x0 or 0xf0000 are always valid DRAM addresses). So we decided to pass the coreboot table address as a parameter to the payload and other architectures later copied it from there (mips and arm64, at least... not actually sure what riscv does).
We could pass it as an argument on x86 as well, but we'd probably still need to keep it in its hardcoded location anyway.
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33447 )
Change subject: Documentation: Explain SimpleELF ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/c/coreboot/+/33447/3/Documentation/lib/payloads/... File Documentation/lib/payloads/selfboot.md:
https://review.coreboot.org/c/coreboot/+/33447/3/Documentation/lib/payloads/... PS3, Line 3: statically linked [ELF] binaries Also other binaries, like Linux images and raw binaries like u-boot.
https://review.coreboot.org/c/coreboot/+/33447/3/Documentation/lib/payloads/... PS3, Line 24: : **Note:** One exception is made on x86 which does not pass arguments to the : payload. WIP to change that.
Martin L Roth has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/33447?usp=email )
Change subject: Documentation: Explain SimpleELF ......................................................................
Abandoned
This patch has not been touched in over 12 months. Anyone who wants to take over work on this patch, please feel free to restore it and do any work needed to get it merged. If you create a new patch based on this work, please credit the original author.