From 59893f5cf02df39b2f3f78796fd12490840f7c03 Mon Sep 17 00:00:00 2001 From: SolidHal Date: Thu, 26 Sep 2019 11:34:59 -0700 Subject: [PATCH] Fixup initramfs mmc booting --- resources/BuildResources/initramfs-init | 3 +- scripts/InstallScripts/InstallToInternal.sh | 46 ++++++++++----------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/resources/BuildResources/initramfs-init b/resources/BuildResources/initramfs-init index 9cad70c..b7c7c35 100644 --- a/resources/BuildResources/initramfs-init +++ b/resources/BuildResources/initramfs-init @@ -37,7 +37,7 @@ ROOT_DEV="${BLKID%1:*}" echo ${ROOT_DEV} #uncomment for debugging -exec setsid /bin/sh -c 'exec /bin/sh /dev/tty1 2>&1' +# exec setsid /bin/sh -c 'exec /bin/sh /dev/tty1 2>&1' # we use this to change what cmdline options get passed into # the next boot stage, aka to enable root encryption @@ -49,7 +49,6 @@ mount ${ROOT_DEV}3 /newroot umount /sys umount /proc -umount /dev # exec setsid /bin/sh -c 'exec /bin/sh /dev/tty1 2>&1' diff --git a/scripts/InstallScripts/InstallToInternal.sh b/scripts/InstallScripts/InstallToInternal.sh index 1f46572..b886702 100755 --- a/scripts/InstallScripts/InstallToInternal.sh +++ b/scripts/InstallScripts/InstallToInternal.sh @@ -57,22 +57,23 @@ then dmesg -E echo Writing kernel partition + dd if=/dev/zero of=/dev/mmcblk2p1 bs=512 count=65536 dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1 BOOT_DEV_NAME=mmcblk2p2 ROOT_DEV_NAME=mmcblk2p3 CRYPTO=false #Handle full disk encryption - read -p "Would you like to setup full disk encrytion using LUKs/DmCrypt? [Y/n]" -n 1 -r - if [[ $REPLY =~ ^[Yy]$ ]] - then - CRYPTO=true - # Since iteration count is based on cpu power, and the rk3288 isn't as fast as a usual - # desktop cpu, maually supply -i 15000 for security at the cost of a slightly slower unlock - cryptsetup -s 512 luksFormat -i 15000 /dev/mmcblk2p2 - cryptsetup luksOpen /dev/mmcblk2p2 mmcblk2p2-encrypted - ROOT_DEV_NAME=mapper/mmcblk2p2-encrypted - fi + # read -p "Would you like to setup full disk encrytion using LUKs/DmCrypt? [Y/n]" -n 1 -r + # if [[ $REPLY =~ ^[Yy]$ ]] + # then + # CRYPTO=true + # # Since iteration count is based on cpu power, and the rk3288 isn't as fast as a usual + # # desktop cpu, maually supply -i 15000 for security at the cost of a slightly slower unlock + # cryptsetup -s 512 luksFormat -i 15000 /dev/mmcblk2p2 + # cryptsetup luksOpen /dev/mmcblk2p2 mmcblk2p2-encrypted + # ROOT_DEV_NAME=mapper/mmcblk2p2-encrypted + # fi echo Writing Filesystem, this will take about 4 minutes... mkfs.ext4 -F -b 1024 /dev/$ROOT_DEV_NAME @@ -81,20 +82,17 @@ then rsync -ah --info=progress2 --info=name0 --numeric-ids -x / /mnt/mmc/ #Remove the live-fstab and install a base fstab rm /mnt/mmc/etc/fstab - if [ $CRYPTO false] - then - echo "/dev/mmcblk2p2 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab - umount /dev/mmcblk2p2 - echo Running fsck - e2fsck -p -f /dev/mmcblk2p2 - fi - if [ $CRYPTO true ] - then - # unmount and close encrypted storage - cryptsetup luksClose mmcblk2p2-encrypted - echo Running fsck - #TODO run fsck on luks part - fi + echo "/dev/mmcblk2p3 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab + umount /dev/$ROOT_DEV_NAME + echo Running fsck + e2fsck -p -f /dev/$ROOT_DEV_NAME + # if [ $CRYPTO true ] + # then + # # unmount and close encrypted storage + # cryptsetup luksClose mmcblk2p2-encrypted + # echo Running fsck + # #TODO run fsck on luks part + # fi echo Rebooting... Please remove the usb drive once shutdown is complete reboot fi