fi
}
+mount_rootfs()
+{
+ /usr/bin/verityctl create rootfs "${PART_ROOTFS}" "${FAKE_ROOT}"
+ case $? in
+ 0)
+ echo "verifyboot: disabled"
+ # do nothing
+ ;;
+ 1)
+ echo "verityboot: enabled";
+ return
+ ;;
+ 2)
+ echo "verifyboot: enabled but corrupted"
+ # should deal with the error like reboot.
+ ;;
+ 3)
+ echo "verifyboot: disabling"
+ ;;
+ esac
+ "$MOUNT" -o ro "${PART_ROOTFS}" "${FAKE_ROOT}"
+}
+
#------------------------------------------------
# mount_partitions
#------------------------------------------------
mount_partitions() {
- if ! restore_mount_checkpoint_partition rootfs "${PART_ROOTFS}" "${FAKE_ROOT}"; then
- return 1
+
+ if [[ "${P_SLOT}" != "" ]]
+ then
+ # For A/B Update rootfs should be updated before the system boots in fota mode.
+ # Therefore rootfs should be mounted as RO.
+ mount_rootfs
+ else
+ if ! restore_mount_checkpoint_partition rootfs "${PART_ROOTFS}" "${FAKE_ROOT}"; then
+ return 1
+ fi
fi
if ! restore_mount_checkpoint_partition system-data "${PART_SYSTEM_DATA}" "${FAKE_ROOT}/${SYSTEM_DATA_MNT}"; then
fi
umount_partition system-data "${FAKE_ROOT}/${SYSTEM_DATA_MNT}"
- if [ "${UPGRADE_SUCCESS}" = "1" ]; then
- commit_partition rootfs "${FAKE_ROOT}"
+ if [[ "${P_SLOT}" != "" ]]
+ then
+ "$UMOUNT" "${FAKE_ROOT}"
+ else
+ if [ "${UPGRADE_SUCCESS}" = "1" ]; then
+ commit_partition rootfs "${FAKE_ROOT}"
+ fi
+ umount_partition rootfs "${FAKE_ROOT}"
fi
- umount_partition rootfs "${FAKE_ROOT}"
}
#------------------------------------------------
PART_USER=$("$BLKID" --match-token PARTLABEL=user -o device || "$BLKID" --match-token LABEL=user -o device)
}
+#------------------------------------------------
+# mount_rootfs
+#------------------------------------------------
+mount_rootfs()
+{
+ /usr/bin/verityctl create rootfs "${PART_ROOTFS}" "${FAKE_ROOT}"
+ case $? in
+ 0)
+ echo "verifyboot: disabled"
+ # do nothing
+ ;;
+ 1)
+ echo "verityboot: enabled";
+ return
+ ;;
+ 2)
+ echo "verifyboot: enabled but corrupted"
+ # should deal with the error like reboot.
+ ;;
+ 3)
+ echo "verifyboot: disabling"
+ ;;
+ esac
+ "$MOUNT" -o ro "${PART_ROOTFS}" "${FAKE_ROOT}"
+}
#------------------------------------------------
# mount_partitions
mount_partitions() {
get_partition_id
- "$MOUNT" -o ro ${PART_ROOTFS} ${FAKE_ROOT}
+ mount_rootfs
"$MOUNT" -t proc none ${FAKE_ROOT}/proc
"$MOUNT" -t sysfs none ${FAKE_ROOT}/sys
"$MOUNT" -t devtmpfs devtmpfs ${FAKE_ROOT}/dev