52aa2321e3e2d4988771c6008d5c1fa0823a653b
[openwrt/openwrt.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 asus,rt-ac58u)
35 CI_UBIPART="UBI_DEV"
36 CI_KERNPART="linux"
37 nand_do_upgrade "$1"
38 ;;
39 openmesh,a42)
40 PART_NAME="inactive"
41 platform_do_upgrade_openmesh "$ARGV"
42 ;;
43 meraki,mr33)
44 CI_KERNPART="part.safe"
45 nand_do_upgrade "$1"
46 ;;
47 *)
48 default_do_upgrade "$ARGV"
49 ;;
50 esac
51 }
52
53 platform_nand_pre_upgrade() {
54 case "$(board_name)" in
55 asus,rt-ac58u)
56 CI_UBIPART="UBI_DEV"
57 CI_KERNPART="linux"
58 ;;
59 meraki,mr33)
60 CI_KERNPART="part.safe"
61 ;;
62 esac
63 }
64
65 blink_led() {
66 . /etc/diag.sh; set_state upgrade
67 }
68
69 append sysupgrade_pre_upgrade blink_led