aboutsummaryrefslogtreecommitdiffstats
path: root/package/uboot-envtools/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-11-01 09:23:28 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-11-01 09:23:28 +0000
commit3ac119b8cfbbe692b453917e4d9f9ff2ab16ad44 (patch)
tree0d8bc2a9884adc0313e2799bbd7f43ace523904a /package/uboot-envtools/files
parentc5ff1e8e96547e34425573fad82d5226f6e3c3a7 (diff)
downloadupstream-3ac119b8cfbbe692b453917e4d9f9ff2ab16ad44.tar.gz
upstream-3ac119b8cfbbe692b453917e4d9f9ff2ab16ad44.tar.bz2
upstream-3ac119b8cfbbe692b453917e4d9f9ff2ab16ad44.zip
package/uboot-envtools: generate config-file from UCI
This adds an init-script for generating /etc/fw_env.config from UCI in case it doesn't exist yet. Signed-off-by: Daniel Golle <dgolle@allnet.de> SVN-Revision: 28697
Diffstat (limited to 'package/uboot-envtools/files')
-rwxr-xr-xpackage/uboot-envtools/files/uboot-envtools.init27
1 files changed, 27 insertions, 0 deletions
diff --git a/package/uboot-envtools/files/uboot-envtools.init b/package/uboot-envtools/files/uboot-envtools.init
new file mode 100755
index 0000000000..066109b5e2
--- /dev/null
+++ b/package/uboot-envtools/files/uboot-envtools.init
@@ -0,0 +1,27 @@
+#!/bin/sh /etc/rc.common
+# (C) 2011 OpenWrt.org
+# Creates /etc/fw_env.conf for fw_printenv (and fw_setenv)
+
+START=80
+
+create_fwenv_config() {
+ local dev
+ local offset
+ local envsize
+ local secsize
+ local numsec
+ config_get dev "$1" dev
+ config_get offset "$1" offset "0x0000"
+ config_get envsize "$1" envsize
+ config_get secsize "$1" secsize
+ config_get numsec "$1" numsec
+ echo "$dev $offset $envsize $secsize $numsec" >>/etc/fw_env.config
+}
+
+start() {
+ [ ! -e /etc/fw_env.config ] && {
+ echo "# MTD device name Device offset Env. size Flash sector size Number of sectors" >/etc/fw_env.config
+ config_load ubootenv
+ config_foreach create_fwenv_config ubootenv
+ }
+}