[U-Boot] [PATCH 1/2] distro_bootcmd: Add command to run FreeBSD

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Dec 4 19:18:22 UTC 2017


On 12/04/2017 08:06 PM, Emmanuel Vadot wrote:
> 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 at 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 5c469a23fa..424d63a355 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -158,6 +158,36 @@
>  #define SCAN_DEV_FOR_EFI
>  #endif
>  
> +#ifdef CONFIG_DISTRO_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 "                \

Your commit message does not provide any reason why you need this.

Couldn't you simply create a boot.scr that invokes ubldr.bin or ubldr as
other distros do?

E.g. Debian has a package flash-boot which generates a new boot.scr
every time a new kernel is installed.

Best

> +				"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_SATA
>  #define BOOTENV_SHARED_SATA	BOOTENV_SHARED_BLKDEV(sata)
>  #define BOOTENV_DEV_SATA	BOOTENV_DEV_BLKDEV
> @@ -331,6 +361,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" \
> @@ -374,6 +405,7 @@
>  			"run scan_dev_for_scripts; "                      \
>  		"done;"                                                   \
>  		SCAN_DEV_FOR_EFI                                          \
> +		SCAN_DEV_FOR_FREEBSD                                      \
>  		"\0"                                                      \
>  	\
>  	"scan_dev_for_boot_part="                                         \
> 



More information about the U-Boot mailing list