burrow-pi-img/export-image
Matthijs Kooijman 99f702f0ff Use parted for partitioning (#285)
Previously, fdisk was used by sending commands into its stdin, which is
not very robust (since it heavily relies on the interactive prompts
offered by fdisk as well as the default values it offers, which seem
prone to changing in future version).

It seems likely that in the past, fdisk was easier than parted since it
provides default values that make it easier to create adjacent
partitions, without precalculating all positions in the script. However
now that partitions are manually being aligned, all data must be
calculated anyway.

This commit changes the partition generation to use parted rather than
fdisk. For this, it rewrites various calculations and renames variables
to be easier to read as well. All values are now in number of bytes,
rather than mixing bytes and sectors.

This commit also makes makes sure that the boot partition and root
partition are always adjacent (previously the root partition was aligned
without also rounding the boot partition size, leaving some empty space
in between).

As a side effect of using parted, this also causes the "bootcode" part
of the MBR to be filled with some default x86 bootcode. This is totally
irrelevant for booting the Raspberry Pi, but it does prevent triggering
a bug in parted. When using parted to change the partition table (e.g.
when resizing the root partition on first boot by raspi-config's
init_resize.sh), the disk identifier would be changed due to this bug,
which would change the PARTUUID of all partitions. The init_resize.sh
script would work around this by updating the PARTUUID in e.g. fstab,
but that's fragile at best.  This commit prevents the bug from
triggering and keeps the disk identifier the same.

See https://debbugs.gnu.org/35714 for details about this parted bug.

This commit fixes #284.
2019-09-25 13:46:38 +01:00
..
01-set-sources Update to Buster 2019-06-07 15:45:15 +01:00
02-network shellcheck 2018-03-13 12:50:50 +00:00
03-set-partuuid Update 00-run.sh 2019-01-23 15:32:08 +00:00
04-finalise Updated export-image to not depend on fake-hwclock and hardlink. (#326) 2019-08-27 18:16:24 +01:00
00-allow-rerun Disable ld.so.preload while building 2019-06-07 19:51:08 +01:00
prerun.sh Use parted for partitioning (#285) 2019-09-25 13:46:38 +01:00