On some Lenovo machines, booting ZFS off MBR partitions does not work
On the Lenovo X61s that we were able to test on at the BSDCan Hackers
Lounge, we were able to get them to boot properly using a BSD
partitioning scheme instead.
- Add support for BSD partition type
- Moved the write of the MBR boot sector to the end of the process to
avoid it being nuked by the pedantic zpool labelclear commands
- Change the MBR code to not always create 2 zpools when using MBR. The
user only wants 2 pools (1 unencrypted to boot, and one encrypted for
data) in the case where they enable encryption. Due to the simplicity of
the code in previous versions of bsdinstall, two pools were used to
avoid a problem with the order of the creation of the partitions to
ensure that there was a partition at the front of the drive for the boot
code, and that the swap partition was the 2nd partition (BSD partition 'b')
- Some style cleanup to make the flow of the MBR section more clear
- Write the 'zfsboot' code to the two different places require for MBR and
BSD. Write the larger section first because writing the first sector
first seems to make the BSD partition disappear and appear as an empty
MBR (No idea why this was happening, reproduced on two Lenovo laptops)
- Resolve variable reuse by renaming 'disksize' in second case to
'usablesize' to avoid disksize being disksize less swap+boot size
Sponsored By: ScaleEngine Inc.