clfs

clfs.git
git clone git://git.lenczewski.org/clfs.git
Log | Files | Refs | README

commit be6c2c188a854c48f8cf832acbb52d27cca008cc
parent c03da04a67715d0bbee7fc0d5fde37f5d853dd73
Author: MikoĊ‚aj Lenczewski <mblenczewski@gmail.com>
Date:   Sun,  7 Apr 2024 21:59:41 +0000

Print current package, and split out kernel into stage4.sh

Diffstat:
Mclfs.sh | 6+++++-
Mstage1.sh | 1+
Mstage2.sh | 5+++++
Mstage3.sh | 26++++----------------------
Astage4.sh | 27+++++++++++++++++++++++++++
5 files changed, 42 insertions(+), 23 deletions(-)

diff --git a/clfs.sh b/clfs.sh @@ -40,8 +40,12 @@ cd "$ROOT" cd "$ROOT" . "$ROOT/stage2.sh" -# cross-compile userland, initramfs, and kernel for target +# cross-compile userland for target cd "$ROOT" . "$ROOT/stage3.sh" +# cross-compile initramfs and kernel for target +cd "$ROOT" +. "$ROOT/stage4.sh" + echo "Done!" diff --git a/stage1.sh b/stage1.sh @@ -3,6 +3,7 @@ echo "Building cross-compilation tools..." if [ ! -e $CROSSTOOLS/.built-crosstools ]; then + echo "Building cross-llvm (clang + lld)..." rm -rf $CROSSTOOLS mkdir -p $CROSSTOOLS diff --git a/stage2.sh b/stage2.sh @@ -125,6 +125,7 @@ mkdir -pv \ $SYSROOT/var/tmp # build linux-headers (requires HOSTCC) +echo "Building linux-headers..." cp -r $SOURCES/$LINUX_DIR $WORK/$LINUX_DIR cd $WORK/$LINUX_DIR @@ -133,6 +134,7 @@ make HOSTCC=$HOSTCC $LINUX_HOSTCC_OPTS ARCH=$LINUX_ARCH \ INSTALL_HDR_PATH=$SYSROOT/usr headers_install # build musl-libc headers +echo "Building musl-libc-headers..." mkdir -p $WORK/build-libc-headers cd $WORK/build-libc-headers @@ -145,6 +147,7 @@ $SOURCES/$MUSL_DIR/configure \ make DESTDIR=$SYSROOT install-headers # build compiler-rt builtins +echo "Building compiler-rt builtins..." mkdir -p $WORK/build-builtins cmake -S $SOURCES/$LLVM_DIR/compiler-rt/lib/builtins -B $WORK/build-builtins -GNinja \ -DCMAKE_INSTALL_PREFIX=$SYSROOT/usr/lib/clang/$LLVM_VER_MAJOR \ @@ -154,6 +157,7 @@ cmake --build $WORK/build-builtins cmake --install $WORK/build-builtins # build musl-libc +echo "Building musl-libc..." mkdir -p $WORK/build-libc cd $WORK/build-libc @@ -168,6 +172,7 @@ make DESTDIR=$SYSROOT install -j$(nproc) cd $WORK # build libunwind, libcxx, libccxabi +echo "Building libunwind, libcxx, and libcxxabi..." LLVM_LIBUNWIND_FLAGS=" -DLIBUNWIND_USE_COMPILER_RT=ON diff --git a/stage3.sh b/stage3.sh @@ -2,9 +2,10 @@ . "$(dirname $0)/env-clfs.sh" -echo "Building $TARGET userland, initramfs, and kernel..." +echo "Building $TARGET userland..." # build toybox +echo "Building toybox..." cp -r $SOURCES/$TOYBOX_DIR $WORK/$TOYBOX_DIR cd $WORK/$TOYBOX_DIR @@ -12,6 +13,7 @@ make LDFLAGS="--static" distclean defconfig toybox make PREFIX=$SYSROOT install # build iana-etc +echo "Building iana-etc..." cp -r $SOURCES/$IANA_ETC_DIR $WORK/$IANA_ETC_DIR cd $WORK/$IANA_ETC_DIR @@ -108,24 +110,4 @@ export HISTFILESIZE=1000 #export EDITOR=/usr/bin/vim EOF -if false; then - -mkdir -p $BOOTROOT $INITRAMFS - -# build initramfs - - -# build linux-kernel -cd $SOURCES/$LINUX_DIR - -make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH mrproper -make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH CROSS_COMPILE=$TARGET- -make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH CROSS_COMPILE=$TARGET- \ - INSTALL_MOD_PATH=$SYSROOT modules_install - -cp -v arch/$LINUX_ARCH/boot/bzImage $BOOTROOT/linuxstub.efi -cp -rv arch/$LINUX_ARCH/boot/dts $BOOTROOT/ - -fi - -echo "Built $TARGET userland, initramfs, and kernel!" +echo "Built $TARGET userland!" diff --git a/stage4.sh b/stage4.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +. "$(dirname $0)/env-clfs.sh" + +echo "Building $TARGET initramfs and kernel..." + +if false; then + +mkdir -p $BOOTROOT $INITRAMFS + +# build initramfs + + +# build linux-kernel +cd $SOURCES/$LINUX_DIR + +make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH mrproper +make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH CROSS_COMPILE=$TARGET- +make HOSTCC=$HOSTCC ARCH=$LINUX_ARCH CROSS_COMPILE=$TARGET- \ + INSTALL_MOD_PATH=$SYSROOT modules_install + +cp -v arch/$LINUX_ARCH/boot/bzImage $BOOTROOT/linuxstub.efi +cp -rv arch/$LINUX_ARCH/boot/dts $BOOTROOT/ + +fi + +echo "Built $TARGET initramfs and kernel!"