public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jason Kridner <jkridner@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] am335x_evm: scan more partitions and use uname_r
Date: Wed,  7 Mar 2018 05:40:42 -0500	[thread overview]
Message-ID: <20180307104044.4739-3-jdk@ti.com> (raw)
In-Reply-To: <20180307104044.4739-1-jdk@ti.com>

This enables mainline u-boot to boot the BeagleBoard.org Debian
distribution builds without extensive environment modifications.

Some boot layouts only have a single partition on the
MMC/eMMC. This will scan those partitions after the second
partition that was already being scanned.

Some layouts use uname_r to define the kernel being used for the boot to
support multiple kernels stored within the boot file system without
using symlinks.

See http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0 for
more details on the BeagleBoard.org Debian image layout.

Signed-off-by: Jason Kridner <jdk@ti.com>
Cc: Robert Nelson <robertcnelson@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
 include/configs/am335x_evm.h |  5 ++++-
 include/environment/ti/mmc.h | 13 +++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 8d45b6fade..32fe0e0cd5 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -61,7 +61,10 @@
 #define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
 	"bootcmd_" #devtypel #instance "=" \
 	"setenv mmcdev " #instance"; "\
-	"setenv bootpart " #instance":2 ; "\
+	"setenv bootpart " #instance":2; "\
+	"run mmcboot;"\
+	"setenv mmcdev " #instance"; "\
+	"setenv bootpart " #instance":1; "\
 	"run mmcboot\0"
 
 #define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h
index 4305ebdaaf..b803ecccb7 100644
--- a/include/environment/ti/mmc.h
+++ b/include/environment/ti/mmc.h
@@ -23,9 +23,10 @@
 	"bootenvfile=uEnv.txt\0" \
 	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
 		"env import -t ${loadaddr} ${filesize}\0" \
-	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
-	"loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
-	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"loadbootenv=if fatload mmc ${mmcdev} ${loadaddr} ${bootdir}/${bootenvfile}; then echo Found ${bootdir}/${bootenvfile} in FAT partition; else load mmc ${mmcdev} ${loadaddr} ${bootdir}/${bootenvfile}; fi\0" \
+	"loadimage=if test -n ${uname_r}; then load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/vmlinuz-${uname_r}; run loadrd; else load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}; fi\0" \
+	"loadrd=load ${devtype} ${bootpart} ${rdaddr} ${bootdir}/initrd.img-${uname_r}; setenv rdsize ${filesize}\0" \
+	"loadfdt=if test -n ${uname_r}; then load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtbs/${uname_r}/${fdtfile}; else load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}; fi;\0" \
 	"envboot=mmc dev ${mmcdev}; " \
 		"if mmc rescan; then " \
 			"echo SD/MMC found on device ${mmcdev};" \
@@ -45,7 +46,11 @@
 	"mmcloados=run args_mmc; " \
 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
 			"if run loadfdt; then " \
-				"bootz ${loadaddr} - ${fdtaddr}; " \
+				"if test -n ${uname_r}; then " \
+					"bootz ${loadaddr} ${rdaddr}:${rdsize} ${fdtaddr}; " \
+				"else " \
+					"bootz ${loadaddr} - ${fdtaddr}; " \
+				"fi; " \
 			"else " \
 				"if test ${boot_fdt} = try; then " \
 					"bootz; " \
-- 
2.15.1

  parent reply	other threads:[~2018-03-07 10:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 10:40 [U-Boot] [PATCH 0/4] Add support for BeagleBoard.org PocketBeagle Jason Kridner
2018-03-07 10:40 ` [U-Boot] [PATCH 1/4] " Jason Kridner
2018-03-07 14:27   ` Tom Rini
2018-04-07  0:44   ` [U-Boot] [U-Boot, " Tom Rini
2018-03-07 10:40 ` Jason Kridner [this message]
2018-03-07 14:27   ` [U-Boot] [PATCH 2/4] am335x_evm: scan more partitions and use uname_r Tom Rini
2018-03-10 16:34     ` Jason Kridner
2018-03-10 23:13       ` Vagrant Cascadian
2018-03-07 10:40 ` [U-Boot] [PATCH 3/4] Handle NETCONSOLE and SPL enabled Jason Kridner
2018-03-07 14:27   ` Tom Rini
2018-03-07 18:01   ` Joe Hershberger
2018-04-07  0:44   ` [U-Boot] [U-Boot,3/4] " Tom Rini
2018-03-07 10:40 ` [U-Boot] [PATCH 4/4] am335x: am335x_evm_usbspl_defconfig: NETCONSOLE Jason Kridner
2018-03-07 14:27   ` Tom Rini
2018-04-07  0:44   ` [U-Boot] [U-Boot, " 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=20180307104044.4739-3-jdk@ti.com \
    --to=jkridner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox