recovery init: format rootfs partition (block devices) when setting a new key

https://jira.digi.com/browse/DEL-3277

Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
Tatiana Leon 2017-02-24 22:07:30 +01:00
parent 4085bc8904
commit 96d7211a71
2 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016 Digi International.
# Copyright (C) 2016, 2017 Digi International Inc.
SUMMARY = "Recovery initramfs files"
LICENSE = "GPL-2.0"
@ -56,3 +56,7 @@ do_install() {
PACKAGES = "${PN}"
FILES_${PN} = "/"
RDEPENDS_${PN}_append_ccimx6 = " \
cryptsetup \
"

View File

@ -415,11 +415,19 @@ if [ -n "${encryption_key_bool}" ]; then
psplash_progress "0"
trustfence-tool "--newkey${encryption_key:+=${encryption_key}}"
if [ "$?" = "0" ]; then
psplash_progress "100"
psplash_progress "10"
log "Trustfence encryption key setup succeed!"
else
quit_with_error "Error configuring trustfence encryption key"
fi
# Format partition.
if [ "$(is_nand)" = "no" ]; then
psplash_message "Formatting rootfs partition..."
rootfs_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<rootfs\>.*,\1,g;T;p")"
trustfence-tool --format ${rootfs_block} cryptroot
fi
psplash_progress "100"
fi
# Check if update package command is configured.
@ -432,6 +440,7 @@ if [ -n "${update_package_bool}" ]; then
else
# Give some time for the devices to settle down
sleep 5
mount_external_disks
mount_partition update "${UPDATE_MOUNT_DIR}"