We need some stuffs to be prepared, like :
- Musl-based linux distro as host. I used dragora GNU/Linux. We may use alpine as well.
- Compiler, I use gcc 14.
- LFS book, just ignore everything about the glibc, openssl and eudev part.
- Mussel to build cross compilers.
- Time and patient.
Note : We won't cover everything and just some needed steps.
-
Do everything before Chapter 5.
-
For chapter 5 :
- skip binutils pass 1 and gcc pass 1 ! Replace them with mussel, just clone and run the script (e.g.
mussel -k -l -o -p
) ! Move the result build to lfs tools directory ! - Replace glibc at 5.5 with musl !
- Enter libstdc++-v3 directory from previous mussel gcc build ! Run
make DESTDIR=$LFS install
!
- skip binutils pass 1 and gcc pass 1 ! Replace them with mussel, just clone and run the script (e.g.
-
For chapter 6 :
- Build everything normally !
- After gcc pass 2 build is done, you need to copy libzstd.so from host to $LFS/usr/lib in order to make gcc pass 2 works. Somehow some binaries under
$LFS/usr/libexec/gcc/x86_64-pc-linux-musl/14.2.0/
still linked to libzstd.so library from host.
-
For chapter 7 :
- Perl need to be built out of tree, make a directory outside source code and run
sh /path/to/Configure -Dmksymlinks -D blablabla
followed by make and make install.
- Perl need to be built out of tree, make a directory outside source code and run
-
For chapter 8.
- Build musl instead of glibc !
- Avoid to build libxcrypt, since it will replace some stuffs from musl (e.g crypt.h header).
- Build binutils and add
--disable-gprofng
or--enable-gprofng=no
option ! - Perl need to be built out of tree, make a directory outside source code and run
sh /path/to/Configure -Dmksymlinks -D blablabla
followed by make and make install. - Build libressl 4.0.0 instead of openssl !
- Kmod 33 need some patches on musl, please check on alpine linux APKBUILD. Kmod 34 works without patch on musl.
- Before build libelf / elfutils, you need to build musl-obstack, musl-fts, and argp-standalone.
- Python need some patches for libressl's compatibility. Check at openbsd port for the patches !
- Build eudev instead of udev !
- If some packages are failed to build, just apply patches from alpine linux !
Kmod 34 works without patch on musl.