fdd26c5176c9b2b5d33a3df6c4a56a701087e009
[openwrt-10.03/.git] / platform.sh
1 # use default "image" for PART_NAME
2 # use default for platform_do_upgrade()
3
4 platform_check_image() {
5         [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
6
7         local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
8         local magic="$(get_magic_word "$1")"
9
10         case "${hardware}" in
11          # hardware with padded uImage + padded rootfs
12          'Linksys WRT350N v2')
13                 [ "${magic}" != '2705' ] && {
14                         echo "Invalid image type ${magic}."
15                         return 1
16                 }
17                 return 0
18                 ;;
19          # Netgear WNR854T has extra header before uImage
20          'Netgear WNR854T')
21                 [ "${magic}" != '8519' ] && {
22                         echo "Invalid image type ${magic}."
23                         return 1
24                 }
25                 return 0
26                 ;;
27         esac
28
29         echo "Sysupgrade is not yet supported on ${hardware}."
30         return 1
31 }