From 642aa0623a821f607c2cd0620b9f1f51f30086cf Mon Sep 17 00:00:00 2001 From: Hal Emmerich Date: Thu, 10 Jan 2019 17:35:26 -0600 Subject: [PATCH] Added support for smaller emmcs. Issue reported in #68 --- .gitignore | 1 + resources/InstallResources/mmc_type2.partmap | 10 ++++++++ scripts/InstallScripts/InstallToInternal.sh | 24 +++++++++++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 resources/InstallResources/mmc_type2.partmap diff --git a/.gitignore b/.gitignore index aa16496..814e980 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ linux-* open-ath9k-htc-firmware PrawnOS-Alpha-c201-libre-2GB.img tmp.* +PrawnOS-Alpha-c201-libre-2GB-git*.img diff --git a/resources/InstallResources/mmc_type2.partmap b/resources/InstallResources/mmc_type2.partmap new file mode 100644 index 0000000..a80bda4 --- /dev/null +++ b/resources/InstallResources/mmc_type2.partmap @@ -0,0 +1,10 @@ + +label: gpt +label-id: EBA5A923-2F33-7C4E-AC9A-1555FD600D19 +device: /dev/mmcblk2 +unit: sectors +first-lba: 34 +last-lba: 30777310 + +/dev/mmcblk2p1 : start= 20480, size= 65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=89B31CDB-1147-5241-8271-C1ADBB9BBB44, name="Kernel", attrs="GUID:49,51,52,54,56" +/dev/mmcblk2p2 : start= 86016, size= 30691294, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root" \ No newline at end of file diff --git a/scripts/InstallScripts/InstallToInternal.sh b/scripts/InstallScripts/InstallToInternal.sh index 10b2cd9..762d128 100755 --- a/scripts/InstallScripts/InstallToInternal.sh +++ b/scripts/InstallScripts/InstallToInternal.sh @@ -28,7 +28,29 @@ then #disable dmesg, writing the partition map tries to write the the first gpt table, which is unmodifiable dmesg -D echo Writing partition map - sfdisk /dev/mmcblk2 < $RESOURCES/mmc.partmap + DISK_SZ="$(blockdev --getsz /dev/mmcblk2)" + echo Total disk size is: $DISK_SZ + if [ $DISK_SZ = 30785536 ] + then + echo Detected Emmc Type 1 + sfdisk /dev/mmcblk2 < $RESOURCES/mmc.partmap + + elif [ $DISK_SZ = 30777344 ] + then + echo Detected Emmc Type 2 + sfdisk /dev/mmcblk2 < $RESOURCES/mmc_type2.partmap + else + echo ERROR! Not a known EMMC type, please open an issue on github or send SolidHal an email with the Total disk size reported above + echo Try a fallback value? This will allow installation to continue, at the cost of a very small amoutnt of disk space. This may not work. + read -p "[Y/n]" -n 1 -r + if [[ $REPLY =~ ^[Yy]$ ]] + then + echo Trying Emmc Type 2 + sfdisk /dev/mmcblk2 < $RESOURCES/mmc_type2.partmap + else + exit + fi + fi dmesg -E echo Writing kernel partition dd if=/dev/sda1 of=/dev/mmcblk2p1