Matt DeVillier has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86656?usp=email )
Change subject: Documentation/lib/rmodules.md: Update simple binary explanation ......................................................................
Documentation/lib/rmodules.md: Update simple binary explanation
Signed-off-by: Maximilian Brune maximilian.brune@9elements.com Change-Id: I9cf21b4258758b18f0d3c9316c9aa32cc0d9c44f Reviewed-on: https://review.coreboot.org/c/coreboot/+/86656 Reviewed-by: Nicholas Chin nic.c3.14@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M Documentation/lib/rmodules.md 1 file changed, 18 insertions(+), 2 deletions(-)
Approvals: Nicholas Chin: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/Documentation/lib/rmodules.md b/Documentation/lib/rmodules.md index 8a707b8..4402742 100644 --- a/Documentation/lib/rmodules.md +++ b/Documentation/lib/rmodules.md @@ -35,8 +35,24 @@ 1. coreboot stages (postcar, ramstage) 2. simple binaries (smm, smmstub, sipi_vector)
-They are actually handled the same by the build system and only differ -in the fact, that they are either coreboot stages or they are not. +There is one important difference in how they are handled: +The simple binaries are compiled into rmodules the same as coreboot +stages are, but the simple binaries are always directly linked to a +stage. Since rmodules are ELF files as well, we can easily link them +to the stages in which we need them (usually postcar or ramstage). +So they are not really separate modules anymore, but still retain +the ability to accept rmodule_parameters. +Since the simple binaries are usually very small, linking them directly +into the stage (e.g. ramstage or postcar) avoids having to fetch them +from CBFS and running all that code to fetch a few hundred bytes of +code. So the build system handles them as follows: +1. create rmodule (which is an ELF file) from source files +2. remove all the ELF headers and sections that are not loadable using +`objcopy -O binary` +3. from this, create an object file, which usually has the self invented +.manual file extension, which can be linked to the appropriate stage +4. add the generated .manual file as "source" file to the stage we want +to link it to
In the end the ELF files will have three different ELF sections, which are all created by the rmodtool.