aboutsummaryrefslogtreecommitdiffstats
path: root/package/uboot-envtools
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
commit011e2be820f83e51f8eb48da39c182a113668d9f (patch)
tree76850d2e69822944ac2eaef7ebd5d11d033079b6 /package/uboot-envtools
parentf5081ab75e41b16f20e12505a8ccae14045d4a2a (diff)
downloadupstream-011e2be820f83e51f8eb48da39c182a113668d9f.tar.gz
upstream-011e2be820f83e51f8eb48da39c182a113668d9f.tar.bz2
upstream-011e2be820f83e51f8eb48da39c182a113668d9f.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> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28697 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/uboot-envtools')
-rw-r--r--package/uboot-envtools/Makefile4
-rwxr-xr-xpackage/uboot-envtools/files/uboot-envtools.init27
2 files changed, 30 insertions, 1 deletions
diff --git a/package/uboot-envtools/Makefile b/package/uboot-envtools/Makefile
index 600697f146..19aebc215f 100644
--- a/package/uboot-envtools/Makefile
+++ b/package/uboot-envtools/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uboot-envtools
PKG_DISTNAME:=u-boot
PKG_VERSION:=2011.06
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
@@ -36,6 +36,8 @@ define Package/uboot-envtools/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fw_printenv $(1)/usr/sbin/
ln -sf fw_printenv $(1)/usr/sbin/fw_setenv
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/uboot-envtools.init $(1)/etc/init.d/uboot-envtools
endef
define Build/Prepare
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
+ }
+}