11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

armhfクロスコンパイル環境を作る

Posted at

同じネタでブログを書いてからほぼ2年が経過しているので、手順とか微妙に変わっていた。

環境

  • Mac OS X Yosemite(10.10.5)
  • VirtualBox 4.3.30
  • Vagrant 1.7.2

手順

  1. 適当なboxを追加(今回はdebian-jessie)し、起動・ログイン 
https://github.com/holms/vagrant-jessie-box/releases/download/Jessie-v0.1/Debian-jessie-amd64-netboot.box
  1. /etc/apt/sources.list.d/crosstools.listに以下を登録する
deb http://emdebian.org/tools/debian/ jessie main
  1. archive keyをインストールする
$ curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -
  1. crossbuild-essential-armhfをインストールする
$ sudo dpkg --add-architecture armhf
$ sudo apt-get update
$ sudo apt-get install crossbuild-essential-armhf
  1. 適当なソースをコンパイルしてみる
$ arm-linux-gnueabihf-gcc-4.9 hello.c
$ file a.out
a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=a80116c58215afc0ae1709c213d40e630b2914bb, not stripped

6.動かしてみる場合はqemuが必要

$ sudo apt-get install qemu-user-static
$ qemu-arm-static ./a.out
hello world

参考URL

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?