Skip to contentSkip to conversation

config: Add FreeBSD kconfig options

PATCH New Emmanuel Vadot 2 participants 8 messages Nov 7, 2016 – Nov 17, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover config: Add FreeBSD kconfig options

This series of patches add the needed bits for booting the FreeBSD loader.
FreeBSD loader needs the U-Boot API and dache disabled for it to run so add kconfig options for them.
Also add some some boot command that locate and run the FreeBSD loader if found.

Emmanuel Vadot (4):
kconfig: Add API kconfig file
kconfig: arm: Add SYS_DCACHE_OFF option
kconfig: Add a FREEBSD option
distro_bootcmd: Add command to run FreeBSD

 Kconfig                         |  2 ++
 api/Kconfig                     |  9 +++++++++
 arch/arm/Kconfig                |  6 ++++++
 common/Kconfig                  |  9 +++++++++
 include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 api/Kconfig
Signature · 1 line
2.9.2
#1 lore raw

PATCH 1/4 kconfig: Add API kconfig file

Add kconfig file to enable API support

---
 Kconfig     | 2 ++
 api/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 api/Kconfig
Kconfig +2 -0
index 1263d0b..6e7c9b0 100644
@@ -335,6 +335,8 @@ config ARCH_FIXUP_FDT
 
 endmenu		# Boot images
 
+source "api/Kconfig"
+
 source "common/Kconfig"
 
 source "cmd/Kconfig"
api/Kconfig new file +9 -0
new file mode 100644
index 0000000..88b4f6c
@@ -0,0 +1,9 @@
+menu "API"
+
+config API
+	bool "Enable U-Boot API"
+	default n
+	help
+	  This option enable the U-Boot API.
+
+endmenu
Signature · 1 line
2.9.2
#2 lore raw

PATCH 2/4 kconfig: arm: Add SYS_DCACHE_OFF option

In reply to Emmanuel Vadot

Add a kconfig option to disable the data cache.

---
 arch/arm/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/Kconfig +6 -0
index d7a9b11..59b91a0 100644
@@ -118,6 +118,12 @@ config SYS_L2CACHE_OFF
 	  If SoC does not support L2CACHE or one do not want to enable
 	  L2CACHE, choose this option.
 
+config SYS_DCACHE_OFF
+	bool "Do not use Data Cache"
+	default n
+	help
+	  If one do not want to enable the data cache, choose this option.
+
 config ENABLE_ARM_SOC_BOOT0_HOOK
 	bool "prepare BOOT0 header"
 	help
Signature · 1 line
2.9.2
#3 lore raw

PATCH 3/4 kconfig: Add a FREEBSD option

In reply to Emmanuel Vadot

Add a FreeBSD option that enable the API and disable the data cache as it is needed to boot the FreeBSD loader.

---
 common/Kconfig | 9 +++++++++
 1 file changed, 9 insertions(+)
common/Kconfig +9 -0
index 913d21a..73cd205 100644
@@ -383,4 +383,13 @@ config DISPLAY_BOARDINFO
 	  when U-Boot starts up. The board function checkboard() is called
 	  to do this.
 
+config FREEBSD
+	bool "Enable FreeBSD boot"
+	select API
+	select SYS_DCACHE_OFF
+	default n
+	help
+	  This option adds boot configuration that can run the FreeBSD
+	  loader.
+
 source "common/spl/Kconfig"
Signature · 1 line
2.9.2
#4 lore raw

PATCH 4/4 distro_bootcmd: Add command to run FreeBSD

In reply to Emmanuel Vadot

Add commands that scans for the FreeBSD loader and run it if found. FreeBSD has two loader: ubldr which is an ELF binary and ubldr.bin which is a PIE binary.

---
 include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
include/config_distro_bootcmd.h +32 -0
index 9ecaf38..0f5d385 100644
@@ -153,6 +153,36 @@
 #define SCAN_DEV_FOR_EFI
 #endif
 
+#ifdef CONFIG_FREEBSD
+#define BOOTENV_SHARED_FREEBSD                                            \
+	"boot_freebsd_binary="                                            \
+		"load ${devtype} ${devnum}:${distro_bootpart} "           \
+			"${kernel_addr_r} ubldr.bin; "                    \
+		"go ${kernel_addr_r}\0"                                   \
+	\
+	"boot_freebsd_elf="                                               \
+		"load ${devtype} ${devnum}:${distro_bootpart} "           \
+			"${kernel_addr_r} ubldr; "                        \
+		"bootelf ${kernel_addr_r}\0"                              \
+	\
+	"scan_dev_for_freebsd="                                           \
+		"if test -e ${devtype} ${devnum}:${distro_bootpart} "     \
+					"ubldr.bin; then "                \
+				"echo Found FreeBSD U-Boot Loader (bin);" \
+				"run boot_freebsd_binary; "               \
+				"echo FREEBSD FAILED: continuing...; "    \
+		"elif test -e ${devtype} ${devnum}:${distro_bootpart} "   \
+					"ubldr; then "                    \
+				"echo Found FreeBSD U-Boot Loader (elf);" \
+				"run boot_freebsd_elf; "                  \
+				"echo FREEBSD FAILED: continuing...; "    \
+		"fi;\0"
+#define SCAN_DEV_FOR_FREEBSD "run scan_dev_for_freebsd;"
+#else
+#define BOOTENV_SHARED_FREEBSD
+#define SCAN_DEV_FOR_FREEBSD
+#endif
+
 #ifdef CONFIG_CMD_SATA
 #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
@@ -326,6 +356,7 @@
 	BOOTENV_SHARED_IDE \
 	BOOTENV_SHARED_UBIFS \
 	BOOTENV_SHARED_EFI \
+	BOOTENV_SHARED_FREEBSD \
 	"boot_prefixes=/ /boot/\0" \
 	"boot_scripts=boot.scr.uimg boot.scr\0" \
 	"boot_script_dhcp=boot.scr.uimg\0" \
@@ -369,6 +400,7 @@
 			"run scan_dev_for_scripts; "                      \
 		"done;"                                                   \
 		SCAN_DEV_FOR_EFI                                          \
+		SCAN_DEV_FOR_FREEBSD                                      \
 		"\0"                                                      \
 	\
 	"scan_dev_for_boot_part="                                         \
Signature · 1 line
2.9.2
#5 lore raw

cover config: Add FreeBSD kconfig options

In reply to Emmanuel Vadot
Quoted 13 lines · Emmanuel Vadot

This series of patches add the needed bits for booting the FreeBSD loader.
FreeBSD loader needs the U-Boot API and dache disabled for it to run so add kconfig options for them.
Also add some some boot command that locate and run the FreeBSD loader if found.

Emmanuel Vadot (4):
kconfig: Add API kconfig file
kconfig: arm: Add SYS_DCACHE_OFF option
kconfig: Add a FREEBSD option
distro_bootcmd: Add command to run FreeBSD

Quoted 5 lines
 Kconfig                         |  2 ++
 api/Kconfig                     |  9 +++++++++
 arch/arm/Kconfig                |  6 ++++++
 common/Kconfig                  |  9 +++++++++
 include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++

This is a good first start. But I think there's a few things that need tweaking. First, we don't want to globally turn off dcache, but it does need to be migrated to Kconfig (so we know if it's enabled or not). Second, we should instead use CMD_CACHE and the 'dcache' command to disable dcache prior to running the FreeBSD loader. Then we make sure that the generic distro feature has CMD_CACHE if !SYS_DCACHE_OFF (and !SYS_ICACHE_OFF). Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161111/3704eb3c/attachment.sig>
#6 lore raw

cover config: Add FreeBSD kconfig options

Quoted 21 lines · On Fri, 11 Nov 2016 11:07:34 -0500 Tom Rini <[email protected]> wrote:
Quoted 13 lines · Emmanuel Vadot

This series of patches add the needed bits for booting the FreeBSD loader.
FreeBSD loader needs the U-Boot API and dache disabled for it to run so add kconfig options for them.
Also add some some boot command that locate and run the FreeBSD loader if found.

Emmanuel Vadot (4):
kconfig: Add API kconfig file
kconfig: arm: Add SYS_DCACHE_OFF option
kconfig: Add a FREEBSD option
distro_bootcmd: Add command to run FreeBSD

Quoted 5 lines
 Kconfig                         |  2 ++
 api/Kconfig                     |  9 +++++++++
 arch/arm/Kconfig                |  6 ++++++
 common/Kconfig                  |  9 +++++++++
 include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++
Quoted 10 lines

This is a good first start. But I think there's a few things that need tweaking. First, we don't want to globally turn off dcache, but it does need to be migrated to Kconfig (so we know if it's enabled or not). Second, we should instead use CMD_CACHE and the 'dcache' command to disable dcache prior to running the FreeBSD loader. Then we make sure that the generic distro feature has CMD_CACHE if !SYS_DCACHE_OFF (and !SYS_ICACHE_OFF). Thanks!

Signature · 1 line
Tom

Hi Tom,

I will make the modification, should I sent the patch for
migration of SYS_DCACHE_OFF to Kconfig as a separate patch ?

Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
#7 lore raw

cover config: Add FreeBSD kconfig options

Quoted 32 lines · Emmanuel Vadot
Quoted 29 lines · On Fri, 11 Nov 2016 11:07:34 -0500 Tom Rini <[email protected]> wrote:
Quoted 13 lines · Emmanuel Vadot

This series of patches add the needed bits for booting the FreeBSD loader.
FreeBSD loader needs the U-Boot API and dache disabled for it to run so add kconfig options for them.
Also add some some boot command that locate and run the FreeBSD loader if found.

Emmanuel Vadot (4):
kconfig: Add API kconfig file
kconfig: arm: Add SYS_DCACHE_OFF option
kconfig: Add a FREEBSD option
distro_bootcmd: Add command to run FreeBSD

Quoted 5 lines
 Kconfig                         |  2 ++
 api/Kconfig                     |  9 +++++++++
 arch/arm/Kconfig                |  6 ++++++
 common/Kconfig                  |  9 +++++++++
 include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++

This is a good first start. But I think there's a few things that need tweaking. First, we don't want to globally turn off dcache, but it does need to be migrated to Kconfig (so we know if it's enabled or not). Second, we should instead use CMD_CACHE and the 'dcache' command to disable dcache prior to running the FreeBSD loader. Then we make sure that the generic distro feature has CMD_CACHE if !SYS_DCACHE_OFF (and !SYS_ICACHE_OFF). Thanks!

Quoted 7 lines
Quoted 2 lines
Signature · 1 line
Tom

Hi Tom,

I will make the modification, should I sent the patch for
migration of SYS_DCACHE_OFF to Kconfig as a separate patch ?

I'll grab (and re-run the moveconfig.py part) for the first two parts of your series.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161117/2958b9c3/attachment.sig>