This introduces an init-script for uboot-envtools which creates /etc/fw_env.config in case it doesn't exist yet and we got settings in uci. For the sake of PFY protection don't install the fw_setenv symlink.
Signed-off-by: Daniel Golle <dgo...@allnet.de> Index: package/uboot-envtools/files/uboot-envtools.init =================================================================== --- package/uboot-envtools/files/uboot-envtools.init (revision 0) +++ package/uboot-envtools/files/uboot-envtools.init (revision 0) @@ -0,0 +1,31 @@ +#!/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 secsize "$1" secsize + config_get envsize "$1" envsize "$secsize" + config_get numsec "$1" numsec + + cat >/etc/fw_env.config <<EOF +# MTD device name Device offset Env. size Flash sector size Number of sectors +$dev $offset $envsize $secsize $numsec +EOF +} + +start() { + [ ! -e /etc/fw_env.config ] && { + config_load ubootenv + config_foreach create_fwenv_config ubootenv + } +} Property changes on: package/uboot-envtools/files/uboot-envtools.init ___________________________________________________________________ Added: svn:executable + * Index: package/uboot-envtools/Makefile =================================================================== --- package/uboot-envtools/Makefile (revision 28611) +++ package/uboot-envtools/Makefile (working copy) @@ -10,7 +10,7 @@ PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot PKG_VERSION:=2011.06 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot @@ -35,7 +35,7 @@ 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_BIN) ./files/uboot-envtools.init $(1)/etc/init.d/uboot-envtools endef define Build/Prepare _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel