blob: 3fc6763bc6470d04a59190e2e321b1b1a546bc0e [file] [log] [blame]
developer0e0b0ce2022-07-20 14:30:33 +08001
2board_name=`cat /proc/device-tree/compatible`
3. /lib/upgrade/nand.sh
developere499f142023-02-13 17:54:38 +08004. /lib/upgrade/mmc.sh
developer0e0b0ce2022-07-20 14:30:33 +08005
6platform_do_upgrade() {
7 local board=$board_name
8 echo " board=$board_name ."
9 case "$board" in
10 *snand*)
11 ubi_do_upgrade "$1"
12 ;;
13 *emmc*)
14 mtk_mmc_do_upgrade "$1"
15 ;;
16 *)
17 default_do_upgrade "$1"
18 ;;
19 esac
20}
21
22 PART_NAME=firmware
23
24platform_check_image() {
25 local board=$board_name
26 local magic="$(get_magic_long "$1")"
27
28 [ "$#" -gt 1 ] && return 1
29
30 case "$board" in
31 *snand* |\
32 *emmc*)
33 # tar magic `ustar`
34 magic="$(dd if="$1" bs=1 skip=257 count=5 2>/dev/null)"
35
36 [ "$magic" != "ustar" ] && {
37 echo "Invalid image type."
38 return 1
39 }
40
41 return 0
42 ;;
43 *)
44 [ "$magic" != "d00dfeed" ] && {
45 echo "Invalid image type."
46 return 1
47 }
48 return 0
49 ;;
50 esac
51
52 return 0
53}