mirror of
https://github.com/jiazhang0/meta-secure-core.git
synced 2026-07-16 20:56:58 +00:00
changed init file from the secure-core-image-initramfs to not load an unencrypted rootfs when using full disk encryption.
This commit is contained in:
@@ -4,6 +4,8 @@ PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
ROOTFS_MOUNT="/rootfs"
|
||||
INIT="/sbin/init"
|
||||
|
||||
is_encrypted=0
|
||||
|
||||
mount -t proc none /proc
|
||||
mount -t sysfs none /sys
|
||||
mount -t devtmpfs none /dev
|
||||
@@ -33,12 +35,14 @@ mkdir -p "$ROOTFS_MOUNT"
|
||||
try_to_mount_rootfs() {
|
||||
local mount_flags="rw,noatime,iversion"
|
||||
|
||||
mount -o "$mount_flags" "$ROOTFS_DEV" "$ROOTFS_MOUNT" \
|
||||
2>/dev/null && return 0
|
||||
|
||||
[ -x /init.cryptfs ] &&
|
||||
/init.cryptfs "$ROOTFS_MOUNT" "$ROOTFS_DEV" \
|
||||
"$mount_flags" && return 0
|
||||
if [ $is_encrypted -eq 1 ] ; then
|
||||
[ -x /init.cryptfs ] &&
|
||||
/init.cryptfs "$ROOTFS_MOUNT" "$ROOTFS_DEV" \
|
||||
"$mount_flags" && return 0
|
||||
else
|
||||
mount -o "$mount_flags" "$ROOTFS_DEV" "$ROOTFS_MOUNT" \
|
||||
2>/dev/null && return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
@@ -76,4 +80,4 @@ exec "$switch_root" "$ROOTFS_MOUNT" "$INIT" || {
|
||||
"$ROOTFS_MOUNT/bin/echo.coreutils" "Couldn't switch to the real rootfs"
|
||||
# Cause kernel panic.
|
||||
exit 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user