Linux kernel

Depending on what ISA you're using with gem5 the instructions for compiling a Linux kernel differ slightly. Ultimately, we'd like to have a single unified way to compile all these kernels, but it will take some work to happen. If you'd like to help, please let us know.

Alpha

Currently we have a patch queue for Alpha that can be applied on top of a linux mercurial repository. This patch queue adds various debugging, performance, introspection capabilities and increases the number of simulated processors the Alpha implementation in gem5 can support from 4 to 64. To compile a new kernel for Alpha follow the directions below:

ARM

x86

x86 doesn't currently have a patch queue, but a generic kernel works well since the normal code already has functions that wait for interrupts in idle loops. Some of the debugging functionality, such as m5dprintk can be trivially added if you need to by just using the patch from the alpha linux-patches repository above.

# To compile a kernel for x86, first get the kernel source. Here again we use mercurial because that is what we use for gem5
# However, you could get the code from kernel.org in a bzip format
hg clone http://www.kernel.org/hg/linux-2.6
# Change directory to the newly cloned directory
cd linux-2.6
# Update to the version you're interested in; 2.6.28.4 in this case because that is what the config file we've got is for
hg update v2.6.28.4
# Grab the config file on the download page:
wget http://www.m5sim.org/dist/current/x86/config-x86.tar.bz2
tar jxvf config-x86.tar.bz2
cp configs/linux-2.6.28.4 .config
# Compile the kernel, assuming you're building on an x86 host
make vmlinux -j 4