Build script fixes
This commit is contained in:
parent
40d670386a
commit
d63195f775
@ -20,8 +20,9 @@ such as QEMU or Virtualbox, bare-metal not tested.
|
|||||||
- grub2 (if under GNU/Linux)
|
- grub2 (if under GNU/Linux)
|
||||||
- xorriso
|
- xorriso
|
||||||
- make
|
- make
|
||||||
- tar (for compiling the toolchain)
|
- tar
|
||||||
- wget/curl (for compiling the toolchain)
|
### Dependencies for compiling toolchain
|
||||||
|
- wget/curl
|
||||||
|
|
||||||
If it is your first time building, you need to compile the toolchain first.
|
If it is your first time building, you need to compile the toolchain first.
|
||||||
For that, you just need to run build-toolchain.sh, which will download binutils,
|
For that, you just need to run build-toolchain.sh, which will download binutils,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#export PREFIX="$HOME/opt/cross-i686"
|
set -e
|
||||||
|
|
||||||
echo "Welcome to rockOS toolchain compilation script, where would you like to install your toolchain?"
|
echo "Welcome to rockOS toolchain compilation script, where would you like to install your toolchain?"
|
||||||
echo "Leave blank for $HOME/opt/cross-i686"
|
echo "Leave blank for $HOME/opt/cross-i686"
|
||||||
@ -14,7 +14,6 @@ echo "This is the location you chose: $PREFIX"
|
|||||||
echo "Press Enter to continue"
|
echo "Press Enter to continue"
|
||||||
read continue
|
read continue
|
||||||
|
|
||||||
mkdir -p "$PREFIX"
|
|
||||||
export TARGET=i686-elf
|
export TARGET=i686-elf
|
||||||
export PATH="$PREFIX/bin:$PATH"
|
export PATH="$PREFIX/bin:$PATH"
|
||||||
|
|
||||||
@ -22,6 +21,13 @@ export BINUTILS_LINK=https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz
|
|||||||
export GCC_LINK=https://ftp.gnu.org/gnu/gcc/gcc-12.1.0/gcc-12.1.0.tar.gz
|
export GCC_LINK=https://ftp.gnu.org/gnu/gcc/gcc-12.1.0/gcc-12.1.0.tar.gz
|
||||||
export GRUB_LINK=https://ftp.gnu.org/gnu/grub/grub-2.06.tar.gz
|
export GRUB_LINK=https://ftp.gnu.org/gnu/grub/grub-2.06.tar.gz
|
||||||
|
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
export NPROC="sysctl -n hw.physicalcpu"
|
||||||
|
else
|
||||||
|
export NPROC="nproc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if command -V wget >/dev/null 2>&1; then
|
if command -V wget >/dev/null 2>&1; then
|
||||||
export DL_CMD="wget"
|
export DL_CMD="wget"
|
||||||
export DL_OUTPUT="-O"
|
export DL_OUTPUT="-O"
|
||||||
@ -35,43 +41,48 @@ fi
|
|||||||
|
|
||||||
mkdir -p "$PREFIX"
|
mkdir -p "$PREFIX"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
rm -rf rockos-toolchain-src
|
||||||
mkdir rockos-toolchain-src
|
mkdir rockos-toolchain-src
|
||||||
cd rockos-toolchain-src
|
cd rockos-toolchain-src
|
||||||
"${DL_CMD}" $DL_OUTPUT binutils.tar.gz $BINUTILS_LINK
|
$(echo $DL_CMD) $DL_OUTPUT binutils.tar.gz $BINUTILS_LINK
|
||||||
mkdir binutils-src
|
mkdir binutils-src
|
||||||
tar -xvf binutils.tar.gz -C ./binutils-src/
|
tar -xvf binutils.tar.gz -C ./binutils-src/
|
||||||
mkdir build-binutils
|
mkdir build-binutils
|
||||||
cd build-binutils
|
cd build-binutils
|
||||||
../binutils-src/*/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
../binutils-src/*/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
|
||||||
make -j$(nproc)
|
make -j$($NPROC)
|
||||||
make install
|
make install
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
"${$DL_CMD}" $DL_OUTPUT gcc.tar.gz $GCC_LINK
|
|
||||||
|
$(echo $DL_CMD) $DL_OUTPUT gcc.tar.gz $GCC_LINK
|
||||||
mkdir gcc-src
|
mkdir gcc-src
|
||||||
tar -xvf gcc.tar.gz -C ./gcc-src/
|
tar -xvf gcc.tar.gz -C ./gcc-src/
|
||||||
|
cd gcc-src/*/
|
||||||
|
./contrib/download_prerequisites
|
||||||
|
cd ../../
|
||||||
mkdir build-gcc
|
mkdir build-gcc
|
||||||
cd build-gcc
|
cd build-gcc
|
||||||
../gcc-src/*/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
|
../gcc-src/*/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
|
||||||
make -j$(nproc) all-gcc
|
make -j$($NPROC) all-gcc
|
||||||
make -j$(nproc) all-target-libgcc
|
make -j$($NPROC) all-target-libgcc
|
||||||
make install-gcc
|
make install-gcc
|
||||||
make install-target-libgcc
|
make install-target-libgcc
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
if [ "$(uname)" == "Darwin" ]; then
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
"${DL_CMD}" $DL_OUTPUT grub.tar.gz $GRUB_LINK
|
$(echo $DL_CMD) $DL_OUTPUT grub.tar.gz $GRUB_LINK
|
||||||
mkdir grub-src
|
mkdir grub-src
|
||||||
tar -xvf grub.tar.gz -C ./grub-src/
|
tar -xvf grub.tar.gz -C ./grub-src/
|
||||||
mkdir build-grub
|
mkdir build-grub
|
||||||
cd build-grub
|
cd build-grub
|
||||||
../grub-src/*/configure --target=$TARGET --prefix="$PREFIX" TARGET_CC=$TARGET-gcc TARGET_OBJCOPY=$TARGET-objcopy TARGET_STRIP=$TARGET-strip TARGET_NM=$TARGET-nm TARGET_RANLIB=$TARGET-ranlib --disable-nls --disable-werror
|
../grub-src/*/configure --target=$TARGET --prefix="$PREFIX" TARGET_CC=$TARGET-gcc TARGET_OBJCOPY=$TARGET-objcopy TARGET_STRIP=$TARGET-strip TARGET_NM=$TARGET-nm TARGET_RANLIB=$TARGET-ranlib --disable-nls --disable-werror
|
||||||
make -j$(nproc)
|
make -j$($NPROC)
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -r rockos-toolchain-src
|
rm -rf /tmp/rockos-toolchain-src
|
||||||
cd
|
cd
|
||||||
|
|
||||||
echo "Toolchain installation is complete!"
|
echo "Toolchain installation is complete!"
|
||||||
|
Reference in New Issue
Block a user