blob: 92b144330f25933be64443d78902efa2d0850607 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh
2#
3# Copyright (C) 2014-2016 OpenWrt.org
4# Copyright (C) 2016 LEDE-Project.org
5#
6
7[ -e /etc/config/ubootenv ] && exit 0
8
9touch /etc/config/ubootenv
10
11. /lib/uboot-envtools.sh
12. /lib/functions.sh
13
14board=$(board_name)
15
16case "$board" in
17buffalo,ls421de)
18 ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000"
19 ;;
20cznic,turris-omnia)
21 if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then
22 ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000"
23 else
24 ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000"
25 fi
26 ;;
27glinet,gl-mv1000)
28 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x8000" "1"
29 ;;
30globalscale,espressobin|\
31globalscale,espressobin-emmc|\
32globalscale,espressobin-ultra|\
33globalscale,espressobin-v7|\
34globalscale,espressobin-v7-emmc)
35 idx="$(find_mtd_index u-boot-env)"
36 if [ -n "$idx" ]; then
37 ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1"
38 else
39 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
40 fi
41 ;;
42marvell,armada8040-mcbin-doubleshot|\
43marvell,armada8040-mcbin-singleshot)
44 ubootenv_add_uci_config "/dev/mtd0" "0x3f0000" "0x10000" "0x10000" "1"
45 ;;
46linksys,wrt1200ac|\
47linksys,wrt1900ac-v2|\
48linksys,wrt1900acs)
49 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x40000"
50 ;;
51linksys,wrt1900ac-v1)
52 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
53 ;;
54linksys,wrt3200acm|\
55linksys,wrt32x)
56 ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
57 ;;
58methode,udpu)
59 ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000"
60 ;;
61esac
62
63config_load ubootenv
64config_foreach ubootenv_add_app_config ubootenv
65
66exit 0