parent
b065867cfb
commit
7f00e5ffc6
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2012 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/ar71xx.sh
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(ar71xx_board_name)
|
||||
|
||||
case "$board" in
|
||||
all0258n)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/lantiq.sh
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(lantiq_board_name)
|
||||
|
||||
case "$board" in
|
||||
GIGASX76X)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2012 OpenWrt.org
|
||||
#
|
||||
|
||||
ubootenv_add_uci_config() {
|
||||
local dev=$1
|
||||
local offset=$2
|
||||
local envsize=$3
|
||||
local secsize=$4
|
||||
local numsec=$5
|
||||
uci batch <<EOF
|
||||
add ubootenv ubootenv
|
||||
set ubootenv.@ubootenv[-1].dev='$dev'
|
||||
set ubootenv.@ubootenv[-1].offset='$offset'
|
||||
set ubootenv.@ubootenv[-1].envsize='$envsize'
|
||||
set ubootenv.@ubootenv[-1].secsize='$secsize'
|
||||
set ubootenv.@ubootenv[-1].numsec='$numsec'
|
||||
EOF
|
||||
uci commit ubootenv
|
||||
}
|
||||
|
||||
ubootenv_add_app_config() {
|
||||
local dev
|
||||
local offset
|
||||
local envsize
|
||||
local secsize
|
||||
local numsec
|
||||
config_get dev "$1" dev
|
||||
config_get offset "$1" offset
|
||||
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
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
--- a/fw_env.c
|
||||
+++ b/fw_env.c
|
||||
@@ -46,8 +46,6 @@
|
||||
|
||||
#include "fw_env.h"
|
||||
|
||||
-#include <config.h>
|
||||
-
|
||||
#define WHITESPACE(c) ((c == '\t') || (c == ' '))
|
||||
|
||||
#define min(x, y) ({ \
|
||||
@@ -401,9 +399,7 @@ int fw_env_write(char *name, char *value
|
||||
if (
|
||||
(strcmp(name, "serial#") == 0) ||
|
||||
((strcmp(name, "ethaddr") == 0)
|
||||
-#if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR)
|
||||
&& (strcmp(oldval, MK_STR(CONFIG_ETHADDR)) != 0)
|
||||
-#endif /* CONFIG_OVERWRITE_ETHADDR_ONCE && CONFIG_ETHADDR */
|
||||
) ) {
|
||||
fprintf (stderr, "Can't overwrite \"%s\"\n", name);
|
||||
errno = EROFS;
|
@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011 OpenWrt.org
|
||||
#
|
||||
|
||||
add_ubootenv() {
|
||||
local dev=$1
|
||||
local offset=$2
|
||||
local envsize=$3
|
||||
local secsize=$4
|
||||
local numsec=$5
|
||||
uci batch <<EOF
|
||||
add ubootenv ubootenv
|
||||
set ubootenv.@ubootenv[-1].dev='$dev'
|
||||
set ubootenv.@ubootenv[-1].offset='$offset'
|
||||
set ubootenv.@ubootenv[-1].envsize='$envsize'
|
||||
set ubootenv.@ubootenv[-1].secsize='$secsize'
|
||||
set ubootenv.@ubootenv[-1].numsec='$numsec'
|
||||
EOF
|
||||
}
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/ar71xx.sh
|
||||
|
||||
board=$(ar71xx_board_name)
|
||||
|
||||
case "$board" in
|
||||
all0258n)
|
||||
add_ubootenv /dev/mtd1 0x0 0x10000 0x10000
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
uci commit ubootenv
|
@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
|
||||
uboot_environment_configuration() {
|
||||
local dev=$1
|
||||
local offset=$2
|
||||
local envsize=$3
|
||||
local secsize=$4
|
||||
local numsec=$5
|
||||
echo "$dev $offset $envsize $secsize $numsec" > /etc/fw_env.config
|
||||
}
|
||||
|
||||
[ -e /etc/config/fw_env.config ] && exit 0
|
||||
|
||||
. /lib/lantiq.sh
|
||||
|
||||
board=$(lantiq_board_name)
|
||||
|
||||
case "$board" in
|
||||
GIGASX76X)
|
||||
uboot_environment_configuration "/dev/mtd1" "0x0" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
|
||||
*)
|
||||
# custom foo goes here
|
||||
true
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue