diff mbox

[U-Boot,RFC,1/7] Allow checking in multiple partitions for scan_dev_for_boot.

Message ID 1412374123-6787-2-git-send-email-vagrant@debian.org
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Vagrant Cascadian Oct. 3, 2014, 10:08 p.m. UTC
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
---

 include/config_distro_bootcmd.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Stephen Warren Oct. 7, 2014, 3:48 a.m. UTC | #1
On 10/03/2014 03:08 PM, Vagrant Cascadian wrote:

Some standalone description of this change, and justification for it,
should really be present in the commit message. Patch 0/7 doesn't get
applied anywhere.

> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h

> -	"bootpart=1\0" \
> +	"boot_partitions=1\0" \

Instead of searching a hard-coded list of partitions, I think it'd be
better to have the script automatically determine which partition to
boot from based on the partition tables' bootable flag or partition
type. I had always intended these scripts to do that, but never got
around to doing it. I think the $dev:$part syntax already chooses the
first partition marked bootable if you don't specify a partition. Would
that work?
Vagrant Cascadian Oct. 7, 2014, 6:07 a.m. UTC | #2
Thanks for the review!

On 2014-10-06, Stephen Warren <swarren@nvidia.com> wrote:
> On 10/03/2014 03:08 PM, Vagrant Cascadian wrote:
>
> Some standalone description of this change, and justification for it,
> should really be present in the commit message. Patch 0/7 doesn't get
> applied anywhere.

Of course; that was a consequence of learning how patman/git-send-email
work... trial by fire... I'll use more verbose commit messages in the
future.


>> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
>
>> -	"bootpart=1\0" \
>> +	"boot_partitions=1\0" \
>
> Instead of searching a hard-coded list of partitions, I think it'd be
> better to have the script automatically determine which partition to
> boot from based on the partition tables' bootable flag or partition
> type. I had always intended these scripts to do that, but never got
> around to doing it. I think the $dev:$part syntax already chooses the
> first partition marked bootable if you don't specify a partition. Would
> that work?

I suspect that might work. I merely went with the simplest approach to
extend what was already there, by supporting an arbitrary number of
partitions to search, and leaving the defaults as is.

The BeagleBone Black board ships with various boot files on the first
FAT partition, but newer images available for it moved boot files
(kernel/initrd/dtb/uEnv.txt) onto the second (ext4?) partition, as the
FAT partition is exported as a multifunction device over USB... So
ideally u-boot could support multiple partitions to search, to support
multiple generations of images without having to manually configure
u-boot.


live well,
  vagrant
diff mbox

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index be616e8..5e5e5e3 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -163,7 +163,7 @@ 
 	"boot_prefixes=/ /boot/\0" \
 	"boot_scripts=boot.scr.uimg boot.scr\0" \
 	BOOTENV_BOOT_TARGETS \
-	"bootpart=1\0" \
+	"boot_partitions=1\0" \
 	\
 	"boot_extlinux="                                                  \
 		"sysboot ${devtype} ${devnum}:${bootpart} any "           \
@@ -194,10 +194,13 @@ 
 		"done\0"                                                  \
 	\
 	"scan_dev_for_boot="                                              \
-		"echo Scanning ${devtype} ${devnum}...; "                 \
-		"for prefix in ${boot_prefixes}; do "                     \
-			"run scan_dev_for_extlinux; "                     \
-			"run scan_dev_for_scripts; "                      \
+		"for partition in ${boot_partitions}; do "                \
+			"echo Scanning ${devtype} ${devnum}:${partition}...; " \
+			"setenv bootpart ${partition};"                   \
+			"for prefix in ${boot_prefixes}; do "             \
+				"run scan_dev_for_extlinux; "             \
+				"run scan_dev_for_scripts; "              \
+			"done;"                                           \
 		"done\0"                                                  \
 	\
 	BOOT_TARGET_DEVICES(BOOTENV_DEV)                                  \