1USE_REFRESH=1
2
3x86_get_rootfs() {
4	local rootfsdev
5	local rootfstype
6	
7	rootfstype="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "rootfstype") { print $2 }' < /proc/cmdline)"
8	case "$rootfstype" in
9		squashfs|jffs2)
10			rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "block2mtd.block2mtd") { print substr($2,1,index($2, ",")-1) }' < /proc/cmdline)";;
11		ext4)
12			rootfsdev="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "root") { print $2 }' < /proc/cmdline)";;
13	esac
14		
15	echo "$rootfstype:$rootfsdev"
16}
17
18platform_check_image() {
19	[ "$ARGC" -gt 1 ] && return 1
20
21	case "$(get_magic_word "$1")" in
22		eb48|eb63) return 0;;
23		*)
24			echo "Invalid image type"
25			return 1
26		;;
27	esac
28}
29
30platform_refresh_partitions() {
31	return 0
32}
33
34platform_copy_config() {
35	local rootfs="$(x86_get_rootfs)"
36	local rootfsdev="${rootfs##*:}"
37	
38	mount -t ext4 -o rw,noatime "${rootfsdev%[0-9]}1" /mnt
39	cp -af "$CONF_TAR" /mnt/
40	umount /mnt
41}
42
43platform_do_upgrade() {
44	local rootfs="$(x86_get_rootfs)"
45	local rootfsdev="${rootfs##*:}"
46
47	sync
48	[ -b ${rootfsdev%[0-9]} ] && get_image "$@" | dd of=${rootfsdev%[0-9]} bs=4096 conv=fsync
49	sleep 1
50}
51