Dual-booting OpenBSD 6.9 and 9front

First download and create installation medium for both

OpenBSD installation

Here we will do an unencrypted installation, if you want to make a full disk encryption install follow the following fqa :

But instead of letting fdisk auto initialize partitions follow the partitioning disk step

boot

Press s to drop into a shell before installation

Welcome to the OpenBSD/amd64 6.9 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? s

partitioning disk

we will use the following disk layout :

bootloader (FAT32) : 200M
OpenBSD : 50G
9front : 25G

Create the hard-drive device node

# cd /dev && sh MAKEDEV sd0

enter the partition manager

# fdisk -e sd0

Create a FAT32 partition

sd0: 1> e 1

Choose 0B (FAT32) as your partition id

Partition id : 0B
Do you wish to edit in CHS mode? [n] n
Partition offset [0 - xxxxxx]: [0] 1024

here I choose to make a 200MiB partition

Partition size [1 - xxxxxx]: [1] 200M

take note of where you partition end so that they don't overlap

sd0*: 1> p

Now let's do the same for our OpenBSD parition

sd0*: 1> e 2
Do you wish to edit in CHS mode? [n] n
Partition id : A6
Partition offset [0 - xxxxx]: 200M
Partition size [1 - xxxxxx]: [1] 50G

Don't forget to set this partition as bootable

sd0: 1> f 2

That's it for now, we will let 9front create its own partition

Write and quit :

sd0*: 1> w
sd0: 1> q

create the FAT file system

# newfs_msdos sd0i

installing

Proceed with the installation until you encounter this prompt

Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit? [OpenBSD] O

OpenBSD will auto-allocate a layout of virtual partitions for you, feel free to edit it if you want, here we won't

Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a] a

Continue the installation as you would normally do.

And reboot

installing 9front

Boot your 9front install medium, and follow the installation step just has specified in the fqa

9front should automatically dedect the available free space

At the end of the installation process at this prompt :

Task to do [bootsetup]:

drop into a shell by typing

!rc
term% dossrv -f /dev/sd0xxxx/dos
term% mount -c /srv/sdos /n/dos
term% 9fs 9fat
term% dircp /n/9fat/ /n/dos/
term% exit

Now proceed to the bootsetup by doing the following :

Install the Plan 9 masterboot record (yes, no)[no default]: yes
Mark the Plan 9 partition active (yes, no)[no default]: no

The system should reboot on OpenBSD

Installing syslinux

I haven't found a way to install a bootloader from OpenBSD itself, so instead I'm using an image of alpine

# apk add syslinux
# dd if=/usr/share/syslinux/mbr.bin of=/dev/sda
# syslinux /dev/sda1
# mount /dev/sda1 /mnt
# cp /usr/share/syslinux/menu.c32 /mnt
# cp /usr/share/syslinux/libutil.c32 /mnt
# cp /usr/share/syslinux/libcom32.c32 /mnt
# cp /usr/share/syslinux/chain.c32 /mnt

Activate MSDOS partition

# fdisk /dev/sda
a
1
a
2
w
q

Then reboot and you should have a menu with both 9front and OpenBSD