x86/Documentation: explain LINUX_EFI_INITRD_MEDIA_GUID
Subsystems (3)
PATCH 1/1 x86/Documentation: explain LINUX_EFI_INITRD_MEDIA_GUID
From: Hugo Osvaldo Barrera <[email protected]>
Since the Handover Protocol was deprecated, the recommended approach is to provide an initrd using a UEFI boot service with the LINUX_EFI_INITRD_MEDIA_GUID device path. Documentation for the new approach has been no more than an admonition with a link to an existing implementation.
Provide a short explanation of this functionality, to ease future implementations without having to reverse engineer existing ones.
--- Documentation/admin-guide/efi-stub.rst | 3 +++ Documentation/arch/x86/boot.rst | 35 ++++++++++++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-)
Documentation/admin-guide/efi-stub.rst +3 -0
@@ -79,6 +79,9 @@ because the image we're executing is interpreted by the EFI shell, which understands relative paths, whereas the rest of the command line is passed to bzImage.efi. +.. hint:: + It is also possible to provide an initrd using UEFI boot services. See + :ref:`pe-coff-entry-point` for details. The "dtb=" option -----------------
Documentation/arch/x86/boot.rst +27 -8
@@ -1431,12 +1431,31 @@ The boot loader *must* fill out the following fields in bp:: All other fields should be zero. .. note:: - The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF - entry point, combined with the LINUX_EFI_INITRD_MEDIA_GUID based initrd - loading protocol (refer to [0] for an example of the bootloader side of - this), which removes the need for any knowledge on the part of the EFI - bootloader regarding the internal representation of boot_params or any - requirements/limitations regarding the placement of the command line - and ramdisk in memory, or the placement of the kernel image itself. + The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF + entry point described below. -[0] https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _pe-coff-entry-point: + +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the +``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd. + +This approach removes the need for any knowledge on the part of the EFI +bootloader regarding the internal representation of boot_params or any +requirements/limitations regarding the placement of the command line and +ramdisk in memory, or the placement of the kernel image itself. + +For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225
base-commit: f44a29784f685804d9970cfb0d3439c9e30981d7
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Randy Dunlap
reviewerHi Bagas,
This mostly looks good to me. I have a couple of small comments below.
Quoted 44 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
Since the Handover Protocol was deprecated, the recommended approach is to provide an initrd using a UEFI boot service with the
LINUX_EFI_INITRD_MEDIA_GUIDdevice path. Documentation for the new approach has been no more than an admonition with a link to an existing implementation.Provide a short explanation of this functionality, to ease future implementations without having to reverse engineer existing ones.
Signed-off-by Hugo Osvaldo Barrera <[email protected]>[Bagas: Don't use :ref: link to EFI stub documentation]Co-developed-by Bagas Sanjaya <[email protected]>Signed-off-by Bagas Sanjaya <[email protected]>--- Documentation/admin-guide/efi-stub.rst | 3 +++ Documentation/arch/x86/boot.rst | 35 ++++++++++++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-)Documentation/admin-guide/efi-stub.rst +3
-0@@ -79,6 +79,9 @@ because the image we're executing is interpreted by the EFI shell, which understands relative paths, whereas the rest of the command line is passed to bzImage.efi. +.. hint:: + It is also possible to provide an initrd using UEFI boot services. See + :ref:`pe-coff-entry-point` for details. The "dtb=" option -----------------Documentation/arch/x86/boot.rst +4
-0+.. _pe-coff-entry-point: + +PE/COFF entry point +===================
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1450
Quoted 10 lines
Documentation/arch/x86/boot.rst +10
-0+ +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the +``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd.
drivers/firmware/efi/libstub/efi-stub-helper.c (line 509) says LoadFile2 protocol. Is that the same as the LoadFile function?
https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0
(the link below) also says LoadFile2() 4 times (and LoadFile 0 times).
thanks.
Signature · 1 line
~Randy
Quoted 19 lines · Randy Dunlap
Quoted 4 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +3
-0+ +PE/COFF entry point +===================Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1450
Quoted 10 lines
Documentation/arch/x86/boot.rst +10
-0+ +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the +``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd.
drivers/firmware/efi/libstub/efi-stub-helper.c(line 509) says LoadFile2 protocol. Is that the same as the LoadFile function?
Quoted 2 lines
https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0
(the link below) also saysLoadFile2()4 times (and LoadFile 0 times).
From UEFI spec [1], both LoadFile and LoadFile2 protocol versions of LoadFile() function has same prototype but somewhat different in behavior. To answer your question, however, I think so.
EFI folks, what are your opinions?
Thanks.
[1]: https://uefi.org/specs/UEFI/2.10/13_Protocols_Media_Access.html
Signature · 1 line
An old man doll... just what I always wanted! - Clara
H. Peter Anvin
reviewerQuoted 27 lines · Bagas Sanjaya
Quoted 19 lines · Randy Dunlap
Quoted 4 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +3
-0+ +PE/COFF entry point +===================Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1450
Quoted 10 lines
Documentation/arch/x86/boot.rst +10
-0+ +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the +``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd.
drivers/firmware/efi/libstub/efi-stub-helper.c(line 509) says LoadFile2 protocol. Is that the same as the LoadFile function?Quoted 2 lines
https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0
(the link below) also saysLoadFile2()4 times (and LoadFile 0 times).From UEFI spec [1], both LoadFile and LoadFile2 protocol versions of
LoadFile()function has same prototype but somewhat different in behavior. To answer your question, however, I think so.
Quoted 6 lines
EFI folks, what are your opinions?
Thanks.
[1]: https://uefi.org/specs/UEFI/2.10/13_Protocols_Media_Access.html
Sounds like the code was updated but not the documentation.
Ard Biesheuvel
maintainerQuoted 29 lines · H. Peter Anvin
Quoted 27 lines · Bagas Sanjaya
Quoted 19 lines · Randy Dunlap
Quoted 4 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +3
-0+ +PE/COFF entry point +===================Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1450
Quoted 10 lines
Documentation/arch/x86/boot.rst +10
-0+ +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the +``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd.
drivers/firmware/efi/libstub/efi-stub-helper.c(line 509) says LoadFile2 protocol. Is that the same as the LoadFile function?Quoted 2 lines
https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0
(the link below) also saysLoadFile2()4 times (and LoadFile 0 times).From UEFI spec [1], both LoadFile and LoadFile2 protocol versions of
LoadFile()function has same prototype but somewhat different in behavior. To answer your question, however, I think so.
Quoted 8 lines
Quoted 6 lines
EFI folks, what are your opinions?
Thanks.
[1]: https://uefi.org/specs/UEFI/2.10/13_Protocols_Media_Access.html
Sounds like the code was updated but not the documentation.
The UEFI spec defines two protocols, LoadFile and LoadFile2, under two different GUIDs. They differ slightly in behavior when used to boot the OS loader from the boot manager, but are identical when used in other contexts.
The protocol definition (i.e., the struct layout) is identical: they both implement a LoadFile() method with the same prototype,
So the answer the question: the LoadFile2 *protocol* is not the same as the LoadFile *function*. And to be pedantic, no LoadFile function is defined in the spec. It does define LoadFile::LoadFile() and LoadFile2::LoadFile() protocol methods.
Ard Biesheuvel
maintainerQuoted 27 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
Since the Handover Protocol was deprecated, the recommended approach is to provide an initrd using a UEFI boot service with the
LINUX_EFI_INITRD_MEDIA_GUIDdevice path. Documentation for the new approach has been no more than an admonition with a link to an existing implementation.Provide a short explanation of this functionality, to ease future implementations without having to reverse engineer existing ones.
Signed-off-by Hugo Osvaldo Barrera <[email protected]>[Bagas: Don't use :ref: link to EFI stub documentation]Co-developed-by Bagas Sanjaya <[email protected]>Signed-off-by Bagas Sanjaya <[email protected]>--- Documentation/admin-guide/efi-stub.rst | 3 +++ Documentation/arch/x86/boot.rst | 35 ++++++++++++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-)Documentation/admin-guide/efi-stub.rst +0
-0
Documentation/admin-guide/efi-stub.rst because the image we're executing is interpreted by the EFI shell, · line 85
Quoted 7 lines
Documentation/admin-guide/efi-stub.rst +3
-0@@ -79,6 +79,9 @@ because the image we're executing is interpreted by the EFI shell, which understands relative paths, whereas the rest of the command line is passed to bzImage.efi. +.. hint:: + It is also possible to provide an initrd using UEFI boot services. See + :ref:`pe-coff-entry-point` for details.
Better say 'using a Linux-specific UEFI protocol at boot time'. The boot services are a specific set of APIs none of which have anything to do with initrd loading.
Quoted 22 lines
Documentation/admin-guide/efi-stub.rst +0
-0The "dtb=" option -----------------Documentation/arch/x86/boot.rst +3
-8@@ -1431,12 +1431,31 @@ The boot loader *must* fill out the following fields in bp:: All other fields should be zero. .. note:: - The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF - entry point, combined with the LINUX_EFI_INITRD_MEDIA_GUID based initrd - loading protocol (refer to [0] for an example of the bootloader side of - this), which removes the need for any knowledge on the part of the EFI - bootloader regarding the internal representation of boot_params or any - requirements/limitations regarding the placement of the command line - and ramdisk in memory, or the placement of the kernel image itself. + The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF + entry point described below. -[0] https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1447
Quoted 10 lines
Documentation/arch/x86/boot.rst +10
-0+ +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the
... which carries implementations of the ``EFI_LOAD_FILE2`` protocol and the device path protocol exposing the ``LINUX_EFI_INITRD_MEDIA_GUID`` vendor media device path.
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1451
Quoted 4 lines
Documentation/arch/x86/boot.rst +4
-0+``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd. +
... will invoke LoadFile2::LoadFile() method on the registered protocol to instruct the firmware to load the initrd into a memory location chosen by the kernel/EFI stub.
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1461
Quoted 11 lines
Documentation/arch/x86/boot.rst +10
-0+This approach removes the need for any knowledge on the part of the EFI +bootloader regarding the internal representation of boot_params or any +requirements/limitations regarding the placement of the command line and +ramdisk in memory, or the placement of the kernel image itself. + +For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225
What is candyboot, and why are we adding this plug for it into the Linux documentation?
Quoted 60 lines · Ard Biesheuvel
Quoted 27 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
Since the Handover Protocol was deprecated, the recommended approach is to provide an initrd using a UEFI boot service with the
LINUX_EFI_INITRD_MEDIA_GUIDdevice path. Documentation for the new approach has been no more than an admonition with a link to an existing implementation.Provide a short explanation of this functionality, to ease future implementations without having to reverse engineer existing ones.
Signed-off-by Hugo Osvaldo Barrera <[email protected]>[Bagas: Don't use :ref: link to EFI stub documentation]Co-developed-by Bagas Sanjaya <[email protected]>Signed-off-by Bagas Sanjaya <[email protected]>--- Documentation/admin-guide/efi-stub.rst | 3 +++ Documentation/arch/x86/boot.rst | 35 ++++++++++++++++++++------ 2 files changed, 30 insertions(+), 8 deletions(-)Documentation/admin-guide/efi-stub.rst +0
-0Documentation/admin-guide/efi-stub.rst because the image we're executing is interpreted by the EFI shell, · line 85
Quoted 7 lines
Documentation/admin-guide/efi-stub.rst +3
-0@@ -79,6 +79,9 @@ because the image we're executing is interpreted by the EFI shell, which understands relative paths, whereas the rest of the command line is passed to bzImage.efi. +.. hint:: + It is also possible to provide an initrd using UEFI boot services. See + :ref:`pe-coff-entry-point` for details.Better say 'using a Linux-specific UEFI protocol at boot time'. The boot services are a specific set of APIs none of which have anything to do with initrd loading.
Quoted 20 lines
Documentation/admin-guide/efi-stub.rst +0
-0The "dtb=" option -----------------Documentation/arch/x86/boot.rst +2
-7@@ -1431,12 +1431,31 @@ The boot loader *must* fill out the following fields in bp:: All other fields should be zero. .. note:: - The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF - entry point, combined with the LINUX_EFI_INITRD_MEDIA_GUID based initrd - loading protocol (refer to [0] for an example of the bootloader side of - this), which removes the need for any knowledge on the part of the EFI - bootloader regarding the internal representation of boot_params or any - requirements/limitations regarding the placement of the command line - and ramdisk in memory, or the placement of the kernel image itself. + The EFI Handover Protocol is deprecated in favour of the ordinary PE/COFF + entry point described below.
Quoted 10 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1445
Quoted 10 lines
Documentation/arch/x86/boot.rst +9
-1-[0] https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _pe-coff-entry-point: + +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. +
This should be a link rather than a path to the source file.
Quoted 11 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1447
Quoted 2 lines
Documentation/arch/x86/boot.rst +2
-0+The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the... which carries implementations of the ``EFI_LOAD_FILE2`` protocol and the device path protocol exposing the ``LINUX_EFI_INITRD_MEDIA_GUID`` vendor media device path.
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1451
Quoted 4 lines
Documentation/arch/x86/boot.rst +4
-0+``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device +path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd. +
Might be worth mentioning that this protocol is defined in the UEFI spec, section 13.2.
Quoted 5 lines
... will invoke
LoadFile2::LoadFile()method on the registered protocol to instruct the firmware to load the initrd into a memory location chosen by the kernel/EFI stub.
Quoted 14 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1461
Quoted 11 lines
Documentation/arch/x86/boot.rst +10
-0+This approach removes the need for any knowledge on the part of the EFI +bootloader regarding the internal representation of boot_params or any +requirements/limitations regarding the placement of the command line and +ramdisk in memory, or the placement of the kernel image itself. + +For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225What is candyboot, and why are we adding this plug for it into the Linux documentation?
It's a UEFI stub loader which can load the Linux kernel and provide it with an initramfs using the above described protocol.
The original version of this patch was based on my notes researching _how_ to implement this stub loader. The implementation is quite minimal, so I think it serves as a useful reference example.
Signature · 1 line
Hugo
Quoted 15 lines · Ard Biesheuvel
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1447
Quoted 9 lines · Bagas Sanjaya
Documentation/arch/x86/boot.rst +9
-0+PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. + +The stub loader can request the initrd via a UEFI protocol. For this to work, +the firmware or bootloader needs to register a handle which implements the... which carries implementations of the ``EFI_LOAD_FILE2`` protocol and the device path protocol exposing the ``LINUX_EFI_INITRD_MEDIA_GUID`` vendor media device path.
Quoted 8 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1451
Quoted 4 lines
+``EFI_LOAD_FILE2`` protocol with the ``LINUX_EFI_INITRD_MEDIA_GUID`` device
Documentation/arch/x86/boot.rst +3
-0+path. In this case, a kernel booting via the EFI stub will use the ``LoadFile`` +function on the registered handle to obtain a reference to the initrd. +... will invoke
LoadFile2::LoadFile()method on the registered protocol to instruct the firmware to load the initrd into a memory location chosen by the kernel/EFI stub.
Thanks for the wording suggestions!
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 13 lines · Hugo Osvaldo Barrera
Quoted 10 lines · Ard Biesheuvel
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1445
Quoted 9 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +8
-0+ +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. +This should be a link rather than a path to the source file.
I think you miss the point of Jon's comment on your original submission [1]. Long story short, in Sphinx, one would cross-reference to other documentation files (so-called internal linking) either with :doc: or :ref: directives. In case of kernel docs, there is third and preferred way: simply mentioning the full docs path. The latter is preferred as it is simpler and also allows building only portion of docs (with make SPHINXDIRS=<dir>) without triggering any reference warnings. Hence why I did addressing his comment. For more information, see Documentation/doc-guide/sphinx.rst.
Thanks.
[1]: https://lore.kernel.org/all/[email protected]/
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 15 lines · Bagas Sanjaya
Quoted 13 lines · Hugo Osvaldo Barrera
Quoted 10 lines · Ard Biesheuvel
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1445
Quoted 9 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +8
-0+ +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. +This should be a link rather than a path to the source file.
Quoted 9 lines
I think you miss the point of Jon's comment on your original submission [1]. Long story short, in Sphinx, one would cross-reference to other documentation files (so-called internal linking) either with :doc: or :ref: directives. In case of kernel docs, there is third and preferred way: simply mentioning the full docs path. The latter is preferred as it is simpler and also allows building only portion of docs (with make SPHINXDIRS=<dir>) without triggering any reference warnings. Hence why I did addressing his comment. For more information, see
Documentation/doc-guide/sphinx.rst.
The RST files are source files to produce documentation in HTML and PDF. If you write the path to another source file, the resulting HTML files don't have any link and the reference is completely lost.
Given the path Documentation/admin-guide/efi-stub.rst, if I'm looking at
https://www.kernel.org/doc/html/latest/arch/x86/boot.html, I'd have on idea where this path is pointing me to.
WRT Jon's comment on the original submission, I do agree that the label is unnecessary, since we can link to the page directly without a label at the top.
Quoted 9 lines
Thanks.
[1]: https://lore.kernel.org/all/[email protected]/
Signature · 4 lines
An old man doll... just what I always wanted! - Clara Attachments: * signature.asc
Signature · 1 line
Hugo
Ard Biesheuvel
maintainerQuoted 8 lines · Hugo Osvaldo Barrera
Quoted 4 lines · Ard Biesheuvel
Quoted 3 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
...
Quoted 10 lines
Quoted 9 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1461
Quoted 6 lines
Documentation/arch/x86/boot.rst +5
-0+For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225What is candyboot, and why are we adding this plug for it into the Linux documentation?
Quoted 7 lines
It's a UEFI stub loader which can load the Linux kernel and provide it with an initramfs using the above described protocol.
The original version of this patch was based on my notes researching _how_ to implement this stub loader. The implementation is quite minimal, so I think it serves as a useful reference example.
I think one example reference is sufficient, and I think piggybacking a plug of your own project onto a documentation refactoring patch is slightly dodgy, to be completely honest.
Where is candyboot used, and what does it add to the existing u-boot reference, which is the most widely used EFI implementation after EDK2 for non-x86 systems? If anything, we should be referring to the OVMF implementation here.
Quoted 23 lines · Ard Biesheuvel
Quoted 8 lines · Hugo Osvaldo Barrera
Quoted 4 lines · Ard Biesheuvel
Quoted 3 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
...
Quoted 13 lines
Quoted 9 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1461
Quoted 6 lines
Documentation/arch/x86/boot.rst +5
-0+For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225What is candyboot, and why are we adding this plug for it into the Linux documentation?
It's a UEFI stub loader which can load the Linux kernel and provide it with an initramfs using the above described protocol.
Quoted 8 lines
Quoted 4 lines
The original version of this patch was based on my notes researching _how_ to implement this stub loader. The implementation is quite minimal, so I think it serves as a useful reference example.
I think one example reference is sufficient, and I think piggybacking a plug of your own project onto a documentation refactoring patch is slightly dodgy, to be completely honest.
I don't know what kind of reaction you're expecting. The documentation improvements were a side-effect of developing candyboot. You're free to exclude the mention if you feel it is inadequate, but I don't appreciate the personal attack.
Quoted 3 lines
Where is candyboot used, and what does it add to the existing u-boot reference, which is the most widely used EFI implementation after EDK2 for non-x86 systems?
candyboot can be used to produce a single bootable UEFI binary bundling the kernel, cmdline and initrd. This binary can be signed to boot using SecureBoot on regular consumer hardware. It is typically useful is situations where u-boot isn't supported, and useless in most situations where u-boot is usable.
The use-case is somewhat tangential here; the reference is merely as a minimal (single file) reference implementation of the feature being described here.
Quoted 1 line
If anything, we should be referring to the OVMF implementation here.
Agreed (I didn't know of its existence), here's a link to it:
Signature · 1 line
Hugo
Ard Biesheuvel
maintainerQuoted 31 lines · Hugo Osvaldo Barrera
Quoted 28 lines · Ard Biesheuvel
Quoted 8 lines · Hugo Osvaldo Barrera
Quoted 4 lines · Ard Biesheuvel
Quoted 3 lines · Bagas Sanjaya
From: Hugo Osvaldo Barrera <[email protected]>
...
Quoted 17 lines
Quoted 9 lines
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1461
Quoted 6 lines
Documentation/arch/x86/boot.rst +5
-0+For sample implementations, refer to `the original u-boot implementation`_ or +`the implementation in candyboot`_. + +.. _the original u-boot implementation: https://github.com/u-boot/u-boot/commit/ec80b4735a593961fe701cc3a5d717d4739b0fd0 +.. _the implementation in candyboot: https://git.sr.ht/~whynothugo/candyboot/tree/4097b2538d7f1cf85f03922bf42409490b666202/item/src/main.rs#L225What is candyboot, and why are we adding this plug for it into the Linux documentation?
It's a UEFI stub loader which can load the Linux kernel and provide it with an initramfs using the above described protocol.
The original version of this patch was based on my notes researching _how_ to implement this stub loader. The implementation is quite minimal, so I think it serves as a useful reference example.
Quoted 9 lines
Quoted 3 lines
I think one example reference is sufficient, and I think piggybacking a plug of your own project onto a documentation refactoring patch is slightly dodgy, to be completely honest.
I don't know what kind of reaction you're expecting. The documentation improvements were a side-effect of developing candyboot. You're free to exclude the mention if you feel it is inadequate, but I don't appreciate the personal attack.
No personal attack intended. I merely commented on the changes themselves, not on your person, and the patch incorporates a reference to your own project without calling that out in the commit log. I'm sure it is a project you care about, and it looks like nice work (no irony here) but it also looks like self-promotion being injected into the Linux Documentation, given that the project in question is one of many that implement LINUX_EFI_INITRD_MEDIA_GUID, including GRUB and OVMF/edk2 which are much more widely known and much more relevant to the audience.
And I am not the Documentation/ maintainer, so it is not up to me to include or exclude the reference - that is the maintainer's job, which is why I felt it appropriate to bring this to the attention of the submitter and of the other people following this thread.
And this is all I am going to say about this.
Randy Dunlap
reviewerHi,
Quoted 28 lines · Hugo Osvaldo Barrera
Quoted 15 lines · Bagas Sanjaya
Quoted 13 lines · Hugo Osvaldo Barrera
Quoted 10 lines · Ard Biesheuvel
Documentation/arch/x86/boot.rst The boot loader *must* fill out the following fields in bp:: · line 1445
Quoted 9 lines · Bagas Sanjaya
+.. _pe-coff-entry-point:
Documentation/arch/x86/boot.rst +8
-0+ +PE/COFF entry point +=================== + +When compiled with ``CONFIG_EFI_STUB=y``, the kernel can be executed as a +regular PE/COFF binary. See Documentation/admin-guide/efi-stub.rst for +implementation details. +This should be a link rather than a path to the source file.
Quoted 9 lines
I think you miss the point of Jon's comment on your original submission [1]. Long story short, in Sphinx, one would cross-reference to other documentation files (so-called internal linking) either with :doc: or :ref: directives. In case of kernel docs, there is third and preferred way: simply mentioning the full docs path. The latter is preferred as it is simpler and also allows building only portion of docs (with make SPHINXDIRS=<dir>) without triggering any reference warnings. Hence why I did addressing his comment. For more information, see
Documentation/doc-guide/sphinx.rst.
Quoted 7 lines
The RST files are source files to produce documentation in HTML and PDF. If you write the path to another source file, the resulting HTML files don't have any link and the reference is completely lost.
Given the path
Documentation/admin-guide/efi-stub.rst, if I'm looking at
https://www.kernel.org/doc/html/latest/arch/x86/boot.html, I'd have on idea where this path is pointing me to.
I applied the original patch from Bagas. I'm looking at arch/x86/boot.html. It shows me:
1.16. PE/COFF entry point
When compiled with CONFIG_EFI_STUB=y, the kernel can be executed as a regular PE/COFF binary. See The EFI Boot Stub for implementation details.
where "The EFI Boot Stub" is (in my browser) in blue and underlined and is a link to admin-guide/efi-stub.html
Is this what you are saying will not happen or am I completely confused? Kernel documentation automarkup handles Documentation/.../*.rst file links automatically.
Quoted 3 lines
WRT Jon's comment on the original submission, I do agree that the label is unnecessary, since we can link to the page directly without a label at the top.
Thanks.
Signature · 1 line
~Randy