2 # Copyright (C) 2014 OpenWrt.org
5 .
/lib
/functions
/octeon.sh
7 platform_get_rootfs
() {
10 if read cmdline
< /proc
/cmdline
; then
13 rootfsdev
="${cmdline##*block2mtd=}"
14 rootfsdev
="${rootfsdev%%,*}"
17 rootfsdev
="${cmdline##*root=}"
18 rootfsdev
="${rootfsdev%% *}"
26 platform_copy_config
() {
27 local board
="$(octeon_board_name)"
31 mount
-t vfat
/dev
/sda1
/mnt
32 cp -af "$CONF_TAR" /mnt
/
38 platform_do_upgrade
() {
39 local board
=$
(octeon_board_name
)
40 local rootfs
="$(platform_get_rootfs)"
42 [ -b "${rootfs}" ] ||
return 1
47 local kernel_length
=`(tar xf $tar_file sysupgrade-erlite/kernel -O | wc -c) 2> /dev/null`
48 local rootfs_length
=`(tar xf $tar_file sysupgrade-erlite/root -O | wc -c) 2> /dev/null`
51 mount
-t vfat
/dev
/sda1
/boot
53 [ -f /boot
/vmlinux
.64 -a ! -L /boot
/vmlinux
.64 ] && {
54 mv /boot
/vmlinux
.64 /boot
/vmlinux
.64.previous
55 mv /boot
/vmlinux
.64.md5
/boot
/vmlinux
.64.md5.previous
58 tar xf
$tar_file sysupgrade-erlite
/kernel
-O > /boot
/vmlinux
.64
59 md5sum /boot
/vmlinux
.64 | cut
-f1 -d " " > /boot
/vmlinux
.64.md5
60 tar xf
$tar_file sysupgrade-erlite
/root
-O |
dd of
="${rootfs}" bs
=4096
71 platform_check_image
() {
72 local board
=$
(octeon_board_name
)
77 local kernel_length
=`(tar xf $tar_file sysupgrade-erlite/kernel -O | wc -c) 2> /dev/null`
78 local rootfs_length
=`(tar xf $tar_file sysupgrade-erlite/root -O | wc -c) 2> /dev/null`
79 [ "$kernel_length" = 0 -o "$rootfs_length" = 0 ] && {
80 echo "The upgarde image is corrupt."
87 echo "Sysupgrade is not yet supported on $board."