[U-Boot] [PATCH 1/3] sysboot: Add support for ubifs to the sysboot command

Hans de Goede hdegoede at redhat.com
Thu Aug 20 18:04:13 CEST 2015


ubifs does not go though the generic block layer because mtd devices
are special, so the "any" filesystem option to sysboot does not work,
this adds support for a "ubifs" filesystem to the sysboot command which
makes it possible to boot from ubifs using an extlinux.conf file.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 common/cmd_pxe.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 080b376..b4f2e3e 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -16,6 +16,10 @@
 #include <fs.h>
 #include <asm/io.h>
 
+#ifdef CONFIG_CMD_UBIFS
+#include "../fs/ubifs/ubifs.h"
+#endif
+
 #include "menu.h"
 #include "cli.h"
 
@@ -156,6 +160,17 @@ static int do_get_ext2(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
 	return -ENOENT;
 }
 
+static int do_get_ubifs(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+{
+#ifdef CONFIG_CMD_UBIFS
+	u32 addr = simple_strtoul(file_addr, NULL, 16);
+
+	if (!ubifs_load((char *)file_path, addr, 0))
+		return 1;
+#endif
+	return -ENOENT;
+}
+
 static int do_get_fat(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
 {
 #ifdef CONFIG_CMD_FAT
@@ -1680,6 +1695,8 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		do_getfile = do_get_ext2;
 	else if (strstr(argv[3], "fat"))
 		do_getfile = do_get_fat;
+	else if (strstr(argv[3], "ubifs"))
+		do_getfile = do_get_ubifs;
 	else if (strstr(argv[3], "any"))
 		do_getfile = do_get_any;
 	else {
-- 
2.4.3



More information about the U-Boot mailing list