>From 4a9565f1139fbb585727638fd69a0437bdd212b6 Mon Sep 17 00:00:00 2001
From: Matthew Fatheree <matthew.fathe...@belkin.com>
Date: Sun, 4 May 2014 19:04:04 +0700
Subject: [PATCH 15/30] mamba mvebu: add fw_printenv tool to read U-boot
 environment from Linux

The /tmp/fw_env.config is generated by looking for the "u_env" partition
at the system startup

Signed-off-by: Matthew Fatheree <matthew.fathe...@belkin.com>
---
 package/linksys-base-files/files/etc/fw_env.config |    1 +
 .../files/lib/preinit/04_fw_env_config_init        |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 120000 package/linksys-base-files/files/etc/fw_env.config
 create mode 100644 
package/linksys-base-files/files/lib/preinit/04_fw_env_config_init

diff --git a/package/linksys-base-files/files/etc/fw_env.config 
b/package/linksys-base-files/files/etc/fw_env.config
new file mode 120000
index 0000000..5814153
--- /dev/null
+++ b/package/linksys-base-files/files/etc/fw_env.config
@@ -0,0 +1 @@
+/tmp/fw_env.config
\ No newline at end of file
diff --git a/package/linksys-base-files/files/lib/preinit/04_fw_env_config_init 
b/package/linksys-base-files/files/lib/preinit/04_fw_env_config_init
new file mode 100644
index 0000000..daedf93
--- /dev/null
+++ b/package/linksys-base-files/files/lib/preinit/04_fw_env_config_init
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+init_fw_env() {
+       uboot_env_partname="u_env"
+       uboot_env_mtdpart="$(find_mtd_part $uboot_env_partname)"
+       if [ ! -n "${uboot_env_mtdpart}" ]
+       then
+               echo "init_fw_env: cannot find u_env partition"
+               return
+       fi
+       uboot_env_mtdpart_idx="$(echo $uboot_env_mtdpart | tr -d 
"/dev/mtdblock")"
+cat <<EOF > /tmp/fw_env.config
+# MTD device name       Device offset   Env. size       Flash sector size      
         Number of Sectos
+ /dev/mtd${uboot_env_mtdpart_idx}               0x0000         0x40000         
0x20000                         2
+EOF
+}
+
+boot_hook_add preinit_main init_fw_env
--
1.7.9.5



__________________________________________________________________ Confidential 
This e-mail and any files transmitted with it are the property of Belkin 
International, Inc. and/or its affiliates, are confidential, and are intended 
solely for the use of the individual or entity to whom this e-mail is 
addressed. If you are not one of the named recipients or otherwise have reason 
to believe that you have received this e-mail in error, please notify the 
sender and delete this message immediately from your computer. Any other use, 
retention, dissemination, forwarding, printing or copying of this e-mail is 
strictly prohibited. Pour la version française: 
http://www.belkin.com/email-notice/French.html Für die deutsche Übersetzung: 
http://www.belkin.com/email-notice/German.html 
__________________________________________________________________
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to