12-04-2019, 03:54 AM
With a bit of trickery it is also possible to preconfigure the GPT so that the idbloader, uboot and trusted firmware images appear as separate partitions. Not only does this make it easier to hack or alter the bootloaders but it also makes it difficult to accidentally damage them (tooling to trim unallocated space for example).
I'm not sure if it possible to create a partition label with a first-lba set to 64 using fdisk. I generally use an sfdisk for this:
cat <<EOF | sudo sfdisk /dev/mmcblk1
unit: sectors
first-lba: 64
/dev/mmcblk1p1 : start= 64, size= 16320, type=8DA63339-0007-60C0-C436-083AC8230908, name="IDBLoader", attrs="RequiredPartition"
/dev/mmcblk1p2 : start= 16384, size= 8192, type=8DA63339-0007-60C0-C436-083AC8230908, name="U-Boot", attrs="RequiredPartition"
/dev/mmcblk1p3 : start= 24576, size= 8192, type=8DA63339-0007-60C0-C436-083AC8230908, name="TrustedFirmware-A", attrs="RequiredPartition"
EOF
Once you have created the disk label above can create other partitions using the normal tooling.
I'm not sure if it possible to create a partition label with a first-lba set to 64 using fdisk. I generally use an sfdisk for this:
cat <<EOF | sudo sfdisk /dev/mmcblk1
unit: sectors
first-lba: 64
/dev/mmcblk1p1 : start= 64, size= 16320, type=8DA63339-0007-60C0-C436-083AC8230908, name="IDBLoader", attrs="RequiredPartition"
/dev/mmcblk1p2 : start= 16384, size= 8192, type=8DA63339-0007-60C0-C436-083AC8230908, name="U-Boot", attrs="RequiredPartition"
/dev/mmcblk1p3 : start= 24576, size= 8192, type=8DA63339-0007-60C0-C436-083AC8230908, name="TrustedFirmware-A", attrs="RequiredPartition"
EOF
Once you have created the disk label above can create other partitions using the normal tooling.