U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Emmanuel Vadot <manu@bidouilliste.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] distro_bootcmd: Add command to run FreeBSD
Date: Mon,  7 Nov 2016 09:34:31 +0100	[thread overview]
Message-ID: <20161107083431.24855-5-manu@bidouilliste.com> (raw)
In-Reply-To: <20161107083431.24855-1-manu@bidouilliste.com>

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="                                         \
-- 
2.9.2

  parent reply	other threads:[~2016-11-07  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07  8:34 [U-Boot] [PATCH 0/4] config: Add FreeBSD kconfig options Emmanuel Vadot
2016-11-07  8:34 ` [U-Boot] [PATCH 1/4] kconfig: Add API kconfig file Emmanuel Vadot
2016-11-07  8:34 ` [U-Boot] [PATCH 2/4] kconfig: arm: Add SYS_DCACHE_OFF option Emmanuel Vadot
2016-11-07  8:34 ` [U-Boot] [PATCH 3/4] kconfig: Add a FREEBSD option Emmanuel Vadot
2016-11-07  8:34 ` Emmanuel Vadot [this message]
2016-11-11 16:07 ` [U-Boot] [PATCH 0/4] config: Add FreeBSD kconfig options Tom Rini
2016-11-17 14:12   ` Emmanuel Vadot
2016-11-17 16:27     ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161107083431.24855-5-manu@bidouilliste.com \
    --to=manu@bidouilliste.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox