mediatek: add bpi-r64 emmc support
[openwrt/staging/jow.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 *)
11 default_do_upgrade "$1"
12 ;;
13 esac
14 }
15
16 PART_NAME=firmware
17
18 platform_check_image() {
19 local board=$(board_name)
20 local magic="$(get_magic_long "$1")"
21
22 [ "$#" -gt 1 ] && return 1
23
24 case "$board" in
25 *)
26 [ "$magic" != "d00dfeed" ] && {
27 echo "Invalid image type."
28 return 1
29 }
30 return 0
31 ;;
32 esac
33
34 return 0
35 }
36
37 platform_copy_config_emmc() {
38 mkdir -p /recovery
39 mount -o rw,noatime /dev/mmcblk0p6 /recovery
40 cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
41 sync
42 umount /recovery
43 }
44
45 platform_copy_config() {
46 case "$(board_name)" in
47 bananapi,bpi-r64-rootdisk)
48 platform_copy_config_emmc
49 ;;
50 esac
51 }