diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/partvi | 41 |
1 files changed, 33 insertions, 8 deletions
@@ -137,11 +137,13 @@ build_partition_image() | |||
137 | boot|samizdat-keys) mkfs.btrfs -q "$tmp" || die "mkfs.btrfs failed" ;; | 137 | boot|samizdat-keys) mkfs.btrfs -q "$tmp" || die "mkfs.btrfs failed" ;; |
138 | dm-verity-data) | 138 | dm-verity-data) |
139 | partuuid=${root_hash:0:32} | 139 | partuuid=${root_hash:0:32} |
140 | set_var partuuid | ||
140 | cp -f -T --reflink "$data_path" "$builddir"/"$partuuid" | 141 | cp -f -T --reflink "$data_path" "$builddir"/"$partuuid" |
141 | ln -sfT "$partuuid" "$tmp" | 142 | ln -sfT "$partuuid" "$tmp" |
142 | ;; | 143 | ;; |
143 | dm-verity-hashes) | 144 | dm-verity-hashes) |
144 | partuuid=${root_hash:32:32} | 145 | partuuid=${root_hash:32:32} |
146 | set_var partuuid | ||
145 | cp -f -T --reflink "$data_path".verity "$builddir"/"$partuuid" | 147 | cp -f -T --reflink "$data_path".verity "$builddir"/"$partuuid" |
146 | ln -sfT "$partuuid" "$tmp" | 148 | ln -sfT "$partuuid" "$tmp" |
147 | ;; | 149 | ;; |
@@ -181,9 +183,16 @@ set_var() | |||
181 | eval "conf_${img}_${1}=\$${1}" | 183 | eval "conf_${img}_${1}=\$${1}" |
182 | } | 184 | } |
183 | 185 | ||
186 | format_guid() | ||
187 | { | ||
188 | set -- "$(tr -dc 0-9a-fA-F <<< "$1")" | ||
189 | printf '%s\n' "${1:0:8}-${1:8:4}-${1:12:4}-${1:16:4}-${1:20:12}" | ||
190 | } | ||
191 | |||
184 | create_ptable_conf() | 192 | create_ptable_conf() |
185 | { | 193 | { |
186 | #inquire_var start && inquire_var devsz || return | 194 | unset partuuid |
195 | inquire_var partuuid | ||
187 | part=$builddir/${f%.conf} | 196 | part=$builddir/${f%.conf} |
188 | devsz=$(stat -L -c '%s' "$part") || return | 197 | devsz=$(stat -L -c '%s' "$part") || return |
189 | [ "$start" -a "$devsz" ] || return | 198 | [ "$start" -a "$devsz" ] || return |
@@ -197,6 +206,15 @@ create_ptable_conf() | |||
197 | case "$type" in | 206 | case "$type" in |
198 | partition-table) start=$((start + devsz)); return;; | 207 | partition-table) start=$((start + devsz)); return;; |
199 | efi-system-partition) typecode=C12A7328-F81F-11D2-BA4B-00A0C93EC93B ;; | 208 | efi-system-partition) typecode=C12A7328-F81F-11D2-BA4B-00A0C93EC93B ;; |
209 | dm-verity-data|dm-verity-hashes) | ||
210 | case "$name" in | ||
211 | samizdat-rootfs|samizdat-root-patch) typecode=4f68bce3-e8cd-4db1-96e7-fbcaf984b709 ;; | ||
212 | samizdat-root-patch-verity) typecode=2c7357ed-ebd2-46d9-aec1-23d437ec2bf5 ;; | ||
213 | samizdat-root-seed) ;; # keep default | ||
214 | samizdat-root-seed-verity) ;; # keep default | ||
215 | esac | ||
216 | ;; | ||
217 | root) typecode=4f68bce3-e8cd-4db1-96e7-fbcaf984b709 ;; | ||
200 | bios-grub) | 218 | bios-grub) |
201 | typecode=21686148-6449-6E6F-744E-656564454649 | 219 | typecode=21686148-6449-6E6F-744E-656564454649 |
202 | printf 'start=1, size=%d, type=ee\n' \ | 220 | printf 'start=1, size=%d, type=ee\n' \ |
@@ -212,13 +230,20 @@ create_ptable_conf() | |||
212 | ;; | 230 | ;; |
213 | esac | 231 | esac |
214 | 232 | ||
215 | printf '%d: start=%d, size=%d, type=%s, name="%s"\n' \ | 233 | ( |
216 | "$i" \ | 234 | exec >> "$GPT_TABLE_FILE" |
217 | "$start_sectors" \ | 235 | printf '%d: start=%d, size=%d, type=%s, name="%s"' \ |
218 | "$size_sectors" \ | 236 | "$i" \ |
219 | "$typecode" \ | 237 | "$start_sectors" \ |
220 | "$name" \ | 238 | "$size_sectors" \ |
221 | >> "$GPT_TABLE_FILE" | 239 | "$typecode" \ |
240 | "$name" | ||
241 | if [ "$partuuid" ] | ||
242 | then | ||
243 | printf ', uuid=%s' "$(format_guid "$partuuid")" | ||
244 | fi | ||
245 | echo | ||
246 | ) | ||
222 | let ++i | 247 | let ++i |
223 | start=$((start + devsz)) | 248 | start=$((start + devsz)) |
224 | } | 249 | } |