source: branches/backfire/target/linux/x86/base-files/lib/upgrade/platform.sh @ 20706

Last change on this file since 20706 was 20706, checked in by nico, 7 years ago

[backfire] sysupgrade: backport r20703

File size: 1004 bytes
Line 
1USE_REFRESH=1
2
3platform_check_image() {
4        [ "$ARGC" -gt 1 ] && return 1
5
6        case "$(get_magic_word "$1")" in
7                eb48) return 0;;
8                *)
9                        echo "Invalid image type"
10                        return 1
11                ;;
12        esac
13}
14
15platform_do_upgrade() {
16        local ROOTFS
17        sync
18        grep -q -e "jffs2" -e "squashfs" /proc/cmdline \
19                && ROOTFS="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "block2mtd.block2mtd") { print substr($2,1,index($2, ",")-1) }' < /proc/cmdline)" \
20                || ROOTFS="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "root") { print $2 }' < /proc/cmdline)"
21        [ -b ${ROOTFS%[0-9]} ] && get_image "$1" > ${ROOTFS%[0-9]}
22}
23
24x86_prepare_ext2() {
25        # if we're running from ext2, we need to make sure that we have a mtd
26        # partition that points to the active rootfs partition.
27        # however this only matters if we actually need to preserve the config files
28        [ "$SAVE_CONFIG" -eq 1 ] || return 0
29        grep rootfs /proc/mtd >/dev/null || {
30                echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd
31        }
32}
33append sysupgrade_pre_upgrade x86_prepare_ext2
Note: See TracBrowser for help on using the repository browser.