4096e127ea9eaa8106475a3143b0b2ea796b5c7c
[openwrt/staging/wigyori.git] / target / linux / ipq40xx / base-files / lib / upgrade / platform.sh
1 PART_NAME=firmware
2 REQUIRE_IMAGE_METADATA=1
3
4 RAMFS_COPY_BIN='fw_printenv fw_setenv'
5 RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
6
7 platform_check_image() {
8 case "$(board_name)" in
9 asus,rt-ac58u)
10 CI_UBIPART="UBI_DEV"
11 local ubidev=$(nand_find_ubi $CI_UBIPART)
12 local asus_root=$(nand_find_volume $ubidev jffs2)
13
14 [ -n "$asus_root" ] || return 0
15
16 cat << EOF
17 jffs2 partition is still present.
18 There's probably no space left
19 to install the filesystem.
20
21 You need to delete the jffs2 partition first:
22 # ubirmvol /dev/ubi0 --name=jffs2
23
24 Once this is done. Retry.
25 EOF
26 return 1
27 ;;
28 esac
29 return 0;
30 }
31
32 platform_do_upgrade() {
33 case "$(board_name)" in
34 8dev,jalapeno)
35 nand_do_upgrade "$ARGV"
36 ;;
37 asus,rt-ac58u)
38 CI_UBIPART="UBI_DEV"
39 CI_KERNPART="linux"
40 nand_do_upgrade "$1"
41 ;;
42 openmesh,a42 |\
43 openmesh,a62)
44 PART_NAME="inactive"
45 platform_do_upgrade_openmesh "$ARGV"
46 ;;
47 meraki,mr33)
48 CI_KERNPART="part.safe"
49 nand_do_upgrade "$1"
50 ;;
51 *)
52 default_do_upgrade "$ARGV"
53 ;;
54 esac
55 }
56
57 platform_nand_pre_upgrade() {
58 case "$(board_name)" in
59 asus,rt-ac58u)
60 CI_UBIPART="UBI_DEV"
61 CI_KERNPART="linux"
62 ;;
63 meraki,mr33)
64 CI_KERNPART="part.safe"
65 ;;
66 esac
67 }
68
69 blink_led() {
70 . /etc/diag.sh; set_state upgrade
71 }
72
73 append sysupgrade_pre_upgrade blink_led