All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] distro: load FDT from any partition on boot device
Date: Wed,  4 Oct 2017 16:16:34 -0400	[thread overview]
Message-ID: <20171004201638.4591-1-robdclark@gmail.com> (raw)

In the EFI_LOADER boot path, we were only checking the FAT partition
containing the EFI payload for dtb files.  But this is somewhat of a
fiction.  In reality there will be one small (V)FAT partition containing
grub (or whatever the payload may be), and a second boot partition
containing kernel/initrd/fdt (typically ext4).  It is this second
partition where we should be looking for a FDT to load.

So instead scan all the partitions of the disk containing the EFI
payload.  This matches where grub looks for kernel/initrd (barring
custom grub.cfg, in which case the user can use grub's 'devicetree'
command to load the correct FDT).

The other option is somehow passing the ${fdtfile} to grub so that it
can load the FDT based on selected kernel version location (which grub
knows) and SoC/board specific ${fdtfile} (which grub does not know).

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/config_distro_bootcmd.h | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index e232a62996..58b2fe3371 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -126,25 +126,37 @@
 		"fi\0"                                                    \
 	\
 	"load_efi_dtb="                                                   \
-		"load ${devtype} ${devnum}:${distro_bootpart} "           \
-			"${fdt_addr_r} ${prefix}${efi_fdtfile}\0"         \
+		"load ${devtype} ${devnum}:${dtb_devp} "                  \
+			"${fdt_addr_r} ${prefix}${efi_fdtfile} && "       \
+		"run boot_efi_binary\0"                                   \
 	\
 	"efi_dtb_prefixes=/ /dtb/ /dtb/current/\0"                        \
-	"scan_dev_for_efi="                                               \
+	"scan_dev_for_dtb="                                               \
 		"setenv efi_fdtfile ${fdtfile}; "                         \
 		BOOTENV_EFI_SET_FDTFILE_FALLBACK                          \
-		"for prefix in ${efi_dtb_prefixes}; do "                  \
-			"if test -e ${devtype} "                          \
-					"${devnum}:${distro_bootpart} "   \
-					"${prefix}${efi_fdtfile}; then "  \
-				"run load_efi_dtb; "                      \
-			"fi;"                                             \
-		"done;"                                                   \
+		"part list ${devtype} ${devnum} dtb_devplist; "           \
+		"env exists dtb_devplist || setenv dtb_devplist "         \
+			"${distro_bootpart}; "                            \
+		"for dtb_devp in ${dtb_devplist}; do "                    \
+			"for prefix in ${efi_dtb_prefixes}; do "          \
+				"if test -e ${devtype} "                  \
+						"${devnum}:${dtb_devp} "  \
+						"${prefix}${efi_fdtfile};"\
+						" then "                  \
+					"echo Found DTB ${devtype} "      \
+						"${devnum}:${dtb_devp} "  \
+						"${prefix}${efi_fdtfile};"\
+					"run load_efi_dtb; "              \
+				"fi;"                                     \
+			"done; "                                          \
+		"done; "                                                  \
+		"run boot_efi_binary\0"                                   \
+	"scan_dev_for_efi="                                               \
 		"if test -e ${devtype} ${devnum}:${distro_bootpart} "     \
 					"efi/boot/"BOOTEFI_NAME"; then "  \
 				"echo Found EFI removable media binary "  \
 					"efi/boot/"BOOTEFI_NAME"; "       \
-				"run boot_efi_binary; "                   \
+				"run scan_dev_for_dtb; "                  \
 				"echo EFI LOAD FAILED: continuing...; "   \
 		"fi; "                                                    \
 		"setenv efi_fdtfile\0"
-- 
2.13.5

             reply	other threads:[~2017-10-04 20:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 20:16 Rob Clark [this message]
2017-10-05 12:39 ` [U-Boot] [PATCH] distro: load FDT from any partition on boot device Alexander Graf
2017-10-05 13:27   ` Rob Clark
2017-10-05 13:38     ` Alexander Graf

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=20171004201638.4591-1-robdclark@gmail.com \
    --to=robdclark@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.