developer | 8a0c6f8 | 2023-08-21 16:59:35 +0800 | [diff] [blame^] | 1 | RAMFS_COPY_BIN='mkfs.f2fs blkid blockdev fw_printenv fw_setenv' |
| 2 | RAMFS_COPY_DATA="/etc/fw_env.config /var/lock/fw_printenv.lock" |
| 3 | |
developer | 010cc99 | 2022-10-19 15:02:34 +0800 | [diff] [blame] | 4 | platform_do_upgrade() { |
| 5 | local board=$(board_name) |
| 6 | |
| 7 | case "$board" in |
| 8 | *snand*) |
developer | 8a0c6f8 | 2023-08-21 16:59:35 +0800 | [diff] [blame^] | 9 | ubi_do_upgrade "$1" |
| 10 | ;; |
| 11 | *emmc*) |
| 12 | mtk_mmc_do_upgrade "$1" |
developer | 010cc99 | 2022-10-19 15:02:34 +0800 | [diff] [blame] | 13 | ;; |
| 14 | *) |
| 15 | default_do_upgrade "$1" |
| 16 | ;; |
| 17 | esac |
| 18 | } |
| 19 | |
| 20 | PART_NAME=firmware |
| 21 | |
| 22 | platform_check_image() { |
| 23 | local board=$(board_name) |
| 24 | local magic="$(get_magic_long "$1")" |
| 25 | |
| 26 | [ "$#" -gt 1 ] && return 1 |
| 27 | |
| 28 | case "$board" in |
developer | 8a0c6f8 | 2023-08-21 16:59:35 +0800 | [diff] [blame^] | 29 | *snand* |\ |
| 30 | *emmc*) |
developer | 010cc99 | 2022-10-19 15:02:34 +0800 | [diff] [blame] | 31 | # tar magic `ustar` |
| 32 | magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)" |
| 33 | |
| 34 | [ "$magic" != "ustar" ] && { |
| 35 | echo "Invalid image type." |
| 36 | return 1 |
| 37 | } |
| 38 | |
| 39 | return 0 |
| 40 | ;; |
| 41 | *) |
| 42 | [ "$magic" != "d00dfeed" ] && { |
| 43 | echo "Invalid image type." |
| 44 | return 1 |
| 45 | } |
| 46 | return 0 |
| 47 | ;; |
| 48 | esac |
| 49 | |
| 50 | return 0 |
| 51 | } |