Skip to contentSkip to conversation

configs: visionfive2: enable CONFIG_DISTRO_DEFAULTS

PATCH NAK Loic Devulder 2 participants 6 messages Nov 25, 2024 – Dec 20, 2024

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/1 configs: visionfive2: enable CONFIG_DISTRO_DEFAULTS

Supported boot device types are MMC, USB, SF and DHCP.

---
 configs/starfive_visionfive2_defconfig |  1 +
 include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------
 2 files changed, 24 insertions(+), 6 deletions(-)
configs/starfive_visionfive2_defconfig +1 -0
index 20f89ae6796..e817e63858b 100644
@@ -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
include/configs/starfive-visionfive2.h +23 -6
index 049b0a06301..7f187307ffe 100644
@@ -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 */
Signature · 1 line
2.47.0
#2 lore raw

Hi Loic,

Quoted 71 lines · Loic Devulder

Supported boot device types are MMC, USB, SF and DHCP.

---
 configs/starfive_visionfive2_defconfig |  1 +
 include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------
 2 files changed, 24 insertions(+), 6 deletions(-)
configs/starfive_visionfive2_defconfig renamed from configs/starfive_visionfive2_defconfig " +1 -0
index 20f89ae6796..e817e63858b 100644
@@ -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
include/configs/starfive-visionfive2.h +23 -7
index 049b0a06301..7f187307ffe 100644
@@ -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 */
--
Quoted 2 lines

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/[email protected]/

Please divert your attention to review and test Hal's patch series:
"Support OF_UPSTREAM for StarFive JH7110"

https://lore.kernel.org/u-boot/[email protected]/

Thanks,

-E

#3 lore raw

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

Quoted 93 lines · E Shattow

Hi Loic,

Quoted 72 lines · Loic Devulder

Supported boot device types are MMC, USB, SF and DHCP.

---
 configs/starfive_visionfive2_defconfig |  1 + include/configs/starfive-visionfive2.h | 29 ++++++++++++++++++++------

 2 files changed, 24 insertions(+), 6 deletions(-)
configs/starfive_visionfive2_defconfig renamed from configs/starfive_visionfive2_defconfig     " +0 -0
index 20f89ae6796..e817e63858b 100644
@@ -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

include/configs/starfive-visionfive2.h +23 -7
index 049b0a06301..7f187307ffe 100644
@@ -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 */
--
Quoted 2 lines

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/[email protected]/

Please divert your attention to review and test Hal's patch series:
"Support OF_UPSTREAM for StarFive JH7110"

https://lore.kernel.org/u-boot/[email protected]/

Thanks,

-E

#4 lore raw
Quoted 12 lines · Loic Devulder

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

#5 lore raw
In reply to E Shattow

Hi,

Sorry for the late reply but I didn't had enough spare time to test before.

Quoted 8 lines · E Shattow

Hi Loic,

NAK.

This was removed March 2024 already. See "board: starfive vf2: switch to standard boot and fix DTS"

Quoted 6 lines

https://lore.kernel.org/u-boot/[email protected]/

Please divert your attention to review and test Hal's patch series:
"Support OF_UPSTREAM for StarFive JH7110"

https://lore.kernel.org/u-boot/[email protected]/

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.

Quoted 4 lines

Thanks,

-E

Signature · 1 line
Loic