💾 Archived View for gemini.hitchhiker-linux.org › gemlog › cross_compiling_hitchhiker_with_musl.gmi captured on 2023-06-14 at 14:04:59. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
My little Linux distro HitchHiker may be getting a pretty dramatic makeover in the form of moving from Glibc to Musl. This is a change that I've been considering for a long time and had even done some work towards implementing, but until today had not been able to fully realize compiling the entire base system after swapping out the C library.
I've been playing around a good bit with Void Linux on both my main workhorse laptop and on one of my Raspberry Pi 4 servers and have been pleasantly happy with the performance and software support that is available. This is especially evident in comparison with the situation just a few years ago. What I'm not completely sold on with Void is using Runit as the init and supervision suite. It's incredibly simple, particularly if you have any experience with any of the various daemontools inspired supervisors. However, I'm much more impressed overall with S6, in particular because it actually solves the problems around dependency ordering during system startup quite nicely. HitchHiker therefore uses S6, and I want to go from a toy system to running it in production on the Pi's soon.
The actual work to get the entire base to compile was in some ways easy, but involved a certain amount of tedious manual intervention. HitchHiker discards GNU coreutils and most of Util Linux in favor of a sort of mishmash userland which draws mostly from utilities ported from all three BSD's, a few suckless tools and a number of utilities that are written from scratch specifically for the distro. A lot of the custom porting work that went into getting BSD utils working on Linux with Glibc had to be repeated or at least tweaked to account for the subtle and sometimes not so subtle differences. None of this was particularly difficult, given a modest understanding of C, just kind of tedious and repetetive after the first few investigations. Some of the gotchas include the fact that certain ancient interfaces which are still supported, although considered deprecated, in Glibc are just plain not implemented in Musl (sigmask and sigsetmask come to mind). There's also a few constants and typedefs which programmers apparently have taken for granted (always a bad idea IMHO).
I took the opportunity to also update some package versions. Linux is now at 6.1.2, Gcc and Binutils are their latest and greatest. I'm actually more excited about ex/vi though. The version of ex/vi that I've had in-tree for a while is basically what the editor looked like as of 4.3BSD, with only portability changes added. I have seen some bugs and crashes with this version (not a lot) and decided to move to Gunnar Rittar's update to the original, which adds Unicode support and cleans up a lot of bugs. But this is still based on the original Ex/Vi written by Bill Joy back in the early days of Unix.
I've gottent the entire userland to compile - exactly once - for aarch64. I need to verify that I can still compile for x86_64 and RiscV64 at least. I'll also make an effort to compile for i586 and armv7, although I'm not currently using any 32 bit equipment.
After that I'll be updating the kernel configs. HitchHiker uses the Slackware methodology of including the most commonly used hardware support in-kernel rather than as modules, ala the Slackware HugeS kernel series. It is expected that if someone is actually going to use this on their machine then they will be compiling their own kernel at some point. By doing things this way it's possible to eliminate the initrd and greatly simplify the boot process. My installs boot at least as fast as anything else I've ever seen.
After that, it will be time to bootstrap Pkgsrc 2022q4 and start compiling software packages.
All content for this site is licensed as CC BY-SA.
© 2023 by JeanG3nie