Created
July 1, 2017 02:59
-
-
Save nekketsuuu/620c3f3f2e508b4f3925d46c102a89c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vagrant 上の ubuntu/xenial64 (20170626.0.0) に AArch64 用のコンパイラをビルドする | |
# 2017/07/01 | |
# Ansible 環境が無かったので手でインストール | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install g++ bison flex texinfo | |
sudo apt install make | |
# 確認 | |
# ubuntu@ubuntu-xenial:~$ uname -a | |
# Linux ubuntu-xenial 4.4.0-83-generic #106-Ubuntu SMP Mon Jun 26 17:54:43 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux | |
# ubuntu@ubuntu-xenial:~$ lsb_release -a | |
# No LSB modules are available. | |
# Distributor ID: Ubuntu | |
# Description: Ubuntu 16.04.2 LTS | |
# Release: 16.04 | |
# Codename: xenial | |
# バージョン等の設定 | |
export BINUTILS_VERSION=binutils-2.25 | |
export GCC_VERSION=gcc-5.2.0 | |
export LINUX_KERNEL_VERSION=linux-3.16 | |
export GLIBC_VERSION=glibc-2.22 | |
export PREFIX=/opt/cross | |
export PARALLEL_MAKE=-j2 | |
export CONFIGURATION_OPTIONS="--disable-multilib --disable-nls" | |
export TARGET=aarch64-linux-gnu | |
export LINUX_ARCH=arm64 | |
sudo mkdir /opt/cross | |
sudo chown ubuntu /opt/cross | |
mkdir cross | |
cd cross | |
# 以降コピペです | |
# http://inaz2.hatenablog.com/entry/2015/12/01/204201 | |
# ソースのダウンロード | |
wget -nc http://ftpmirror.gnu.org/binutils/$BINUTILS_VERSION.tar.gz | |
wget -nc http://ftpmirror.gnu.org/gcc/gcc-5.2.0/$GCC_VERSION.tar.gz | |
wget -nc https://www.kernel.org/pub/linux/kernel/v3.x/$LINUX_KERNEL_VERSION.tar.xz | |
wget -nc http://ftpmirror.gnu.org/glibc/$GLIBC_VERSION.tar.xz | |
for f in *.tar*; do | |
tar xfk $f | |
done | |
cd $GCC_VERSION | |
./contrib/download_prerequisites | |
cd .. | |
# 1. Binutils | |
mkdir -p build-binutils-$TARGET | |
cd build-binutils-$TARGET | |
../$BINUTILS_VERSION/configure --prefix=$PREFIX --target=$TARGET $CONFIGURATION_OPTIONS | |
make $PARALLEL_MAKE | |
make install | |
cd .. | |
# 2. Linux Kernel Headers | |
cd $LINUX_KERNEL_VERSION | |
make ARCH=$LINUX_ARCH INSTALL_HDR_PATH=$PREFIX/$TARGET headers_install | |
cd .. | |
# 3. C/C++ Compilers | |
mkdir -p build-gcc-$TARGET | |
cd build-gcc-$TARGET | |
../$GCC_VERSION/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ $CONFIGURATION_OPTIONS | |
make $PARALLEL_MAKE gcc_cv_libc_provides_ssp=yes all-gcc | |
make install-gcc | |
cd .. | |
# 4. Standard C Library Headers and Startup Files | |
mkdir -p build-glibc-$TARGET | |
cd build-glibc-$TARGET | |
../$GLIBC_VERSION/configure --prefix=$PREFIX/$TARGET --build=$MACHTYPE --host=$TARGET --target=$TARGET --with-headers=$PREFIX/$TARGET/include $CONFIGURATION_OPTIONS libc_cv_forced_unwind=yes | |
make install-bootstrap-headers=yes install-headers | |
# make $PARALLEL_MAKE csu/subdir_lib | |
# Fail. | |
# With `export PATH=`/opt/cross/bin/:${PATH}`, succeed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment