#!/bin/sh -e # $Id$ # ------------------- # Version information # ------------------- MUSLCC_VER="11" OPENSSL_VER="3.4.0" KSH_VER="1.0.10" NCURSES_VER="6.5" ZLIB_VER="1.3.1" SYSVINIT_VER="3.11" UTILLINUX_VER="2.40.2" SQLITE_VER="3.47.0" PAM_VER="1.6.1" TIRPC_VER="1.3.6" NSL_VER="2.0.1" KRB5_VER="1.21.3" SHADOW_VER="4.16.0" BINUTILS_VER="2.43" MUSL_VER="1.2.5" MPC_VER="1.3.1" MPFR_VER="4.2.1" GMP_VER="6.3.0" GCC_VER="14.2.0" KMOD_VER="33" TCSH_VER="6_24_13" SYSKLOGD_VER="2.6.2" DHCP_VER="4_4_3" INETUTILS_VER="2.5" NETTOOLS_VER="2.10" XFSPROGS_VER="6.11.0" INIH_VER="58" URCU_VER="0.14.1" PIGZ_VER="2.8" DOSFSTOOLS_VER="4.2" LIMINE_VER="8.2.0" VERSION="1.0" RELEASE="1.0" # ------------------------------------------------ # Ignore this if you want to build kernel yourself # ------------------------------------------------ if [ "x$SLACKWARE_ROOT" = "x" ]; then SLACKWARE_ROOT="http://ftp.slackware.com/pub/slackware" fi # ----------------- # Architecture/Bits #------------------ export ARCH=$(uname -m) export BITS=32 if [ "$ARCH" = "x86_64" ]; then BITS=64 fi if [ ! "$0" = "./bootstrap" ]; then return fi # ------------ # Tarball root # ------------ if [ "x$MUSLCC_ROOT" = "x" ]; then MUSLCC_ROOT="http://more.musl.cc" fi if [ "x$OPENSSL_ROOT" = "x" ]; then OPENSSL_ROOT="https://github.com/openssl/openssl/releases/download" fi if [ "x$KSH_ROOT" = "x" ]; then KSH_ROOT="https://github.com/ksh93/ksh/archive/refs/tags" fi if [ "x$NCURSES_ROOT" = "x" ]; then NCURSES_ROOT="https://invisible-island.net/archives/ncurses" fi if [ "x$ZLIB_ROOT" = "x" ]; then ZLIB_ROOT="https://zlib.net" fi if [ "x$SYSVINIT_ROOT" = "x" ]; then SYSVINIT_ROOT="https://github.com/slicer69/sysvinit/releases/download" fi if [ "x$UTILLINUX_ROOT" = "x" ]; then UTILLINUX_ROOT="https://github.com/util-linux/util-linux/archive/refs/tags" fi if [ "x$SQLITE_ROOT" = "x" ]; then SQLITE_ROOT="https://github.com/sqlite/sqlite/archive/refs/tags" fi if [ "x$PAM_ROOT" = "x" ]; then PAM_ROOT="https://github.com/linux-pam/linux-pam/releases/download" fi if [ "x$NSL_ROOT" = "x" ]; then NSL_ROOT="https://github.com/thkukuk/libnsl/releases/download" fi if [ "x$TIRPC_ROOT" = "x" ]; then TIRPC_ROOT="https://downloads.sourceforge.net/libtirpc" fi if [ "x$KRB5_ROOT" = "x" ]; then KRB5_ROOT="https://kerberos.org/dist/krb5" fi if [ "x$SHADOW_ROOT" = "x" ]; then SHADOW_ROOT="https://github.com/shadow-maint/shadow/releases/download" fi if [ "x$GNU_ROOT" = "x" ]; then GNU_ROOT="https://ftp.gnu.org/gnu" fi if [ "x$MUSL_ROOT" = "x" ]; then MUSL_ROOT="https://musl.libc.org/releases" fi if [ "x$KMDD_ROOT" = "x" ]; then KMOD_ROOT="https://mirrors.edge.kernel.org/pub/linux/utils/kernel/kmod" fi if [ "x$TCSH_ROOT" = "x" ]; then TCSH_ROOT="https://github.com/tcsh-org/tcsh/archive/refs/tags" fi if [ "x$SYSKLOGD_ROOT" = "x" ]; then SYSKLOGD_ROOT="https://github.com/troglobit/sysklogd/releases/download" fi if [ "x$DHCP_ROOT" = "x" ]; then DHCP_ROOT="https://github.com/isc-projects/dhcp/archive/refs/tags" fi if [ "x$IPROUTE2_ROOT" = "x" ]; then IPROUTE2_ROOT="https://mirrors.edge.kernel.org/pub/linux/utils/net/iproute2" fi if [ "x$NETTOOLS_ROOT" = "x" ]; then NETTOOLS_ROOT="https://downloads.sourceforge.net/project/net-tools" fi if [ "x$XFSPROGS_ROOT" = "x" ]; then XFSPROGS_ROOT="https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs" fi if [ "x$INIH_ROOT" = "x" ]; then INIH_ROOT="https://github.com/benhoyt/inih/archive" fi if [ "x$URCU_ROOT" = "x" ]; then URCU_ROOT="https://lttng.org/files/urcu" fi if [ "x$PIGZ_ROOT" = "x" ]; then PIGZ_ROOT="https://zlib.net/pigz" fi if [ "x$DOSFSTOOLS_ROOT" = "x" ]; then DOSFSTOOLS_ROOT="https://github.com/dosfstools/dosfstools/releases/download" fi if [ "x$LIMINE_ROOT" = "x" ]; then LIMINE_ROOT="https://github.com/limine-bootloader/limine/releases/download" fi if [ ! `id -u` = "0" ]; then echo "Build as root, please" exit 1 fi START="`date`" echo "Bootstrap started at: $START" echo "--- Log" mkdir -p build sys-root if [ -e build/wrap ]; then : svn co http://svn.nishi.boats/repo/wrap/trunk build/wrap else : svn up build/wrap fi mkdir -p sys-root/dev mkdir -p sys-root/root mkdir -p sys-root/proc mkdir -p sys-root/sys mkdir -p sys-root/tmp mkdir -p sys-root/bin mkdir -p sys-root/sbin mkdir -p sys-root/run mkdir -p sys-root/mnt mkdir -p sys-root/var/spool/pkg mkdir -p sys-root/var/log mkdir -p sys-root/var/run mkdir -p sys-root/var/tmp mkdir -p sys-root/var/db mkdir -p sys-root/usr/include/sys mkdir -p sys-root/usr/lib mkdir -p sys-root/usr/bin if [ ! -e sys-root/lib ]; then ln -sf ./usr/lib sys-root/lib fi if [ ! -e sys-root/lib64 ]; then ln -sf ./usr/lib64 sys-root/lib64 fi if [ ! -e sys-root/usr/lib64 ]; then ln -sf ./lib sys-root/usr/lib64 fi if [ ! -e sys-root/sbin/mount ]; then ln -sf ../usr/linux/bin/mount sys-root/sbin/mount fi if [ ! -e sys-root/sbin/umount ]; then ln -sf ../usr/linux/bin/umount sys-root/sbin/umount fi if [ ! -e sys-root/usr/bin/rm ]; then ln -sf ../../usr/svr42/bin/rm sys-root/usr/bin/rm fi if [ ! -e sys-root/usr/bin/rmdir ]; then ln -sf ../../usr/svr42/bin/rmdir sys-root/usr/bin/rmdir fi if [ ! -e sys-root/usr/bin/cp ]; then ln -sf ../../usr/svr42/bin/cp sys-root/usr/bin/cp fi SYS_ROOT="`pwd`/sys-root" echo -n "MUSLCC... " if [ -e build/$ARCH-linux-musl-cross -a ! -e build/$ARCH-linux-musl-cross.tar.gz ]; then echo "skipped" else echo "needed" wget $MUSLCC_ROOT/$MUSLCC_VER/$ARCH-linux-musl/$ARCH-linux-musl-cross.tgz -O build/$ARCH-linux-musl-cross.tar.gz tar --no-same-owner -xvf build/$ARCH-linux-musl-cross.tar.gz -C build rm build/$ARCH-linux-musl-cross.tar.gz fi if [ ! -e $SYS_ROOT/usr/include/sys/cdefs.h ]; then wget https://github.com/openembedded/openembedded-core/raw/refs/heads/master/meta/recipes-core/musl/bsd-headers/sys-cdefs.h -O $SYS_ROOT/usr/include/sys/cdefs.h fi if [ ! -e $SYS_ROOT/usr/include/sys/queue.h ]; then wget https://github.com/openembedded/openembedded-core/raw/refs/heads/master/meta/recipes-core/musl/bsd-headers/sys-queue.h -O $SYS_ROOT/usr/include/sys/queue.h fi if [ ! -e $SYS_ROOT/usr/include/sys/tree.h ]; then wget https://github.com/openembedded/openembedded-core/raw/refs/heads/master/meta/recipes-core/musl/bsd-headers/sys-tree.h -O $SYS_ROOT/usr/include/sys/tree.h fi echo -n "OpenSSL... " if [ -e build/openssl-$OPENSSL_VER -a ! -e build/openssl-$OPENSSL_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $OPENSSL_ROOT/openssl-$OPENSSL_VER/openssl-$OPENSSL_VER.tar.gz -O build/openssl-$OPENSSL_VER.tar.gz tar --no-same-owner -xvf build/openssl-$OPENSSL_VER.tar.gz -C build rm build/openssl-$OPENSSL_VER.tar.gz fi echo -n "NCurses... " if [ -e build/ncurses-$NCURSES_VER -a ! -e build/ncurses-$NCURSES_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $NCURSES_ROOT/ncurses-$NCURSES_VER.tar.gz -O build/ncurses-$NCURSES_VER.tar.gz tar --no-same-owner -xvf build/ncurses-$NCURSES_VER.tar.gz -C build rm build/ncurses-$NCURSES_VER.tar.gz fi echo -n "ZLib... " if [ -e build/zlib-$ZLIB_VER -a ! -e build/zlib-$ZLIB_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $ZLIB_ROOT/zlib-$ZLIB_VER.tar.gz -O build/zlib-$ZLIB_VER.tar.gz tar --no-same-owner -xvf build/zlib-$ZLIB_VER.tar.gz -C build rm build/zlib-$ZLIB_VER.tar.gz fi echo -n "KSH... " if [ -e build/ksh-$KSH_VER -a ! -e build/ksh-$KSH_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $KSH_ROOT/v$KSH_VER.tar.gz -O build/ksh-$KSH_VER.tar.gz tar --no-same-owner -xvf build/ksh-$KSH_VER.tar.gz -C build rm build/ksh-$KSH_VER.tar.gz fi echo -n "SysVInit... " if [ -e build/sysvinit-$SYSVINIT_VER -a ! -e build/sysvinit-$SYSVINIT_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $SYSVINIT_ROOT/$SYSVINIT_VER/sysvinit-$SYSVINIT_VER.tar.xz -O build/sysvinit-$SYSVINIT_VER.tar.xz tar --no-same-owner -xvf build/sysvinit-$SYSVINIT_VER.tar.xz -C build rm build/sysvinit-$SYSVINIT_VER.tar.xz fi echo -n "util-linux... " if [ -e build/util-linux-$UTILLINUX_VER -a ! -e build/util-linux-$UTILLINUX_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $UTILLINUX_ROOT/v$UTILLINUX_VER.tar.gz -O build/util-linux-$UTILLINUX_VER.tar.gz tar --no-same-owner -xvf build/util-linux-$UTILLINUX_VER.tar.gz -C build rm build/util-linux-$UTILLINUX_VER.tar.gz fi echo -n "SQLite... " if [ -e build/sqlite-version-$SQLITE_VER -a ! -e build/sqlite-$SQLITE_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $SQLITE_ROOT/version-$SQLITE_VER.tar.gz -O build/sqlite-$SQLITE_VER.tar.gz tar --no-same-owner -xvf build/sqlite-$SQLITE_VER.tar.gz -C build rm build/sqlite-$SQLITE_VER.tar.gz fi echo -n "PAM... " if [ -e build/Linux-PAM-$PAM_VER -a ! -e build/Linux-PAM-$PAM_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $PAM_ROOT/v$PAM_VER/Linux-PAM-$PAM_VER.tar.xz -O build/Linux-PAM-$PAM_VER.tar.xz tar --no-same-owner -xvf build/Linux-PAM-$PAM_VER.tar.xz -C build rm build/Linux-PAM-$PAM_VER.tar.xz fi echo -n "NSL... " if [ -e build/libnsl-$NSL_VER -a ! -e build/libnsl-$NSL_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $NSL_ROOT/v$NSL_VER/libnsl-$NSL_VER.tar.xz -O build/libnsl-$NSL_VER.tar.xz tar --no-same-owner -xvf build/libnsl-$NSL_VER.tar.xz -C build rm build/libnsl-$NSL_VER.tar.xz fi echo -n "TIRPC... " if [ -e build/libtirpc-$TIRPC_VER -a ! -e build/libtirpc-$TIRPC_VER.tar.bz2 ]; then echo "skipped" else echo "needed" wget $TIRPC_ROOT/libtirpc-$TIRPC_VER.tar.bz2 -O build/libtirpc-$TIRPC_VER.tar.bz2 tar --no-same-owner -xvf build/libtirpc-$TIRPC_VER.tar.bz2 -C build rm build/libtirpc-$TIRPC_VER.tar.bz2 fi echo -n "KRB5... " if [ -e build/krb5-$KRB5_VER -a ! -e build/krb5-$KRB5_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $KRB5_ROOT/`echo "$KRB5_VER" | sed -E 's/\.[0-9]+$//g'`/krb5-$KRB5_VER.tar.gz -O build/krb5-$KRB5_VER.tar.gz tar --no-same-owner -xvf build/krb5-$KRB5_VER.tar.gz -C build rm build/krb5-$KRB5_VER.tar.gz fi echo -n "Shadow... " if [ -e build/shadow-$SHADOW_VER -a ! -e build/shadow-$SHADOW_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $SHADOW_ROOT/$SHADOW_VER/shadow-$SHADOW_VER.tar.xz -O build/shadow-$SHADOW_VER.tar.xz tar --no-same-owner -xvf build/shadow-$SHADOW_VER.tar.xz -C build rm build/shadow-$SHADOW_VER.tar.xz fi echo -n "Binutils... " if [ -e build/binutils-$BINUTILS_VER -a ! -e build/binutils-$BINUTILS_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/binutils/binutils-$BINUTILS_VER.tar.gz -O build/binutils-$BINUTILS_VER.tar.gz tar --no-same-owner -xvf build/binutils-$BINUTILS_VER.tar.gz -C build rm build/binutils-$BINUTILS_VER.tar.gz fi echo -n "MPC... " if [ -e build/mpc-$MPC_VER -a ! -e build/mpc-$MPC_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/mpc/mpc-$MPC_VER.tar.gz -O build/mpc-$MPC_VER.tar.gz tar --no-same-owner -xvf build/mpc-$MPC_VER.tar.gz -C build rm build/mpc-$MPC_VER.tar.gz fi echo -n "MPFR... " if [ -e build/mpfr-$MPFR_VER -a ! -e build/mpfr-$MPFR_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/mpfr/mpfr-$MPFR_VER.tar.gz -O build/mpfr-$MPFR_VER.tar.gz tar --no-same-owner -xvf build/mpfr-$MPFR_VER.tar.gz -C build rm build/mpfr-$MPFR_VER.tar.gz fi echo -n "GMP... " if [ -e build/gmp-$GMP_VER -a ! -e build/gmp-$GMP_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/gmp/gmp-$GMP_VER.tar.gz -O build/gmp-$GMP_VER.tar.gz tar --no-same-owner -xvf build/gmp-$GMP_VER.tar.gz -C build rm build/gmp-$GMP_VER.tar.gz fi echo -n "GCC... " if [ -e build/gcc-$GCC_VER -a ! -e build/gcc-$GCC_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.gz -O build/gcc-$GCC_VER.tar.gz tar --no-same-owner -xvf build/gcc-$GCC_VER.tar.gz -C build rm build/gcc-$GCC_VER.tar.gz fi echo -n "MUSL... " if [ -e build/musl-$MUSL_VER -a ! -e build/musl-$MUSL_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $MUSL_ROOT/musl-$MUSL_VER.tar.gz -O build/musl-$MUSL_VER.tar.gz tar --no-same-owner -xvf build/musl-$MUSL_VER.tar.gz -C build rm build/musl-$MUSL_VER.tar.gz fi echo -n "KMOD... " if [ -e build/kmod-$KMOD_VER -a ! -e build/kmod-$KMOD_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $KMOD_ROOT/kmod-$KMOD_VER.tar.gz -O build/kmod-$KMOD_VER.tar.gz tar --no-same-owner -xvf build/kmod-$KMOD_VER.tar.gz -C build rm build/kmod-$KMOD_VER.tar.gz fi echo -n "TCSH... " if [ -e build/tcsh-TCSH$TCSH_VER -a ! -e build/TCSH$TCSH_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $TCSH_ROOT/TCSH$TCSH_VER.tar.gz -O build/TCSH$TCSH_VER.tar.gz tar --no-same-owner -xvf build/TCSH$TCSH_VER.tar.gz -C build rm build/TCSH$TCSH_VER.tar.gz fi echo -n "sysklogd... " if [ -e build/sysklogd-$SYSKLOGD_VER -a ! -e build/sysklogd-$SYSKLOGD_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $SYSKLOGD_ROOT/v$SYSKLOGD_VER/sysklogd-$SYSKLOGD_VER.tar.gz -O build/sysklogd-$SYSKLOGD_VER.tar.gz tar --no-same-owner -xvf build/sysklogd-$SYSKLOGD_VER.tar.gz -C build rm build/sysklogd-$SYSKLOGD_VER.tar.gz fi echo -n "DHCP... " if [ -e build/dhcp-$DHCP_VER -a ! -e build/dhcp-$DHCP_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $DHCP_ROOT/v$DHCP_VER.tar.gz -O build/dhcp-$DHCP_VER.tar.gz tar --no-same-owner -xvf build/dhcp-$DHCP_VER.tar.gz -C build rm build/dhcp-$DHCP_VER.tar.gz fi echo -n "inetutils... " if [ -e build/inetutils-$INETUTILS_VER -a ! -e build/inetutils-$INETUTILS_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $GNU_ROOT/inetutils/inetutils-$INETUTILS_VER.tar.gz -O build/inetutils-$INETUTILS_VER.tar.gz tar --no-same-owner -xvf build/inetutils-$INETUTILS_VER.tar.gz -C build rm build/inetutils-$INETUTILS_VER.tar.gz fi echo -n "net-tools... " if [ -e build/net-tools-$NETTOOLS_VER -a ! -e build/net-tools-$NETTOOLS_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $NETTOOLS_ROOT/net-tools-$NETTOOLS_VER.tar.xz -O build/net-tools-$NETTOOLS_VER.tar.xz tar --no-same-owner -xvf build/net-tools-$NETTOOLS_VER.tar.xz -C build rm build/net-tools-$NETTOOLS_VER.tar.xz fi echo -n "xfsprogs... " if [ -e build/xfsprogs-$XFSPROGS_VER -a ! -e build/xfsprogs-$XFSPROGS_VER.tar.xz ]; then echo "skipped" else echo "needed" wget $XFSPROGS_ROOT/xfsprogs-$XFSPROGS_VER.tar.xz -O build/xfsprogs-$XFSPROGS_VER.tar.xz tar --no-same-owner -xvf build/xfsprogs-$XFSPROGS_VER.tar.xz -C build rm build/xfsprogs-$XFSPROGS_VER.tar.xz fi echo -n "inih... " if [ -e build/inih-r$INIH_VER -a ! -e build/inih-$INIH_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $INIH_ROOT/r$INIH_VER/inih-r$INIH_VER.tar.gz -O build/inih-$INIH_VER.tar.gz tar --no-same-owner -xvf build/inih-$INIH_VER.tar.gz -C build rm build/inih-$INIH_VER.tar.gz fi echo -n "urcu... " if [ -e build/userspace-rcu-$URCU_VER -a ! -e build/urcu-$URCU_VER.tar.bz2 ]; then echo "skipped" else echo "needed" wget $URCU_ROOT/userspace-rcu-$URCU_VER.tar.bz2 -O build/urcu-$URCU_VER.tar.bz2 tar --no-same-owner -xvf build/urcu-$URCU_VER.tar.bz2 -C build rm build/urcu-$URCU_VER.tar.bz2 fi echo -n "pigz... " if [ -e build/pigz-$PIGZ_VER -a ! -e build/pigz-$PIGZ_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $PIGZ_ROOT/pigz-$PIGZ_VER.tar.gz -O build/pigz-$PIGZ_VER.tar.gz tar --no-same-owner -xvf build/pigz-$PIGZ_VER.tar.gz -C build rm build/pigz-$PIGZ_VER.tar.gz fi echo -n "dosfstools... " if [ -e build/dosfstools-$DOSFSTOOLS_VER -a ! -e build/dosfstools-$DOSFSTOOLS_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $DOSFSTOOLS_ROOT/v$DOSFSTOOLS_VER/dosfstools-$DOSFSTOOLS_VER.tar.gz -O build/dosfstools-$DOSFSTOOLS_VER.tar.gz tar --no-same-owner -xvf build/dosfstools-$DOSFSTOOLS_VER.tar.gz -C build rm build/dosfstools-$DOSFSTOOLS_VER.tar.gz fi echo -n "Limine... " if [ -e build/limine-$LIMINE_VER -a ! -e build/limine-$LIMINE_VER.tar.gz ]; then echo "skipped" else echo "needed" wget $LIMINE_ROOT/v$LIMINE_VER/limine-$LIMINE_VER.tar.gz -O build/limine-$LIMINE_VER.tar.gz tar --no-same-owner -xvf build/limine-$LIMINE_VER.tar.gz -C build rm build/limine-$LIMINE_VER.tar.gz fi END="`date`" echo "--- Summary" echo "Bootstrap started at: $START" echo "Bootstrap finished at: $END" echo "" echo "Run \`./kernel\` to prepare kernel headers for building" echo "Build can be started, run \`./construct\`"