Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 1 | #!/bin/sh |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 2 | # |
| 3 | # Generate partition table for HiKey eMMC or HiKey960 UFS |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 4 | # |
| 5 | # tiny: for testing purpose. |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 6 | # aosp: (same as linux with userdata). |
| 7 | # linux: (same as aosp without userdata). |
| 8 | # swap: (similar to asop, drop reserved, 1.5G of swap) |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 9 | |
| 10 | PTABLE=${PTABLE:-aosp} |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 11 | SECTOR_SIZE=${SECTOR_SIZE:-512} |
| 12 | SGDISK=${SGDISK:-sgdisk} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 13 | TEMP_FILE=$(mktemp /tmp/${PTABLE}.XXXXXX) |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 14 | # 128 entries at most |
| 15 | ENTRIES_IN_SECTOR=$(expr ${SECTOR_SIZE} / 128) |
| 16 | ENTRY_SECTORS=$(expr 128 / ${ENTRIES_IN_SECTOR}) |
| 17 | PRIMARY_SECTORS=$(expr ${ENTRY_SECTORS} + 2) |
| 18 | SECONDARY_SECTORS=$(expr ${ENTRY_SECTORS} + 1) |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 19 | |
| 20 | case ${PTABLE} in |
| 21 | tiny) |
| 22 | SECTOR_NUMBER=81920 |
| 23 | ;; |
| 24 | aosp-4g|linux-4g) |
| 25 | SECTOR_NUMBER=7471104 |
| 26 | ;; |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 27 | aosp-8g|linux-8g|swap-8g) |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 28 | SECTOR_NUMBER=15269888 |
| 29 | ;; |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 30 | aosp-32g*|linux-32g) |
| 31 | SECTOR_NUMBER=62447650 # count with 512-byte block size |
| 32 | ;; |
| 33 | aosp-64g|linux-64g) |
| 34 | SECTOR_NUMBER=124895300 # count with 512-byte block size |
| 35 | ;; |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 36 | esac |
| 37 | |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 38 | SECTOR_ALIGNMENT=$(expr ${SECTOR_SIZE} / 512) |
| 39 | SECTOR_NUMBER=$(expr '(' ${SECTOR_NUMBER} '*' 512 + ${SECTOR_SIZE} - 1 ')' / ${SECTOR_SIZE}) |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 40 | |
| 41 | # get the partition table |
| 42 | case ${PTABLE} in |
| 43 | tiny) |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 44 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 45 | fakeroot ${SGDISK} -U -R -v ${TEMP_FILE} |
| 46 | fakeroot ${SGDISK} -n 1:2048:4095 -t 1:0700 -u 1:F9F21F01-A8D4-5F0E-9746-594869AEC3E4 -c 1:"vrl" -p ${TEMP_FILE} |
| 47 | fakeroot ${SGDISK} -n 2:4096:6143 -t 2:0700 -u 2:F9F21F02-A8D4-5F04-9746-594869AEC3E4 -c 2:"vrl_backup" -p ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 48 | ;; |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 49 | aosp-4g|aosp-8g) |
| 50 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 51 | fakeroot ${SGDISK} -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 52 | #[1: vrl: 1M-2M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 53 | fakeroot ${SGDISK} -n 1:0:+1M -t 1:0700 -u 1:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 1:"vrl" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 54 | #[2: vrl_backup: 2M-3M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 55 | fakeroot ${SGDISK} -n 2:0:+1M -t 2:0700 -u 2:61A36FC1-8EFB-4899-84D8-B61642EFA723 -c 2:"vrl_backup" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 56 | #[3: mcuimage: 3M-4M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 57 | fakeroot ${SGDISK} -n 3:0:+1M -t 3:0700 -u 3:65007411-962D-4781-9B2C-51DD7DF22CC3 -c 3:"mcuimage" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 58 | #[4: fastboot: 4M-12M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 59 | fakeroot ${SGDISK} -n 4:0:+8M -t 4:EF02 -u 4:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 4:"fastboot" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 60 | #[5: nvme: 12M-14M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 61 | fakeroot ${SGDISK} -n 5:0:+2M -t 5:0700 -u 5:00354BCD-BBCB-4CB3-B5AE-CDEFCB5DAC43 -c 5:"nvme" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 62 | #[6: boot: 14M-78M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 63 | fakeroot ${SGDISK} -n 6:0:+64M -t 6:EF00 -u 6:5C0F213C-17E1-4149-88C8-8B50FB4EC70E -c 6:"boot" ${TEMP_FILE} |
Dmitry Shmidt | 4c6629b | 2018-04-09 14:13:32 -0700 | [diff] [blame] | 64 | #[7: vendor: 78M-334M] |
| 65 | fakeroot ${SGDISK} -n 7:0:+256M -t 7:0700 -u 7:BED8EBDC-298E-4A7A-B1F1-2500D98453B7 -c 7:"vendor" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 66 | #[8: cache: 334M-590M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 67 | fakeroot ${SGDISK} -n 8:0:+256M -t 8:8301 -u 8:A092C620-D178-4CA7-B540-C4E26BD6D2E2 -c 8:"cache" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 68 | #[9: system: 590M-2126M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 69 | fakeroot ${SGDISK} -n 9:0:+1536M -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 70 | #[10: userdata: 2126M-End] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 71 | fakeroot ${SGDISK} -n -E -t 10:8300 -u 10:064111F6-463B-4CE1-876B-13F3684CE164 -c 10:"userdata" -p ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 72 | ;; |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 73 | linux-4g|linux-8g) |
| 74 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 75 | fakeroot ${SGDISK} -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 76 | #[1: vrl: 1M-2M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 77 | fakeroot ${SGDISK} -n 1:0:+1M -t 1:0700 -u 1:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 1:"vrl" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 78 | #[2: vrl_backup: 2M-3M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 79 | fakeroot ${SGDISK} -n 2:0:+1M -t 2:0700 -u 2:61A36FC1-8EFB-4899-84D8-B61642EFA723 -c 2:"vrl_backup" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 80 | #[3: mcuimage: 3M-4M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 81 | fakeroot ${SGDISK} -n 3:0:+1M -t 3:0700 -u 3:65007411-962D-4781-9B2C-51DD7DF22CC3 -c 3:"mcuimage" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 82 | #[4: fastboot: 4M-12M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 83 | fakeroot ${SGDISK} -n 4:0:+8M -t 4:EF02 -u 4:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 4:"fastboot" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 84 | #[5: nvme: 12M-14M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 85 | fakeroot ${SGDISK} -n 5:0:+2M -t 5:0700 -u 5:00354BCD-BBCB-4CB3-B5AE-CDEFCB5DAC43 -c 5:"nvme" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 86 | #[6: boot: 14M-78M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 87 | fakeroot ${SGDISK} -n 6:0:+64M -t 6:EF00 -u 6:5C0F213C-17E1-4149-88C8-8B50FB4EC70E -c 6:"boot" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 88 | #[7: reserved: 78M-334M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 89 | fakeroot ${SGDISK} -n 7:0:+256M -t 7:0700 -u 7:BED8EBDC-298E-4A7A-B1F1-2500D98453B7 -c 7:"reserved" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 90 | #[8: cache: 334M-590M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 91 | fakeroot ${SGDISK} -n 8:0:+256M -t 8:8301 -u 8:A092C620-D178-4CA7-B540-C4E26BD6D2E2 -c 8:"cache" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 92 | #[9: system: 590M-End] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 93 | fakeroot ${SGDISK} -n -E -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 94 | ;; |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 95 | swap-8g) |
| 96 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 97 | fakeroot ${SGDISK} -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 98 | #[1: vrl: 1M-2M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 99 | fakeroot ${SGDISK} -n 1:0:+1M -t 1:0700 -u 1:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 1:"vrl" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 100 | #[2: vrl_backup: 2M-3M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 101 | fakeroot ${SGDISK} -n 2:0:+1M -t 2:0700 -u 2:61A36FC1-8EFB-4899-84D8-B61642EFA723 -c 2:"vrl_backup" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 102 | #[3: mcuimage: 3M-4M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 103 | fakeroot ${SGDISK} -n 3:0:+1M -t 3:0700 -u 3:65007411-962D-4781-9B2C-51DD7DF22CC3 -c 3:"mcuimage" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 104 | #[4: fastboot: 4M-12M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 105 | fakeroot ${SGDISK} -n 4:0:+8M -t 4:EF02 -u 4:496847AB-56A1-4CD5-A1AD-47F4ACF055C9 -c 4:"fastboot" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 106 | #[5: nvme: 12M-14M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 107 | fakeroot ${SGDISK} -n 5:0:+2M -t 5:0700 -u 5:00354BCD-BBCB-4CB3-B5AE-CDEFCB5DAC43 -c 5:"nvme" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 108 | #[6: boot: 14M-78M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 109 | fakeroot ${SGDISK} -n 6:0:+64M -t 6:EF00 -u 6:5C0F213C-17E1-4149-88C8-8B50FB4EC70E -c 6:"boot" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 110 | #[7: cache: 78M-384M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 111 | fakeroot ${SGDISK} -n 7:0:+256M -t 7:8301 -u 7:A092C620-D178-4CA7-B540-C4E26BD6D2E2 -c 7:"cache" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 112 | #[8: swap: 384M-1920M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 113 | fakeroot ${SGDISK} -n 8:0:+1536M -t 8:8200 -u 8:FC56E344-2E8E-49AE-B2F8-5B9D263FE377 -c 8:"swap" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 114 | #[9: system: 1920M-3556M] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 115 | fakeroot ${SGDISK} -n 9:0:+1536M -t 9:8300 -u 9:FC56E345-2E8E-49AE-B2F8-5B9D263FE377 -c 9:"system" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 116 | #[10: userdata: 3556M-End] |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 117 | fakeroot ${SGDISK} -n -E -t 10:8300 -u 10:064111F6-463B-4CE1-876B-13F3684CE164 -c 10:"userdata" -p ${TEMP_FILE} |
| 118 | ;; |
| 119 | aosp-32g*|aosp-64g) |
| 120 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 121 | fakeroot ${SGDISK} -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE} |
| 122 | #[1: xloader_reserved1: 1M-2M] |
| 123 | fakeroot ${SGDISK} -n 1:0:+1M -t 1:0700 -u 1:697c41e0-7a59-4dfa-a9a6-aa43ac5be684 -c 1:"xloader_reserved1" ${TEMP_FILE} |
| 124 | #[2: fastboot: 2M-14M] |
| 125 | fakeroot ${SGDISK} -n 2:0:+12M -t 2:0700 -u 2:3f5f8c48-4402-4ace-9058-30bfea4fa53f -c 2:"fastboot" ${TEMP_FILE} |
| 126 | #[3: nvme: 14M-20M] |
| 127 | fakeroot ${SGDISK} -n 3:0:+6M -t 3:0700 -u 3:e2f5e2a9-c9b7-4089-9859-4498f1d3ef7e -c 3:"nvme" ${TEMP_FILE} |
| 128 | #[4: fip: 20M-32M] |
| 129 | fakeroot ${SGDISK} -n 4:0:+12M -t 3:0700 -u 4:dc1a888e-f17c-4964-92d6-f8fcc402ed8b -c 4:"fip" ${TEMP_FILE} |
| 130 | #[5: cache: 32M-288M] |
| 131 | fakeroot ${SGDISK} -n 5:0:+256M -t 5:0700 -u 5:10cc3268-05f0-4db2-aa00-707361427fc8 -c 5:"cache" ${TEMP_FILE} |
| 132 | #[6: fw_lpm3: 288M-289M] |
| 133 | fakeroot ${SGDISK} -n 6:0:+1M -t 6:0700 -u 6:5d8481d4-c170-4aa8-9438-8743c73ea8f5 -c 6:"fw_lpm3" ${TEMP_FILE} |
| 134 | #[7: boot: 289M-353M] |
| 135 | fakeroot ${SGDISK} -n 7:0:+64M -t 7:EF00 -u 7:d3340696-9b95-4c64-8df6-e6d4548fba41 -c 7:"boot" ${TEMP_FILE} |
| 136 | #[8: dts: 353M-369M] |
| 137 | fakeroot ${SGDISK} -n 8:0:+16M -t 8:0700 -u 8:6e53b0bb-fa7e-4206-b607-5ae699e9f066 -c 8:"dts" ${TEMP_FILE} |
| 138 | #[9: trustfirmware: 369M-371M] |
| 139 | fakeroot ${SGDISK} -n 9:0:+2M -t 9:0700 -u 9:f1e126a6-ceef-45c1-aace-29f33ac9cf13 -c 9:"trustfirmware" ${TEMP_FILE} |
| 140 | #[10: system: 371M-5059M] |
| 141 | fakeroot ${SGDISK} -n 10:0:+4688M -t 10:8300 -u 10:c3e50923-fb85-4153-b925-759614d4dfcd -c 10:"system" ${TEMP_FILE} |
| 142 | #[11: vendor: 5059M-5843M] |
| 143 | fakeroot ${SGDISK} -n 11:0:+784M -t 11:0700 -u 11:919d7080-d71a-4ae1-9227-e4585210c837 -c 11:"vendor" ${TEMP_FILE} |
| 144 | #[12: reserved: 5843M-5844M] |
| 145 | fakeroot ${SGDISK} -n 12:0:+1M -t 12:0700 -u 12:611eac6b-bc42-4d72-90ac-418569c8e9b8 -c 12:"reserved" ${TEMP_FILE} |
| 146 | case ${PTABLE} in |
| 147 | aosp-32g) |
| 148 | #[13: userdata: 5844M-End] |
| 149 | fakeroot ${SGDISK} -n -E -t 13:8300 -u 13:fea80d9c-f3e3-45d9-aed0-1d06e4abd77f -c 13:"userdata" ${TEMP_FILE} |
| 150 | ;; |
| 151 | aosp-32g-spare) |
| 152 | #[13: userdata: 5844M-9844M] |
| 153 | fakeroot ${SGDISK} -n 13:0:+1000M -t 13:8300 -u 13:fea80d9c-f3e3-45d9-aed0-1d06e4abd77f -c 13:"userdata" ${TEMP_FILE} |
| 154 | #[14: swap: 9844M-End] |
| 155 | fakeroot ${SGDISK} -n -E -t 14:8300 -u 14:9501eade-20fb-4bc7-83d3-62c1be3ed92d -c 14:"swap" ${TEMP_FILE} |
| 156 | ;; |
| 157 | esac |
| 158 | ;; |
| 159 | linux-32g|linux-64g) |
| 160 | dd if=/dev/zero of=${TEMP_FILE} bs=${SECTOR_SIZE} count=${SECTOR_NUMBER} conv=sparse |
| 161 | fakeroot ${SGDISK} -U 2CB85345-6A91-4043-8203-723F0D28FBE8 -v ${TEMP_FILE} |
| 162 | #[1: vrl: 1M-2M] |
| 163 | fakeroot ${SGDISK} -n 1:0:+1M -t 1:0700 -u 1:697c41e0-7a59-4dfa-a9a6-aa43ac5be684 -c 1:"vrl" ${TEMP_FILE} |
| 164 | #[2: fastboot: 2M-14M] |
| 165 | fakeroot ${SGDISK} -n 2:0:+12M -t 2:0700 -u 2:3f5f8c48-4402-4ace-9058-30bfea4fa53f -c 2:"fastboot" ${TEMP_FILE} |
| 166 | #[3: nvme: 14M-20M] |
| 167 | fakeroot ${SGDISK} -n 3:0:+6M -t 3:0700 -u 3:e2f5e2a9-c9b7-4089-9859-4498f1d3ef7e -c 3:"nvme" ${TEMP_FILE} |
| 168 | #[4: fip: 20M-32M] |
| 169 | fakeroot ${SGDISK} -n 4:0:+12M -t 3:0700 -u 4:dc1a888e-f17c-4964-92d6-f8fcc402ed8b -c 4:"fip" ${TEMP_FILE} |
| 170 | #[5: cache: 32M-288M] |
| 171 | fakeroot ${SGDISK} -n 5:0:+256M -t 5:0700 -u 5:10cc3268-05f0-4db2-aa00-707361427fc8 -c 5:"cache" ${TEMP_FILE} |
| 172 | #[6: fw_lpm3: 288M-289M] |
| 173 | fakeroot ${SGDISK} -n 6:0:+1M -t 6:0700 -u 6:5d8481d4-c170-4aa8-9438-8743c73ea8f5 -c 6:"fw_lpm3" ${TEMP_FILE} |
| 174 | #[7: boot: 289M-353M] |
| 175 | fakeroot ${SGDISK} -n 7:0:+64M -t 7:EF00 -u 7:d3340696-9b95-4c64-8df6-e6d4548fba41 -c 7:"boot" ${TEMP_FILE} |
| 176 | #[8: dts: 353M-369M] |
| 177 | fakeroot ${SGDISK} -n 8:0:+16M -t 8:0700 -u 8:6e53b0bb-fa7e-4206-b607-5ae699e9f066 -c 8:"dts" ${TEMP_FILE} |
| 178 | #[9: trustfirmware: 369M-371M] |
| 179 | fakeroot ${SGDISK} -n 9:0:+2M -t 9:0700 -u 9:f1e126a6-ceef-45c1-aace-29f33ac9cf13 -c 9:"trustfirmware" ${TEMP_FILE} |
| 180 | #[10: system: 371M-5059M] |
| 181 | fakeroot ${SGDISK} -n 10:0:+4688M -t 10:8300 -u 10:c3e50923-fb85-4153-b925-759614d4dfcd -c 10:"system" ${TEMP_FILE} |
| 182 | #[11: vendor: 5059M-5843M] |
| 183 | fakeroot ${SGDISK} -n 11:0:+784M -t 11:0700 -u 11:919d7080-d71a-4ae1-9227-e4585210c837 -c 11:"vendor" ${TEMP_FILE} |
| 184 | #[12: reserved: 5843M-5844M] |
| 185 | fakeroot ${SGDISK} -n 12:0:+1M -t 12:0700 -u 12:611eac6b-bc42-4d72-90ac-418569c8e9b8 -c 12:"reserved" ${TEMP_FILE} |
Mark Salyzyn | 97ae220 | 2017-05-26 14:56:52 -0700 | [diff] [blame] | 186 | ;; |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 187 | esac |
| 188 | |
John Stultz | 09c0fb8 | 2017-08-10 17:30:17 -0700 | [diff] [blame] | 189 | # get the primary partition table |
| 190 | dd if=${TEMP_FILE} of=prm_ptable.img bs=${SECTOR_SIZE} count=${PRIMARY_SECTORS} |
| 191 | |
| 192 | BK_PTABLE_LBA=$(expr ${SECTOR_NUMBER} - ${SECONDARY_SECTORS}) |
| 193 | dd if=${TEMP_FILE} of=sec_ptable.img skip=${BK_PTABLE_LBA} bs=${SECTOR_SIZE} count=${SECONDARY_SECTORS} |
Vishal Bhoj | 9a67d91 | 2016-06-09 10:02:07 +0100 | [diff] [blame] | 194 | |
| 195 | rm -f ${TEMP_FILE} |