1 REQUIRE_IMAGE_METADATA
=1
2 RAMFS_COPY_BIN
='fitblk'
6 # initialize UBI if it's running on initramfs
7 [ "$(rootfs_type)" = "tmpfs" ] ||
return 0
9 ubirmvol
/dev
/ubi0
-N rootfs
10 ubirmvol
/dev
/ubi0
-N rootfs_data
11 ubirmvol
/dev
/ubi0
-N jffs2
12 ubimkvol
/dev
/ubi0
-N jffs2
-s 0x3e000
15 xiaomi_initial_setup
()
17 # initialize UBI and setup uboot-env if it's running on initramfs
18 [ "$(rootfs_type)" = "tmpfs" ] ||
return 0
20 local mtdnum
="$( find_mtd_index ubi )"
21 if [ ! "$mtdnum" ]; then
22 echo "unable to find mtd partition ubi"
26 local kern_mtdnum
="$( find_mtd_index ubi_kernel )"
27 if [ ! "$kern_mtdnum" ]; then
28 echo "unable to find mtd partition ubi_kernel"
32 ubidetach
-m "$mtdnum"
33 ubiformat
/dev
/mtd
$mtdnum -y
35 ubidetach
-m "$kern_mtdnum"
36 ubiformat
/dev
/mtd
$kern_mtdnum -y
38 if ! fw_printenv
-n flag_try_sys2_failed
&>/dev
/null
; then
39 echo "failed to access u-boot-env. skip env setup."
43 fw_setenv boot_wait on
45 fw_setenv flag_boot_rootfs
0
46 fw_setenv flag_last_success
1
47 fw_setenv flag_boot_success
1
48 fw_setenv flag_try_sys1_failed
8
49 fw_setenv flag_try_sys2_failed
8
51 local board
=$
(board_name
)
53 xiaomi
,mi-router-ax3000t|\
54 xiaomi
,mi-router-wr30u-stock
)
55 fw_setenv mtdparts
"nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),34816k(ubi),34816k(ubi1),32768k(overlay),12288k(data),256k(KF)"
57 xiaomi
,redmi-router-ax6000-stock
)
58 fw_setenv mtdparts
"nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),30720k(ubi),30720k(ubi1),51200k(overlay)"
63 platform_do_upgrade
() {
64 local board
=$
(board_name
)
84 bananapi
,bpi-r3-mini|\
86 [ -e /dev
/fit0
] && fitblk
/dev
/fit0
87 [ -e /dev
/fitrw
] && fitblk
/dev
/fitrw
88 bootdev
="$(fitblk_get_bootdev)"
91 EMMC_KERN_DEV
="/dev/$bootdev"
95 PART_NAME
="/dev/mtd${bootdev:8}"
96 default_do_upgrade
"$1"
105 case "$(cmdline_get_var root)" in
107 CI_KERNPART
="production"
118 default_do_upgrade
"$1"
128 mediatek
,mt7981-rfb|\
133 xiaomi
,mi-router-ax3000t-ubootmod|\
134 xiaomi
,mi-router-wr30u-ubootmod|\
135 xiaomi
,redmi-router-ax6000-ubootmod
)
140 CI_KERNPART
="production"
148 CI_KERNPART
="kernel0"
149 EMMC_ROOT_DEV
="$(cmdline_get_var root)"
152 xiaomi
,mi-router-ax3000t|\
153 xiaomi
,mi-router-wr30u-stock|\
154 xiaomi
,redmi-router-ax6000-stock
)
155 CI_KERN_UBIPART
=ubi_kernel
159 zyxel
,ex5601-t0-ubootmod
)
161 CI_ROOTPART
="ubi_rootfs"
172 platform_check_image
() {
173 local board
=$
(board_name
)
174 local magic
="$(get_magic_long "$1")"
176 [ "$#" -gt 1 ] && return 1
182 [ "$magic" != "d00dfeed" ] && {
183 echo "Invalid image type."
189 nand_do_platform_check
"$board" "$1"
197 platform_copy_config
() {
198 case "$(board_name)" in
200 case "$(cmdline_get_var root)" in
207 bananapi
,bpi-r3-mini|\
209 case "$(fitblk_get_bootdev)" in
225 platform_pre_upgrade
() {
226 local board
=$
(board_name
)
234 xiaomi
,mi-router-ax3000t|\
235 xiaomi
,mi-router-wr30u-stock|\
236 xiaomi
,redmi-router-ax6000-stock
)