Converting PV to HVM - boot methods
Stephen Borrill <[email protected]> Thu, 24 Apr 2025 15:06:53 +0100 (BST)
| Newsgroups | gmane.os.netbsd.ports.i386 |
|---|---|
| Message-ID | <Pine.NEB.4.64.2504241418310.1680@ugly> |
I've set this to port-i386 rather than port-xen as it's more about the x86 boot process rather than Xen. I have a (large) number of PV Xen VMs. These were created from a disk image built with makefs that the sets were extracted into. This means there is no partitioning except for disklabel and the root partition begins at sector 0: 16 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 18874368 0 4.2BSD 2048 16384 0 # (Cyl. 0 - 18724*) b: 2097152 18874368 swap # (Cyl. 18724*- 20805*) c: 20971520 0 unused 0 0 # (Cyl. 0 - 20805*) d: 20971520 0 unused 0 0 # (Cyl. 0 - 20805*) Now that XenServer and XCP-ng no longer support PV booting (and PV-on-PVH doesn't work either), I now need to convert them to HVM. As there's no free sectors at the start, I cannot create a partition table, etc. My current best fix is to add a 2nd tiny (16MB) virtual disk with GPT partitioning and a single MSDOS EFI partition containing: /efi/boot/bootx64.efi /efi/NetBSD/boot.cfg The boot.cfg is altered so that instead of boot netbsd, the lines say boot hd1a:netbsd. Full set of steps (assuming xbd1 for new disk and no existing wedges): gpt create xbd1 gpt add -b 64 -t efi -l efiboot xbd1 newfs_msdos dk0 mount NAME=efiboot /mnt mkdir -p /mnt/efi/boot /mnt/efi/NetBSD cp /usr/mdec/bootx64.efi /mnt/efi/boot sed 's/boot netbsd/boot hd1a:netbsd/' /boot.cfg > /mnt/efi/NetBSD/boot.cfg At the boot prompt: > dev disk hd0 mediaId 0 size 16 MB NAME=efiboot(EFI System) disk hd1 mediaId 0 size 10 GB hd1a(4.2BSD) hd1b(swap) net net0 22:6f:a5:97:cc:a0 pci0,4,0 default NAME=efiboot This all works fine, but I'm interested in others' alternatives suggestions. Observations: 1) According to boot(8) the dev command "Sets the default drive and partition for subsequent file system operations", but this doesn't appear to work. After entering dev hd1a:, all operations still default to NAME=bootconfig (was the same before I labelled the partitions, they defaulted to hd0b). 2) Would be nice to be able to chain-load a replacement boot.cfg e.g. reconfig=hd1a:/boot.cfg -- Stephen