Tuesday, August 15, 2023

NetBSD on MacOS 10.14 (Mojave), notes

Didn't find a good description of 'gotcha's' and directory naming/layout for building, i.e. replicating 
FAQ's & Howto's are detailed & excellent, have complete NetBSD directory layout, in use.
Mention made of Xwindows, "xsrc" tree. Untested.



Mewburn & Green, 2003
build.sh: Cross-building NetBSD [ PDF ]
http://www.mewburn.net/luke/papers/build.sh.pdf

The NetBSD Guide [ HTML ]

The NetBSD Guide [ PDF ]


NetBSD releases
NetBSD 9.3: the latest release

Announcing NetBSD 9.3 (August 4, 2022)

65 Prebuilt Distributions + "iso" + "images" + "Source" (Sets .tar.xz) + "Shared" files

(cd ~/src/NetBSD/src; ./build.sh list-arch ) | less [ list the known Machine/Arch pairs, 106 @ Aug 2023 ]

NetBSD: README.files

AMD64, bootable ISO

32.4. Fetching by CVS

export CVSROOT="anoncvs@anoncvs.NetBSD.org:/cvsroot"
export CVS_RSH="ssh"
cd /usr/NetBSD
cvs checkout -r netbsd-9-3-RELEASE -P src

Github repo: The NetBSD Foundation [ source, github, not prime Repo ]

Automatic conversion of the NetBSD src CVS module, use with care. 
Please submit bugs/changes via https://gnats.netbsd.org

mkdir ~/src/NetBSD
mkdir ~/src/NetBSD/obj    [ better: obj/netbsd-9.3_amd64 ]

Get the Source
(cd ~/src/NetBSD; git clone https://github.com/NetBSD/src.git) [ gets 'head' of development, not stable ]
(cd ~/src/NetBSD/src; git checkout netbsd-9) [ how to fetch this directly ? ]
(cd ~/src/NetBSD/src; git status)

Build the source
Build tools, then a kernel, release, then distribution sets & full system on a CD (iso)
the '-j3' is "run 3 makes in parallel", assumes CPU limited, not I/O.

(cd ~/src/NetBSD/src
unset M     [ this environment variable was picked up, didn't notice in doco ]

./build.sh -U -u -j3 -O ~/src/NetBSD/obj -m amd64 -a x86_64 cleandir 
    [ 'clean' needed only if prev build done ]
    [ plus remove or move aside "~/src/NetBSD/obj", prev binaries ]

./build.sh -U -u -j3 -O ~/src/NetBSD/obj -m amd64 -a x86_64 tools
./build.sh -U -u -j3 -O ~/src/NetBSD/obj -m amd64 -a x86_64 kernel=SJ-amd64-inst
./build.sh -U -u -j3 -O ~/src/NetBSD/obj -m amd64 -a x86_64 release

./build.sh -U -u -j3 -O ~/src/NetBSD/obj -m amd64 -a x86_64 distsets iso-image
)




Qemu: run the just created ISO

(cd ~/QEMU; 
  qemu-img create -f qcow2 netbsd.qcow2 8G [ create disk for filesystem ]
  sh start-netbsd.sh    [ boot the just built ISO, install to new disk, reboot & new install runs ]
                                  [ untested: live image ISO available to build or download ]
)

start-netbsd.sh
/usr/local/bin/qemu-system-x86_64 \
-cpu max \
-smp cpus=2 \
-machine type=q35,accel=hvf \
-m 2G \
-display default,show-cursor=on \
-drive file=netbsd.qcow2,if=none,id=ld0 \
-device virtio-blk-pci,drive=ld0 \
-net user,hostfwd=tcp::2222-:22 -net nic \
-cdrom /Users/steve/src/NetBSD/obj/releasedir/images/NetBSD-9.3_STABLE-amd64.iso