summaryrefslogtreecommitdiffstats
path: root/package/uboot-envtools/files/uboot-envtools.init
blob: 066109b5e2b23e027a4c218118669e8f9244e7aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
	}
}