i386-jos-elf toolchain on OS X Lion

Yesterday friend and I decided to follow the MIT Operating System Engineering course together in order to get a deep understanding of OS’s. And today I started setting up the cross compling environment for the labs. At first I wanted to get the toolchain from macports, but unluckily it didn’t successfully build binutils on my Mac. As a result, I started building the toolchain from the source code, following the instructions at http://pdos.csail.mit.edu/6.828/2011/tools.html.

The programs you need for the toolchain include binutils, gcc, and gdb. For compiling gcc you also need GMP, MPFR, and MPC. The source codes are available at:

Unzip them in a directory and build binutils, gcc, and gdb one by one.

In order to build gcc, GMP, MPFR and MPC needs to be built first.

Note that it’s essential to build gcc in a directory different from the source code directory to avoid compiling errors.

Then make gdb:

QEMU is available in macports:

8 thoughts on “i386-jos-elf toolchain on OS X Lion

  1. Hi!!
    I have to follow the Mit Operating System Course and I am using a MacBook Air. I followed your precious advices but I am not able to compile binutils because I receive this error: make[1]: Nothing to be done for `all-target’.

    Could you please help me?

  2. Hi! Thank you for the reply. Now it’s working, but I still am having some problems with symbol table, this is the error message I received when I launch gdb:
    “+ symbol-file obj/kern/kernel
    .gdbinit:30: Error in sourced command file:
    “/Users/username/jos/lab/obj/kern/kernel”: can’t read symbols: File format not recognized.”

    Could you maybe help me?

    Thanks a lot!

  3. Maybe it’s a problem with kernel compilation without parameter – g, but I don’t know how to solve it.

Leave a Reply

Your email address will not be published.