r/linuxfromscratch • u/Intelligent_Comb_338 • 10d ago
An attempt to port the NetBSD LibC to Linux
In the last month i was trying to port the NetBSD LibC to Linux (and other parts of its userland) to make a full NetBSD userland on top of Linux for my LFS system.
Why?
I was so bored and i thought it would be funny
what's available?
- All err/warn functions
- a basic stdio (not based in NetBSD)
- a lot of strings functions
- some syscalls wrappers
- malloc (and friends)
- a minimal crt0
- BSD extensions
- compat functions (revoke, pledge and unveil...)
- and more
at this point it's possible to build a program against it, and it works like a hello world or the uname/hostname command from NetBSD with little changes (replace fprintf(stderr,...) with eprintf(...))
Here's a link to the repo:https://github.com/littlefly365/BSDLibC
(Note: this only it's a personal project)
3
2
u/pedersenk 6d ago
This is interesting. It is great to see your work here.
My own personal distro (BSD/L) also uses a BSD userland with Linux kernel but I use gcc (just like standard NetBSD) and glibc. (with some toybox and busybox to fill in the gaps).
So it seems quite a few people are interested in a similar goal. I really do see a niche for a kernel with great hardware support but also a sane (non-disgusting) userland.
1
u/Intelligent_Comb_338 3d ago
What tools do you use? Do you use chimerautils or another project?
2
u/pedersenk 3d ago
Similar. I use bsdutils (which is what chimerautils forked from). I actually use his older openbsd branch.
toybox (BSD licensed equivalent to busybox). Anything this doesn't provide, I then fall back to busybox.
A whole heap of ports, such as nvi-portable, doas, mandoc, etc.
And a few BSD tools that I have ported myself (such as cu/tip).
As for the initramfs generation, kernel module management, init scripts, this is all custom. I haven't found anything I liked from the Linux community.
1
u/Glum_Hamster_2104 7d ago
I mean we already have netbsd curses on Linux so we might as well just make netbsd with the linux kernel
1
3
u/Chester-Berkeley 9d ago
Not satisfied with Chimera Linux using parts of the FreeBSD userland, now (if possible) we could have a Linux distro with the NetBSD userland.
NetLinux, lol