81444769433e2072d5e7d4a4c52c2d643505fc2a
[openwrt/staging/rmilecki.git] / target / linux / mediatek / mt7622 / base-files / lib / upgrade / platform.sh
1 platform_do_upgrade() {
2 local board=$(board_name)
3
4 case "$board" in
5 bananapi,bpi-r64-rootdisk)
6 #2097152=0x200000 is the offset in bytes from the start
7 #of eMMC and to the location of the kernel
8 get_image "$1" | dd of=/dev/mmcblk0 bs=2097152 seek=1 conv=fsync
9 ;;
10 mediatek,mt7622,ubi)
11 nand_do_upgrade "$1"
12 ;;
13 *)
14 default_do_upgrade "$1"
15 ;;
16 esac
17 }
18
19 PART_NAME=firmware
20
21 platform_check_image() {
22 local board=$(board_name)
23 local magic="$(get_magic_long "$1")"
24
25 [ "$#" -gt 1 ] && return 1
26
27 case "$board" in
28 *)
29 [ "$magic" != "d00dfeed" ] && {
30 echo "Invalid image type."
31 return 1
32 }
33 return 0
34 ;;
35 esac
36
37 return 0
38 }
39
40 platform_copy_config_emmc() {
41 mkdir -p /recovery
42 mount -o rw,noatime /dev/mmcblk0p6 /recovery
43 cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
44 sync
45 umount /recovery
46 }
47
48 platform_copy_config() {
49 case "$(board_name)" in
50 bananapi,bpi-r64-rootdisk)
51 platform_copy_config_emmc
52 ;;
53 esac
54 }