Explorar o código

Added support for smaller emmcs. Issue reported in #68

Hal Emmerich %!s(int64=5) %!d(string=hai) anos
pai
achega
642aa0623a

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@ linux-*
 open-ath9k-htc-firmware
 PrawnOS-Alpha-c201-libre-2GB.img
 tmp.*
+PrawnOS-Alpha-c201-libre-2GB-git*.img

+ 10 - 0
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"

+ 23 - 1
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