mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-02-09 08:08:27 +00:00
66 lines
1.3 KiB
Bash
66 lines
1.3 KiB
Bash
|
PART_NAME=firmware
|
||
|
REQUIRE_IMAGE_METADATA=1
|
||
|
|
||
|
RAMFS_COPY_BIN='fw_printenv fw_setenv'
|
||
|
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
|
||
|
|
||
|
xiaomi_initramfs_prepare() {
|
||
|
# Wipe UBI if running initramfs
|
||
|
[ "$(rootfs_type)" = "tmpfs" ] || return 0
|
||
|
|
||
|
local rootfs_mtdnum="$( find_mtd_index rootfs )"
|
||
|
if [ ! "$rootfs_mtdnum" ]; then
|
||
|
echo "unable to find mtd partition rootfs"
|
||
|
return 1
|
||
|
fi
|
||
|
|
||
|
local kern_mtdnum="$( find_mtd_index ubi_kernel )"
|
||
|
if [ ! "$kern_mtdnum" ]; then
|
||
|
echo "unable to find mtd partition ubi_kernel"
|
||
|
return 1
|
||
|
fi
|
||
|
|
||
|
ubidetach -m "$rootfs_mtdnum"
|
||
|
ubiformat /dev/mtd$rootfs_mtdnum -y
|
||
|
|
||
|
ubidetach -m "$kern_mtdnum"
|
||
|
ubiformat /dev/mtd$kern_mtdnum -y
|
||
|
}
|
||
|
|
||
|
platform_check_image() {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
platform_pre_upgrade() {
|
||
|
case "$(board_name)" in
|
||
|
xiaomi,ax3600)
|
||
|
xiaomi_initramfs_prepare
|
||
|
;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
platform_do_upgrade() {
|
||
|
case "$(board_name)" in
|
||
|
xiaomi,ax3600)
|
||
|
# Make sure that UART is enabled
|
||
|
fw_setenv boot_wait on
|
||
|
fw_setenv uart_en 1
|
||
|
|
||
|
# Enforce single partition.
|
||
|
fw_setenv flag_boot_rootfs 0
|
||
|
fw_setenv flag_last_success 0
|
||
|
fw_setenv flag_boot_success 1
|
||
|
fw_setenv flag_try_sys1_failed 8
|
||
|
fw_setenv flag_try_sys2_failed 8
|
||
|
|
||
|
# Kernel and rootfs are placed in 2 different UBI
|
||
|
CI_KERN_UBIPART="ubi_kernel"
|
||
|
CI_ROOT_UBIPART="rootfs"
|
||
|
nand_do_upgrade "$1"
|
||
|
;;
|
||
|
*)
|
||
|
default_do_upgrade "$1"
|
||
|
;;
|
||
|
esac
|
||
|
}
|