SSE3044: Operating Systems (Fall 2012)


Using GCC 4.1.2 for Pintos

September 1, 2012

Jin-Soo Kim
Computer Systems Laboratory
Sungkyunkwan University

Let sse-gcc and sse-g++ be the GNU C and C++ compiler version 4.1.2, respectively. (Refer to this page on how to build them.)

Compiling bochs using gcc version 4.1.2

In Pintos, bochs is usually built using the shell script ~/pintos/src/misc/bochs-2.2.6-build.sh. When running this script, override the environment variables CC and CXX as follows:

$ cd ~/pintos/src/misc
$ sudo env SRCDIR=/home/jinsoo PINTOSDIR=/home/jinsoo/pintos DSTDIR=/usr/local CC=sse-gcc CXX=sse-g++ ./bochs-2.2.6-build.sh

Building Pintos using gcc version 4.1.2

Pintos also should be compiled with gcc version 4.1.2. This can be done by modifying the ~/pintos/src/Make.config file as shown below:

# -*- makefile -*-

SHELL = /bin/sh

VPATH = $(SRCDIR)

# Binary utilities.
# If the host appears to be x86, use the normal tools.
# If it's x86-64, use the compiler and linker in 32-bit mode.
# Otherwise assume cross-tools are installed as i386-elf-*.
X86 = i.86\|pentium.*\|[pk][56]\|nexgen\|viac3\|6x86\|athlon.*\|i86pc
X86_64 = x86_64
ifneq (0, $(shell expr `uname -m` : '$(X86)'))
  CC = sse-gcc
  LD = ld
  OBJCOPY = objcopy
else
  ifneq (0, $(shell expr `uname -m` : '$(X86_64)'))
    CC = sse-gcc -m32
    LD = ld -melf_i386
    OBJCOPY = objcopy
  else
    CC = i386-elf-gcc
    LD = i386-elf-ld
    OBJCOPY = i386-elf-objcopy
  endif
endif
...