Partition sizes need to be divisible by 4096

This commit is contained in:
Davide Cavalca 2022-11-05 05:05:39 +00:00
parent 64f71cdf0f
commit 81f2a876b5
2 changed files with 11 additions and 6 deletions

View File

@ -47,11 +47,17 @@ fatcat "${workdir}/${imagename}1" -x "${workdir}/package/esp"
mv "${workdir}/${imagename}2" "${workdir}/package/boot.img" mv "${workdir}/${imagename}2" "${workdir}/package/boot.img"
mv "${workdir}/${imagename}3" "${workdir}/package/root.img" mv "${workdir}/${imagename}3" "${workdir}/package/root.img"
esp_volume_id="$(file "${workdir}/${imagename}1" | awk -v 'RS=,' '/serial number/ { print $3 }')"
esp_size="$(stat -c %s "${workdir}/${imagename}1")"
boot_size="$(stat -c %s "${workdir}/package/boot.img")"
# TODO: round up the size instead of hardcoding
truncate -s 10G "${workdir}/package/root.img"
root_size="$(stat -c %s "${workdir}/package/root.img")"
pushd "${workdir}/package" > /dev/null pushd "${workdir}/package" > /dev/null
zip -r "${basedir}/${package}" . zip -r "${basedir}/${package}" .
popd > /dev/null popd > /dev/null
volume_id="$(file "${workdir}/${imagename}1" | awk -v 'RS=,' '/serial number/ { print $3 }')"
cat > installer_data.json <<EOF cat > installer_data.json <<EOF
{ {
"os_list": [ "os_list": [
@ -66,9 +72,9 @@ cat > installer_data.json <<EOF
{ {
"name": "EFI", "name": "EFI",
"type": "EFI", "type": "EFI",
"size": "500MB", "size": "${esp_size}B",
"format": "fat", "format": "fat",
"volume_id": "${volume_id}", "volume_id": "${esp_volume_id}",
"copy_firmware": true, "copy_firmware": true,
"copy_installer_data": true, "copy_installer_data": true,
"source": "esp" "source": "esp"
@ -76,13 +82,13 @@ cat > installer_data.json <<EOF
{ {
"name": "Boot", "name": "Boot",
"type": "Linux", "type": "Linux",
"size": "1050MB", "size": "${boot_size}B",
"image": "boot.img" "image": "boot.img"
}, },
{ {
"name": "Root", "name": "Root",
"type": "Linux", "type": "Linux",
"size": "15GB", "size": "${root_size}B",
"expand": true, "expand": true,
"image": "root.img" "image": "root.img"
} }

View File

@ -20,7 +20,6 @@
<volume name="home"/> <volume name="home"/>
<volume name="root"/> <volume name="root"/>
</systemdisk> </systemdisk>
<size unit="G">15</size>
<oemconfig> <oemconfig>
<oem-resize>false</oem-resize> <oem-resize>false</oem-resize>
</oemconfig> </oemconfig>