Initial commit
This commit is contained in:
83
package/boot/uboot-envtools/Makefile
Normal file
83
package/boot/uboot-envtools/Makefile
Normal file
@@ -0,0 +1,83 @@
|
||||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uboot-envtools
|
||||
PKG_DISTNAME:=u-boot
|
||||
PKG_VERSION:=2018.03
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://git.denx.de/u-boot.git
|
||||
PKG_SOURCE_VERSION:=f95ab1fb6e37f0601f397091bb011edf7a98b890
|
||||
PKG_MIRROR_HASH:=b50d8b6fe0d90b92c8c147457b1b4c2ed1cdb03191085cfc57fdad77c0bfffab
|
||||
|
||||
PKG_BUILD_DEPENDS:=fstools
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
||||
PKG_LICENSE_FILES:=Licenses/README
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/uboot-envtools
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Boot Loaders
|
||||
TITLE:=read/modify U-Boot bootloader environment
|
||||
URL:=http://www.denx.de/wiki/U-Boot
|
||||
endef
|
||||
|
||||
define Package/uboot-envtools/description
|
||||
This package includes tools to read and modify U-Boot bootloader environment.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
touch $(PKG_BUILD_DIR)/include/config.h
|
||||
mkdir -p $(PKG_BUILD_DIR)/include/config
|
||||
touch $(PKG_BUILD_DIR)/include/config/auto.conf
|
||||
mkdir -p $(PKG_BUILD_DIR)/include/generated
|
||||
touch $(PKG_BUILD_DIR)/include/generated/autoconf.h
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
|
||||
HOSTLDFLAGS= \
|
||||
no-dot-config-targets=envtools \
|
||||
envtools
|
||||
endef
|
||||
|
||||
define Package/uboot-envtools/conffiles
|
||||
/etc/config/ubootenv
|
||||
/etc/fw_env.config
|
||||
endef
|
||||
|
||||
define Package/uboot-envtools/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin
|
||||
$(LN) fw_printenv $(1)/usr/sbin/fw_setenv
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(if $(wildcard ./files/$(BOARD)), \
|
||||
$(INSTALL_DATA) ./files/$(BOARD) \
|
||||
$(1)/etc/uci-defaults/30_uboot-envtools \
|
||||
)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,uboot-envtools))
|
||||
109
package/boot/uboot-envtools/files/ar71xx
Normal file
109
package/boot/uboot-envtools/files/ar71xx
Normal file
@@ -0,0 +1,109 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2014 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
a40|\
|
||||
a60|\
|
||||
alfa-ap120c|\
|
||||
all0258n|\
|
||||
ap121f|\
|
||||
ap90q|\
|
||||
ap91-5g|\
|
||||
arduino-yun|\
|
||||
cap324|\
|
||||
cap4200ag|\
|
||||
carambola2|\
|
||||
cpe830|\
|
||||
cpe870|\
|
||||
cr3000|\
|
||||
cr5000|\
|
||||
e1700ac-v2|\
|
||||
e600g-v2|\
|
||||
e600gac-v2|\
|
||||
eap300v2|\
|
||||
ens202ext|\
|
||||
gl-ar300m|\
|
||||
gl-ar750|\
|
||||
hornet-ub|\
|
||||
hornet-ub-x2|\
|
||||
jwap230|\
|
||||
koala|\
|
||||
mr1750|\
|
||||
mr1750v2|\
|
||||
mr600|\
|
||||
mr600v2|\
|
||||
mr900|\
|
||||
mr900v2|\
|
||||
n5q|\
|
||||
nbg6616|\
|
||||
nbg6716|\
|
||||
om5p|\
|
||||
om5p-ac|\
|
||||
om5p-acv2|\
|
||||
om5p-an|\
|
||||
r36a|\
|
||||
rme-eg200|\
|
||||
sr3200|\
|
||||
t830|\
|
||||
tube2h|\
|
||||
wam250|\
|
||||
wnr1000-v2|\
|
||||
wnr2000-v3|\
|
||||
wnr2200|\
|
||||
wnr612-v2|\
|
||||
xd3200)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
alfa-ap96|\
|
||||
all0315n|\
|
||||
om2p|\
|
||||
om2p-hs|\
|
||||
om2p-hsv2|\
|
||||
om2p-hsv3|\
|
||||
om2p-hsv4|\
|
||||
om2p-lc|\
|
||||
om2pv2|\
|
||||
om2pv4)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x40000"
|
||||
;;
|
||||
dap-2695-a1|\
|
||||
wzr-hp-ag300h)
|
||||
ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
dr342|\
|
||||
dr531)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000"
|
||||
;;
|
||||
rambutan)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x100000" "0x20000" "0x20000"
|
||||
;;
|
||||
qihoo-c301)
|
||||
ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
wi2a-ac200i)
|
||||
ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x8000" "0x10000"
|
||||
;;
|
||||
wndr3700)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000"
|
||||
;;
|
||||
wndr4300)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
27
package/boot/uboot-envtools/files/cns3xxx
Normal file
27
package/boot/uboot-envtools/files/cns3xxx
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
laguna)
|
||||
# Laguna uboot env size/erasesize vary depending on NOR vs SPI FLASH
|
||||
size=$(grep mtd1 /proc/mtd | awk '{print $2}')
|
||||
erasesize=$(grep mtd1 /proc/mtd | awk '{print $3}')
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x$size" "0x$erasesize"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
35
package/boot/uboot-envtools/files/imx6
Normal file
35
package/boot/uboot-envtools/files/imx6
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
*gw5*)
|
||||
if [ -c /dev/mtd1 ]; then
|
||||
# board boots from NAND
|
||||
ubootenv_add_uci_config /dev/mtd1 0x0 0x20000 0x40000
|
||||
ubootenv_add_uci_config /dev/mtd1 0x80000 0x20000 0x40000
|
||||
else
|
||||
# board boots from microSD
|
||||
ubootenv_add_uci_config /dev/mmcblk0 0xb1400 0x20000 0x20000
|
||||
ubootenv_add_uci_config /dev/mmcblk0 0xd1400 0x20000 0x20000
|
||||
fi
|
||||
;;
|
||||
wandboard)
|
||||
ubootenv_add_uci_config "/dev/mmcblk0" "0x60000" "0x2000" "0x2000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
43
package/boot/uboot-envtools/files/ipq40xx
Normal file
43
package/boot/uboot-envtools/files/ipq40xx
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 LEDE
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
ubootenv_mtdinfo () {
|
||||
UBOOTENV_PART=$(cat /proc/mtd | grep APPSBLENV)
|
||||
mtd_dev=$(echo $UBOOTENV_PART | awk '{print $1}' | sed 's/:$//')
|
||||
mtd_size=$(echo $UBOOTENV_PART | awk '{print "0x"$2}')
|
||||
mtd_erase=$(echo $UBOOTENV_PART | awk '{print "0x"$3}')
|
||||
nor_flash=$(find /sys/bus/spi/devices/*/mtd -name ${mtd_dev})
|
||||
|
||||
if [ -n "$nor_flash" ]; then
|
||||
ubootenv_size=$mtd_size
|
||||
else
|
||||
# size is fixed to 0x40000 in u-boot
|
||||
ubootenv_size=0x40000
|
||||
fi
|
||||
|
||||
sectors=$(( $ubootenv_size / $mtd_erase ))
|
||||
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
|
||||
}
|
||||
|
||||
case "$board" in
|
||||
openmesh,a42 |\
|
||||
openmesh,a62)
|
||||
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
49
package/boot/uboot-envtools/files/ipq806x
Normal file
49
package/boot/uboot-envtools/files/ipq806x
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2016 LEDE
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
ubootenv_mtdinfo () {
|
||||
UBOOTENV_PART=$(cat /proc/mtd | grep APPSBLENV)
|
||||
mtd_dev=$(echo $UBOOTENV_PART | awk '{print $1}' | sed 's/:$//')
|
||||
mtd_size=$(echo $UBOOTENV_PART | awk '{print "0x"$2}')
|
||||
mtd_erase=$(echo $UBOOTENV_PART | awk '{print "0x"$3}')
|
||||
nor_flash=$(find /sys/bus/spi/devices/*/mtd -name ${mtd_dev})
|
||||
|
||||
if [ -n "$nor_flash" ]; then
|
||||
ubootenv_size=$mtd_size
|
||||
else
|
||||
# size is fixed to 0x40000 in u-boot
|
||||
ubootenv_size=0x40000
|
||||
fi
|
||||
|
||||
sectors=$(( $ubootenv_size / $mtd_erase ))
|
||||
echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
|
||||
}
|
||||
|
||||
case "$board" in
|
||||
linksys,ea8500)
|
||||
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
qcom,ipq8064-ap148 |\
|
||||
qcom,ipq8064-db149)
|
||||
ubootenv_add_uci_config $(ubootenv_mtdinfo)
|
||||
;;
|
||||
zyxel,nbg6817)
|
||||
ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
33
package/boot/uboot-envtools/files/kirkwood
Normal file
33
package/boot/uboot-envtools/files/kirkwood
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
cloudengines,pogoe02|\
|
||||
cloudengines,pogoplugv4|\
|
||||
linksys,viper|\
|
||||
raidsonic,ib-nas62x0|\
|
||||
seagate,dockstar|\
|
||||
zyxel,nsa310b|\
|
||||
zyxel,nsa325)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
linksys,audi)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
38
package/boot/uboot-envtools/files/lantiq
Normal file
38
package/boot/uboot-envtools/files/lantiq
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
bt,homehub-v2b)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
bt,homehub-v3a)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x4000" "1"
|
||||
;;
|
||||
siemens,gigaset-sx76x)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
zyxel,p-2812hnu-f1)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x2000" "0x20000" "1"
|
||||
;;
|
||||
buffalo,wbmr-300hpd)
|
||||
idx="$(find_mtd_index ubootconfig)"
|
||||
[ -n "$idx" ] && \
|
||||
ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x2000" "0x1000" "2"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
41
package/boot/uboot-envtools/files/mvebu
Normal file
41
package/boot/uboot-envtools/files/mvebu
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
armada-385-linksys-caiman|\
|
||||
armada-385-linksys-cobra|\
|
||||
armada-385-linksys-shelby)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
|
||||
;;
|
||||
armada-385-linksys-rango|\
|
||||
armada-385-linksys-venom)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
|
||||
;;
|
||||
armada-385-turris-omnia)
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0xC0000" "0x10000" "0x40000"
|
||||
;;
|
||||
armada-xp-linksys-mamba)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
|
||||
;;
|
||||
globalscale,espressobin|\
|
||||
marvell,armada8040-mcbin)
|
||||
ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
25
package/boot/uboot-envtools/files/mxs
Normal file
25
package/boot/uboot-envtools/files/mxs
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
duckbill)
|
||||
ubootenv_add_uci_config "/dev/mmcblk0" "0x20000" "0x20000"
|
||||
ubootenv_add_uci_config "/dev/mmcblk0" "0x40000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
27
package/boot/uboot-envtools/files/oxnas
Normal file
27
package/boot/uboot-envtools/files/oxnas
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
akitio|\
|
||||
kd20|\
|
||||
stg212)
|
||||
ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x4000" "0x1F000" "1"
|
||||
ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x4000" "0x1F000" "1"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
27
package/boot/uboot-envtools/files/pistachio
Normal file
27
package/boot/uboot-envtools/files/pistachio
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
img,pistachio-marduk)
|
||||
ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x1000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
42
package/boot/uboot-envtools/files/ramips
Normal file
42
package/boot/uboot-envtools/files/ramips
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2011-2012 OpenWrt.org
|
||||
#
|
||||
|
||||
[ -e /etc/config/ubootenv ] && exit 0
|
||||
|
||||
touch /etc/config/ubootenv
|
||||
|
||||
. /lib/uboot-envtools.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
alfa-network,ac1200rm|\
|
||||
alfa-network,awusfree1)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000"
|
||||
;;
|
||||
all0239-3g|\
|
||||
all0256n-4M|\
|
||||
all0256n-8M|\
|
||||
all5002)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
|
||||
;;
|
||||
linkits7688|\
|
||||
miwifi-nano|\
|
||||
sk-wb8|\
|
||||
wsr-1166|\
|
||||
wsr-600|\
|
||||
zbt-wg2626)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
||||
;;
|
||||
mir3g)
|
||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
|
||||
;;
|
||||
esac
|
||||
|
||||
config_load ubootenv
|
||||
config_foreach ubootenv_add_app_config ubootenv
|
||||
|
||||
exit 0
|
||||
36
package/boot/uboot-envtools/files/uboot-envtools.sh
Normal file
36
package/boot/uboot-envtools/files/uboot-envtools.sh
Normal file
@@ -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
|
||||
}
|
||||
|
||||
13
package/boot/uboot-envtools/patches/001-compile.patch
Normal file
13
package/boot/uboot-envtools/patches/001-compile.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
--- a/tools/env/Makefile
|
||||
+++ b/tools/env/Makefile
|
||||
@@ -10,6 +10,10 @@
|
||||
# with "CC" here for the maximum code reuse of scripts/Makefile.host.
|
||||
override HOSTCC = $(CC)
|
||||
|
||||
+ifneq ($(TARGET_CFLAGS),)
|
||||
+HOSTCFLAGS = $(TARGET_CFLAGS)
|
||||
+endif
|
||||
+
|
||||
# Compile for a hosted environment on the target
|
||||
HOST_EXTRACFLAGS = $(patsubst -I%,-idirafter%, $(filter -I%, $(UBOOTINCLUDE))) \
|
||||
-idirafter $(srctree)/tools/env \
|
||||
Reference in New Issue
Block a user