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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
REQUIRE_IMAGE_METADATA=1
platform_do_upgrade() {
local board=$(board_name)
local file_type=$(identify $1)
case "$board" in
bananapi,bpi-r64)
local rootdev="$(cmdline_get_var root)"
rootdev="${rootdev##*/}"
case "$rootdev" in
mmc*)
CI_ROOTDEV="$rootdev"
CI_KERNPART="production"
emmc_do_upgrade "$1"
;;
*)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
esac
;;
buffalo,wsr-2533dhp2)
local magic="$(get_magic_long "$1")"
# use "mtd write" if the magic is "DHP2 (0x44485032)"
# or "DHP3 (0x44485033)"
if [ "$magic" = "44485032" -o "$magic" = "44485033" ]; then
buffalo_upgrade_ubinized "$1"
else
CI_KERNPART="firmware"
nand_do_upgrade "$1"
fi
;;
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
totolink,a8000ru|\
xiaomi,redmi-router-ax6s)
nand_do_upgrade "$1"
;;
linksys,e8450-ubi)
CI_KERNPART="fit"
nand_do_upgrade "$1"
;;
linksys,e8450)
if grep -q mtdparts=slave /proc/cmdline; then
PART_NAME=firmware2
else
PART_NAME=firmware1
fi
default_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}
PART_NAME=firmware
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_long "$1")"
[ "$#" -gt 1 ] && return 1
case "$board" in
buffalo,wsr-2533dhp2)
buffalo_check_image "$board" "$magic" "$1" || return 1
;;
elecom,wrc-x3200gst3|\
mediatek,mt7622-rfb1-ubi|\
totolink,a8000ru|\
xiaomi,redmi-router-ax6s)
nand_do_platform_check "$board" "$1"
;;
*)
[ "$magic" != "d00dfeed" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
esac
return 0
}
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r64)
export_bootdevice
export_partdevice rootdev 0
if echo $rootdev | grep -q mmc; then
emmc_copy_config
fi
;;
esac
}
|