9 TOOLCHAIN_INSTALL
=/usr
/local
10 TOOLCHAIN_BIN
=${TOOLCHAIN_INSTALL}/bin
11 CROSS_SYSROOT
=${TOOLCHAIN_INSTALL}/$TARGET/sys-root
13 export PATH
=${TOOLCHAIN_BIN}:$PATH
16 # Grab all of the source for the toolchain bootstrap.
19 wget https
://ftp.gnu.org
/gnu
/binutils
/binutils-2.37.
tar.xz
20 wget https
://ftp.gnu.org
/gnu
/gcc
/gcc-11.2
.0/gcc-11.2
.0.
tar.xz
21 wget https
://ftp.gnu.org
/gnu
/glibc
/glibc-2.34.
tar.xz
22 wget https
://cdn.kernel.org
/pub
/linux
/kernel
/v5.x
/linux-5.10
.70.
tar.xz
24 tar axf binutils-2.37.
tar.xz
25 tar axf gcc-11.2
.0.
tar.xz
26 tar axf glibc-2.34.
tar.xz
27 tar axf linux-5.10
.70.
tar.xz
29 mv binutils-2.37 src-binu
31 mv glibc-2.34 src-glibc
32 mv linux-5.10
.70 src-linux
34 mkdir
-p bld-hdr bld-binu bld-gcc bld-glibc
35 mkdir
-p ${CROSS_SYSROOT}/usr
/include
38 # Install kernel and glibc headers
42 make headers_install ARCH
=${LINUX_ARCH} INSTALL_HDR_PATH
=${CROSS_SYSROOT}/usr
46 ..
/src-glibc
/configure
--prefix=/usr
--host=${TARGET}
47 make install-headers DESTDIR
=${CROSS_SYSROOT}
48 touch ${CROSS_SYSROOT}/usr
/include
/gnu
/stubs.h
56 ..
/src-binu
/configure
--disable-werror \
57 --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET}
63 # Build gcc, without shared libraries, because we do not yet
64 # have a shared libc against which to link.
68 ..
/src-gcc
/configure
--disable-werror --disable-shared \
69 --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET} \
70 --enable-languages=c
--disable-libssp --disable-libsanitizer \
71 --disable-libatomic --disable-libgomp --disable-libquadmath
78 # There are a few random things that use c++ but we didn't build that
79 # cross-compiler. We can get away without them. Disable CXX so that
80 # glibc doesn't try to use the host c++ compiler.
84 CXX
=false ..
/src-glibc
/configure
--prefix=/usr
--host=${TARGET}
86 make install DESTDIR
=${CROSS_SYSROOT}