1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-19 00:57:31 +02:00
openwrt-xburst/package/uboot-envtools/files/uboot-envtools.init
juhosg 18a0b2664f 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
2011-11-01 09:23:28 +00:00

28 lines
673 B
Bash
Executable File

#!/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
}
}