Installing Linux Kernel 2.6.23 on the PPC405 core of a Xilinx ML403 board
The aim of the following text is to explain the necessary steps, especially potential pitfalls and their avoidance, to setup a Linux Kernel 2.6.23 on a Xilinx ML403 prototyping board.
Contents[hide]
|
Hardware Setup
Section to be written.
Software Setup
Installing a Cross Compiler Chain for PPC405
Write something about cross-tools here.
Making the Cross Compiler accessible
Configuring the Linux Kernel
After generating the cross compilation tool chain it is necessary to compile a fitting Linux Kernel. This section details how this is done.
Generating a Board Support Package (BSP) for Kernel 2.6
Use XPS for that, see its documentation. The main directory of the EDK project will be referred to as $EDK_PROJECT_DIR in the following text. The Xilinx Platform Studio (XPS), on my machine, generates the Bord Support Package (BSP) in the directory: $EDK_PROJECT_DIR/ppc405_0/libsrc/linux_2_6_v1_00_b/. This directory will be referred to as $BSP_DIR in the following text. Please note that depending on the version of the Xilinx tools this location may slightly differ.
Obtaining the Kernel Sources
Before integrating the BSP into the Kernel Tree it is necessary to obtain the kernel sources of Kernel 2.6.23. Extract the sources at a convenient location. The top-level directory of the kernel (linux-2.6.23) will be referred to as $KERNEL_DIR in the following.
Enabling Cross Compilation for the Linux Kernel
The Linux Kernel allows the user to define the target architecture (ARCH) and which compiler chain to use (CROSS_COMPILE). To do so please edit the file `$KERNEL_DIR/Makefile' with the following values:
ARCH ?= ppc CROSS_COMPILE ?= powerpc-405-linux-gnu
Integrating the BSP into the Kernel Tree
The BSP generated by the Xilinx tools contains all necessary drivers for Kernel 2.6. Many of these drivers have been integrated into Kernel 2.6.23 already. Therefore, I do not use the drivers generated by Xilinx but the ones provided by the Kernel. However, due to the fact that we are using a custom hardware setup here, without a BIOS, it is necessary to give the kernel detailed information about it. We do this by including a xparamerter header file. The files of interest are stored in the directory: $BSP_DIR/arch/ppc/platforms/4xx/xparameters/. Copy the two header files to the directory: $BSP_DIR/arch/ppc/platforms/4xx/xparameters/. Due to some changes in the kernel it is necessary to modify the file: xparameters.h, change the line:
#if defined(CONFIG_XILINX_ML40X)
to:
#if defined(CONFIG_XILINX_ML403)
Furthermore, change the line:
#include<linux/config.h>
to:
#include<linux/autoconf.h>
To obtain the configuration of the selected embedded system the kernel calls the function embed_config(). Unfortunately, by default the linux kernel uses a dummy function instead of the real one. To change this comment out the following from the file $KERNEL_DIR/arch/ppc/boot/simple/misc-embedded.c :
void __attribute__((weak)) embed_config(bdt **bpd){ }
This completes the necessary modifications to the Linux Kernel source code, now it is time to configure the kernel.
Configuring the Kernel
The Linux kernel contains many different configuration options. Most of these are optional / additional at the moment. Nevertheless, the following options are necessary in this case. To configure the kernel execute the following command in your kernel root:
make menuconfig
Set the following configuration options:
- Enable loadable module support: DISABLE
- Processor:
- Type 40x
- Math emulation: ENABLE
- IBM 40x options:
- Machine Type: "Xilinx-ML403"
- Platform options:
- Kernel command line: "console=ttyUL0 root=/dev/$FOO", The setting for the root device depends on the actual system. In my current system it is the second partition of the CF card connected to the SystemACE controller (/dev/xsa2).
- Bus options:
- PCI support: DISABLE
- PCCARD (PCMCIA/CardBus) support:
- PCCARD (PCMCIA/CardBus) support: DISABLE
- Drivers
- Block Devices:
- Xilinx SystemACE support: ENABLE
- Character devices:
- Serial drivers:
- Xilinx uartlite serial port support: ENABLE
- Support for console on Xilinx uartlite serial port: ENABLE
- Serial drivers:
- Block Devices:
Compiling the Kernel
To compile the kernel execute the following command in the kernel root directory:
make bzImage
This compiles the kernel for the PPC, and generates the file:
$KERNEL_DIR/arch/ppc/boot/images/zImage.elf
Configuring the ML403 and Booting Kernel the using Xilinx's SystemACE
To test the compiled kernel it is necessary to create a SystemACE file. A SystemACE file, short ace-file, combines an elf-file with a bitstream to configure an FPGA. This file is then copied onto the first partition (file system: FAT), of a medium that the SystemACE controller can access. In case of the ML403 board this is a Compact Flash card. To generate an ace-file, named: linux.ace, for the current project execute the following command in the project root directory:
xmd -tcl genace.tcl -jprog -board ml403 -hw implementation/download.bit -elf $KERNEL_DIR/arch/ppc/boot/images/zImage.elf -ace linux.ace
Copy it onto the CF card, and then place the CF card into the CF slot of the ML403. When you switch on the board it should configure the FPGA and then load the kernel. Don't forget to connect the serial port of the ML403 to a terminal program to watch the kernel booting. If there are any problems, check that you did all the changes to the kernel correct, check the HW settings as well.
Part two of this howto details how to get the Xilinx EMAC 10/100 MBit/s network core working.