public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Purna Chandra Mandal <purna.mandal@microchip.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 18/18] board: pic32mzdask: Customize default environments for OS boot.
Date: Thu, 17 Dec 2015 23:04:51 +0530	[thread overview]
Message-ID: <5672F23B.7020403@microchip.com> (raw)

Add custom environment variables and commands to help boot
from micro-SD card and/or from network (TFTP protocol).

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>

---

 include/configs/pic32mzdask.h | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index 94e73e3..c903113 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -169,5 +169,48 @@
 #define CONFIG_BOOTDELAY    5 /* autoboot after X seconds     */
 #undef    CONFIG_BOOTARGS
 
+#define CONFIG_EXTRA_ENV_SETTINGS                \
+    "loadaddr="__stringify(CONFIG_SYS_LOAD_ADDR)"\0"    \
+    "uenvfile=uEnv.txt\0"                    \
+    "uenvaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0"        \
+    "scriptfile=boot.scr\0"                    \
+    "ubootfile=u-boot.bin\0"                \
+    "importbootenv= "                    \
+        "env import -t -r ${uenvaddr} ${filesize};\0"    \
+                                \
+    "tftploadenv=tftp ${uenvaddr} ${uenvfile} \0"        \
+    "tftploadscr=tftp ${uenvaddr} ${scriptfile} \0"        \
+    "tftploadub=tftp ${loadaddr} ${ubootfile} \0"        \
+                                \
+    "mmcloadenv=fatload mmc 0 ${uenvaddr} ${uenvfile}\0"    \
+    "mmcloadscr=fatload mmc 0 ${uenvaddr} ${scriptfile}\0"    \
+    "mmcloadub=fatload mmc 0 ${loadaddr} ${ubootfile}\0"    \
+                                \
+    "flashub=protect off bank 1; "                \
+        "erase.b 0x9d004000 0x9d0f3fff; "        \
+        "cp.b ${loadaddr} 0x9d004000 ${filesize}; "    \
+        "cmp.b ${loadaddr} 0x9d004000 ${filesize}; "    \
+        "protect on bank 1; \0"                \
+                                \
+    "loadbootenv=run mmcloadenv || run tftploadenv\0"    \
+    "loadbootscr=run mmcloadscr || run tftploadscr\0"    \
+    "bootcmd_root= "                    \
+        "if run loadbootenv; then "            \
+            "echo Loaded environment ${uenvfile}; "    \
+            "run importbootenv; "            \
+        "fi; "                        \
+        "if test -n \"${bootcmd_uenv}\" ; then "    \
+            "echo Running bootcmd_uenv ...; "    \
+            "run bootcmd_uenv; "            \
+        "fi; "                        \
+        "if run loadbootscr; then "            \
+            "echo Jumping to ${scriptfile}; "    \
+            "source ${uenvaddr}; "            \
+        "fi; "                        \
+        "echo Custom environment or script not found. "    \
+            "Aborting auto booting...; \0"        \
+    ""
+
+#define CONFIG_BOOTCOMMAND        "run bootcmd_root"
 #define CONFIG_MEMSIZE_IN_BYTES        /* pass 'memsize=' in bytes */
 #endif    /* __PIC32MZDASK_CONFIG_H */
-- 
1.8.3.1

                 reply	other threads:[~2015-12-17 17:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=5672F23B.7020403@microchip.com \
    --to=purna.mandal@microchip.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