Assumes a UBI partition called boot

Signed-off-by: Roy Spliet <r.spl...@ultimaker.com>
---
 include/config_distro_bootcmd.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 3a360ca4..361b914 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -72,6 +72,21 @@
        BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC
 #endif
 
+#ifdef CONFIG_CMD_NAND
+#define BOOTENV_DEV_NAND(devtypeu, devtypel, instance) \
+       "bootcmd_nand="                                                   \
+               "ubi part " #devtypel #instance "_main; "                 \
+               "ubifsmount ubi:boot; "                                   \
+               "run scan_ubifs_for_script\0"
+#define BOOTENV_DEV_NAME_NAND(devtypeu, devtypel, instance)    #devtypel " "
+#else
+#define BOOTENV_SHARED_NAND
+#define BOOTENV_DEV_NAND \
+       BOOT_TARGET_DEVICES_references_NAND_without_CONFIG_CMD_NAND
+#define BOOTENV_DEV_NAME_NAND \
+       BOOT_TARGET_DEVICES_references_NAND_without_CONFIG_CMD_NAND
+#endif
+
 #ifdef CONFIG_CMD_SATA
 #define BOOTENV_SHARED_SATA    BOOTENV_SHARED_BLKDEV(sata)
 #define BOOTENV_DEV_SATA       BOOTENV_DEV_BLKDEV
@@ -202,6 +217,17 @@
                        "echo SCRIPT FAILED: continuing...; "             \
                "fi\0"                                                    \
        \
+       "scan_ubifs_for_script="                                          \
+               "for script in ${boot_scripts}; do "                      \
+                       "for prefix in ${boot_prefixes}; do "             \
+                               "if ubifsload ${scriptaddr} "             \
+                               "${prefix}${script}; then "               \
+                                       "echo Found U-Boot script "       \
+                                               "${prefix}${script}; "    \
+                                       "source ${scriptaddr}; "          \
+                               "fi; "                                    \
+                       "done; "                                          \
+               "done\0"                                                  \
        "boot_a_script="                                                  \
                "load ${devtype} ${devnum}:${bootpart} "                  \
                        "${scriptaddr} ${prefix}${script}; "              \
-- 
2.4.2


-- 


IMAGINE IT >> MAKE IT

Meet us online at Twitter <http://twitter.com/ultimaker>, Facebook 
<http://facebook.com/ultimaker>, Google+ <http://google.com/+Ultimaker>

www.ultimaker.com

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to