gcc: remove version 4.9
[15.05/openwrt.git] / target / linux / orion / generic / base-files / lib / upgrade / platform.sh
1 #
2 # Copyright (C) 2010-2011 OpenWrt.org
3 #
4
5 # use default "image" for PART_NAME
6 # use default for platform_do_upgrade()
7
8 platform_check_image() {
9         [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
10
11         local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
12         local magic="$(get_magic_word "$1")"
13         local magic_long="$(get_magic_long "$1")"
14
15         case "${hardware}" in
16          # hardware with a direct uImage partition
17          # image header format as described in U-Boot's include/image.h
18          # see http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/image.h
19          'Linksys WRT350N v2')
20                 [ "${magic_long}" != '27051956' ] && {
21                         echo "Invalid image type ${magic_long}."
22                         return 1
23                 }
24                 return 0
25                 ;;
26          # Netgear WNR854T (has uImage as file inside a JFFS2 partition)
27          'Netgear WNR854T')
28                 [ "${magic}" != '8519' ] && {
29                         echo "Invalid image type ${magic}."
30                         return 1
31                 }
32                 return 0
33                 ;;
34         esac
35
36         echo "Sysupgrade is not yet supported on ${hardware}."
37         return 1
38 }