Linux 2.6 on MicroBlaze

Introduction

This page contains patches and instructions for testing out the current developments of 2.6 support for MicroBlaze. Once this work reaches production-ready status, it will be integrated into the standard PetaLinux environment.

Please use the existing MicroBlaze uClinux mailing list to discuss issues and questions relating to this work. For early-adopters who require commercial assistance with 2.6 on MicroBlaze, or who may be willing to help fund the completion of this project to assure timely commercial readiness, please contact us at enquiries@petalogix.com.

Status

This platform is still at an experimental stage.

  • Baseline 2.6.19 kernel is booting and functional
  • Kernel compile/link options supported standard auto-config process (e.g automatic detection of compiler flags to support CPU features etc)
  • Xilinx-specific drivers (see below) have been auto-config'd

Device driver support

  • Xilinx UARTLITE
  • Xilinx 10/100 Ethernet MAC
    • Functionality not confirmed
  • More device driver supported is expected in a code drop from Xilinx / LynuxWorks in March/April 2007 timeframe.

What's missing

  • any serious testing
  • arch-specific support in /proc (/proc/interrupts, /proc/cpuinfo not implemented)
  • sub-arch / per-platform support in arch/microblaze.
  • user application debug and profiling
  • some of the low level arch-specific internals are in a pretty rough state, and need to be cleaned up

Kernel Download and Patching

  1. Download and install the current PetaLinux release
  2. Download a stock 2.6.19 kernel tree
  3. Expand the 2.6.19 archive inside the ${PETALINUX}/software subdirectory.
  4. Rename software/linux-2.6.19 to software/linux-2.6.19-uc0
  5. Download and apply petalinux-2.6-devel-sw-r2218.patch
    • Apply at patchlevel -p0 from the top level ${PETALINUX} directory
  6. Download Kconfig.auto and copy into ${PETALINUX}/software/linux-2.6.19-uc0/arch/microblaze
  7. Symlink ${PETALINUX}/software/petalinux-dist/linux-2.6.x to point to the newly-created linux-2.6.19-uc0 directory

Updating the kernel headers in the microblaze-uclinux-gcc toolchain

Ensure you have sourced the PetaLinux settings.sh shell script file, as per standard PetaLinux usage procedures.

# cd ${PETALINUX}/tools/linux-i386/microblaze-uclinux-tools/microblaze-uclinux/include
# rm -rf linux asm-microblaze
# ln -s ${PETALINUX}/software/petalinux-dist/include/linux linux
# ln -s ${PETALINUX}/software/petalinux-dist/include/asm-microblaze asm-microblaze
# ln -s ${PETALINUX}/software/petalinux-dist/include/asm-generic asm-generic

Building it

  1. Change to the software/petalinux-dist kernel build directory
  2. # make menuconfig
  3. Select "PetaLogix/MicroBlaze-auto" as vendor/platform combination (this will default to a 2.6 kernel)
  4. Save and exit
  5. Press 'Enter' if prompted to provide any kernel configuration settings
  6. When returned to the shell prompt, simply type make.

The resulting kernel/filesystem image file ${PETALINUX}/software/petalinux-dist/image.bin can be downloaded to your hardware platform as per standard PetaLinux development procedures.

Customising

Until the new PetaLinux BSP tools with 2.6 support are released, if you wish to customise the kernel to suit your hardware platform you will need to edit the Kconfig.auto file.

The file is in standard 2.6 kernel config syntax, and the definitions for memory size, base addresses and so on are obvious. Be sure to perform a make oldconfig phase after updting Kconfig.auto, to ensure your changes propagate to the kernel configuration headers.

Contributing patches

The 2.6 kernel support for MicroBlaze is a work in progress. You can help by submitting patches for bug fixes and new features. Please submit patches to the microblaze-uclinux mailing list.

Guide for contributing patches

Please ensure your patches are relative to the patched kernel that results from the instructions above. That is, to generate diffs you shold diff between the linux-2.6.19-uc0 tree that resaults from the above instructions, and whatever local working copy you have. Following this simple guideline will make integrating your patches a lot easier.

Other patches

For purposes of code review and discussion, here is a patch directly for linux-2.6.19-uc0. It shows the changes necessary after the SnapGear linux-2.6.19-uc0-big.patch is applied to a vanilla 2.6.19 kernel.

There are several components to this patch:

  • Core MicroBlaze support in arch/microblaze and include/asm-microblaze
  • Drivers for Xilinx devices:
    • drivers/xilinx_common/* (low level support for Xilinx driver infrastructure)
    • drivers/serial/uartlite.c - Xilinx UARTLITE
    • drivers/net/xilinx_emac/* - Xilinx Ethernet MAC
    • associated Kconfig updates, include/linux/serial_core.h etc
  • Some hackery in /usr to work around MicroBlaze old binutils
  • Some small hits in mainline, including
    • drivers/mtd/maps/uclinux.c to work with CRAMFS as well as ROMFS root FS types

Attachments