Musl-LFS
Linux From Scratch using Musl as Libc and S6+S6-rc as init system
This is based on the works of Linux From Scratch (http://www.linuxfromscratch.org), which use GLibc and SysVinit/systemD. Additional work was derived from Void Linux (https://voidlinux.org), Alpine Linux (https://alpinelinux.org), and Dragora Linux (https://dragora.org). For logging during development of tool chains, I used porg from http://porg.sourceforge.net/.
The aim of this project is to create a create a Linux system using Musl (www.musl-libc.org) instead of GNU's Glibc and S6 (https://skarnet.org/) instead SysVinit.
Supported Architectures
- i686/i586 : Stable and tested. Stable enough to build Xorg, Qt5 (without QT-webengine), Rust, and Firefox.
- x86_64 : Stable and tested. Stable enough to build Xorg, Qt5, Rust, and Firefox.
- aarch64: Stable and tested. Stable enough to build Xorg, Qt5, Rust, and Firefox.
- armv7/armv6: Builds fine. Requires modification to suit target hardware.
Goals:
- Properly name patches to reflect origin (i.e. Alpine or void)
- Create a list for wget to download sources.
- Create md5s list for sources
- Update s6-rc & s6 to lastest version
- Redesign tool chain build to avoid two build passes of binutils and GCC
- Generate HTML 'book' like LFS
- Add utmp/utmpx implementation
- Transition from pkgconfig to pkgconf
- Transition from gettext to gettext-tiny
- POSIX compatibility
- Unify directories bin, sbin, and lib from / and /usr
- Remove obselete bin group & user
Build Method
MLFS is based on LFS 9.1 and composed of 3 stages: cross-tools, tools, and chroot.
- Cross-Tools -- Create a very basic toolchain with host's own tool chain. THis will be used to build the next stage. It also allows the next stage to use Musl Libc instead of Glibc.
- Tools -- Creates the tool chain that will be used in the next stage. Resulting toolchain is sandboxed from host and uses its own libc: Musl
- Chroot -- Last stage in which the final Musl system is built, using the tool chain built in the previous stage
Starting with LFS 10.x, LFS now uses as new method and has not been tested to work with MLFS at this time.
Tested Builds
Host | Target | Build Status |
---|---|---|
i686-musl | i686-musl | Pass |
i686-glibc | i686-musl | Pending |
x86_64-musl | x86_64-musl | Pass |
x86_64-glibc | x86_64-musl | Pass |
aarch64-glibc | aarch64-musl | Pass |
armv7l-glibc | armv7l-musl | Pass |
armv7l-musl | armv7l-musl | Pending |
armv6-glibc | armv6-musl | Pending |
armv6-musl | armv6-musl | Pending |
ARM builds will need some modification based on specific hardware
Additional Required Packages
If pursuing BLFS, some packages will fail to compile due certain implementions left out in the Musl C Library.
- Musl C Library https://www.musl-libc.org/
- Musl-FTS https://github.com/pullmoll/musl-fts
- Musl-Obstack https://github.com/pullmoll/musl-obstack
- Musl-RPmatch https://github.com/pullmoll/musl-rpmatch
- Musl-Legacy-Compatibility Headers https://github.com/void-linux/void-packages/blob/master/srcpkgs/musl-legacy-compat
- Argp-Standalone https://github.com/jahrome/argp-standalone
Optional Packages:
- LibreSSL (instead of OpenSSL) https://www.libressl.org/
- GNU Nano (Text Editor) https://www.nano-editor.org/
Projects of Interest
- gCompat - "The gcompat project provides a glibc-compatible runtime environment for distributions that use musl libc." https://code.foxkit.us/adelie/gcompat
- Locales - "Locale program for musl libc" https://github.com/rilian-la-te/musl-locales
- Mussel - "...the shortest and fastest script available today to build working cross compilers that target musl libc." https://github.com/firasuke/mussel
- shimmy - POSIX
®️ compatibility shims for Linux (and other environments) https://code.foxkit.us/adelie/shimmy - gettext-tiny - It provides lightweight replacements for tools typically used from the GNU gettext suite. https://github.com/AdelieLinux/gettext-tiny
- MLFS-pkgtool - MLFS built with Slackware's pkgtools. https://github.com/dslm4515/MLFS-pkgtool
Layout
- build-scripts - Build scripts to use to semi-automate building /cross-tools, /tools, and the final system
- contrib - Additional sources that are hard to find or re-packed
- doc - Build instructions to build a LFS installation that uses Musl instead of Glibc and S6 instead of SysVint.
- extra - Helpful scripts to mount, chroot, and umount a MLFS build.
- files - Files that will be needed during the build
- patches - All patches used to patch sources to work/recognize Musl C Library
- sources.list - List of sources to download
Changelog (since 8.00)
- Completed scripts to build cross-tools and tools
- Upgraded bash to 5.1
- Updated lsb-release to 9.0
- Upgraded flex to 2.6.4
- Upgraded expat to 2.4.1
- Upgraded inetutils to 2.0
- Upgraded perl to 5.34.0
- Upgraded autoconf to 2.7.1
- Upgraded automake to 1.16.3
- Upgraded libelf to 0.185
- Upgraded libreSSL to 3.3.3
- Upgraded Python3 to 3.9.5
- Upgraded procps-ng to 3.3.17 with utmps support
- Upgraded coreutils with utmps support
- Upgraded grub to 2.06
- Upgraded iproute 2 to 5.12.0
- Upgraded to man-db 2.9.4.
- Upgraded vim to 8.2.2890
- Upgraded util-linux to 2.36.2
- Upgraded execline to 2.8.0.1
- Upgraded s6 to 2.10.0.3
- Upgraded s6-rc to 0.5.2.2
- Upgraded s6-linux-utils to 2.5.1.5
- Upgraded s6-portable-utils to 2.2.3.2
- Upgraded s6-linux-init 1.0.6.3