metropolis/node/core/bios_bootcode: Add legacy bootcode
This change provides a legacy bootcode that shows the user that they
are using an invalid configuration, e.g. not use UEFI. This can be
tested with "qemu-system-i386 -hda bazel-bin/metropolis/node/image.img".
Closes monogon-dev/monogon#142
Change-Id: I3337a70125010aec110ad75647346310cac76d37
Reviewed-on: https://review.monogon.dev/c/monogon/+/3748
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/osbase/build/mkimage/osimage/osimage.go b/osbase/build/mkimage/osimage/osimage.go
index d139d6b..2f497a8 100644
--- a/osbase/build/mkimage/osimage/osimage.go
+++ b/osbase/build/mkimage/osimage/osimage.go
@@ -92,6 +92,9 @@
// PartitionSize specifies a size for the ESP, Metropolis System and
// Metropolis data partition.
PartitionSize PartitionSizeInfo
+ // BIOSBootCode provides the optional contents for the protective MBR
+ // block which gets executed by legacy BIOS boot.
+ BIOSBootCode []byte
}
type plan struct {
@@ -155,6 +158,7 @@
}
params.tbl.ID = params.DiskGUID
+ params.tbl.BootCode = p.BIOSBootCode
params.efiPartition = &gpt.Partition{
Type: gpt.PartitionTypeEFISystem,
Name: ESPLabel,