Depending on what ISA you're using with gem5 the instructions for compiling a Linux kernel differ slightly.
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:
# First clone a copy of the mercurial linux repository hg clone http://www.kernel.org/hg/linux-2.6 # Go to the .hg directory cd linux-2.6/.hg #Get a copy of the patches repository hg clone http://repo.gem5.org/linux-patches patches # Go back to the linux directory cd .. #Update the linux repository to a known working version hg update v2.6.27 # Select the patches for 2.6.27 hg qselect 2.6.27 # Apply the patches to the repository hg qpush -a # Copy the default config file to .config cp .config.m5 .config # Build the kernel make ARCH=alpha CROSS_COMPILE=/path/to/alpha/compiler/alpha-unknown-linux-gnu- vmlinux -j 4
I few minutes later a kernel will be compiled. You can use a newer version of m5, however you'll likely need to modify the config file and some of the patches slightly for it to work.