Quick Recipe For Self-Compiled NetBSD-current On A Linveo VPS
Quick Recipe For Self-Compiled NetBSD-current On A Linveo VPS
Linveo kindly provided several free VPSes to guys actively posting in the LES BSD Thread. Linveo also kindly added @cmeerw's NetBSD 10 Minimum image. As shown above, NetBSD 10 Minimum now easily can be installed at Linveo directly from "Other BSD" category on the Rebuild page of vmcontrol.linveo.com.
After installing @cmeerw's NetBSD 10 Minimum image, with help from the NetBSD Guide references linked below, I followed the steps listed below to upgrade from NetBSD 10 to self-compiled NetBSD-current.
Getting to self-compiled NetBSD-current requires us to add to the NetBSD 10 Minimum VPS a NetBSD 10 compiler, other build tools, and the source code for both the NetBSD-current kernel and the NetBSD-current userland. Then a NetBSD-current compiler and other build tools are compiled by the NetBSD 10 compiler. Next, the newly compiled NetBSD-current build tools are used to build the NetBSD-current kernel and the NetBSD-current userland. The end result is a NetBSD-current VPS running its own code as compiled on itself by its own compiler.
My Linveo VPS seems to reboot and to run normally following the upgrade to NetBSD-current. There seems to be plenty of space remaining available, though the X sources and pkgsrc haven't yet been added:
linveo# df -h .
Filesystem Size Used Avail %Cap Mounted on
/dev/dk2 48G 10G 35G 22% /
linveo#
Installing pkgsrc
added 1 G to the usage:
linveo$ CVS_RSH=ssh cvs [email protected]:/cvsroot checkout -P pkgsrc
[ . . . ]
linveo$ df -h .
Filesystem Size Used Avail %Cap Mounted on
/dev/dk2 48G 11G 35G 24% /
linveo$
- Issue
The biggest issue that I know about with respect to the NetBSD-current upgrade proposed here relates to the etcupdate
command, which is the last command in the sequence below.
etcupdate
is an sh
shell script. There also is a man page, which mentions that the idea for etcupdate
came from FreeBSD's mergemster
.
I need to figure out how to set options making etcupdate
faster and easier to run within the limited scope of this single CPU architecture NetBSD-current upgrade. The VPS is not attempting to build the full multi-architecture NetBSD panopoly. Perhaps limiting the etcupdate
source directory to my VM's amd64 architecture might help. Perhaps -- as recommended in the man page -- running etcupdate
on a tar
file instead of directly on the sources also might help.
- NetBSD 10 Image
Here are links to @cmeerw's NetBSD 10 image and to a discussion of how the image was made:
https://lowendspirit.com/discussion/comment/187386/#Comment_187386
https://lowendspirit.com/discussion/comment/187452/#Comment_187452
- NetBSD Guide Reference Links
Here are reference links to the very helpful NetBSD Guide:
https://www.netbsd.org/docs/guide/en/chap-fetch.html#chap-fetch-cvs-netbsd-release
https://www.netbsd.org/docs/guide/en/chap-updating.html
- Adding Compilers To The NetBSD 10 Image
Here is the LES comment where @cmeerw showed us the one line command used below to add NetBSD 10 compilers to the NetBSD 10 base image:
https://lowendspirit.com/discussion/comment/186774/#Comment_186774
- Recipe
Here are the steps I followed to convert a clean, new Linveo VPS install of @cmeerw's NetBSD 10 image to what seems to be self-compiled NetBSD-current:
- Run as root to install a compiler, create needed directories, and an unprivileged user
ftp -o - https://cdn.netbsd.org/pub/NetBSD/NetBSD-10.0/amd64/binary/sets/comp.tar.xz | progress -z tar xpf - -C /
cd /usr
mkdir obj src tools
mkdir /home
useradd -m -G wheel tom
passwd tom
chown tom obj src tools
su tom
- Run as the unprivileged user which owns the
obj
,src
, andtools
subdirectories
export CVSROOT="[email protected]:/cvsroot"
export CVS_RSH="ssh"
cvs checkout -A -P src
cd src
less UPDATING
./build.sh -j 2 -O ../obj -T ../tools -U distribution
./build.sh -j 2 -O ../obj -T ../tools -U kernel=GENERIC
- Back to root to install and reboot to use our newly compiled NetBSD-current kernel
mv /netbsd /netbsd.old
mv /usr/obj/sys/arch/amd64/compile/GENERIC/netbsd /
shutdown -r now
- As root, install and reboot to run the newly compiled NetBSD-current userland
cd /usr/src
./build.sh -j 2 -O ../obj -T ../tools -U install=/
shutdown -r now
- As root,
postinstall
/usr/sbin/postinstall -s /usr/src check
/usr/sbin/postinstall -s /usr/src fix
- As root,
etcupdate
/usr/sbin/etcupdate -s /usr/src
Please point out any mistakes.
Any questions, please ask.
Thanks @linveo for the nice VPS! Thanks @cmeerw for the NetBSD 10 Minimum image! Thanks to the NetBSD project! And thanks to LES!
I hope everyone gets the servers they want!
Comments
Thank you everybody involved to put this together! I'll definitely try this out .
@Crab Is there an easy way to do full kernel plus userland self-compiling on FreeBSD-current?
A quick Google search led me to "essentially make buildworld / buildkernel / installkernel / installworld," (2009) but I didn't see a good tutorial in the Google results.
I hope everyone gets the servers they want!
The handbook should have everything needed:
https://docs.freebsd.org/en/books/handbook/kernelconfig/#kernelconfig-building
https://docs.freebsd.org/en/books/handbook/ports/#ports-using
https://docs.freebsd.org/en/books/handbook/ports/#ports-poudriere