[PATCH 0/1] configs: visionfive2: enable CONFIG_DISTRO_DEFAULTS

This is needed for some Linux distributions (like openSUSE) to be able to load the DTB provided by the OS. It also simplify the boot process by allowing to use bootcmd* commands.
Tested successfully on my VisionFive2 board.
Loic Devulder (1): configs: visionfive2: enable CONFIG_DISTRO_DEFAULTS
configs/starfive_visionfive2_defconfig | 1 + include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-)

Supported boot device types are MMC, USB, SF and DHCP.
Signed-off-by: Loic Devulder ldevulder@suse.com --- configs/starfive_visionfive2_defconfig | 1 + include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 20f89ae6796..e817e63858b 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -41,6 +41,7 @@ CONFIG_SD_BOOT=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" +CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" CONFIG_SYS_CBSIZE=256 diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 049b0a06301..7f187307ffe 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -15,14 +15,29 @@
#define __io
+#ifdef CONFIG_DISTRO_DEFAULTS +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(SF, sf, 0) \ + func(DHCP, dhcp, na) + +#include <config_distro_bootcmd.h> +#include <env/distro/sf.h> +#else +#define BOOTENV +#define BOOTENV_SF +#endif + #define TYPE_GUID_SPL "2E54B353-1271-4842-806F-E436D6AF6985" -#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" +#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" #define TYPE_GUID_SYSTEM "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
-#define PARTS_DEFAULT \ - "name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \ - "name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \ - "name=system,size=-,bootable,type=${type_guid_gpt_system};" +#define PARTS_DEFAULT \ + "name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \ + "name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \ + "name=system,size=-,bootable,type=${type_guid_gpt_system};"
#define CFG_EXTRA_ENV_SETTINGS \ "kernel_addr_r=0x40200000\0" \ @@ -37,6 +52,8 @@ "type_guid_gpt_loader2=" TYPE_GUID_UBOOT "\0" \ "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ "partitions=" PARTS_DEFAULT "\0" \ - "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTENV \ + BOOTENV_SF
#endif /* _STARFIVE_VISIONFIVE2_H */

Hi Loic,
On Mon, Nov 25, 2024 at 1:48 AM Loic Devulder ldevulder@suse.com wrote:
Supported boot device types are MMC, USB, SF and DHCP.
Signed-off-by: Loic Devulder ldevulder@suse.com
configs/starfive_visionfive2_defconfig | 1 + include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 20f89ae6796..e817e63858b 100644 --- a/configs/starfive_visionfive2_defconfig " +++ b/configs/starfive_visionfive2_defconfig @@ -41,6 +41,7 @@ CONFIG_SD_BOOT=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" +CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" CONFIG_SYS_CBSIZE=256 diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 049b0a06301..7f187307ffe 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -15,14 +15,29 @@
#define __io
+#ifdef CONFIG_DISTRO_DEFAULTS +#define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 1) \
func(MMC, mmc, 0) \
func(USB, usb, 0) \
func(SF, sf, 0) \
func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h> +#include <env/distro/sf.h> +#else +#define BOOTENV +#define BOOTENV_SF +#endif
#define TYPE_GUID_SPL "2E54B353-1271-4842-806F-E436D6AF6985" -#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" +#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" #define TYPE_GUID_SYSTEM "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
-#define PARTS_DEFAULT \
"name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \
"name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \
"name=system,size=-,bootable,type=${type_guid_gpt_system};"
+#define PARTS_DEFAULT \
"name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \
"name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \
"name=system,size=-,bootable,type=${type_guid_gpt_system};"
#define CFG_EXTRA_ENV_SETTINGS \ "kernel_addr_r=0x40200000\0" \ @@ -37,6 +52,8 @@ "type_guid_gpt_loader2=" TYPE_GUID_UBOOT "\0" \ "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ "partitions=" PARTS_DEFAULT "\0" \
"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"
"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
BOOTENV \
BOOTENV_SF
#endif /* _STARFIVE_VISIONFIVE2_H */
2.47.0
NAK.
This was removed March 2024 already. See "board: starfive vf2: switch to standard boot and fix DTS"
https://lore.kernel.org/u-boot/20240221120014.149193-1-namcao@linutronix.de/
Please divert your attention to review and test Hal's patch series: "Support OF_UPSTREAM for StarFive JH7110"
https://lore.kernel.org/u-boot/20241125003205.75327-1-hal.feng@starfivetech....
Thanks,
-E

Hi!
Oh sorry I didn't know that it was already here before... Thanks, I will try the patches then.
Just one question: does this means that we will not be able to "easily" load a different DTB like we can with distri_defaults? I know that we can always does this with u-boot command line as well as with Grub but it's not so easy. But maybe it's handled by OF_UPSTREAM, but I have first to read all the patch series ;-).
Loic
On Mon, 2024-11-25 at 02:40 -0800, E Shattow wrote:
Hi Loic,
On Mon, Nov 25, 2024 at 1:48 AM Loic Devulder ldevulder@suse.com wrote:
Supported boot device types are MMC, USB, SF and DHCP.
Signed-off-by: Loic Devulder ldevulder@suse.com
configs/starfive_visionfive2_defconfig | 1 + include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 20f89ae6796..e817e63858b 100644 --- a/configs/starfive_visionfive2_defconfig " +++ b/configs/starfive_visionfive2_defconfig @@ -41,6 +41,7 @@ CONFIG_SD_BOOT=y CONFIG_OF_BOARD_SETUP=y CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" +CONFIG_DISTRO_DEFAULTS=y CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" CONFIG_SYS_CBSIZE=256 diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h index 049b0a06301..7f187307ffe 100644 --- a/include/configs/starfive-visionfive2.h +++ b/include/configs/starfive-visionfive2.h @@ -15,14 +15,29 @@
#define __io
+#ifdef CONFIG_DISTRO_DEFAULTS +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 0) \ + func(USB, usb, 0) \ + func(SF, sf, 0) \ + func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h> +#include <env/distro/sf.h> +#else +#define BOOTENV +#define BOOTENV_SF +#endif
#define TYPE_GUID_SPL "2E54B353-1271-4842-806F-E436D6AF6985" -#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" +#define TYPE_GUID_UBOOT "BC13C2FF-59E6-4262-A352-B275FD6F7172" #define TYPE_GUID_SYSTEM "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"
-#define PARTS_DEFAULT \ - "name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \ - "name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \ - "name=system,size=-,bootable,type=${type_guid_gpt_system};" +#define PARTS_DEFAULT \ + "name=spl,start=2M,size=2M,type=${type_guid_gpt_loader1};" \ + "name=uboot,size=4MB,type=${type_guid_gpt_loader2};" \ + "name=system,size=-,bootable,type=${type_guid_gpt_system};"
#define CFG_EXTRA_ENV_SETTINGS \ "kernel_addr_r=0x40200000\0" \ @@ -37,6 +52,8 @@ "type_guid_gpt_loader2=" TYPE_GUID_UBOOT "\0" \ "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ "partitions=" PARTS_DEFAULT "\0" \ - "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTENV \ + BOOTENV_SF
#endif /* _STARFIVE_VISIONFIVE2_H */
2.47.0
NAK.
This was removed March 2024 already. See "board: starfive vf2: switch to standard boot and fix DTS"
https://lore.kernel.org/u-boot/20240221120014.149193-1-namcao@linutronix.de/
Please divert your attention to review and test Hal's patch series: "Support OF_UPSTREAM for StarFive JH7110"
https://lore.kernel.org/u-boot/20241125003205.75327-1-hal.feng@starfivetech....
Thanks,
-E

On Mon, Nov 25, 2024 at 2:51 AM Loic Devulder ldevulder@suse.com wrote:
Hi!
Oh sorry I didn't know that it was already here before... Thanks, I will try the patches then.
Just one question: does this means that we will not be able to "easily" load a different DTB like we can with distri_defaults? I know that we can always does this with u-boot command line as well as with Grub but it's not so easy. But maybe it's handled by OF_UPSTREAM, but I have first to read all the patch series ;-).
Loic
See "Device-tree selection" in documentation at: https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html
Additional information to understand is that EFI bootmgr can prefer the EFI configuration variable (file `ubootefi.var` on EFI System Partition) to select FDT. There is not much control by the user of which ESP is selected for U-Boot to operate its EFI environment, so the environment may change at boot if there are more than one ESP present.
When combined Unified Kernel Image (UKI) with support for wget in EFI then there is not any need to prepare a separate TFTP server or media for network-based installation. I have tested some version of Debian Installer as UKI and it is easy, not depending on hybrid ISO9660 complexity. I think this may be how all OS distribution installer can become less complicated.
When you need to make improvements to the DTS then you will submit a patch to Linux Kernel Mailing List and when merged upstream then U-Boot will sync to the Linux Kernel Devicetree-Rebasing git repository.
If you need DTBO (overlay support) then that is some other topic.
-E

Hi,
Sorry for the late reply but I didn't had enough spare time to test before.
On Mon, 2024-11-25 at 02:40 -0800, E Shattow wrote:
Hi Loic,
NAK.
This was removed March 2024 already. See "board: starfive vf2: switch to standard boot and fix DTS"
https://lore.kernel.org/u-boot/20240221120014.149193-1-namcao@linutronix.de/
Please divert your attention to review and test Hal's patch series: "Support OF_UPSTREAM for StarFive JH7110"
https://lore.kernel.org/u-boot/20241125003205.75327-1-hal.feng@starfivetech....
I finally was able to test the v8 version of the patches and I can confirm that it works as I expected with latest version of openSUSE Tumbleweed. I will add a tested-by flag on the series.
Thanks,
-E
participants (2)
-
E Shattow
-
Loic Devulder