Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:manual:contrib:hbbsd_devel_guidelines [2024/01/19 22:35]
coadde [Building a modified OpenBSD bootloader to support HyperbolaBSD kernel]
en:manual:contrib:hbbsd_devel_guidelines [2024/02/11 14:23] (current)
emulatorman
Line 4: Line 4:
 This article is still in progress and is expected to be finished soon. This article is still in progress and is expected to be finished soon.
 </note> </note>
 +
 +===== 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 [[https://mirrors.dotsrc.org/pub/OpenBSD/|mirrors.dotsrc.org]]. You can find the needed data and ISO-file [[https://mirrors.dotsrc.org/pub/OpenBSD/7.0/amd64/|here]].
 +
 +<note warning>
 +As Richard Stallman said in [[https://www.gnu.org/philosophy/is-ever-good-use-nonfree-program.html#f2|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.
 +</note>
 +
 +<note important>
 +Please note that **AMD64 (x86_64)** is mandatory needed for the moment.
 +</note>
 +
 +You should setup your preferred way for virtualization, either with [[https://www.hyperbola.info/packages/?q=qemu|qemu]] or [[en:manual:virtual_machine_manager|qtemu]].
  
 ===== HyperbolaBSD/OpenBSD mount point suggestions ===== ===== HyperbolaBSD/OpenBSD mount point suggestions =====
Line 14: Line 30:
 </note> </note>
  
-Mount the root **FFS2** as secondary device:<code bash>+Mount the root **FFS2** as secondary device: 
 + 
 +<code bash>
 # mkdir hbbsd_dir/ # mkdir hbbsd_dir/
 +</code>
 +
 +<code bash>
 # mount /dev/sd1a hbbsd_dir/ # mount /dev/sd1a hbbsd_dir/
 </code> </code>
  
-Mount a primary **EXT2** as third device:<code bash>+Mount a primary **EXT2** as third device: 
 +<code bash>
 # mkdir ext2_dir/ # mkdir ext2_dir/
-# mount /dev/sd2i ext2_dir/</code>+</code> 
 + 
 +<code bash> 
 +# mount /dev/sd2i ext2_dir/ 
 +</code>
  
 ===== Getting the source code and building the kernel (HyperBK) ===== ===== Getting the source code and building the kernel (HyperBK) =====
Line 33: Line 59:
  
   * Install **GCC** and **Binutils** for HyperbolaBSD cross compilation.<code bash>   * Install **GCC** and **Binutils** for HyperbolaBSD cross compilation.<code bash>
-    $ TARCH=x86_64-unknown-hyperbolabsd+    $ TARCH=x86_64-unknown-hyperbolabsd</code><code bash>
     $ doas pacman -S $TARCH-gcc $TARCH-binutils</code>     $ doas pacman -S $TARCH-gcc $TARCH-binutils</code>
   * Install **BSD make** and **Athena Jot**.<code bash>   * Install **BSD make** and **Athena Jot**.<code bash>
Line 40: Line 66:
     $ git clone https://git.hyperbola.info:50100/hyperbolabsd/hyperbk.git</code>     $ git clone https://git.hyperbola.info:50100/hyperbolabsd/hyperbk.git</code>
   * Access the directory **hyperbk/arch/amd64/compile/GENERIC.MP**:<code bash>   * Access the directory **hyperbk/arch/amd64/compile/GENERIC.MP**:<code bash>
-    $ KARCH=amd64 KCFG=GENERIC.MP+    $ KARCH=amd64 KCFG=GENERIC.MP</code><code bash>
     $ cd hyperbk/arch/$KARCH/compile/$KCFG; unset KARCH KCFG</code>     $ cd hyperbk/arch/$KARCH/compile/$KCFG; unset KARCH KCFG</code>
   * Copy the directory **obj_gen** to **obj**:<code bash>   * Copy the directory **obj_gen** to **obj**:<code bash>
Line 47: Line 73:
     $ cd obj</code>     $ cd obj</code>
   * Make the //HyperbolaBSD// kernel //("bmake install" to install this kernel)//:<code bash>   * Make the //HyperbolaBSD// kernel //("bmake install" to install this kernel)//:<code bash>
-    $ NTHREADS=2 +    $ NTHREADS=2</code><code bash> 
-    $ bmake -j $NTHREADS CC=$TARCH-cc LD=$TARCH-ld+    $ bmake -j $NTHREADS CC=$TARCH-cc LD=$TARCH-ld</code><code bash>
     $ unset CC LD NTHREADS TARCH</code>     $ unset CC LD NTHREADS TARCH</code>
  
 Steps to clean source code:<code bash> Steps to clean source code:<code bash>
-    $ KARCH=amd64 KCFG=GENERIC.MP +    $ KARCH=amd64 KCFG=GENERIC.MP</code><code bash> 
-    $ cd hyperbk/arch/$KARCH/compile/$KCFG; unset KARCH KCFG+    $ cd hyperbk/arch/$KARCH/compile/$KCFG; unset KARCH KCFG</code><code bash>
     $ bmake clean</code>     $ bmake clean</code>
  
Line 74: Line 100:
  
   * Install **GCC** and **Binutils** for HyperbolaBSD cross compilation.<code bash>   * Install **GCC** and **Binutils** for HyperbolaBSD cross compilation.<code bash>
-    $ TARCH=x86_64-unknown-hyperbolabsd+    $ TARCH=x86_64-unknown-hyperbolabsd</code><code bash>
     $ doas pacman -S $TARCH-gcc $TARCH-binutils</code>     $ doas pacman -S $TARCH-gcc $TARCH-binutils</code>
-  * Install **BSD make**, **rpcsvc-proto**, **Sharutils** \\ and **Universal Ctags**.<code bash>+  * Install **BSD make**, **rpcsvc-proto**, **Sharutils** and **Universal Ctags**.<code bash>
     $ doas pacman -S bmake rpcsvc-proto sharutils ctags</code>     $ doas pacman -S bmake rpcsvc-proto sharutils ctags</code>
   * Clone this repository:<code bash>   * Clone this repository:<code bash>
-    $ URL=https://git.hyperbola.info:50100 +    $ URL=https://git.hyperbola.info:50100</code><code bash> 
-    $ git clone $URL/hyperbolabsd/userspace-alpha.git+    $ git clone $URL/hyperbolabsd/userspace-alpha.git</code><code bash>
     $ unset URL</code>     $ unset URL</code>
   * Install **OpenBSD lorder**.<code bash>   * Install **OpenBSD lorder**.<code bash>
-    $ cd userspace-alpha +    $ cd userspace-alpha</code><code bash> 
-    $ doas cp usr.bin/lorder/lorder.sh /usr/local/bin/lorder +    $ doas cp usr.bin/lorder/lorder.sh /usr/local/bin/lorder</code><code bash> 
-    $ doas chown 0:0 /usr/local/bin/lorder+    $ doas chown 0:0 /usr/local/bin/lorder</code><code bash>
     $ doas chmod 0755 /usr/local/bin/lorder</code>     $ doas chmod 0755 /usr/local/bin/lorder</code>
-  * Prepare the **HyperBK&trade;** source code:<code bash>+  * Prepare the **HyperBK** source code:<code bash>
     $ ./sys.sh</code>     $ ./sys.sh</code>
   * Generate **obj** directories:<code bash>   * Generate **obj** directories:<code bash>
Line 93: Line 119:
  
   * Make the //HyperbolaBSD// kernel //("bmake install" to install this kernel)//:<code bash>   * Make the //HyperbolaBSD// kernel //("bmake install" to install this kernel)//:<code bash>
-    $ NTHREADS=2 +    $ NTHREADS=2</code><code bash> 
-    $ bmake -m $PWD/share/mk -j $NTHREADS CC=$TARCH-cc LD=$TARCH-ld+    $ bmake -m $PWD/share/mk -j $NTHREADS CC=$TARCH-cc LD=$TARCH-ld</code><code bash>
     $ unset CC LD NTHREADS TARCH</code>     $ unset CC LD NTHREADS TARCH</code>
  
 Steps to clean source code:<code bash> Steps to clean source code:<code bash>
-    $ cd userspace-alpha +    $ cd userspace-alpha</code><code bash> 
-    $ bmake -m $PWD/share/mk clean+    $ bmake -m $PWD/share/mk clean</code><code bash>
     $ bmake -f obj.mk clean</code>     $ bmake -f obj.mk clean</code>
  
Line 127: Line 153:
  
 <code bash> <code bash>
-$ qemu-img create obsd.img 2.2G+$ qemu-img create obsd.img 2.2G</code><code bash>
 $ 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</code> $ 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</code>
  
Line 186: Line 212:
  
 <code bash> <code bash>
-$ qemu-img create ext2.img 5G +$ qemu-img create ext2.img 5G</code><code bash> 
-$ 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 openbsd.img -hdb ext2.img -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7922-:22 -device virtio-net,netdev=mynet0</code>+$ 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</code>
  
 <code bash> <code bash>
-# newfs_ext2fs -IO 1 sd1c+# newfs_ext2fs -IO 1 sd1c</code><code bash>
 # halt -p</code> # halt -p</code>
  
Line 204: Line 230:
  
 <code bash> <code bash>
-$ cd /usr +$ cd /usr</code><code bash> 
-$ cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -rOPENBSD_7_0 -P src +$ cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -rOPENBSD_7_0 -P src</code><code bash> 
-$ cvs -d anoncvs@anoncvs.spacehopper.org:/cvs checkout -P src +$ cvs -d anoncvs@anoncvs.spacehopper.org:/cvs checkout -P src</code><code bash> 
-Are you sure you want to continue connecting (yes/no)? yes+Are you sure you want to continue connecting (yes/no)? yes</code>
  
 +<code bash>
 nano /usr/src/sys/sys/disklabel.h: nano /usr/src/sys/sys/disklabel.h:
 --- ---
 -#define       DOSPTYP_OPENBSD 0xa6            /* OpenBSD partition type */ -#define       DOSPTYP_OPENBSD 0xa6            /* OpenBSD partition type */
 +#define       DOSPTYP_OPENBSD 0x6a            /* HyperbolaBSD partition type */ +#define       DOSPTYP_OPENBSD 0x6a            /* HyperbolaBSD partition type */
 +</code>
  
-# cd /usr/src/sys/arch/amd64/compile/GENERIC.MP +<code bash> 
-# make obj +# cd /usr/src/sys/arch/amd64/compile/GENERIC.MP</code><code bash> 
-# make config +# make obj</code><code bash> 
-# make +# make config</code><code bash> 
-# mount -t ext2fs /dev/sd1c /mnt +# make</code><code bash> 
-# cd /usr/obj/?? +# mount -t ext2fs /dev/sd1c /mnt</code><code bash> 
-# cp -va biosboot boot /mnt +# cd /usr/obj/??</code><code bash> 
-# umount /mnt+# cp -va biosboot boot /mnt</code><code bash> 
 +# umount /mnt</code><code bash>
 # halt -p</code> # halt -p</code>
  
Line 238: Line 267:
 ===== Creating the HyperbolaBSD user space package ===== ===== Creating the HyperbolaBSD user space package =====
  
-Create the HyperbolaBSD userspace, with same as locationownergroup and permission from OpenBSD userspace.+Create the HyperbolaBSD userspace, with same as locationsownersgroups and permissions from OpenBSD userspace. 
 + 
 +<code bash> 
 +# cd hbsd_base/var/sysmerge/etc_dir/</code><code bash> 
 +# bsdtar cvozf ../etc.tgz --options gzip:compression-level=9 *</code><code bash> 
 +# cd ..</code><code bash> 
 +# rm -r etc_dir</code><code bash> 
 +# cd hbsd_base/</code><code bash> 
 +# bsdtar cvzf ../hbbsd_base.tgz *</code>
  
 ===== Adding HyperbolaBSD packages in install70.img ===== ===== Adding HyperbolaBSD packages in install70.img =====
  
 <code bash> <code bash>
-$ 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</code> +$ 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</code><code bash> 
- +# mkdir ext2_dir</code><code bash> 
-<code bash> +# mount /dev/sd1a /mnt</code><code bash> 
-# mkdir ext2_dir +# mount -t ext2fs /dev/sd2c ext2_dir</code><code bash> 
-# mount /dev/sd1a /mnt +# mkdir /mnt/hbbsd</code><code bash> 
-# mount -t ext2fs /dev/sd2c ext2_dir +# cp -va /mnt/7.0/amd64/INSTALL.amd64 /mnt/hbbsd</code><code bash> 
-# mkdir /mnt/hbbsd +# cd ext2_dir</code><code bash> 
-# cp -va /mnt/7.0/amd64/INSTALL.amd64 /mnt/hbbsd +# cp -va bsd bsd.mp bsd.rd /mnt/hbbsd</code><code bash> 
-# cd ext2_dir +# cp -va hbbsd_base.tgz /mnt/hbbsd/base70.tgz</code><code bash> 
-# cp -va bsd bsd.mp bsd.rd /mnt/hbbsd +# cd /mnt/hbbsd</code><code bash> 
-# cp -va hbbsd.tgz /mnt/hbbsd/base70.tgz +# sha256 * > SHA256</code><code bash> 
-# cd /mnt/hbbsd +# chmod 0644 *</code><code bash> 
-# sha256 * > SHA256 +# chmod 0755 bsd bsd.mp</code><code bash> 
-# chmod 0644 * +# chown build:2000 *</code><code bash> 
-# chmod 0755 bsd bsd.mp +# chown 0 INSTALL.amd64 bsd.rd</code><code bash> 
-# chown build:2000 * +# chown 0:wheel SHA256</code><code bash> 
-# chown 0 INSTALL.amd64 bsd.rd +# cd</code><code bash> 
-# chown 0:wheel SHA256 +# umount /mnt</code><code bash> 
-# cd +# umount ext2_dir</code><code bash> 
-# umount /mnt +# rmdir ext2_dir</code><code bash>
-# umount ext2_dir +
-# rmdir ext2_dir+
 # halt -p</code> # halt -p</code>
  
Line 270: Line 305:
  
 <code bash> <code bash>
-$ qemu-img create hbbsd_inst.img 2.2G+$ qemu-img create hbbsd_inst.img 2.2G</code><code bash>
 $ 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</code> $ 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</code>
  
Line 324: Line 359:
  
 What timezone are you in? ('?' for list) [Canada/Montain] Etc/UTC What timezone are you in? ('?' for list) [Canada/Montain] Etc/UTC
-</code> +</code><code bash> 
- +# halt -p</code>
-<code bash> +
-# halt -p +
-</code> +
- +
-<code bash> +
-$ 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</code> +
- +
-<code bash> +
-# mkdir hbbsd_dir +
-</code>+
  
 <code bash> <code bash>
 +$ 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</code><code bash>
 +# mkdir hbbsd_dir</code><code bash>
 # mount /dev/sd1a hbbsd_dir # mount /dev/sd1a hbbsd_dir
-</code> +</code><code bash>
- +
-<code bash>+
 # mount /dev/sd2a /mnt # mount /dev/sd2a /mnt
-</code> +</code><code bash>
- +
-<code bash>+
 # cd /mnt # cd /mnt
-</code> +</code><code bash>
- +
-<code bash>+
 # cp -va altroot bin bsd bsd.mp bsd.rd dev etc home mnt root sbin tmp usr var hbbsd_dir # cp -va altroot bin bsd bsd.mp bsd.rd dev etc home mnt root sbin tmp usr var hbbsd_dir
-</code> +</code><code bash>
- +
-<code bash>+
 # umount hbbsd_dir # umount hbbsd_dir
-</code> +</code><code bash>
- +
-<code bash>+
 # umount /mnt # umount /mnt
-</code> +</code><code bash>
- +
-<code bash>+
 # rmdir hbbsd_dir # rmdir hbbsd_dir
-</code> +</code><code bash> 
- +# halt -p</code>
-<code bash> +
-# halt -p +
-</code>+