summaryrefslogtreecommitdiffstats
path: root/temporary-bootstrap-builder-setup.txt
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-02 01:16:56 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-02 01:23:06 (EST)
commit2c6af80b625bb840a06fcbc602f052d4eca44299 (patch)
tree05221ae9cd25c0d0b6bdefdeb4b04c9d5a7e6f29 /temporary-bootstrap-builder-setup.txt
parenta8b3e9de6b95c069116b21c452479d822af9c9d9 (diff)
Add nice new procedure for making a TBB system.
NB: This new procedure is largely untested at the moment.
Diffstat (limited to 'temporary-bootstrap-builder-setup.txt')
-rw-r--r--temporary-bootstrap-builder-setup.txt211
1 files changed, 211 insertions, 0 deletions
diff --git a/temporary-bootstrap-builder-setup.txt b/temporary-bootstrap-builder-setup.txt
new file mode 100644
index 0000000..fda7a76
--- /dev/null
+++ b/temporary-bootstrap-builder-setup.txt
@@ -0,0 +1,211 @@
+ABOUT THIS GUIDE
+================
+
+This is a guide to building a custom BusyBox/Linux-libre system with the GNU
+toolchain. It mostly follows Cross Linux From Scratch version
+SVN-0.0.1-20090726-x86, except that it uses more recent versions of software
+packages 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 Cross Linux From Scratch version
+SVN-0.0.1-20090726-x86 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':
+ $ mkdir src sys
+
+Download all of the necessary source archives and branches.
+ $ cd src
+ $ wget http://www.busybox.net/downloads/busybox-1.19.3.tar.bz2
+ $ wget http://www.fsfla.org/svnwiki/selibre/linux-libre/download/releases/\
+ > LATEST-3.1.N/linux-3.1.6-libre.tar.bz2
+ $ svn co svn://svn.eglibc.org/branches/eglibc-2_14 eglibc-2.14
+ $ wget http://ftp.gnu.org/gnu/gcc/gcc-4.6.2/gcc-4.6.2.tar.bz2
+ $ wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.bz2
+ $ wget http://ftp.gnu.org/gnu/make/make-3.82.tar.bz2
+ $ wget http://ftp.gnu.org/gnu/automake/automake-1.11.2.tar.bz2
+ $ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2
+ $ wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.bz2
+ $ wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2
+ $ wget http://www.mpfr.org/mpfr-current/mpfr-3.1.0.tar.bz2
+ $ wget http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz
+ $ for file in *.tar.bz2; do tar -xjf ${file}; done
+ $ for file in *.tar.gz; do tar -xzf ${file}; done
+ $ cd ..
+
+Make and mount the filesystem. mkfs and mount must be run as the superuser, but
+dd shouldn't need to be.
+ $ cd sys
+ $ dd if=/dev/zero of=fs bs=1024 count=$((3*1024*1024))
+ # mkfs -t ext4 fs
+ $ mkdir fsmnt
+ # mount -o loop fs fsmnt
+
+Set up a new user.
+ # groupadd bbl
+ # useradd -s /bin/bash -g bbl -d /home/bbl bbl
+ # mkdir -pv /home/bbl
+ # chown -v bbl:bbl /home/bbl
+ # passwd bbl
+ # chown -Rv fsmnt
+
+Set up the toolchain work environment. Be sure to change '<BASE_DIR>' to the
+absolute path to the base work directory you made earlier, and adjust the
+configuration name in BBL_TARGET if you're building for a different
+architecture. We're using GNU Bash as the new user's default shell for
+convenience; this has no effect on the target system.
+ $ su - bbl
+ $ cat > ~/.bash_profile <<EOF
+ > exec env -i HOME="${HOME}" TERM="${TERM}" /bin/bash
+ > EOF
+ $ cat > ~/.bashrc <<EOF
+ > set +h
+ > umask 022
+ > BBL=<BASE_DIR>/sys/fsmnt
+ > LC_ALL=C
+ > PATH=${BBL}/cross-tools/bin:/bin:/usr/bin
+ > export BBL LC_ALL PATH
+ > PS1='$ '
+ > unset CFLAGS
+ > unset CXXFLAGS
+ > export BBL_HOST=$(echo ${MACHTYPE} | \
+ > sed "s/$(echo ${MACHTYPE} | cut -d - -f 2)/cross/")
+ > export BBL_TARGET=x86_64-pc-linux-gnu
+ > EOF
+ $ source ~/.bash_profile
+
+Make system directories. These commands should give you a system that is
+compliant with Filesystem Hierarchy Standard version 2.3. Note that the range
+syntax in many of these command lines is a non-standard feature of GNU Bash;
+this may not work on other shells.
+ $ mkdir -pv ${BBL}/bin
+ $ mkdir -pv ${BBL}/boot
+ $ mkdir -pv ${BBL}/dev
+ $ mkdir -pv ${BBL}/etc{,/opt}
+ $ mkdir -pv ${BBL}/home
+ $ mkdir -pv ${BBL}/lib
+ $ mkdir -pv ${BBL}/mnt
+ $ mkdir -pv ${BBL}/opt
+ $ mkdir -pv ${BBL}/proc
+ $ install -dv -m 0750 ${BBL}/root
+ $ mkdir -pv ${BBL}/sbin
+ $ mkdir -pv ${BBL}/srv
+ $ mkdir -pv ${BBL}/sys
+ $ install -dv -m 1777 ${BBL}{,/var}/tmp
+ $ mkdir -pv ${BBL}/usr/{,local/}{bin,include,lib,sbin,share/{man,misc},src}
+ $ mkdir -pv ${BBL}/usr/local/{etc,games}
+ $ mkdir -pv ${BBL}/usr/{,local/}share/{doc,info,locale,terminfo,zoneinfo}
+ $ mkdir -pv ${BBL}/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
+ $ ln -sv share/man ${BBL}/usr/local/man
+ $ mkdir -pv ${BBL}/var/{cache,lib/misc,local,lock,log,mail,opt,run,spool}
+
+Write the passwd and group files.
+ $ cat > ${BBL}/etc/passwd <<EOF
+ > root::0:0:root:/root:/bin/bash
+ > EOF
+ $ cat > ${BBL}/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
+
+If CONFIG_FEATURE_UTMP and/or CONFIG_FEATURE_WTMP are enabled in BusyBox,
+certain BusyBox applets (getty, login, init, etc.) will log user logins to
+/var/run/utmp and/or /var/run/wtmp. However, BusyBox's supporting library won't
+create /var/run/wtmp if it doesn't exist. So create these files now and set
+proper modes for them.
+ $ touch ${BBL}/var/run/{u,w}tmp
+ $ chmod -v 664 ${BBL}/var/run/{u,w}tmp
+/var/run/utmp is used to track logged-in users. /var/run/wtmp is used to record
+when users log into and out of the system. NB: This is an odd location for
+wtmp, but that's where an unpatched BusyBox will expect it.
+
+Make and change to a directory for package source code.
+ $ mkdir -v ${BBL}/src
+ $ cd ${BBL}/src
+
+Install Linux's headers for use by EGLIBC.
+ $ cp -pR ${BBL}/../../src/linux-3.1.6 .
+ $ cd linux-3.1.6
+ $ make mrproper
+ $ make headers_check
+ $ make INSTALL_HDR_PATH=${BBL}/usr headers_install
+ $ find ${BBL}/usr/include/ -name .install -o -name ..install.cmd | \
+ > xargs rm -fv
+ $ cd ..
+ $ rm -Rf linux-3.1.6
+
+Install GMP for use by the cross-compiling GCC build.
+ $ cp -pR ${BBL}/../../src/gmp-5.0.2 .
+ $ cd gmp-5.0.2
+ $ CPPFLAGS=-fexceptions ./configure --prefix=${BBL}/cross-tools --enable-cxx
+ $ make
+ $ make install
+ $ cd ..
+ $ rm -Rf gmp-5.0.2
+
+Install MPFR for use by the cross-compiling GCC build.
+ $ cp -pR ${BBL}/../../src/mpfr-3.1.0 .
+ $ cd mpfr-3.1.0
+ $ LDFLAGS="-Wl,-rpath,${BBL}/cross-tools/lib" ./configure \
+ > --prefix=${BBL}/cross-tools --enable-shared --with-gmp=${BBL}/cross-tools
+ $ make
+ $ make install
+ $ cd ..
+ $ rm -Rf mpfr-3.1.0
+
+Install PPL for use by the cross-compiling GCC build.
+ $ cp -pR ${BBL}/../../src/ppl-FIXME .
+ $ cd ppl-FIXME
+ $ LDFLAGS="-Wl,-rpath,${BBL}/cross-tools/lib" ./configure \
+ > --prefix=${BBL}/cross-tools --enable-shared --enable-interfaces="c,cxx" \
+ > --disable-optimization --with-libgmp-prefix=${BBL}/cross-tools \
+ > --with-libgmpxx-prefix=${BBL}/cross-tools
+ $ make
+ $ make install
+ $ cd ..
+ $ rm -Rf ppl-FIXME
+
+Install CLooG-PPL for use by the cross-compiling GCC build.
+ $ cp -pR ${BBL}/../../src/FIXME .
+ $ cd FIXME
+ $ LDFLAGS="-Wl,-rpath,${BBL}/cross-tools/lib" ./configure \
+ > --prefix=${BBL}/cross-tools --enable-shared --with-bits=gmp \
+ > --with-gmp=${BBL}/cross-tools --with-ppl=${BBL}/cross-tools
+ $ make
+ $ make install
+ $ cd ..
+ $ rm -Rf FIXME
+
+Configure and build a cross-compiling GNU Binutils.
+ $ cp -pR ${BBL}/../../src/binutils-2.22 .
+ $ mkdir binutils-build
+ $ cd binutils-build
+ $ AR=ar AS=as ../binutils-2.22/configure --prefix=${BBL}/cross-tools \
+ > --host=${BBL_HOST} --target=${BBL_TARGET} --with-sysroot=${BBL} \
+ > --disable-nls --enable-shared --disable-multilib
+ $ make configure-host
+ $ make
+ $ make install
+ $ cp -v ../binutils-2.22/include/libiberty.h ${BBL}/usr/include
+ $ cd ..
+ $ rm -Rf binutils-2.22 binutils-build