[U-Boot] [PATCH 0/4] 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

Add kconfig file to enable API support
Signed-off-by: Emmanuel Vadot manu@bidouilliste.com --- Kconfig | 2 ++ api/Kconfig | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 api/Kconfig
diff --git a/Kconfig b/Kconfig index 1263d0b..6e7c9b0 100644 --- a/Kconfig +++ b/Kconfig @@ -335,6 +335,8 @@ config ARCH_FIXUP_FDT
endmenu # Boot images
+source "api/Kconfig" + source "common/Kconfig"
source "cmd/Kconfig" diff --git a/api/Kconfig b/api/Kconfig new file mode 100644 index 0000000..88b4f6c --- /dev/null +++ b/api/Kconfig @@ -0,0 +1,9 @@ +menu "API" + +config API + bool "Enable U-Boot API" + default n + help + This option enable the U-Boot API. + +endmenu

Add a kconfig option to disable the data cache.
Signed-off-by: Emmanuel Vadot manu@bidouilliste.com --- arch/arm/Kconfig | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d7a9b11..59b91a0 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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

Add a FreeBSD option that enable the API and disable the data cache as it is needed to boot the FreeBSD loader.
Signed-off-by: Emmanuel Vadot manu@bidouilliste.com --- common/Kconfig | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/common/Kconfig b/common/Kconfig index 913d21a..73cd205 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -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"

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.
Signed-off-by: Emmanuel Vadot manu@bidouilliste.com --- include/config_distro_bootcmd.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 9ecaf38..0f5d385 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -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=" \

On Mon, Nov 07, 2016 at 09:34:27AM +0100, Emmanuel Vadot wrote:
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 ++++++++++++++++++++++++++++++++
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!

On Fri, 11 Nov 2016 11:07:34 -0500 Tom Rini trini@konsulko.com wrote:
On Mon, Nov 07, 2016 at 09:34:27AM +0100, Emmanuel Vadot wrote:
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 ++++++++++++++++++++++++++++++++
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!
-- 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 ?

On Thu, Nov 17, 2016 at 03:12:02PM +0100, Emmanuel Vadot wrote:
On Fri, 11 Nov 2016 11:07:34 -0500 Tom Rini trini@konsulko.com wrote:
On Mon, Nov 07, 2016 at 09:34:27AM +0100, Emmanuel Vadot wrote:
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 ++++++++++++++++++++++++++++++++
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!
-- 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.
participants (2)
-
Emmanuel Vadot
-
Tom Rini