Table of Contents

HyperbolaBSD Development Guidelines

This article is still in progress and is expected to be finished soon.

Preparations for development-environment

Before going forward a generic setup with a valid installation for OpenBSD 7.0 is needed as HyperbolaBSD is also in need for testing-environment. We recommend to use an official mirror offering that version like mirrors.dotsrc.org. You can find the needed data and ISO-file here.

As Richard Stallman said in the second footnote of his article "Is It Ever a Good Thing to Use a Nonfree Program?", it is legitimate to recommend running some nonfree software momentarily in order to remove it.

Therefore, Hyperbola Project clarifies here which is recommending the OpenBSD installation in a virtual machine in order to replace it with HyperbolaBSD. Once the official HyperbolaBSD live image be ready, this part of the documentation will be removed.

Please note that AMD64 (x86_64) is mandatory needed for the moment.

You should setup your preferred way for virtualization, either with qemu or qtemu.

HyperbolaBSD/OpenBSD mount point suggestions

Notes:
  • BSD partitions/slices start with “a” as root, “b” as swap and “c” as entire device.
  • MBR and GUID partition start with “i” as primary partition.
  • Unpartition storages always use “c”.

Mount the root FFS2 as secondary device:

# mkdir hbbsd_dir/
# mount /dev/sd1a hbbsd_dir/

Mount a primary EXT2 as third device:

# mkdir ext2_dir/
# mount /dev/sd2i ext2_dir/

Getting the source code and building the kernel (HyperBK)

The following requirements are needed:

The next preparation steps are:

Steps to clean source code:

    $ KARCH=amd64 KCFG=GENERIC.MP
    $ cd hyperbk/arch/$KARCH/compile/$KCFG; unset KARCH KCFG
    $ bmake clean
For more information see:

Getting the source code and building the user space (alpha)

The following requirements are needed:

The next preparation steps are:

Steps to clean source code:

    $ cd userspace-alpha
    $ bmake -m $PWD/share/mk clean
    $ bmake -f obj.mk clean
Notes:
  • Works with AMD64 (x86_64) only.
  • Some programs does not compile:
    • sbin/unwind
    • usr.bin/make
    • usr.bin/nm
    • usr.bin/unifdef
    • usr.bin/vi
    • usr.sbin/nsd
    • usr.sbin/pkg_add
    • usr.sbin/switchd
    • usr.sbin/unbound
    • gnu
    • games

Installing OpenBSD virtual machine

$ qemu-img create obsd.img 2.2G
$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name OpenBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda install70.img -hdb obsd.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i
 
Choose your keyboard layout ('?' or 'L' for list) [default]
System hostname? (short form, e.g. 'foo') openbsd
 
Which network interface do you wish to configure? (or 'done') [em0]
IPv4 address for em0? (or 'autoconf' or 'none') [autoconf]
 
IPv6 address for em0? (or 'autoconf' or 'none') [none]
 
Which network interface do you wish to configure? (or 'done') [done]
 
DNS nameservers? (IP address list or 'none') [none]
 
Password for root account? (will not echo) openbsd
Password for root account? (again) openbsd
Start sshd(8) by default? [yes]
Do you expect to run the X Window System? [yes]
Do you want the X Window System to be started by xenodm(1)? [no]
Change the default console to com0? [no]
Setup a user? (enter a lower-case loginname, or 'no') [no] openbsd
Full name for user openbsd? [openbsd] OpenBSD
Password for user openbsd? (will not echo) openbsd
Password for user openbsd? (again) openbsd
 
Allow root ssh login? (yes, no, prohibit-password) [no]
 
Which disk is the root disk? ('?' for details) [sd0] sd1
 
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole]
 
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
 
Which disk do you wish to initialize? (or 'done') [done]
 
Location of sets? (cd0 disk http nfs or 'done') [cd0] disk
Is the disk partition already mounted? [yes] no
 
Which disk contains the install media? (or 'done') [sd0]
 
Which sd0 partition has the install sets? (or 'done') [a]
Pathname to the sets? (or 'done') [7.0/amd64]
 
Set name(s)? (or 'abort' or 'done') [done]
Directory does not contain SHA256.sig. Continue without verification? [no] yes
 
Location of sets? (cd0 disk http nfs or 'done') [done]
 
What timezone are you in? ('?' for list) [Canada/Montain] Etc/UTC
 
Exit to (S)hell, (H)alt or (R)eboot? [reboot] h

Creating image storage with EXT2 file system

$ qemu-img create ext2.img 5G
$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name OpenBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda obsd.img -hdb ext2.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
# newfs_ext2fs -IO 1 sd1c
# halt -p

Building a modified OpenBSD bootloader to support HyperbolaBSD kernel

$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name OpenBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda obsd.img -hdb ext2.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
$ cd /usr
$ cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -rOPENBSD_7_0 -P src
$ cvs -d anoncvs@anoncvs.spacehopper.org:/cvs checkout -P src
Are you sure you want to continue connecting (yes/no)? yes
nano /usr/src/sys/sys/disklabel.h:
---
-#define       DOSPTYP_OPENBSD 0xa6            /* OpenBSD partition type */
+#define       DOSPTYP_OPENBSD 0x6a            /* HyperbolaBSD partition type */
# cd /usr/src/sys/arch/amd64/compile/GENERIC.MP
# make obj
# make config
# make
# mount -t ext2fs /dev/sd1c /mnt
# cd /usr/obj/??
# cp -va biosboot boot /mnt
# umount /mnt
# halt -p

Adapting a duplicated OpenBSD virtual machine

Extracting the OpenBSD user space

Creating the HyperbolaBSD user space package

Create the HyperbolaBSD userspace, with same as locations, owners, groups and permissions from OpenBSD userspace.

# cd hbsd_base/var/sysmerge/etc_dir/
# bsdtar cvozf ../etc.tgz --options gzip:compression-level=9 *
# cd ..
# rm -r etc_dir
# cd hbsd_base/
# bsdtar cvzf ../hbbsd_base.tgz *

Adding HyperbolaBSD packages in install70.img

$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name OpenBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda obsd.img -hdb install70.img -hdc ext2.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
# mkdir ext2_dir
# mount /dev/sd1a /mnt
# mount -t ext2fs /dev/sd2c ext2_dir
# mkdir /mnt/hbbsd
# cp -va /mnt/7.0/amd64/INSTALL.amd64 /mnt/hbbsd
# cd ext2_dir
# cp -va bsd bsd.mp bsd.rd /mnt/hbbsd
# cp -va hbbsd_base.tgz /mnt/hbbsd/base70.tgz
# cd /mnt/hbbsd
# sha256 * > SHA256
# chmod 0644 *
# chmod 0755 bsd bsd.mp
# chown build:2000 *
# chown 0 INSTALL.amd64 bsd.rd
# chown 0:wheel SHA256
# cd
# umount /mnt
# umount ext2_dir
# rmdir ext2_dir
# halt -p

Installing HyperbolaBSD virtual machine

$ qemu-img create hbbsd_inst.img 2.2G
$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name HyperbolaBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda install70.img -hdb hbbsd_inst.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? i
 
Choose your keyboard layout ('?' or 'L' for list) [default]
System hostname? (short form, e.g. 'foo') hyperbolabsd
 
Which network interface do you wish to configure? (or 'done') [em0]
IPv4 address for em0? (or 'autoconf' or 'none') [autoconf]
 
IPv6 address for em0? (or 'autoconf' or 'none') [none]
 
Which network interface do you wish to configure? (or 'done') [done]
 
DNS nameservers? (IP address list or 'none') [none]
 
Password for root account? (will not echo) hyperbolabsd
Password for root account? (again) hyperbolabsd
Start sshd(8) by default? [yes]
Do you expect to run the X Window System? [yes]
Do you want the X Window System to be started by xenodm(1)? [no]
Change the default console to com0? [no]
Setup a user? (enter a lower-case loginname, or 'no') [no] hyperbolabsd
Full name for user hyperbolabsd? [hyperbolabsd] HyperbolaBSD
Password for user hyperbolabsd? (will not echo) hyperbolabsd
Password for user hyperbolabsd? (again) hyperbolabsd
 
Allow root ssh login? (yes, no, prohibit-password) [no]
 
Which disk is the root disk? ('?' for details) [sd0] sd1
 
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole]
 
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
 
Which disk do you wish to initialize? (or 'done') [done]
 
Location of sets? (cd0 disk http nfs or 'done') [cd0] disk
Is the disk partition already mounted? [yes] no
 
Which disk contains the install media? (or 'done') [sd0]
 
Which sd0 partition has the install sets? (or 'done') [a]
Pathname to the sets? (or 'done') [7.0/amd64] hbbsd
 
Set name(s)? (or 'abort' or 'done') [done]
Directory does not contain SHA256.sig. Continue without verification? [no] yes
 
 
Location of sets? (cd0 disk http nfs or 'done') [done]
 
What timezone are you in? ('?' for list) [Canada/Montain] Etc/UTC
# halt -p
$ qemu-system-x86_64 -machine q35 -cpu max -smp 2 -m 4G -device intel-hda -device hda-duplex -name HyperbolaBSD -net nic -net user,id=port1,hostfwd=tcp::2022-:22 -s -hda obsd.img -hdb hbbsd.img -hdc hbbsd_inst.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0
# mkdir hbbsd_dir
# mount /dev/sd1a hbbsd_dir
# mount /dev/sd2a /mnt
# cd /mnt
# cp -va altroot bin bsd bsd.mp bsd.rd dev etc home mnt root sbin tmp usr var hbbsd_dir
# umount hbbsd_dir
# umount /mnt
# rmdir hbbsd_dir
# halt -p