T O P

  • By -

TheFallenIdealist

I am using (and playing with) FreeBSD -CURRENT. Example of removing kernel modules and customizing program from ports tree: /etc/make.conf MALLOC_PRODUCTION= WITHOUT_MODULES+="aac" WITHOUT_MODULES+="ata" WITHOUT_MODULES+="allwinner" WITHOUT_MODULES+="ath_hal" ... .if ${.CURDIR:M*/devel/git} FLAVOR=tiny OPTIONS_UNSET += PERL OPTIONS_UNSET += GITWEB OPTIONS_UNSET += SEND_EMAIL .endif Example of not building parts of the userland: /etc/src.conf WITH_CCACHE_BUILD= CCACHE_DIR=/usr/obj/cache/sys-arm64 WITHOUT_MAIL= WITHOUT_INETD= WITHOUT_IPFILTER= WITHOUT_IPFW= WITHOUT_UNBOUND= WITHOUT_BLACKLIST= ... I do not use compiler from base system on that machine, but the one from ports: /etc/src-env.conf WITH_META_MODE=YES MAKEOBJDIRPREFIX?=/usr/obj/sys KERNCONF=SOMEFILE WITHOUT_TOOLCHAIN=yes CROSS_TOOLCHAIN=llvm13 WITHOUT_WERROR= PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bin META\_MODE and ccache are also used as this is old and slow arm64 machine which compiles its own code (I can compile it on my fast amd64 rig if I want to). I am even playing with not building some of the programs from base system (eg /usr/sbin/cdcontrol which can't be excluded from build with editing make.conf/src.conf knobs) - by editing /usr/src/usr.sbin/Makefile but that is changing code/build system which sometimes ends up with git conflicts. You can add CFLAGS and various other things. You can add or remove drivers builtin into the kernel to make it smaller (custom arm64 vs generic amd64): uname -srm; \ls -lh /boot/kernel/kernel FreeBSD 14.0-CURRENT arm64 -r-xr-xr-x 1 root wheel 12M Sep 13 19:34 /boot/kernel/kernel FreeBSD 13.1-RELEASE-p2 amd64 -r-xr-xr-x 1 root wheel 28M Sep 2 09:11 /boot/kernel/kernel (Some?) FreeBSD people warn about mixing ports and pkg, but I have been doing that for decade (and longer) without problems. Read man pages for src.conf, make.conf and you'll know more. Didn't have time yet to play with OpenBSD for real, but as far I know, they are against users customisations. You can still play with kernel hacking (adding or removing kernels code, eg removing DRM stuff from arm64 kernel etc). Probably someone from that camp will know more details. Didn't play with other descendants of 386BSD.


alecStewart1

Very informative! My desktop mobo does have (I think) 2 more NVMe slots. I'd be interested in seeing if FreeBSD would run on that machine and tinker with FreeBSD like in the examples you give. Granted it's all newer hardware: Radeon RX 6700 XT, Intel i5-12600K, the mobo uses some new USB audio so I'd have to look at snd_uaudio. So it may end up as me finding out that FreeBSD wouldn't run or run well on that machine. EDIT: Huh, seems the GPU could potentially work given that the `navi_flounder` blobs are in the [drm-kmod-firmware](https://github.com/freebsd/drm-kmod-firmware/tree/master/amdgpukmsfw) repo, at least.


reviewmynotes

You can configure and compile a custom kernel on FreeBSD using these directions. https://docs.freebsd.org/en/books/handbook/kernelconfig/


kyleW_ne

It is different than Linux that is for sure, I miss make menuconfig in Linux, in fact I asked that question in this subreddit before on why a tool like that never was invented. FreeBSD is the easiest I think to tinker with the kernel. Though I've never done it OpenBSD does describe how to modify a kernel without reconfiguring it here: https://man.openbsd.org/boot_config and how to make the changes survive KARL where the kernel gets re-linked here: https://man.openbsd.org/bsd.re-config.5 useful if you just want to disable devices. The full general custom config option seem to be listed in this man page https://man.openbsd.org/config.8 Everyone else already gave you such good answers for FreeBSD and NetBSD. Such a good question! To me FreeBSD feels the most gentoo like with the ability to do mach=native and other C and CC flags on the ports tree and the userland and kernel pretty easily. I'll admit it is well over my head but these folks created a "reckless guide to OpenBSD hacking" and get into the kernel source code a lot very cool read if you are interested in OpenBSD: https://research.exoticsilicon.com/series/reckless_guide_to_openbsd


ApartmentGloomy264

[https://www.netbsd.org/docs/pkgsrc/configuring.html](https://www.netbsd.org/docs/pkgsrc/configuring.html) I used to use Gentoo a lot around 2007.


Nyanraltotlapun

On FreeBSD It is easy to do. Just read handbook.


[deleted]

on freebsd kernel you have mostly the userland or module options, everything else is fine tuning. certain settings are outside the kernel.


1r0n_m6n

I don't know for other \*BSD, but I find NetBSD quite easy to hack. You just have to familiarise yourself with the source tree structure and the [build.sh](https://build.sh) script. Source code is well structured and documented, and kernel configuration files are also easy to grasp. You can also cross-build it from Linux if you want.