On 12/12/2017 10:03 AM, Emmanuel Vadot wrote: > > Hi Heinrich, > > On Mon, 4 Dec 2017 20:18:22 +0100 > Heinrich Schuchardt <xypron.g...@gmx.de> wrote: > >> 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 <m...@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 > > The answer is really easy, for FreeBSD 11 (our actual stable release) > we still use ubldr.bin/ubldr but for FreeBSD 12 (our current HEAD) we > want to switch to EFI (almost there). Our ports tree/packages are > common to both releases and using boot.scr would mean to re-implement > the distroboot logic in it. >
Why should U-Boot implement any distro specific logic which could be implemented with in the distro itself? My feeling is that U-Boot should be distro agnostic. It shall implement standards and load any conforming distro. Best regards Heinrich > I'll resend a V2 explaining this better in the commit message. > >>> + "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=" \ >>> > > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot