1 platform_export_bootpart() {
2 local cmdline uuid disk
4 if read cmdline < /proc/cmdline; then
7 disk="${cmdline##*block2mtd=}"
11 disk="${cmdline##*root=}"
17 PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02)
18 uuid="${disk#PARTUUID=}"
20 for disk in /dev/[hsv]d[a-z]; do
21 set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "')
22 if [ "$4$3$2$1" = "$uuid" ]; then
23 export BOOTPART="${disk}1"
29 export BOOTPART="${disk%[0-9]}1"
38 platform_check_image() {
39 [ "$#" -gt 1 ] && return 1
41 case "$(get_magic_word "$1")" in
44 echo "Invalid image type"
50 platform_copy_config() {
51 if [ -b "$BOOTPART" ]; then
52 mount -t ext4 -o rw,noatime "$BOOTPART" /mnt
53 cp -af "$CONF_TAR" /mnt/
58 platform_do_upgrade() {
59 platform_export_bootpart
61 if [ -b "${BOOTPART%[0-9]}" ]; then
63 get_image "$@" | dd of="${BOOTPART%[0-9]}" bs=4096 conv=fsync