STATUS_DIR="/opt/data/recovery"
VERSION_FILE="/opt/etc/version"
-flash_initrd() {
- echo "Flash initrd..."
+flash_image() {
+ echo "Flash new images..."
DEVICE="/dev/mmcblk0"
- INITRD_INFO=("ramdisk.img" "ramdisk1" "1024")
- INITRD_RECOVERY_INFO=("ramdisk-recovery.img" "ramdisk2" "1024")
+ RAMDISK_PART=("ramdisk.img" "ramdisk" "1024")
+ RECOVERY_PART=("ramdisk-recovery.img" "ramdisk2" "1024")
+ RECOVERY_KERN=("zImage-recovery" "recovery" "1024")
-# Flash initrd
- /bin/tar xvfp $1 -C $FOTA_DIR ${INITRD_INFO[0]}
- if [ ! -e "$FOTA_DIR/${INITRD_INFO[0]}" ]; then
- echo "There is no ${INITRD_INFO[0]}"
- return 1
+# Flash ramdisk partition
+ /bin/tar xvfp $1 -C $FOTA_DIR ${RAMDISK_PART[0]}
+ if [ ! -e "$FOTA_DIR/${RAMDISK_PART[0]}" ]; then
+ echo "There is no ${RAMDISK_PART[0]}"
+ else
+ PART_NUM=$(partx -s $DEVICE | grep ${RAMDISK_PART[1]} | awk '{print $1}')
+ echo "Flashing ${RAMDISK_PART[0]}..."
+ dd if="$FOTA_DIR/${RAMDISK_PART[0]}" of="$DEVICE"p"$PART_NUM" bs="${RAMDISK_PART[2]}"
+ rm -f $FOTA_DIR/${RAMDISK_PART[0]}
fi
- PART_NUM=$(partx -s $DEVICE | grep ${INITRD_INFO[1]} | awk '{print $1}')
- echo "Flashing initrd..."
- dd if="$FOTA_DIR/${INITRD_INFO[0]}" of="$DEVICE"p"$PART_NUM" bs="${INITRD_INFO[2]}"
- rm -f $FOTA_DIR/${INITRD_INFO[0]}
-# Flash initrd-recovery
- /bin/tar xvfp $1 -C $FOTA_DIR ${INITRD_RECOVERY_INFO[0]}
- if [ ! -e "$FOTA_DIR/${INITRD_RECOVERY_INFO[0]}" ]; then
- echo "There is no ${INITRD_RECOVERY_INFO[0]}"
- return 1
+# Flash recovery partition
+ /bin/tar xvfp $1 -C $FOTA_DIR ${RECOVERY_PART[0]}
+ if [ ! -e "$FOTA_DIR/${RECOVERY_PART[0]}" ]; then
+ echo "There is no ${RECOVERY_PART[0]}"
+ else
+ PART_NUM=$(partx -s $DEVICE | grep ${RECOVERY_PART[1]} | awk '{print $1}')
+ echo "Flashing ${RECOVERY_PART[0]}..."
+ dd if="$FOTA_DIR/${RECOVERY_PART[0]}" of="$DEVICE"p"$PART_NUM" bs="${RECOVERY_PART[2]}"
+ rm -f $FOTA_DIR/${RECOVERY_PART[0]}
+ fi
+
+# Flash recovery kernel
+ /bin/tar xvfp $1 -C $FOTA_DIR ${RECOVERY_KERN[0]}
+ if [ ! -e "$FOTA_DIR/${RECOVERY_KERN[0]}" ]; then
+ echo "There is no ${RECOVERY_KERN[0]}"
+ else
+ PART_NUM=$(partx -s $DEVICE | grep ${RECOVERY_KERN[1]} | awk '{print $1}')
+ echo "Flashing ${RECOVERY_KERN[0]}..."
+ dd if="$FOTA_DIR/${RECOVERY_KERN[0]}" of="$DEVICE"p"$PART_NUM" bs="${RECOVERY_KERN[2]}"
+ rm -f $FOTA_DIR/${RECOVERY_KERN[0]}
fi
- PART_NUM=$(partx -s $DEVICE | grep ${INITRD_RECOVERY_INFO[1]} | awk '{print $1}')
- echo "Flashing initrd-recovery..."
- dd if="$FOTA_DIR/${INITRD_RECOVERY_INFO[0]}" of="$DEVICE"p"$PART_NUM" bs="${INITRD_RECOVERY_INFO[2]}"
- rm -f $FOTA_DIR/${INITRD_RECOVERY_INFO[0]}
}
write_version_info() {
/bin/mkdir -p "$STATUS_DIR"
fi
-# Record version info in target if it doesn't exist
-# (in case of Tizen 3.0)
+# Record version info in target if it doesn't exist
ls "$VERSION_FILE"
if [ $? -ne 0 ]; then
write_version_info
fi
-# Flash initrd images
-# - in case of Tizen 3.0
-flash_initrd $1
+# Flash new images
+# - This operation for Tizen 3.0
+flash_image $1
# Extract delta.ua
echo "Extract delta.ua..."