mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] xload: be more flexible when searching for second stage bootloader.
@ 2015-09-27 14:08 Vicente Bergas
  2015-09-29  7:05 ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Vicente Bergas @ 2015-09-27 14:08 UTC (permalink / raw)
  To: barebox; +Cc: Vicente Bergas

A first stage bootloader can read fat and ext4 filesystems, and
even both can be compiled-in at the same time.
But then xload has a hardcoded fat filesystem mount option which
renders ext4 unusable.
This patch tries to mount it as ext4 if the fat attempt fails.

Then, a typical use case of an ext4 formatted filesystem
is it to be a standard linux filesystem, which contains
boot-related files in /boot. So, when searching for the second stage
bootloader, try /boot/barebox.bin after not finding it in /barebox.bin

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 arch/arm/mach-omap/xload.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index ebcbcbc..c5e29f8 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -118,6 +118,8 @@ static void *omap_xload_boot_mmc(void)
 	partname = asprintf("%s.0", diskdev);
 
 	ret = mount(partname, "fat", "/", NULL);
+	if (ret)
+		ret = mount(partname, "ext4", "/", NULL);
 
 	if (ret) {
 		printf("Unable to mount %s (%d)\n", partname, ret);
@@ -128,6 +130,8 @@ static void *omap_xload_boot_mmc(void)
 	free(partname);
 
 	buf = read_file("/barebox.bin", &len);
+	if (!buf)
+		buf = read_file("/boot/barebox.bin", &len);
 	if (!buf) {
 		printf("could not read barebox.bin from sd card\n");
 		return NULL;
-- 
2.5.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-02  7:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-27 14:08 [PATCH] xload: be more flexible when searching for second stage bootloader Vicente Bergas
2015-09-29  7:05 ` Sascha Hauer
2015-09-29 19:06   ` vj
2015-09-30  7:19     ` Sascha Hauer
2015-09-30 17:49       ` vj
2015-10-01  6:04         ` Sascha Hauer
2015-10-01 23:08           ` [PATCH 0/2] second version for "be more flexible when searching for second stage" Vicente Bergas
2015-10-01 23:08             ` [PATCH 1/2] detect_fs: use device instead of file Vicente Bergas
2015-10-01 23:08             ` [PATCH 2/2] xload: be more flexible when searching for second stage bootloader Vicente Bergas
2015-10-02  7:11             ` [PATCH 0/2] second version for "be more flexible when searching for second stage" Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox