From OSDev Wiki
Jump to: navigation, search

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Vagrant puts standard operating system installs into a container. Vagrant integrates with either VMWare or VirtualBox. Then when a container is downloaded and run for the first time vagrant will perform actions specified in your Vagrantfile. In this way development environments can be easily shared. Once the virtual machine created from the container is started with Vagrant. Vagrant will automatically start an ssh session. The folder in which you start Vagrant has to contain a Vagrantfile. This folder will also be shared with the virtual machine.


# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config| = "ubuntu/trusty32"
  config.vm.provision "shell", inline: <<-SHELL
    sudo apt-get update
    sudo apt-get install -y libgmp3-dev libmpfr-dev libisl-dev libcloog-isl-dev libmpc-dev texinfo make bison flex gcc g++ nasm build-essential grub qemu zip xorriso
    sudo export PREFIX="/opt/cross"
    sudo export TARGET=i686-elf
    sudo export PATH="$PREFIX/bin:$PATH"
    sudo mkdir /tmp/
    sudo mkdir /tmp/build
    sudo cd /tmp/build
    sudo wget -O binutils.tar.gz
    sudo tar -xf binutils.tar.gz
    sudo cd binutils-2.25
    sudo mkdir build-binutils
    sudo cd build-binutils
    sudo ../configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
    sudo make
    sudo make install
    sudo cd ../..
    sudo rm -r binutils-2.25
    sudo wget -O gcc.tar.gz
    sudo tar -xf gcc.tar.gz
    sudo cd gcc-4.9.2
    sudo mkdir build-gcc
    sudo cd build-gcc
    sudo ../configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
    sudo make all-gcc
    sudo make all-target-libgcc
    sudo make install-gcc
    sudo make install-target-libgcc
    sudo rm -rf /tmp/build

This example Vagrantfile will download a Ubuntu 14.04 32-bit container and install a i686-elf-gcc cross compiler. It will also download several other tools usefull for operating system development.

Personal tools