blob: e738b2bb9a8c1f3e8e460dd491a68e08e4397ded [file] [log] [blame]
From: Weijie Gao <weijie.gao@mediatek.com>
Subject: [PATCH 4/8] mediatek: filogic: add support for MediaTek RBFs upgrade
Add support for MediaTek RBFs upgrade (both normal and dual-image)
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
@@ -1,5 +1,5 @@
REQUIRE_IMAGE_METADATA=1
-RAMFS_COPY_BIN='fitblk'
+RAMFS_COPY_BIN='fitblk blkid'
asus_initial_setup()
{
@@ -64,6 +64,31 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
+ mediatek,mt7981-rfb|\
+ mediatek,mt7988a-rfb)
+ [ -e /dev/fit0 ] && fitblk /dev/fit0
+ [ -e /dev/fitrw ] && fitblk /dev/fitrw
+ bootdev="$(fitblk_get_bootdev)"
+ case "$bootdev" in
+ mmcblk*)
+ EMMC_KERN_DEV="/dev/$bootdev"
+ mmc_do_upgrade "$1"
+ ;;
+ mtdblock*)
+ PART_NAME="/dev/mtd${bootdev:8}"
+ default_do_upgrade "$1"
+ ;;
+ ubiblock*)
+ CI_KERNPART="firmware"
+ ubi_do_upgrade "$1"
+ ;;
+ *)
+ if grep \"rootfs_data\" /proc/mtd; then
+ default_do_upgrade "$1"
+ fi
+ ;;
+ esac
+ ;;
acer,predator-w6|\
smartrg,sdg-8612|\
smartrg,sdg-8614|\
@@ -134,7 +159,6 @@ platform_do_upgrade() {
;;
h3c,magic-nx30-pro|\
jcg,q30-pro|\
- mediatek,mt7981-rfb|\
netcore,n60|\
qihoo,360t7|\
xiaomi,mi-router-ax3000t-ubootmod|\
@@ -205,6 +229,8 @@ platform_check_image() {
[ "$#" -gt 1 ] && return 1
case "$board" in
+ mediatek,mt7981-rfb|\
+ mediatek,mt7988a-rfb|\
bananapi,bpi-r3|\
bananapi,bpi-r4|\
bananapi,bpi-r4-poe|\
@@ -226,6 +252,14 @@ platform_check_image() {
platform_copy_config() {
case "$(board_name)" in
+ mediatek,mt7981-rfb|\
+ mediatek,mt7988a-rfb)
+ case "$(fitblk_get_bootdev)" in
+ mmcblk*)
+ mmc_copy_config
+ ;;
+ esac
+ ;;
cmcc,rax3000m)
case "$(cmdline_get_var root)" in
/dev/mmc*)