Difference between revisions of "Linux kernel"

From gem5
Jump to: navigation, search
(ARM)
(Remove broken ARM instructions and point to separate page.)
 
(7 intermediate revisions by 3 users not shown)
Line 4: Line 4:
 
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:
 
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
+
  # First clone a copy of the linux repository
  hg clone http://www.kernel.org/hg/linux-2.6
+
  hg clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6
 +
cd linux-2.6
 
   
 
   
 
  # Go to the .hg directory
 
  # Go to the .hg directory
  cd linux-2.6/.hg
+
  cd .hg
 
   
 
   
 
  #Get a copy of the patches repository
 
  #Get a copy of the patches repository
Line 34: Line 35:
  
 
===ARM===
 
===ARM===
ARM 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.
+
See [[ARM Linux Kernel]].
 
 
If you're using Code Sourcery 2011.03-41 or newer you'll need to add <code>EXTRA_CFLAGS=-mno-unaligned-access</code> to the command line when you compile the kernel.
 
 
# To compile a kernel for ARM, 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 or from another source such as Linaro http://www.linaro.org/downloads/
 
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.37 in this case because that is what the config file we've got is for
 
hg update v2.6.37
 
 
# Grab the config file on the download page:
 
wget http://www.m5sim.org/dist/current/arm/config-arm
 
mv config-arm .config
 
 
# Compile the kernel
 
make ARCH=arm CROSS_COMPILE=/path/to/arm/compiler/arm-unknown-linux-gnu- vmlinux -j 4
 
  
 
===x86===
 
===x86===

Latest revision as of 10:37, 7 September 2015

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:

# First clone a copy of the linux repository
hg clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6
cd linux-2.6

# Go to the .hg directory
cd .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.

ARM

See ARM Linux Kernel.

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