[PATCH v2 014/113] efi: payload: image: use assigned barebox loader type on x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Starting with Linux v6.2, there's a loader type assigned to barebox:

  commit a27e292b8a54e24f85181d949fac8c51fdec8ff3
  Author:     Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
  AuthorDate: Sun Oct 2 14:57:53 2022 +0200
  Commit:     Borislav Petkov <bp@xxxxxxx>
  CommitDate: Mon Oct 17 11:22:33 2022 +0200

      Documentation/x86/boot: Reserve type_of_loader=13 for barebox

      barebox[1], a bootloader for mostly ARM and MIPS embedded systems, can
      also be built as EFI payload for x86[2] to provide redundant power-fail
      safe, watchdog-supervised boot up.

      Since its v2015.09.0 release, it has been booting Linux on x86 with
      type_of_loader=0xff[3]. Reserve 13, the next free id, so that can be
      used instead in the future.

      [1]: https://www.barebox.org/
      [2]: https://www.barebox.org/doc/latest/boards/efi.html
      [3]: https://elixir.bootlin.com/barebox/v2022.09.0/source/common/efi/payload/image.c#L217

      Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
      Signed-off-by: Borislav Petkov <bp@xxxxxxx>
      Link: https://lore.kernel.org/r/20221002125752.3400831-1-a.fatoum@xxxxxxxxxxxxxx

Thus, let's start making use of that.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 efi/payload/image.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/efi/payload/image.c b/efi/payload/image.c
index b7f4b7560b4b..a8748da1df88 100644
--- a/efi/payload/image.c
+++ b/efi/payload/image.c
@@ -261,7 +261,10 @@ static int do_bootm_efi(struct image_data *data)
 	memset(boot_header, 0, 0x4000);
 	memcpy(boot_header, image_header, sizeof(*image_header));
 
-	boot_header->type_of_loader = 0xff;
+	/* Refer to Linux kernel commit a27e292b8a54
+	 * ("Documentation/x86/boot: Reserve type_of_loader=13 for barebox")
+	 */
+	boot_header->type_of_loader = 0x13;
 
 	if (data->initrd_file) {
 		tmp = read_file(data->initrd_file, &size);
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux