Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get xv6 running with QEMU on OSX Yosemite
#! /usr/bin/env bash
# Get xv6 working with OSX Yosemite
# Most things were here:
# You need homebrew installed to make this thing work
brew tap homebrew/versions && brew install gcc48
brew deps qemu | xargs brew install
export PATH=/usr/local/bin:$PATH
export CC=/usr/local/bin/gcc-4.8
brew install wget
mkdir -p /tmp/xv6-deps
cd /tmp/xv6-deps
mkdir /usr/local/xv6
tar -xzf binutils-2.21.1.tar.bz2 && cd binutils-2.21.1
CFLAGS=-Wno-error=deprecated-declarations ./configure --target=i386-jos-elf --disable-nls --prefix=/usr/local/xv6 && make && make install
cd .. && mkdir install
tar -xzf gmp-5.0.4.tar.bz2 && mkdir gmp-build; cd gmp-build
../gmp-5.0.4/configure --prefix=$(cd ../install && pwd) && make && make install
cd .. && tar -xzf mpfr-3.1.0.tar.bz2 && mkdir mpfr-build; cd mpfr-build
../mpfr-3.1.0/configure --prefix=$(cd ../install && pwd) --with-gmp=$(cd ../install && pwd) && make && make install
cd .. && tar -xzf mpc-0.8.2.tar.gz && mkdir mpc-build; cd mpc-build
../mpc-0.8.2/configure --prefix=$(cd ../install && pwd) --with-gmp=$(cd ../install && pwd) --with-mpfr=$(cd ../install && pwd) && make && make install
cd .. && tar -xzf gcc-core-4.5.1.tar.bz2 && mkdir gcc-build; cd gcc-build
../gcc-4.5.1/configure --target=i386-jos-elf --disable-nls --without-headers --with-newlib --disable-threads --disable-shared --disable-libmudflap --disable-libssp --with-gmp=$(cd ../install && pwd) --with-mpfr=$(cd ../install && pwd) --with-mpc=$(cd ../install && pwd) --prefix=/usr/local/xv6 && make && make install
export PATH=/usr/local/xv6/bin:$PATH
cd .. && tar -xzf gdb-6.8a.tar.gz && mkdir gdb-build; cd gdb-build
../gdb-6.8/configure --target=i386-jos-elf --program-prefix=i386-jos-elf- --disable-werror --prefix=/usr/local/xv6 && make && make install
# Best way to do this
brew install qemu
# Get the code
cd /tmp
git clone git:// && cd xv6
# Run it
QEMU=qemu-system-i386 clean && make qemu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment