rpi3: Enable verified boot from FIT image
PATCH 1/1 rpi3: Enable verified boot from FIT image
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
board/raspberrypi/rpi/rpi.c +6 -0
@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel.
@@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob.
@@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */
@@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif int ft_board_setup (void *blob,bd_t *bd) {
include/configs/rpi.h +14 -1
@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \ + "boot_a_script=" \ + "load ${devtype} ${devnum}:${distro_bootpart} " \ + "${scriptaddr} ${prefix}${script}; " \ + "iminfo ${scriptaddr};" \ + "if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
Signature · 1 line
2.7.4
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 9 lines · Jun Nie <[email protected]> 于2019年7月11日周四 上午11:56写道:
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Hi Matthias,
Do you have comments on verified boot config here?
Thanks!
Jun
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }
Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?
You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
Matthias
Yes, it overwrite the boot_a_script in distro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.
Quoted 12 lines
Quoted 12 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 96 lines · Jun Nie <[email protected]> 于2019年7月31日周三 下午4:16写道:
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?
Quoted 21 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.Quoted 12 lines
Quoted 12 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
Hi Matthias,
How do you think to merge this patch?
Regards,
Jun
PATCH 1/1 rpi3: Enable verified boot from FIT image
In reply to Jun Nie+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?
Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add FIT_BOOT_CMD to that?
Regards,
Matthias
Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 108 lines · Matthias Brugger
+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.
Quoted 5 lines
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add
FIT_BOOT_CMDto that?Regards,
Matthias
The idea of distro-boot was to make it easier for Linux distributions to update the information needed by U-Boot to find the right kernel and ramdisk.
According to doc/README.distro file extlinux.conf should be used for the communication between the distribution and U-Boot. Some distributions like Debian still rely on boot.scr.
Many distributions (OpenBSD, FreeBSD, Suse, Fedora) have moved from distro-boot to UEFI as booting standard. Unfortunately we have not documented our support for this in doc/README.distro (TODO for me). Takahiro is working on secure boot using UEFI. Once completed this could obsolete FIT images.
Would we expect Linux distributions to provide FIT images upon kernel updates?
Is there any Linux distribution doing so?
Only if we can answer these questions with yes, adding FIT_BOOT_CMD to distro-boot would make sense to me.
Best regards
Heinrich
Quoted 15 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 123 lines · Heinrich Schuchardt
Quoted 108 lines · Matthias Brugger
+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.Quoted 5 lines
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add
FIT_BOOT_CMDto that?Regards,
MatthiasThe idea of distro-boot was to make it easier for Linux distributions to update the information needed by U-Boot to find the right kernel and ramdisk.
According to doc/README.distro file extlinux.conf should be used for the communication between the distribution and U-Boot. Some distributions like Debian still rely on boot.scr.
Quoted 5 lines
Many distributions (OpenBSD, FreeBSD, Suse, Fedora) have moved from distro-boot to UEFI as booting standard. Unfortunately we have not documented our support for this in doc/README.distro (TODO for me). Takahiro is working on secure boot using UEFI. Once completed this could obsolete FIT images.
Well, UEFI secure boot handles PE(+) images and doesn't cover dtb, initrd or whatever FIT may contain.
-Takahiro Akashi
Quoted 27 lines
Would we expect Linux distributions to provide FIT images upon kernel updates?
Is there any Linux distribution doing so?Only if we can answer these questions with yes, adding
FIT_BOOT_CMDto distro-boot would make sense to me.Best regards
Heinrich
Quoted 15 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
PATCH 1/1 rpi3: Enable verified boot from FIT image
In reply to Heinrich SchuchardtQuoted 130 lines · Heinrich Schuchardt <[email protected]> 于2019年9月2日周一 下午7:19写道:
Quoted 108 lines · Matthias Brugger
+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.Quoted 5 lines
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add
FIT_BOOT_CMDto that?Regards,
MatthiasThe idea of distro-boot was to make it easier for Linux distributions to update the information needed by U-Boot to find the right kernel and ramdisk.
According to doc/README.distro file extlinux.conf should be used for the communication between the distribution and U-Boot. Some distributions like Debian still rely on boot.scr.
Many distributions (OpenBSD, FreeBSD, Suse, Fedora) have moved from distro-boot to UEFI as booting standard. Unfortunately we have not documented our support for this in doc/README.distro (TODO for me). Takahiro is working on secure boot using UEFI. Once completed this could obsolete FIT images.
Quoted 3 lines
Would we expect Linux distributions to provide FIT images upon kernel updates?
Is there any Linux distribution doing so?
Embedded Linux, a new distribution from ARM, is using FIT images to update kernel.
https://os.mbed.com/docs/mbed-linux-os/v0.8/welcome/index.html
Jun
Quoted 24 lines
Only if we can answer these questions with yes, adding
FIT_BOOT_CMDto distro-boot would make sense to me.Best regards
Heinrich
Quoted 15 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
include/configs/rpi.h +2
-1#define CONFIG_EXTRA_ENV_SETTINGS \ "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ ENV_DEVICE_SETTINGS \ ENV_MEM_LAYOUT_SETTINGS \ - BOOTENV + BOOTENV \ + FIT_BOOT_CMD#endif
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 131 lines · Jun Nie
Quoted 130 lines · Heinrich Schuchardt <[email protected]> 于2019年9月2日周一 下午7:19写道:
Quoted 108 lines · Matthias Brugger
+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.Quoted 5 lines
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add
FIT_BOOT_CMDto that?Regards,
MatthiasThe idea of distro-boot was to make it easier for Linux distributions to update the information needed by U-Boot to find the right kernel and ramdisk.
According to doc/README.distro file extlinux.conf should be used for the communication between the distribution and U-Boot. Some distributions like Debian still rely on boot.scr.
Many distributions (OpenBSD, FreeBSD, Suse, Fedora) have moved from distro-boot to UEFI as booting standard. Unfortunately we have not documented our support for this in doc/README.distro (TODO for me). Takahiro is working on secure boot using UEFI. Once completed this could obsolete FIT images.
Quoted 8 lines
Quoted 3 lines
Would we expect Linux distributions to provide FIT images upon kernel updates?
Is there any Linux distribution doing so?Embedded Linux, a new distribution from ARM, is using FIT images to update kernel.
https://os.mbed.com/docs/mbed-linux-os/v0.8/welcome/index.html
Ok, so secure boot does not provide all capabilities that FIT images do and there exists a distro which uses FIT images.
I think that's enough to add FIT_BOOT_CMD to distro_boot.
So please do so. Sorry that this has taken longer then expected.
Regards,
Matthias
PATCH 1/1 rpi3: Enable verified boot from FIT image
In reply to Heinrich SchuchardtHi Heinrich,
Quoted 124 lines · Heinrich Schuchardt
Quoted 108 lines · Matthias Brugger
+Alex, Lukas, Heinrich, Bin and Simon
Quoted 95 lines · Jun Nie
Quoted 52 lines · Matthias Brugger <[email protected]> 于2019年7月31日周三 下午4:05写道:
Quoted 48 lines · Jun Nie
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)board/raspberrypi/rpi/rpi.c +4
-0@@ -297,6 +297,7 @@ static void set_fdtfile(void)env_set ("fdtfile" , fdtfile); } +#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware provided a valid FDT at boot time, let's expose it in * ${fdt_addr} so it may be passed unmodified to the kernel. @@ -311,6 +312,7 @@ static void set_fdt_addr(void) env_set_hex("fdt_addr", fw_dtb_pointer); } +#endif /* * Prevent relocation from stomping on a firmware provided FDT blob. @@ -393,7 +395,9 @@ static void set_serial_number(void)int misc_init_r (void ) { +#ifndef CONFIG_FIT_SIGNATURE set_fdt_addr (); +#endif set_fdtfile ();set_usbethaddr ();#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG @@ -470,6 +474,7 @@ int board_init(void)return bcm2835_power_on_module (BCM2835_MBOX_POWER_DEVID_USB_HCD ); }Quoted 12 lines
board/raspberrypi/rpi/rpi.c void *board_fdt_blob_setup(void) · line 487
Quoted 9 lines
board/raspberrypi/rpi/rpi.c +2
-0+#ifndef CONFIG_FIT_SIGNATURE /* * If the firmware passed a device tree use it for U-Boot. */ @@ -479,6 +484,7 @@ void *board_fdt_blob_setup(void)return NULL ; return (void *)fw_dtb_pointer; } +#endif Just to get this clear we need this because we want to pass the device tree via
OF_SEPARATE, correct?You are right. U-boot need to read he signature from dtb.
Quoted 27 lines
Quoted 14 lines
board/raspberrypi/rpi/rpi.c +0
-0int ft_board_setup (void *blob,bd_t *bd) {include/configs/rpi.h +2
-0@@ -180,11 +180,24 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_FIT_SIGNATURE +#define FIT_BOOT_CMD \include/configs/rpi.h line 194
Quoted 10 lines
include/configs/rpi.h +10
-0+"boot_a_script=" \ +"load ${devtype} ${devnum}:${distro_bootpart} " \ +"${scriptaddr} ${prefix}${script}; " \ +"iminfo ${scriptaddr};" \ +"if test $? -eq 1; then reset; fi;" \ + "source ${scriptaddr}:bootscr\0" +#else +#define FIT_BOOT_CMD "" +#endif +Doesn't this overwrite the
boot_a_scriptindistro_bootcmd?Quoted 9 lines
Quoted 4 lines
Would it make sense to add FIT booting to the distro boot command?
Regards,
MatthiasYes, it overwrite the
boot_a_scriptindistro_bootcmd. It is make sense to add this to the distro boot command. I can send another patch to move these lines to common code later.Quoted 5 lines
Question to the people just added, as you have relevant submission to distroboot. Do you think it makes sense to add
FIT_BOOT_CMDto that?Regards,
MatthiasThe idea of distro-boot was to make it easier for Linux distributions to update the information needed by U-Boot to find the right kernel and ramdisk.
According to doc/README.distro file extlinux.conf should be used for the communication between the distribution and U-Boot. Some distributions like Debian still rely on boot.scr.
Quoted 5 lines
Many distributions (OpenBSD, FreeBSD, Suse, Fedora) have moved from distro-boot to UEFI as booting standard. Unfortunately we have not documented our support for this in doc/README.distro (TODO for me). Takahiro is working on secure boot using UEFI. Once completed this could obsolete FIT images.
Oh please no.
Quoted 8 lines
Would we expect Linux distributions to provide FIT images upon kernel updates?
Is there any Linux distribution doing so?Only if we can answer these questions with yes, adding
FIT_BOOT_CMDto distro-boot would make sense to me.
U-Boot is the main boot loader for ARM. I wish that distros would just support it (adding what is needed) instead of trying to pretend that U-Boot is a variant of UEFI :-)
I think having a default secure boot option is useful, but how does the image get signed?
Regards,
Simon
PATCH 1/1 rpi3: Enable verified boot from FIT image
Quoted 1 line · Simon Glass
Hi Heinrich,
<snip />
Quoted 3 lines
U-Boot is the main boot loader for ARM. I wish that distros would just support it (adding what is needed) instead of trying to pretend that U-Boot is a variant of UEFI :-)
Distros may have a different viewpoint than you. They may not want to add anything boot loader specific and are happy if all systems independent of their architecture can be booted in the same way, e.g. via UEFI and GRUB. Cf.
https://fedoraproject.org/wiki/Changes/uEFIforARMv7
Currently OpenBSD, FreeBSD, Fedora, and Suse rely on booting via UEFI. And Debian is ready for it.
That U-Boot implements the UEFI API and this is in wide use in no way contradicts U-Boot being the main boot loader for ARM.
Nothing pretended here ¯\_(ツ)_/¯
Regards
Heinrich
PATCH 1/1 rpi3: Enable verified boot from FIT image
Hi Heinrich,
Quoted 16 lines · Heinrich Schuchardt
Quoted 1 line · Simon Glass
Hi Heinrich,
<snip />
Quoted 3 lines
U-Boot is the main boot loader for ARM. I wish that distros would just support it (adding what is needed) instead of trying to pretend that U-Boot is a variant of UEFI :-)
Distros may have a different viewpoint than you. They may not want to add anything boot loader specific and are happy if all systems independent of their architecture can be booted in the same way, e.g. via UEFI and GRUB. Cf.
https://fedoraproject.org/wiki/Changes/uEFIforARMv7
Quoted 5 lines
Currently OpenBSD, FreeBSD, Fedora, and Suse rely on booting via UEFI. And Debian is ready for it.
That U-Boot implements the UEFI API and this is in wide use in no way contradicts U-Boot being the main boot loader for ARM.
Well I am not keen on the complexity and layers of obfuscation created by UEFI, and grub. We have so many layers....
Quoted 6 lines
Nothing pretended here ¯\_(ツ)_/¯
Regards
Heinrich
Regards,
Simon
PATCH 1/1 rpi3: Enable verified boot from FIT image
In reply to Jun NieQuoted 9 lines · Jun Nie <[email protected]> 于2019年7月11日周四 上午11:56写道:
Enable verified boot from FIT image with select configs and specify boot script image node in FIT image, the FIT image is verified before it is run.
Code that reusing dtb in firmware is disabled, so that the dtb with pubic key packed in u-boot.bin can be used to verify the signature of next stage FIT image.
Quoted 6 lines
Signed-off-by Jun Nie <[email protected]>--- board/raspberrypi/rpi/rpi.c | 6 ++++++ include/configs/rpi.h | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
Hi Matthias,
Do you have any concern or comments for merging this patch?
Regards,
Jun