this post was submitted on 17 Oct 2026
39 points (100.0% liked)

technology

24504 readers
187 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 6 years ago
MODERATORS
 

With Linux going the slop route, I've been thinking of switching to NetBSD which says (so far) they won't admit AI-generated code. I even tried making the switch earlier today, but it doesn't support my wifi card, so I want to be able to write a diver for it. I've done a little bit of osdev and worked some on emulators, so I think I have the ability, just not the knowledge yet. How do I get immersed in the code? Do I just pick a source file and start reading? I am decent with C code, so that's not a huge concern for me, I don't think.

top 15 comments
sorted by: hot top controversial new old
[–] PorkrollPosadist@hexbear.net 13 points 3 days ago* (last edited 3 days ago) (2 children)

The crisis befalling the Linux kernel is not technical in nature. It is a social crisis. Switching to NetBSD is a technical solution which does not address the root cause of the problem. NetBSD likely has only avoided the slop so far because the project is not economically interesting, but if it evolves into a broadly viable alternative to Linux, FreeBSD, and OpenBSD, that interest will materialize and the project will suffer the same fate. It is already concerning that they do not reject slop on ideological grounds. The status quo is that they simply haven't accepted any yet. The gears of co-option are already turning, with the project accepting grants from FUTO for instance. This isn't to say that they are compromised or evil or anything like that, but it is a concern.

The solution to this crisis requires organization. New organizations which embrace a naked antipathy towards capitalism, to seize the mantle which has been abdicated by the sclerotic FSF, SFC, and company. The path forward very well might be NetBSD, or it might be a hard fork of the Linux kernel. The problem of user-space remains, so it is necessary for the movement to be much larger in scope than simply a kernel. Fortunately, I am hearing these concerns voiced by a lot of people who are absolutely dismayed by the trajectory of the Free Software movement.

All that said, I hope you have success. Whether the future lies in NetBSD or Linux, we will need all of the hands to build the alternative. I myself have been checking out NetBSD with interest recently (and other wacky alternatives like Redox OS) for the same reasons, ~~though I haven't been able to boot the installer on my physical machine.~~ (I got it. I had to use a different USB, and I also needed to manually run NetBSD's fsck on the EFI partition I originally created when installing Gentoo a long time ago)

I too am keeping my ear to the ground, to try and see where it might be useful to contribute. I am pretty much only a hobbyist though.

[–] PorkrollPosadist@hexbear.net 2 points 2 days ago

Positive update on the FUTO situation: https://mastodon.sdf.org/@netbsd/117464275119384776

NetBSD Foundation: Hey, just to clear this situation up:

We received the donation out of the blue with no knowledge of who these people are. We don't have any communication with them and don't know what (if anything) they want from us. Maybe they just want more traffic to their site, which is mostly about software.

Our rule is donations cannot come with restrictions/requirements/influence other than we add a logo to our site. They requested this. At the moment we have to follow our own bureaucratic rules.

[–] imogen_underscore@hexbear.net 3 points 3 days ago (1 children)

great comment. what do you mean by "the problem of user-space"? i understand that linux is "just" a kernel where something like FreeBSD is an OS where both sides are developed in harmony so to speak. do you think GNU userland not fit for purpose or see it as under similar threat as the kernel? would love to hear more of your thoughts.

[–] PorkrollPosadist@hexbear.net 2 points 2 days ago* (last edited 2 days ago)

Userland (whether GNU or alternatives) is vulnerable to the same pressures. The only thing unique about the Linux kernel is that it is indespensible (hence the existential dread). A lot of major projects have already embraced the same LLM-driven development process as Linux (though it is particularly egregious in Linux). Aside from the kernel, the task of putting together a slop-free distribution today is very challenging (nothing like this exists, except for some highly experimental and incomplete projects like Hyperbola). It requires the sacrifice of a lot of tools which we have grown accustomed to. It is something like a regression to the state of free software computing 20 years ago.

The same problem applies to the BSDs, because even if the base system is clean (say, if NetBSD maintains the status quo, or embraces an explicit no AI policy going forward), people rely on ports (packages) to do anything serious with their computers, which are the same programs people run on Linux. Your web browsers, text editors, window managers, word processors, password managers, graphic design tools, etc. Also a lot of plumbing falls into this category, like system libraries, image/video/audio codecs, programming languages, build systems, databases, webservers, middleware, etc.

You can have your perfectly slop-free operating system with new drivers to leverage the latest hardware, but you're still stuck with no alternative to Firefox.

[–] uokgerku@hexbear.net 17 points 3 days ago* (last edited 3 days ago) (1 children)

I would suggest starting by trying to configure and build a NetBSD kernel.

BSD kernels have a unique and cool (imo :3) file format that defines a kind of device tree for setting compile-time options and drivers built into the kernel or as modules (in the case of FreeBSD and NetBSD). See here for the file format: https://man.netbsd.org/config.5 and here: https://man.netbsd.org/NetBSD-11.0/options.4 for misc but important compile-time options (which are set as preprocessor defines like #define BEANIS). Traditionally, machine-specific kernel configurations (like the NetBSD amd64 kernel config) include a more generic configuration that contains options that are set for all architectures. The reason I bring this up is because the way device drivers are compiled by the bespoke BSD build system (collection of makefiles primary found under /src/share/mk relative to the CVS repo root) and made known to the kernel at runtime is via that file (indirectly, it tells the autoconfiguration framework that walks down the device tree what drivers it should attach if it matches a device ID or what drivers it should call to probe for their respective devices).

So, basically, if you want to add your new network interface driver you would insert a line into the kernel configuration (usually the architecture specific one) like:

cupcakeif* at pci? dev ? function ? (assuming your interface is attached via PCI bus ^w^)

which, when the relevant bus is configured, causes the autoconf framework to call that driver's "match" function (assuming you can directly configure your driver without having to probe for it) for every device on the bus. If your driver thinks it's relevant to that device and should be loaded your match function would return > 0. At which point that driver's "attach" function is called to setup the device. You can refer to this manpage for more details on device driver definition and how it interacts with the autoconf framework: https://man.netbsd.org/driver.9 (as well as how all this info and function pointers even get to the autoconf framework >w< it's a structure initialized with the CFATTACH_DECL_NEW macro described in that manpage)

You can see an example of all of this in the already existing WiFi interface drivers under /src/sys/dev/pci.

For example, the classic athn Atheros wifi interface defined in if_athn_pci.c (which I would suggest generously copy-pasting from :3):

long (edited for brevity)

/* ... */
CFATTACH_DECL_NEW(athn_pci, sizeof(struct athn_pci_softc), athn_pci_match,
    athn_pci_attach, athn_pci_detach, athn_pci_activate);
/* ... */
Static int
athn_pci_match(device_t parent, cfdata_t match, void *aux)
{
	static const struct {
		pci_vendor_id_t		apd_vendor;
		pci_product_id_t	apd_product;
	} athn_pci_devices[] = {
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5416 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR5418 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9160 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9280 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9281 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9285 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR2427 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9227 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9287 },
		{ PCI_VENDOR_ATHEROS, PCI_PRODUCT_ATHEROS_AR9300 }
	};
	struct pci_attach_args *pa = aux;
	size_t i;

	for (i = 0; i < __arraycount(athn_pci_devices); i++) {
		if (PCI_VENDOR(pa->pa_id) == athn_pci_devices[i].apd_vendor &&
		    PCI_PRODUCT(pa->pa_id) == athn_pci_devices[i].apd_product)
			/*
			 * Match better than 1, we prefer this driver
			 * over ath(4)
			 */
			return 10;
	}
	return 0;
}

Static void
athn_pci_attach(device_t parent, device_t self, void *aux)
{
/* ... */
}

Besides the generic device driver infrastructure, the other kernel infrastructure you will probably most interact with is the WiFi specific network interface glue/helper code described in https://man.netbsd.org/ieee80211.9 which does varies things like allow userspace to set encryption keys, specify access points to associate with, set media modes, etc, implement the generic ethernet interface API, etc etc

It's getting late and I rly need to go to bed but I hope this helps a little >w< It can get very complicated cuz this codebase is older than Linux and prolly even older than most surviving commercial Unixes. The ppl on the NetBSD IRC and mailing list (also maybe a Telegram group or two) will help you out if you need! Also I'll be around later. My experience is mainly in the OpenBSD codebase but OpenBSD is a fork of NetBSD and although they've diverged significantly they still share a lot of code and there are a few ppl that have copy-pasted code between them over the years (in a comradely manner)

Oh, one last tip! If you get confused or stuck with documentation, consider referring to OpenBSD documentation or code cuz the coverage (at least with userspace stuff.......) and quality tends to be better

If there's a Linux driver for your device, referring to it could help u a lot too as long as you're willing to put up with uhhhhh less than good code quality x3

Also, also: the index for the NetBSD kernel documentation: https://man.netbsd.org/intro.9 :3

Happy hacking!!

[–] CupcakeOfSpice@hexbear.net 3 points 2 days ago (1 children)

Thanks for the detailed answer! I do have another question, though. To test the driver, do I have to run it straight on my hardware? I've been able to build a live image and run it in QEMU; is there a way to expose my laptop's network card through QEMU so I can test without having to keep some partition aside for testing?

[–] PorkrollPosadist@hexbear.net 2 points 2 days ago* (last edited 2 days ago) (1 children)

Just scrolled past this comment on Mastodon: https://justfollow.me.uk/@sborrill/117461932167067930

Xen support in #NetBSD both as a host and guest is very mature; it got support not much after Linux and predates KVM by a number of years. It supports UVC with the uvideo driver. USB audio also generally OK. You can do kernel USB development entirely in userland using rump kernels, so the actual kernel code is used but cannot panic the machine and you can debug with gdb.

[–] CupcakeOfSpice@hexbear.net 1 points 21 hours ago

Uff. Spent most of yesterday and today trying to get NetBSD running with Xen, but I did finally get it working. Thanks for the direction.

[–] inari@piefed.zip 11 points 3 days ago* (last edited 3 days ago) (1 children)

NetBSD's Commit Guidelines state:

Code generated by a large language model or similar technology, such as GitHub/Microsoft's Copilot, OpenAI's ChatGPT, or Facebook/Meta's Code Llama, is presumed to be tainted code, and must not be committed without prior written approval by core.

which to me implies that LLM code can be accepted in certain situations. Doesn't read like a blanket ban to me.

See: https://codeberg.org/ethical-foss/open-slopware#operating-systems

I will note that this list is not very good because they hyperlink to "evidence" of a stranger in a github issue posting a chatgpt share link and use that to justify the second-worst rating label for the whole project

Needs more nuance

[–] Letztertod@hexbear.net 8 points 3 days ago

Assassinate Linus Torvald/joke but seriously all the best

[–] Enjoyer_of_Games@hexbear.net 8 points 3 days ago (1 children)
[–] orlando@hexbear.net 4 points 3 days ago

reference you made

[–] orlando@hexbear.net 5 points 3 days ago

you should be contacting them as well as us

[–] 30_to_50_Feral_PAWGs@hexbear.net 1 points 3 days ago* (last edited 3 days ago)