Added stage 2 installer

This commit is contained in:
Liam Waldron 2022-08-02 22:32:50 -04:00
parent b696e78396
commit 0ea74861a7
2 changed files with 186 additions and 0 deletions

180
scripts/build-2.sh Executable file
View File

@ -0,0 +1,180 @@
#!/bin/sh
# Everest Linux 1.0.0-busybox - Stage 2 Installation Script
# This program is free software: See the GNU GPL v3.0 for details
printf "[ i ] Starting stage 2 installation...\n"
sleep 0.5
printf "[ i ] Creating bash configuration files...\n"
cat > ~/.bash_profile << "EOF"
exec env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' /bin/bash
EOF
cat > ~/.bashrc << "EOF"
set +h
umask 022
EVEREST=/mnt/everest
LC_ALL=POSIX
PATH=${EVEREST}/cross-tools/bin:/bin:/usr/bin
export EVEREST LC_ALL PATH
EOF
printf "[ i ] Sourcing .bash_profile...\n"
source ~/.bash_profile
printf "[ i ] Unsetting CFLAGS...\n"
unset CFLAGS
echo unset CFLAGS >> ~/.bashrc
printf "[ i ] Setting build variables...\n"
export EVEREST_HOST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/")
export EVEREST_TARGET=x86_64-linux-musl
export EVEREST_CPU=k8
printf "[ i ] Setting CPU architecture..\n"
export EVEREST_ARCH="x86"
printf "[ i ] Adding build variables to .bashrc...\n"
echo export EVEREST_HOST=\""${EVEREST_HOST}\"" >> ~/.bashrc
echo export EVEREST_TARGET=\""${EVEREST_TARGET}\"" >> ~/.bashrc
echo export EVEREST_ARCH=\""${EVEREST_ARCH}\"" >> ~/.bashrc
echo export EVEREST_CPU=\""${EVEREST_CPU}\"" >> ~/.bashrc
printf "[ i ] Creating sysroot directory...\n"
mkdir -p ${EVEREST}/cross-tools/${EVEREST_TARGET}
ln -sfv . ${EVEREST}/cross-tools/${EVEREST_TARGET}/usr
printf "[ i ] Moving tarballs to cross-tools directory...\n"
cd /home/everest/everest-install/scripts/tempfiles
mv -rv * $EVEREST/cross-tools
printf "[ i ] Preparing to build initial toolchain...\n"
cd $EVEREST/cross-tools
printf "[ i ] Starting build of >>> Linux-Headers-4.9.22 <<<\n"
sleep 3
tar -xvf linux-4.9.22.tar.xz
cd linux-4.9.22
make mrproper
make ARCH=${EVEREST_ARCH} headers_check
make ARCH=${EVEREST_ARCH} INSTALL_HDR_PATH=${EVEREST}/cross-tools/${EVEREST_TARGET} headers_install
cd ..
printf "[ i ] Starting build of >>> Binutils-2.27 <<<\n"
sleep 3
tar -xvf binutils-2.27.tar.bz2
cd binutils-2.27
mkdir -v ../binutils-build
cd ../binutils-build
../binutils-2.27/configure \
--prefix=${EVEREST}/cross-tools \
--target=${EVEREST_TARGET} \
--with-sysroot=${EVEREST}/cross-tools/${EVEREST_TARGET} \
--disable-nls \
--disable-multilib
make configure-host
make
make install
cd ../..
printf "[ i ] Finished build of >>> Binutils-2.27 <<<\n"
printf "[ i ] Starting build of >>> GCC-6.2.0 - Static <<<\n"
sleep 3
tar -xvf gcc-6.2.0.tar.bz2
cd gcc-6.2.0
tar xf ../mpfr-3.1.4.tar.bz2
mv -v mpfr-3.1.4 mpfr
tar xf ../gmp-6.1.1.tar.bz2
mv -v gmp-6.1.1 gmp
tar xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-6.2.0/configure \
--prefix=${EVEREST}/cross-tools \
--build=${EVEREST_HOST} \
--host=${EVEREST_HOST} \
--target=${EVEREST_TARGET} \
--with-sysroot=${EVEREST}/cross-tools/${EVEREST_TARGET} \
--disable-nls \
--disable-shared \
--without-headers \
--with-newlib \
--disable-decimal-float \
--disable-libgomp \
--disable-libmudflap \
--disable-libssp \
--disable-libatomic \
--disable-libquadmath \
--disable-threads \
--enable-languages=c \
--disable-multilib \
--with-mpfr-include=$(pwd)/../gcc-6.2.0/mpfr/src \
--with-mpfr-lib=$(pwd)/mpfr/src/.libs \
--with-arch=${EVEREST_CPU}
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
cd ..
rm -rf gcc-build
cd ..
printf "[ i ] Finished build of >>> GCC-6.2.0 - Static <<<\n"
printf "[ i ] Starting build of >>> musl-1.1.16 <<<\n"
sleep 3
tar -xvf musl-1.1.16.tar.gz
cd musl-1.1.16
./configure \
CROSS_COMPILE=${EVEREST_TARGET}- \
--prefix=/ \
--target=${EVEREST_TARGET}
make
DESTDIR=${EVEREST}/cross-tools/${EVEREST_TARGET} make install
cd ..
printf "[ i ] Finished build of >>> musl-1.1.16 <<<\n"
printf "[ i ] Starting build of >>> GCC-6.2.0 - Final <<<\n"
sleep 3
rm -rf gcc-6.2.0
tar -xvf gcc-6.2.0.tar.bz2
cd gcc-6.2.0
tar xf ../mpfr-3.1.4.tar.bz2
mv -v mpfr-3.1.4 mpfr
tar xf ../gmp-6.1.1.tar.bz2
mv -v gmp-6.1.1 gmp
tar xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc
mkdir -v ../gcc-build
cd ../gcc-build
../gcc-6.2.0/configure \
--prefix=${EVEREST}/cross-tools \
--build=${EVEREST_HOST} \
--host=${EVEREST_HOST} \
--target=${EVEREST_TARGET} \
--with-sysroot=${EVEREST}/cross-tools/${EVEREST_TARGET} \
--disable-nls \
--enable-languages=c,c++ \
--enable-c99 \
--enable-long-long \
--disable-libmudflap \
--disable-multilib \
--with-mpfr-include=$(pwd)/../gcc-6.2.0/mpfr/src \
--with-mpfr-lib=$(pwd)/mpfr/src/.libs \
--with-arch=${EVEREST_CPU}
make
make install
cd ..
printf "[ i ] Finished build of >> GCC-6.2.0 - Final <<<\n"
printf "[ i ] Toolchain has finished building.\n"
printf "[ i ] Setting toolchain variables...\n"
echo export CC=\""${EVEREST_TARGET}-gcc --sysroot=${EVEREST}/targetfs\"" >> ~/.bashrc
echo export CXX=\""${EVEREST_TARGET}-g++ --sysroot=${EVEREST}/targetfs\"" >> ~/.bashrc
echo export AR=\""${EVEREST_TARGET}-ar\"" >> ~/.bashrc
echo export AS=\""${EVEREST_TARGET}-as\"" >> ~/.bashrc
echo export LD=\""${EVEREST_TARGET}-ld --sysroot=${EVEREST}/targetfs\"" >> ~/.bashrc
echo export RANLIB=\""${EVEREST_TARGET}-ranlib\"" >> ~/.bashrc
echo export READELF=\""${EVEREST_TARGET}-readelf\"" >> ~/.bashrc
echo export STRIP=\""${EVEREST_TARGET}-strip\"" >> ~/.bashrc
source ~/.bashrc

View File

@ -0,0 +1,6 @@
{
"group_name": "everest-base-busybox-musl",
"group_version": "1.0.0-busybox",
"group-description": "The Everest Linux base system",
"incl_pkgs": "binutils 2.27", "busybox 1.24.2", "gcc 6.2.0", "gmp 6.1.1", "iana-etc 2.30", "linux 4.9.22", "linux-headers 4.9.22", "mpc 1.0.3", "mpfr 3.1.4", "musl 1.1.16"
}