ABOUT THIS GUIDE ================ This is a guide to building a custom BusyBox/Linux-libre system with the GNU toolchain. It mostly follows Linux From Scratch version 7.0, except that it uses more recent versions of some software packages, avoids applying patches where possible, builds cross-compiling GCC and other toolchain components in a "sysroot" configuration, and uses a BusyBox-based userspace rather than a GNU-based one. This guide assumes the use of a GNU/Linux host system with all the necessary development software (GCC, GNU Binutils, Subversion, etc.) already installed. It is recommended that you read Linux From Scratch version 7.0 to understand the full build process and the rationale behind various elements of the setup. PROCEDURE ========= Make a directory in which all work will be done. Under this directory, make directories 'src' and sys'. Download all of the necessary source archives and branches. src$ wget http://www.busybox.net/downloads/busybox-1.19.3.tar.bz2 src$ wget http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/\ > LATEST-3.1.N/linux-3.1.6-libre.tar.bz2 src$ svn co svn://svn.eglibc.org/branches/eglibc-2_14 eglibc-2.14 src$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.bz2 src$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2 src$ wget http://ftp.gnu.org/gnu/make/make-3.82.tar.bz2 src$ wget http://ftp.gnu.org/gnu/automake/automake-1.11.2.tar.bz2 src$ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2 src$ wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.bz2 src$ wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2 src$ wget http://www.mpfr.org/mpfr-current/mpfr-3.1.0.tar.bz2 src$ wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz src$ for file in *.tar.bz2; do tar -xjf ${file}; done src$ for file in *.tar.gz; do tar -xzf ${file}; done Make and mount the filesystem. sys$ dd if=/dev/zero of=fs bs=1024 count=$((3*1024*1024)) sys$ sudo mkfs -t ext4 fs sys$ mkdir fsmnt sys$ sudo mount -o loop fs fsmnt Set up the toolchain environment. Be sure to change '' to the absolute path to the base work directory you made earlier. We're using GNU Bash as the new user's default shell for convenience; this has no effect on the target system. sys$ sudo mkdir -v fsmnt/tools fsmnt/tools/usr fsmnt/src sys$ sudo ln -sv "${PWD}/fsmnt/tools" /tools sys$ sudo cp -pR ../src/*/ fsmnt/src/ sys$ sudo groupadd bbll sys$ sudo useradd -s /bin/bash -g bbll -m -k /dev/null bbll sys$ sudo passwd bbll sys$ sudo chown -R bbll:bbll fsmnt/tools fsmnt/src sys$ su - bbll $ cat > ~/.bash_profile < exec env -i HOME="${HOME}" TERM="${TERM}" PS1='\u:\w$ ' /bin/bash > EOF $ cat > ~/.bashrc < set +h > umask 022 > BBLL=/sys/fsmnt > LC_ALL=C > BBLL_TARGET=$(uname -m)-bbll-linux-gnu > PATH=/tools/bin:/tools/usr/bin:/bin:/usr/bin > export BBLL LC_ALL BBLL_TARGET PATH > EOF $ source ~/.bash_profile Configure and build a cross-compiling GNU Binutils. $ cd "${BBLL}/src" $ mkdir binutils-build $ cd binutils-build $ ../binutils-2.22/configure --target=${BBLL_TARGET} --prefix=/tools/usr \ > --disable-nls --disable-werror $ make -j 4 $ case $(uname -m) in > x86_64) > mkdir -v /tools/lib > ln -sv lib /tools/usr/lib64 > ;; > esac $ make install Configure and build a cross-compiling GCC. $ cd .. $ mv gmp-5.0.2/ gcc-4.6.2/gmp $ mv mpfr-3.1.0/ gcc-4.6.2/mpfr $ mv mpc-0.9/ gcc-4.6.2/mpc $ mkdir gcc-build $ cd gcc-build $ ../gcc-4.6.2/configure --target=${BBLL_TARGET} --prefix=/tools/usr \ > --disable-nls --disable-shared --disable-multilib --disable-decimal-float \ > --disable-threads --disable-libmudflap --disable-libssp --disable-libgomp \ > --disable-libquadmath --enable-languages=c --without-ppl --without-cloog \ > --with-mpfr-include=$(pwd)/../gcc-4.6.2/mpfr/src \ > --with-mpfr-lib=$(pwd)/mpfr/src/.libs $ make -j 4 $ make install $ ln -sv libgcc.a $(${BBLL_TARGET}-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/') Install Linux's headers for use by EGLIBC. $ cd ../linux-3.1.6 $ make mrproper $ make headers_check $ make INSTALL_HDR_PATH=/tools/usr headers_install Configure and build a cross-compiling EGLIBC. ...