From a89f6fe8d2c36b9bff372041a6d706d8450fe6f2 Mon Sep 17 00:00:00 2001 From: Liam Waldron Date: Wed, 5 Oct 2022 12:30:45 -0400 Subject: [PATCH] Update 'Building rootfs tarballs' --- Building-rootfs-tarballs.md | 85 ++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 10 deletions(-) diff --git a/Building-rootfs-tarballs.md b/Building-rootfs-tarballs.md index 82fdd5a..0d80d01 100644 --- a/Building-rootfs-tarballs.md +++ b/Building-rootfs-tarballs.md @@ -12,16 +12,16 @@ To do everything manually, do the following: 3 - Create an environment variable for ease of use - `$ export EVEREST=/mnt/everest # replace /mnt/everest with the path to your workspace` + $ export EVEREST=/mnt/everest # replace /mnt/everest with the path to your workspace 4 - Change permissions of the workspace - `# chmod 777 ${EVEREST}` + # chmod 777 ${EVEREST} 5 - Create a sources directory to store packages - `$ mkdir -v ${EVEREST}/sources` + $ mkdir -v ${EVEREST}/sources -6 - Download the latest versions of the following programs: +6 - Reference for programs in use - binutils - busybox - everest-bootscripts @@ -33,20 +33,85 @@ To do everything manually, do the following: - mpfr - musl +Syntax may differ between versions. The following versions were used for this guide: + - binutils 2.33.1 + - busybox 1.24.2 + - everest-bootscripts git + - gcc 9.4.0 + - gmp 6.1.2 + - iana-etc 2.30 + - linux 4.19.88 + - mpc 1.1.0 + - mpfr 4.0.2 + - musl 1.2.3 + 7 - Download the following patch for iana-etc: http://patches.clfs.org/embedded-dev/iana-etc-2.30-update-2.patch 8 - Ensure the EVEREST environment variable is set up properly - `$ echo ${EVEREST}` + $ echo ${EVEREST} 9 - Create the build user - `# groupadd everest` - `# useradd -s /bin/bash -g everest -m -k /dev/null everest` - `# passwd everest` - `# chown -Rv everest ${EVEREST}` + # groupadd everest + # useradd -s /bin/bash -g everest -m -k /dev/null everest + # passwd everest + # chown -Rv everest ${EVEREST} 10 - Login as the new user - `su - everest` + $ su - everest + +11 - Create a new bash profile + + $ cat > ~/.bash_profile << "EOF" + exec env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' /bin/bash + EOF +12 - Create a new bashrc + + $ 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 + +13 - Source the new bash profile + + $ source ~/.bash_profile + +14 - Disable CFLAGS, which will cause problems with cross-compilation tools. + + $ unset CFLAGS + $ echo unset CFLAGS >> ~/.bashrc + +15 - Set host, target, CPU type, and architecture. This guide assumes you are building for a k8 cpu and x86 target. + + $ export EVEREST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/") + $ export EVEREST_TARGET="x86_64-linux-musl" + $ export EVEREST_CPU="k8" + $ export EVEREST_ARCH="x86" + +16 - Add the following variables to the build user's ~/.bashrc + + $ 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 + +17 - Create the cross tools directory + + $ mkdir -p ${EVEREST}/cross-tools/${EVEREST_TARGET} + +18 - Build the cross-toolchain + $ cd ${EVEREST}/sources + $ git clone https://git.everestlinux.org/EverestLinux/musl-cross-make + $ cd musl-cross-make + $ make + $ make install + *Note: to speed up this process, prefix both make commands with -jX, replacing X with your CPU's cores + threads* + +19 - Install \ No newline at end of file