Building a Linux Kernel for BEE2


  1. Building a Linux Kernel for BEE2
    1. Introduction
    2. Acquiring the Kernel Source
    3. Generating the Hardware BSP files
    4. Configuring the Kernel
    5. Setting up a Build Environment
    6. Compiling the Kernel
    7. Creating the ACE File


Introduction


The BEE2 supports booting Linux kernel version 2.4. There are future plans to support kernel version 2.6 when and if drivers for Xilinx IP cores such as ethernet are released. We officially support a fork of the Linux-PPC kernel tree which has its root in version 2.4.30-pre1. This new tree is hosted in our CVS repository (see Bee2Cvs for more information). We have provided precompiled binary versions of the kernel (see Bee2Binaries), however it is likely that most users will need to build their own kernel at some point, primarily due to the static way in which device addresses are configured. This document specifies the few steps required to build a kernel image for the BEE2.

Most of these instructions have been described in greater detail in other excellent documents prepared at UIUC. For more detailed information please refer to "Building a Xilinx ML300/ML310 Linux Kernel".

Acquiring the Kernel Source


The officially supported kernel source for the BEE2 can be either checked out from our CVS repository, or can be downloaded as a daily snapshot from our BEE2 homepage. If you are checking out from the repository simply execute:

cvs co linuxppc-2.4

or if you have downloaded the snapshot execute:

tar -zxvf linuxppc-2.4_DXXX.tar.gz

This will create a clean kernel tree called linuxppc-2.4. Change into this directory to begin compiling the kernel.

Generating the Hardware BSP files


Many of the pcore drivers found in the kernel use a statically defined macros to define the base address and other parameters of the hardware. The values are communicated from the Xilinx tools to the kernel via automatically generated header files. The header files are part of the "BSP" generated by Platform Studio.

These instructions assume you are using a base system derived from a BEE2 reference design. In the BEE2 reference designs, the files will be created in a directory called /PATH/TO/XPS/PROJECT/bsp/. If you are using a different design, you must set the TARGET_DIR parameter under the OS software settings. To generate the BSP files perform the following steps:

The kernel is now set up with the proper BSP files. To verify that they are up to date you can inspect the file /PATH/TO/linuxppc-2.4/arch/ppc/platforms/xilinx_ocp/xparameters_ml300.h. This file contains all of the definitions of the hardware addresses and other configuration parameters.

Configuring the Kernel


We have provided a default configuration for the kernel that matches the hardware found in the XPS_Ctrlfpga_linux reference design. You should start with this configuration and modify it as necessary to suit your kernel and hardware needs. Using the default kernel configuration is fairly straight forward:

cd /PATH/TO/linuxppc-2.4
cp arch/ppc/configs/bee2_defconfig .config
make oldconfig

If you would like to make further configuration changes simply run make menuconfig.

Setting up a Build Environment


Since most users have a workstation that does not run PowerPC code natively it is usually necessary to obtain a cross compiler to properly build the kernel. The other alternative is to build your kernels on a PowerPC machine such as a Mac (we have a Mac Mini on our bench that works well). Regardless, most people will want the power of their workstation or server, so a cross compiler is usually the best option.

Obtaining and installing a cross compiler has already been described in great detail, we refer you to the Cross Tool instructions written up by UIUC. The only thing to be aware of is the name of the cross compiler. The kernel we have provided is looking for a cross compiler with the prefix powerpc-405-linux-gnu-. If you have a different prefix for your compiler, you should change the CROSS_COMPILE parameter in linuxppc-2.4/Makefile.

Compiling the Kernel


Once you have your compiler setup and configuration done, it is a simple process to actually build the kernel. Simply run the following:

cd /PATH/TO/linuxppc-2.4
make dep
make zImage
make modules

The build should proceed smoothly from there. A common error you might encounter is a complaining about a variable prefixed with XPAR not being defined. This means that the xparameters_ml300.h file is either out of date, or you have enabled a kernel option for a hardware device that is not found in your design. To update the xparameter_ml300.h file, follow the instructions on creating the BSP files found above. If the kernel is configured for hardware that is not actually in your base system, simply run make menuconfig and remove the non-existent device.

If everything does go smoothly you will end up with arch/ppc/boot/images/zImage.embedded newly generated. This is the new Linux kernel with the bootloader already embedded.

Creating the ACE File


The ACE file is used to program the control FPGA from a CompactFlash card on boot. In our XPS_Ctrlfpga_linux reference design we have provided several files that are used to create the ACE file. If you are not using our reference design as a starting point you will need to copy the following files which are all found in its root directory:

  1. bee2Genace.opt - Options for the ACE generator script

  2. genace.tcl - The ACE generator script modified to meet the boot requirements of the BEE2 memory

  3. mkace.sh - Wrapper script to invoke the ACE generator

The only file you should potentially modify is the bee2Genace.opt script. It sets the the paths of the three filenames required to generate an ACE file:

  1. -ace XXX - Path and filename of the output ACE file (system.ace)

  2. -elf XXX - Path and filename to the Linux kernel image (zImage.embedded)

  3. -hw XXX - Path and filename to the hardware bitstream (download.bit)

Creating the ACE file is several steps if you are using the default paths:

cd /PATH/TO/XPS_Ctrlfpga_linux
cp /PATH/TO/linuxppc-2.4/arch/ppc/boot/images/zImage.embedded .
./mkace.sh

Once you have generated the ACE file you are ready to place it on a CompactFlash card to boot the system or to load it using XMD. Instructions on proper formatting of the boot CF can be found in Bee2DebianRootFs

Bee2LinuxKernel (last edited 2006-06-26 16:17:46 by alschult)