SetupMemo - TochigiRaspberryPICircle/bm GitHub Wiki
参考資料
Install
Virtual Box
Vagrant
Ubuntuのインストール[自分でつくるパターン]
> mkdir ~/vagrant_box/vos
> cd vos
> mkdir share_data
> cd ~/vagrant_box/vos
> vagrant init ubuntu/xenial64
> vagrant up
Vagrantファイルの編集
- vagrant up をしたフォルダの直下にできた"Vagrantfile"を編集して以下の二つの内容を設定する
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.synced_folder "./share_data", "/home/vagrant/shared"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.memory = "4096"
end
end
ubuntuの再起動とログイン
> vagrant reload
> vagrant ssh
クロスコンパイラ用の環境作成
- Ubuntuにログインしている状態で(vagrant ssh)
- 必要なファイルのダウンロードとビルド
> sudo apt update
> sudo apt upgrade -y
> sudo apt-get -y install build-essential git
> sudo apt-get install zlib1g-dev
> sudo mkdir -p /usr/local/cross-compiler/bin
> echo "export PATH=/usr/local/cross-compiler/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
> mkdir build; cd build
> wget http://ftp.jaist.ac.jp/pub/GNU/binutils/binutils-2.29.tar.gz
> wget http://ftpmirror.gnu.org/gcc/gcc-7.2.0/gcc-7.2.0.tar.gz
> wget http://ftp.jaist.ac.jp/pub/GNU/mpfr/mpfr-4.0.0.tar.gz
> wget http://ftp.jaist.ac.jp/pub/GNU/gmp/gmp-6.1.2.tar.xz
> wget http://ftp.jaist.ac.jp/pub/GNU/mpc/mpc-1.1.0.tar.gz
> wget ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-0.18.1.tar.gz
> for i in *.tar.gz; do tar -xzf $i; done
> for i in *.tar.bz2; do tar -xjf $i; done
> for i in *.tar.xz; do tar -Jxf $i; done
Binutils
> cd binutils-2.29/
> ./configure --prefix=/usr/local/cross-compiler --target=aarch64-elf --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-plugin --disable-linker-build-id --enable-lto --enable-install-libiberty --with-linker-hash-style=gnu --with-gnu-ld--enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-gnu-unique-object
> make -j4
> sudo make install
gcc
> cd gcc-7.2.0/
> ln -s ../mpfr-4.0.0 mpfr
> ln -s ../gmp-6.1.2 gmp
> ln -s ../mpc-1.1.0 mpc
> ln -s ../cloog-0.18.1 cloog
> ./configure --prefix=/usr/local/cross-compiler --target=aarch64-elf --enable-languages=c --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-plugin --disable-linker-build-id --enable-lto --enable-install-libiberty --with-linker-hash-style=gnu --with-gnu-ld--enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-gnu-unique-object
> make -j4 all-gcc
> sudo make install-gcc