#bingsu linux - small and sweet

227 messages · Page 1 of 1 (latest)

lyric galleon
#

since someones probably going to ask this is the design philosophy im going by:

  • if theres a smaller alternative that has a majority of another bit of software's functionality, use the smaller alternative (tcc compared to gcc, hummingbird compared to systemd, etc)

  • its unopinionated, you can just use what you prefer (xlibre/wayland, systemd/everyone else, emacs/vim, etc)

runic badge
#

Is this going to use the busybox implementation of coreutils?

#

By default

lyric galleon
#

busybox is pretty cool but it also comes with a lot of other stuff that i dont really need or want, such as the init, sh implementation and vi clone

runic badge
#

Well you can always exclude compiling those parts into your binary. I was also going to suggest using busybox runit as the init, since it’s pretty dang minuscule. The whole thing adds less than 100 KiB to the busybox binary

#

But if you’re not using busybox then hummingbird is probably the smallest choice

lyric galleon
runic badge
#

Yeah! You can toggle what features you want in your binary when compiling it

lyric galleon
#

ok that sounds peak i might try that out

runic badge
#

They provide a whole menuconfig and everything

#

I can try compiling sbase/ubase and busybox with some of the features you don’t want disabled and comparing their sizes. I have no experience with tcc though

lyric galleon
runic badge
#

Also it’s probably a good idea to make them statically linked even on the final distro, unless you’re going for truly embedded systems level of tiny (which might be hard with glibc)

lyric galleon
#

glibc CAN be used to make statically linked binaries right? the only times ive ever built stuff with static linking is on musl

runic badge
#

You can, but there’s no point since musl exists

lyric galleon
#

and i was going to go with musl but glibc's compatibility won out

runic badge
#

And it’s a statically linked binary so it doesn’t matter which libc you use for it

#

Just go with the smaller one

lyric galleon
#

oh wait i think i got it now

#

im setting up the package repos in this sorta configuraton:

  • base / extra / desktop, similar to kiss repos, not really relevant right now
  • bootstrap, which is just a bunch of static binaries that can be used to install and setup bingsu
runic badge
#

Use musl for busybox/sbase/ubase and compile it statically, then link everything else dynamically with glibc and ship glibc in your distro

lyric galleon
#

so i could build all of the binaries in 'bootstrap' using musl on my main system and link statically, then just use glibc once i can chroot in

lyric galleon
lyric galleon
runic badge
#

You just use musl-gcc

#

If you’re an insane person you might also be able to do something like this

#

gcc -o myprogram myprogram.c -I /usr/include/musl -L /usr/lib/musl -static -lmusl

runic badge
#

Correct

lyric galleon
#

for the most part im just kinda following TL;DR LFS and making the appropriate adjustments

#

and then later on making a package manager which will probably be one of the most difficult bits

lyric galleon
runic badge
lyric galleon
#

and ive just realised that i removed all virtualisation support in my custom kernel so im either going to have to re-add it back in, or sacrifice whatevers on my secondary hdd (which i think is just a kiss linux install)

runic badge
#

Definitely add virtualization support back in, it’s gonna back your development so much faster

#

And then once it’s in a working state on the VM you can strip it out and try it on bare metal

lyric galleon
#

yea i was thinking that too

#

actually i think i have a bootable zen kernel i can just do that

runic badge
#

Also do you have a plan for the initramfs generator?

#

I have a script for the init that you can use

#

Well actually it wouldn’t work for your configuration I would have to change it, nvm

lyric galleon
#

but obviously some ppl are going to need one so ill work something out

runic badge
#

You can probably just use Alpine’s mkinitfs

#

And just package it for your distro

lyric galleon
#

yea that sounds good

#

tinyramfs is on the radar too

heavy tulip
#

are you doing some kind of competition to arch/gentoo

#

no offense

lyric galleon
#

ok so this is probably the current working toolchain 빙수 will use:

  • ubase/sbase coreutils, probably toybox for bootstrap just to make setting things up easier for myself lol
  • hummingbird as the default init (never mentioned this but i was originally going to use s6, then tried to figure out how to use it and subsequently experienced brain explosion)
  • tcc/musl for building binaries
  • kernel will be the user's responsibility, so will initramfs as it isnt strictly necessary
  • custom package manager, will work on that later on down the line
#

shit TCC uses __malloc_hook for some reason and so cant build on musl??

#

i think its just for the bound checker though so theres gotta be a way to bypass that

#

nevermind im stupid you just have to pass --config-musl to ./configure

lyric galleon
#

ok i dont know what the fuck is going on but tcc just refuses to use the musl headers

ill come back to it later ill just get the rest of bootstrap done first

#

i think it will work on an environment where just musl headers are in /usr/include so it SHOULD be fine

#

ok im REALLY stupid i could just be doing all of this in my kiss linux install which uses musl natively and so there would be no libc clobbering

lyric galleon
#

simple chroot successful, now to just apply polish and then tar it

#

and then we have a rootfs tarball

lyric galleon
#
  • tcc works too
lyric galleon
#

glibc installed

#

once ive confirmed that the base is able to expand itself ill drop a rootfs tarball

runic badge
#

Is this going to be a /usr-merged system

lyric galleon
runic badge
#

I means that everything that would’ve been in /bin /lib and a few other places goes to /usr/bin and /usr/lib and the original places are symlinked to the new ones

#

Pretty much all the modern linux distros are /usr-merged

#

Even Alpine is switching to it and it doesn’t even use systemd

lyric galleon
#

all of the binaries so far are in /usr/bin

#

i DID try to make a symlink to oksh at /bin/sh but that didnt work and i cba to fix it

#

also i changed shell from dash to oksh since oksh is better as an interactive shell while still staying small

runic badge
#

I haven’t even heard of oksh

lyric galleon
#

portable version of openbsd's shell

runic badge
#

Ah

#

I haven’t used OpenBSD :P

lyric galleon
#

a lot of openbsd's stuff is really good

#

like i dont even use sudo anymore i use doas

#

cause doas has 95% of sudo's functionality in 5% of sudo's size

runic badge
#

I used to use doas except then I realized it has no features at all and I was just hopping on the minimalism aesthetic hype train

lyric galleon
#

also its kinda silly but i personally type doas a lot faster than i do sudo

runic badge
#

But for something designed to be small doas is a lot better

lyric galleon
#

yea

#

package manager for this distro is kinda dawning on me, itll probably be one of the most difficult parts

runic badge
#

Also I saw earlier you were struggling with musl, why were you building anything with musl?

lyric galleon
#

i know a fair bit of python and lua but i would prefer to just shell script, however im a lot less experienced with it

lyric galleon
lyric galleon
#

THEN rebuild with glibc once i have a working system

runic badge
#

Well that just seems overly complicated lol

lyric galleon
#

right now i just have a directory in /var/db/ containing build scripts for stuff

runic badge
#

Why not build statically with glibc if you’re eventually gonna replace it anyway

lyric galleon
runic badge
#

Fair enough!

lyric galleon
#

also im under the impression libressl is a direct upgrade to openssl

#

though if it was then wouldnt everyone be using it

runic badge
#

Btw if you have a GitHub with all your scripts so far I’d like to take a look and possibly contribute :)

lyric galleon
#

i got it on codeberg

runic badge
#

Alrighty

lyric galleon
#

its all privated so far since i havent put anything on there yet LOL

#

i think i just gotta build binutils and curl then check to see if i can build stuff then im done

runic badge
#

Cool!

runic badge
#

btw you really should use an initramfs by default lol….

lyric galleon
runic badge
#

alright. Well we can package tinyramfs or something

#

Should be pretty easy

lyric galleon
#

yea tinyramfs wouldnt be too hard

#

from my current understanding what i would have to do to make a functional package manager is:

  • have it look for a build script in a given directory

  • execute the script

  • then add the pkg name to a list of installed packages

#

i COULD just go full slackware and put dependency management on the user but thats just silly

runic badge
#

You should also store metadata about what files are owned by what package so you can uninstall packages as well

#

And query info about installed packages and stuff

lyric galleon
#

yea i would also have to do that

runic badge
#

You can just include the metadata in the package itself

lyric galleon
#

shit i forgot to link glibc statically so now nothing to do with it works in chroot

runic badge
#

And then have the package manager move it somewhere during installation

lyric galleon
runic badge
#

Huh why do you need to build glibc statically anyway

lyric galleon
lyric galleon
#

also this is all being done OUTSIDE of a chroot, since the system has no working libc yet and so wouldnt be able to build one

lyric galleon
#

im making an executive decision glibc is outta here with how much of a pain in the ass it is

lyric galleon
#

whoops just borked my entire kiss install due to a typo gonna have to hold things off until i fix it

lyric galleon
dusk mirage
#

Interesting

lyric galleon
#

how the fuck do you build gnu binutils statically this shit is insisting on being dynamic

lavish sedge
#

Does it taste like Korean BBQ?

#

Bingsu is the Korean word for soup, so ig not

lyric galleon
#

bingsu is an ice dessert kinda like sorbet

lavish sedge
#

Oh, Okie

lyric galleon
#

really all i need binutils for is ld ar and as so i think if i can just get those then ill be fine

#

theres gotta be an alternative to gnu binutils right

lyric galleon
#

hummmm i was also considering llvm/clang but that toolchain is an absolute behemoth

dusk mirage
#

LFS?

lyric galleon
#

lfs is good but its more focused on 'functional system' rather than 'tiny base'

lyric galleon
dusk mirage
runic badge
#

@lyric galleon

checking for python3... python3
checking version of python3... 3.13.8, ok
configure: error:
*** These critical programs are missing or too old: compiler
*** Check the INSTALL file for required versions.```

You can't build glibc with tcc
#

you might need to switch to musl

#

or switch to gcc

#

or llvm/clang

#

Imo switching to LLVM/clang/mold toolchain should be considered

#

Though you’ll need to patch LLVM’s libc++

#

I know that without some patch some KDE plasma stuff will break and presumably other things as well but that’s what I know of

lyric galleon
#

i was considering llvm/clang actually

runic badge
#

It’s a good toolchain but harder to build

#

Use mold as the linker as well instead of lld. It’s a lot faster

#

I also find LLVM/Clang to be a little faster at compiling than GCC

#

And with -Oz it produces smaller (but slower) binaries and libs

#

Than GCC’s -Os

lyric galleon
#

my main concern is just how big llvm is, but avoiding gnu bullshit i think is a worthy trade

#

even on my 2600x llvm/clang still takes about an hour if not 2 to compile

runic badge
#

Yikes

#

Yeah that’s a lot

lyric galleon
#

i will probably get a new motherboard and a ryzen 9 around december though

#

so that should make it go by faster if i am still working on the distro by then (hopefully i am but if i burnout i burnout)

lyric galleon
runic badge
lyric galleon
#

cmake...

#

ew.

#

though given theres an active (last i checked) and officially-unofficially recognised llvm-based kiss repo/rootfs it seems fine enough

#

its just a matter of if i can make it fucking build now

runic badge
#

I'm trying right now

#

however I'm also using musl

#

because in order to build glibc you're going to need GCC anyway

#

or at least components from it

lyric galleon
#

Chimera uses musl and llvm/clang so its definitely compatible

lyric galleon
runic badge
#

musl + llvm/clang is a lot easier than glibc + llvm/clang

#

I'm building llvm right now

#

trying to bootstrap it

lyric galleon
#

i never had anti-gnu sentiment but after glibc and binutils i probably will

runic badge
#

I can't bootstrap LLVM

#

good luck

lyric galleon
runic badge
#

@lyric galleon I was able to get a musl + gcc LFS chroot working

#

once I figure out how to compile LLVM within this environment I can recompile all packages with it

#

I've documented everything I've had to do so far so you can follow that

#

and hopefully get this thing working

lyric galleon
#

aight peak

runic badge
#

here's some stuff I've documented. Other than this you just need to follow LFS

#

there's a better way to create the cross toolchain but I haven't tried it yet

runic badge
#

now you only compile GCC in one pass

#

for the cross compiler though

#

you need to compile GCC again with the cross compiler to get the target's GCC to link against musl, instead of the host's libraries

#

but with this you only need to build GCC twice instead of 3 times

#

so it's quite significant

lyric galleon
#

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbingsu

runic badge
#

ok I have it working with busybox

#

not sbase/ubase though

#

busybox ended up being smaller because it provides more utils than sbase/ubase

#

however I couldn't get the vi, grep, egrep, or xargs modules to compile

#

I'll have to patch it

#

apparently there's some weird regex incompatibilities with musl

lyric galleon
#

yea musl just has some wierd specific incompatibilities

runic badge
#

I'm sure there's some patch that fixes it cause Alpine linux exists

#

> Looks up Alpine patches for Musl
> First thing I see it CVE-2025-26519.patch

#

yeah I should probably include that

#

bruh why are there so many patches for busybox

#

like i know the busybox's code quality is dog

#

but still

lyric galleon
lyric galleon
#

mom found the bingsu

lyric galleon
#
  • toybox has 95% of its functionality in a smaller more secure package
rotund lodge
#

I like this things name.

lyric galleon
#

pushing this just so i dont lose it. work has slowed down since i really dont want to try to bootstrap llvm/clang on my current cpu

lyric galleon
lyric galleon
#

puush

rotund lodge
#

I can maybe help once I get my main machine back online in the coming months. It has enough 🐏 and a barely used ryzen 5

#

Oh, and hella cooling.

lyric galleon
#

im just getting my new pc set up and ready to go so ill be back at the stove soon enough

rotund lodge
#

Oooo

#

Looking forward to updates. 👀

lyric galleon
#

not super relevant to bingsu but i just found out about dbin and its cool as hell

#

kinda goes against the spirit of the distro though so i probably wont use it

rotund lodge
lyric galleon
#

only reason im against dbin for this distro is because it distributes binaries, not source