LoginSignup
3
5

More than 5 years have passed since last update.

OS X Yosemiteでxv6をbuildして動かすまで

Last updated at Posted at 2015-04-28

xv6
http://pdos.csail.mit.edu/6.828/2014/xv6.html

OS Xではcross-compilerが必要なので以下の手順でtoolchainを用意してからbuildします。

i386-jos-elf toolchainを準備する

以下のサイトで説明してくれているので、参考に、というかほとんどそのままです。ありがとうございます!
http://d.hatena.ne.jp/gionXY/20130909/1378660645
http://daoyuan.li/i386-jos-elf-toolchain-on-os-x-lion/
http://blogs.yahoo.co.jp/i_love_raspberry_pi/39244842.html
また、以下も参考になります。
http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html

以下、$PREFIXは任意のインストールディレクトリ名

binutils

$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.gz    
$ tar xvf binutils-2.25.tar.gz          
$ mkdir build-binutil       
$ cd build-binutil
$ ../binutils-2.25/configure --disable-nls --target=i386-jos-elf --disable-werror --prefix=$PREFIX  
$ make all
$ make install

gcc

$ wget http://public.p-knowledge.co.jp/gnu-mirror/gnu/gcc/gcc-4.9.2/gcc-4.9.2.tar.gz      
$ tar xvf gcc-4.9.2.tar.gz     
$ mkdir build-gcc
$ cd build-gcc
$ ../gcc-4.9.2/configure --disable-nls --target=i386-jos-elf --disable-werror --enable-languages=c --without-headers --prefix=$PREFIX
$ make all-gcc
$ make install-gcc

xv6をbuild & run

git repositoryからsourceを取得

$ git clone git://pdos.csail.mit.edu/xv6/xv6.git

Makefileをちょっと修正
TOOLPREFIXQEMUのコメントアウトを削除。
上のtoolchainのインストールディレクトリをTOOLPREFIXに指定する。

Makefile
-# TOOLPREFIX = i386-jos-elf
+TOOLPREFIX = $PREFIX/i386-jos-elf-
-# QEMU = qemu-system-i386
+QEMU = qemu-system-i386

qemuが入っていない場合はHomebrewなどでインストール。

$ brew install qemu

ビルド、実行

$ cd xv6
$ make
$ make qemu-nox
3
5
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
3
5