qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

build-toolchain.sh (1880B)


      1 #!/bin/bash
      2 
      3 set -e
      4 
      5 TARGET=microblaze-linux-musl
      6 LINUX_ARCH=microblaze
      7 
      8 J=$(expr $(nproc) / 2)
      9 TOOLCHAIN_INSTALL=/usr/local
     10 TOOLCHAIN_BIN=${TOOLCHAIN_INSTALL}/bin
     11 CROSS_SYSROOT=${TOOLCHAIN_INSTALL}/$TARGET/sys-root
     12 
     13 export PATH=${TOOLCHAIN_BIN}:$PATH
     14 
     15 #
     16 # Grab all of the source for the toolchain bootstrap.
     17 #
     18 
     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://www.musl-libc.org/releases/musl-1.2.2.tar.gz
     22 wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.70.tar.xz
     23 
     24 tar axf binutils-2.37.tar.xz
     25 tar axf gcc-11.2.0.tar.xz
     26 tar axf musl-1.2.2.tar.gz
     27 tar axf linux-5.10.70.tar.xz
     28 
     29 mv binutils-2.37 src-binu
     30 mv gcc-11.2.0 src-gcc
     31 mv musl-1.2.2 src-musl
     32 mv linux-5.10.70 src-linux
     33 
     34 mkdir -p bld-hdr bld-binu bld-gcc bld-musl
     35 mkdir -p ${CROSS_SYSROOT}/usr/include
     36 
     37 #
     38 # Install kernel headers
     39 #
     40 
     41 cd src-linux
     42 make headers_install ARCH=${LINUX_ARCH} INSTALL_HDR_PATH=${CROSS_SYSROOT}/usr
     43 cd ..
     44 
     45 #
     46 # Build binutils
     47 #
     48 
     49 cd bld-binu
     50 ../src-binu/configure --disable-werror \
     51   --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET}
     52 make -j${J}
     53 make install
     54 cd ..
     55 
     56 #
     57 # Build gcc, just the compiler so far.
     58 #
     59 
     60 cd bld-gcc
     61 ../src-gcc/configure --disable-werror --disable-shared \
     62   --prefix=${TOOLCHAIN_INSTALL} --with-sysroot --target=${TARGET} \
     63   --enable-languages=c --disable-libssp --disable-libsanitizer \
     64   --disable-libatomic --disable-libgomp --disable-libquadmath
     65 make -j${J} all-gcc
     66 make install-gcc
     67 cd ..
     68 
     69 #
     70 # Build musl.
     71 # We won't go through the extra step of building shared libraries
     72 # because we don't actually use them in QEMU docker testing.
     73 #
     74 
     75 cd bld-musl
     76 ../src-musl/configure --prefix=/usr --host=${TARGET} --disable-shared
     77 make -j${j}
     78 make install DESTDIR=${CROSS_SYSROOT}
     79 cd ..
     80 
     81 #
     82 # Go back and build the compiler runtime
     83 #
     84 
     85 cd bld-gcc
     86 make -j${j}
     87 make install
     88 cd ..