Openembedded on xilinx virtex 4,5 support

In this lasts weeks I’have been working on Openembedded
for generic support for Xilinx virtex4, virtex5; Only u-boot and the
Linux kernel needs attention to be configured for the final target arch
since it can be Powerpc 405, 440 or Microblaze. Final arch settings needs
some user configuration in local.conf file it should be set the target
board options:

# Generic Powerpc 440 based board
MACHINE = “xilinx-virtex5”
TARGET_ARCH = “powerpc”
TARGET_CPU = “440”
TARGET_TUNE = “ppc440”
# Hardware project options
XILINX_BSP_PATH = “${HOME}/workspace/ppc44x/xilinx-ml507”
XILINX_BOARD = “ml507”

The machine can be xilinx-virtex4, xilinx-virtex5 or xilinx-mb-gen (generic microblaze)
the final arch can be override by setting TARGET_* values, for example for virtex5
family board targeting microblaze
TARGET_ARCH = “microblaze”
TARGET_CPU = “microblaze”
TARGET_TUNE = “microblaze”
I know that this is kind of odd but until I fix how to override this values inside conf
machine files this would be useful for testing stage.

The logic for setting the target options for u-boot and the kernel are handled in
xilinx-bsp.class where I add some logic for the configure settings based on the
TARGET_ARCH and XILINX_BOARD values, a similar approach is needed in config machine
files to do the black magic on setting the default options for a particular target

I had problems with running any ace file (fpga bitstream + elf executable) from compact
flash on ML405 target board, on power-up the board was just flashing a led indicating an
error on compact flash read, and to solve the problem I had to add an option on
`etc/bitgen.ut` file

-g Match_cycle:NoWait

I’m not sure but it seems that my compact flash is the problem;

There’s a lot still to be done specially for Microblaze support, where I have to still
deal with glibc or uClibc to be integrated in OE, or to get working an external toolchain
Also fully test Angstrom on ml405 board since it’s failing when running init scripts it
complains about permissions errors.

The OE code changes can be found at

Openembedded on xilinx ml507 quick how to

* Some notes are Fedora specific if you are using any other distro make the proper changes

I currently working on hardware/software co design project, my goals are at 
hardware level integrate peripheral modules following the wishbone spec at
software level boot the Linux kernel and develop the corresponding Linux device
driver. For first hardware candidate I’m consider a simple IO device that
I will connect to an encoder wheel so it can be used as an input device.

1. Install development libraries and tools on your host machine * Fedora way

sudo yum groupinstall “Development Libraries”
sudo yum groupinstall “Development Tools”

2. Set selinux in permissive mode

Edit the file /etc/sysconfig/selinux
sudo <your-favorite-text-editor> /etc/sysconfig/selinux
And set SELINUX to

3. Make Qemu happy set vm.mmap_min_addr = 0
Edit the file /etc/sysctl.conf
Add the next line
vm.mmap_min_addr = 0

4. Reboot so vm.mmap and selinux take effect

5. Getting some help scripts for setting openembedded

git clone git://
cd oe-utils

6. Setting Openembedded build environment

source oe-setup-env xilinx-ml507

The first time it will download Openembedded, Bitbake, create a work directories
structure and copy a local configuration file that you should edit to set the variables
XILINX_BSP_PATH and XILINX_MACHINE of your Xilinx XPS project dir.

7. Building console image

bitbake console-image

It would take a while depending on you computer monster; The result images are placed at



8. Build u-boot elf image

bitbake -b ~/workspace/oe/openembedded/recipes/u-boot/

The build procedure will export the u-boot elf image to the hardware project dir
set via the XILINX_BSP_PATH variable

9. Generate ace image (u-boot + hardware model)

Use the script provided in my hardware reference design; The scripts set xilinx devtools via “xlnx-env” script and can be found at previous blog post which is referenced as  “setup-xlnx”

10. Compact flash card partition layout

Disk /dev/sdc: 510 MB, 510418944 bytes
16 heads, 63 sectors/track, 989 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Disk identifier: 0x001c2022
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         123       61960+   6  FAT16
/dev/sdc2             124         989      436464   83  Linux

11. Install the images to compact flash

Copy ace image to first partition
cp <project dir>/ML50X/cfg2/ml507_bsp_u-boot.ace /media/<first-partition>

Copy kernel image
cp <angstrom images dir>/uImage-2.6.32+git-r0-xilinx-ml507.bin /media/<first partition>/uImage.bin

Copy device tree blob
cp <angstrom images dir>/uImage-2.6.32+git-r0-xilinx-ml507.dtb /media/<firstpartition>/uImage.dtb

Extract root file system
sudo tar xf <angstrom images dir>/Angstrom-console-image-glibc-ipk-2009.X-test-20100319-xilinx-ml507.rootfs.tar -C /media/<second-partition>

Extract kernel modules
sudo tar xf <angstrom images dir>/modules-2.6.32+git-r0-xilinx-ml507.tgz -C /media/<second-partition>

12. First boot
Connect Uart1 to pc and open a serial terminal 9600 bps, 8N1 turn on board

13. Set u-boot variables

load_dtb=fatload ace 0 0x03000000 uimage.dtb 12288
load_kernel=fatload ace 0 0x03020000 uimage.bin 1890732
bootargs=console=ttyS0,9600 ip=on root=/dev/xsa2 rw
boot_addr=0x03020000 – 0x03000000
go=run load_dtb; run load_kernel; bootm $(boot_addr)
bootcmd=run go

14. Reboot via system ace reset button

15. Subsequent development

Set OE dev environment

cd ~/workspace/oe/
source oe-setup-env xilinx-ml507

By default it updates Openembedded development branch and creates a
branch named xilinx-ml507 where you can add/improve bitbake recipes.

Sync your development branch with oe branch

cd ~/workspace/oe/openembbed
git merge

More information about openembedded is here;