259 lines
8.1 KiB
Bash
Executable File
259 lines
8.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Everest Linux 1.0.0-busybox - Stage 3 Installation Script
|
|
# This program is free software: See the GNU GPL v3.0 for details.
|
|
|
|
printf "[ i ] NOTICE - This script can either be run as the 'everest' user (assuming they own /mnt/everest), or as root.\n"
|
|
sleep 5
|
|
|
|
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/sources
|
|
|
|
printf "[ i ] Preparing to build initial toolchain...\n"
|
|
cd $EVEREST/sources
|
|
|
|
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
|
|
|
|
printf "[ i ] Starting build of system...\n"
|
|
sleep 3
|
|
|
|
printf "[ i ] Creating system directories...\n"
|
|
mkdir -pv ${EVEREST}/targetfs/{bin,boot,dev,etc,home,lib/{firmware,modules}}
|
|
mkdir -pv ${EVEREST}/targetfs/{mnt,opt,proc,sbin,srv,sys}
|
|
mkdir -pv ${EVEREST}/targetfs/var/{cache,lib,local,lock,log,opt,run,spool}
|
|
install -dv -m 0750 ${EVEREST}/targetfs/root
|
|
install -dv -m 1777 ${EVEREST}/targetfs/{var/,}tmp
|
|
mkdir -pv ${EVEREST}/targetfs/usr/{,local/}{bin,include,lib,sbin,share,src}
|
|
ln -svf ../proc/mounts ${EVEREST}/targetfs/etc/mtab
|
|
cat > ${EVEREST}/targetfs/etc/passwd << "EOF"
|
|
root::0:0:root:/root:/bin/ash
|
|
EOF
|
|
cat > ${CLFS}/targetfs/etc/group << "EOF"
|
|
root:x:0:
|
|
bin:x:1:
|
|
sys:x:2:
|
|
kmem:x:3:
|
|
tty:x:4:
|
|
tape:x:5:
|
|
daemon:x:6:
|
|
floppy:x:7:
|
|
disk:x:8:
|
|
lp:x:9:
|
|
dialout:x:10:
|
|
audio:x:11:
|
|
video:x:12:
|
|
utmp:x:13:
|
|
usb:x:14:
|
|
cdrom:x:15:
|
|
EOF
|
|
touch ${EVEREST}/targetfs/var/log/lastlog
|
|
chmod -v 664 ${EVEREST}/targetfs/var/log/lastlog
|
|
|
|
printf "[ i ] Starting build of >>> libgcc-6.2.0 <<<\n"
|
|
cp -v ${EVEREST}/cross-tools/${EVEREST_TARGET}/lib/libgcc_s.so.1 ${EVEREST}/targetfs/lib/
|
|
${EVEREST_TARGET}-strip ${EVEREST}/targetfs/lib/libgcc_s.so.1
|
|
printf "[ i ] Finished build of >>> libgcc-6.2.0 <<<\n"
|
|
sleep 1
|
|
|
|
printf "[ i ] Starting build of >>> musl-1.1.16 <<<\n"
|
|
rm -rf musl-1.1.16
|
|
tar -xvf musl-1.1.16.tar.gz
|
|
cd musl-1.1.16
|
|
./configure \
|
|
CROSS_COMPILE=${EVEREST_TARGET}- \
|
|
--prefix=/ \
|
|
--disable-static \
|
|
--target=${EVEREST_TARGET}
|
|
make
|
|
DESTDIR=${EVEREST}/targetfs make install-libs
|
|
cd ..
|
|
printf "[ i ] Finished build of >>> musl-1.1.16 <<<\n"
|
|
sleep 1
|
|
|
|
printf "[ i ] Starting build of >>> busybox-1.24.2 <<<\n"
|
|
tar -xvf busybox-1.24.2.tar.bz2
|
|
cd busybox-1.24.2
|
|
make distclean
|
|
make ARCH="${EVEREST_ARCH}" defconfig
|
|
sed -i 's/\(CONFIG_\)\(.*\)\(INETD\)\(.*\)=y/# \1\2\3\4 is not set/g' .config
|
|
sed -i 's/\(CONFIG_IFPLUGD\)=y/# \1 is not set/' .config
|
|
sed -i 's/\(CONFIG_FEATURE_WTMP\)=y/# \1 is not set/' .config
|
|
sed -i 's/\(CONFIG_FEATURE_UTMP\)=y/# \1 is not set/' .config
|
|
sed -i 's/\(CONFIG_UDPSVD\)=y/# \1 is not set/' .config
|
|
sed -i 's/\(CONFIG_TCPSVD\)=y/# \1 is not set/' .config
|
|
make ARCH="${EVEREST_ARCH}" CROSS_COMPILE="${EVEREST_TARGET}-"
|
|
make ARCH="${EVEREST_ARCH}" CROSS_COMPILE="${EVEREST_TARGET}-"\
|
|
CONFIG_PREFIX="${EVEREST}/targetfs" install
|
|
cp -v examples/depmod.pl ${EVEREST}/cross-tools/bin
|
|
chmod -v 755 ${EVEREST}/cross-tools/bin/depmod.pl
|
|
cd ..
|
|
printf "[ i ] Finished build of >>> busybox-1.24.2 <<<\n"
|
|
sleep 1
|
|
|
|
printf "[ i ] Starting build of >>> iana-etc-2.30 <<<\n"
|
|
tar -xvf iana-etc-2.30.tar.bz2
|
|
cd iana-etc-2.30
|
|
patch -Np1 -i ../iana-etc-2.30-update-2.patch
|
|
make get
|
|
make STRIP=yes
|
|
make DESTFIR=${EVEREST}/targetfs install
|
|
printf "[ i ] Finished build of >>> iana-etc-2.30 <<<\n"
|
|
sleep 1
|
|
|
|
printf "[ i ] Finished building system software\n"
|
|
sleep 1
|
|
|
|
printf "[ i ] Creating /etc/fstab...\n"
|
|
cat > ${EVEREST}/targetfs/etc/fstab << "EOF"
|
|
# file-system mount-point type options dump fsck
|
|
EOF
|
|
|
|
printf "[ i ] Building the Linux kernel...\n"
|
|
rm -rf linux-4.9.22
|
|
tar -xvf linux-4.9.22.tar.xz
|
|
cd linux-4.9.22
|
|
make mrproper
|
|
printf "[ !!! ] WARNING!!! KERNEL INSTALLATION WILL COMMENCE ONCE MENUCONFIG IS EXITED BY THE USER!!!\n"
|
|
wait 5
|
|
make ARCH=${EVEREST_ARCH} CROSS_COMPILE=${EVEREST_TARGET}- menuconfig
|
|
make ARCH=${EVEREST_ARCH} CROSS_COMPILE=${EVEREST_TARGET}-
|
|
make ARCH=${EVEREST_ARCH} CROSS_COMPILE=${EVEREST_TARGET}- \
|
|
INSTALL_MOD_PATH=${EVEREST}/targetfs modules_install
|
|
printf "[ i ] Finished build of the Linux kernel...\n"
|
|
|
|
printf "[ i ] NOTE: Bootloader will need to be installed manually by the user (unless utilizing the bootloader of another system)\n"
|
|
wait 3
|
|
|
|
printf "[ i ] Bootstrapping Glacier package management system...\n"
|
|
|
|
|