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
SELINUX=permissive

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://github.com/aalonso/oe-utils
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

~/workspace/oe/build-xilinx-ml507/conf/tmp/deploy/glibc/images/xilinx-ml507

Angstrom-console-image-glibc-ipk-2009.X-test-20100319-xilinx-ml507.rootfs.tar
modules-2.6.32+git-r0-xilinx-ml507.tgz
u-boot-xilinx-ml507-git-r43.bin
uImage-2.6.32+git-r0-xilinx-ml507.bin
uImage-2.6.32+git-r0-xilinx-ml507.dtb

8. Build u-boot elf image

bitbake -b ~/workspace/oe/openembedded/recipes/u-boot/u-boot_git.bb

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 genace_all.sh 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

bootdelay=5
baudrate=9600
loads_echo=1
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
stdin=serial
stdout=serial
stderr=serial

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 org.openembedded.dev

More information about openembedded is here;

Advertisement

7 thoughts on “Openembedded on xilinx ml507 quick how to

  1. Dear Aalonso!

    I see, you made may patches to OE related to ml507.
    One thing, that I cant’ understand is why OE latest default xilinx-ml507 build of kernel can’t get command-line parameters of OE latest default u-boot?

    for example,

    U-Boot 1.3.4 (Jun 16 2010 – 18:58:36)

    CPU: Xilinx PowerPC 440 UNKNOWN (PVR=7ff21912) at 400 MHz

    => setenv bootargs console=ttyS0,9600 ip=no root=/dev/xsa2 rw
    => saveenv
    Saving Environment to EEPROM…
    => fatload ace 0 0x03000000 uImage.dtb 12288
    reading uImage.dtb

    12288 bytes read
    => fatload ace 0 0x03020000 uImage.bin 1885369
    reading uImage.bin

    1885369 bytes read
    => bootm 0x03020000 – 0x03000000
    ## Booting kernel from Legacy Image at 03020000 …
    Image Name: Angstrom/2.6.32+git/xilinx-ml507
    Image Type: PowerPC Linux Kernel Image (gzip compressed)
    Data Size: 1885305 Bytes = 1.8 MB
    Load Address: 00000000
    Entry Point: 00000000
    Verifying Checksum … OK
    ## Flattened Device Tree blob at 03000000
    Booting using the fdt blob at 0x3000000
    Uncompressing Kernel Image … OK
    Loading Device Tree to 007fa000, end 007fffff … OK
    Unable to update property /plb/opb:clock-frequency, err=FDT_ERR_NOTFOUND
    Unable to update property /plb/ebc:clock-frequency, err=FDT_ERR_NOTFOUND
    Unable to update property NOR mapping, err=FDT_ERR_NOTFOUND
    Using Xilinx Virtex440 machine description
    Linux version 2.6.32 (dv@dvpc) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Wed Jun 160
    Zone PFN ranges:
    DMA 0x00000000 -> 0x00010000
    Normal 0x00010000 -> 0x00010000
    Movable zone start PFN for each node
    early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00010000
    MMU: Allocated 1088 bytes of context maps for 255 contexts
    Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65024
    Kernel command line: console=ttyS0 ip=on root=/dev/ram
    ….
    and then I got:
    edBoot partition parsing not available
    Device Tree Probing ‘ethernet’
    xilinx_lltemac 81c00000.ethernet: MAC address is now 2: 0: 0: 0: 0: 0
    xilinx_lltemac 81c00000.ethernet: XLlTemac: using DMA mode.
    XLlTemac: DCR address: 0x80
    XLlTemac: buffer descriptor size: 32768 (0x8000)
    XLlTemac: Allocating DMA descriptors with kmalloc
    XLlTemac: (buffer_descriptor_init) phy: 0xfaf0000, virt: 0xcfaf0000, size: 0x800
    XTemac: PHY detected at address 7.
    xilinx_lltemac 81c00000.ethernet: eth0: Xilinx TEMAC at 0x81C00000 mapped to 0x8
    mice: PS/2 mouse device common for all mice
    TCP cubic registered
    NET: Registered protocol family 17
    eth0: XLlTemac: Options: 0x3fa
    eth0: XLlTemac: allocating interrupt 20 for dma mode tx.
    eth0: XLlTemac: allocating interrupt 19 for dma mode rx.
    eth0: XLlTemac: speed set to 100Mb/s
    eth0: XLlTemac: Send Threshold = 24, Receive Threshold = 4
    eth0: XLlTemac: Send Wait bound = 254, Receive Wait bound = 254
    Sending DHCP requests …… timed out!

    U-boot’s ping silently not working.

    I’m using ml507_ppc440_emb_ref BlackCat default Xilinx project.

    1. Hi Dvorkin,

      Kernel command line parameters are passed from kernel device tree In my hardware reference design device tree (see [1]) at line 46 theres the boot args used by the kernel. I’m not sure if u-boot parameters are ignored or over witted by the kernel when using the device tree blob; Just make sure that your hardware reference projects has the bootargs that you want to use.

      Hope this helps, regards.

      [1] http://github.com/aalonso/xilinx-ml507/blob/device-tree/ppc440_0/libsrc/device-tree_v0_00_x/xilinx.dts

      1. sorry for the next question… I don’t have device tree in my Xilinx project directory:

        [dv@dvpc ml507_ppc440_emb_ref]$ find ./ -name “*.dts”
        [dv@dvpc ml507_ppc440_emb_ref]$

        where from I can get it? looks like I need some additional sources from Xilinx, but what sources or project archive do I need to download?

      2. Yep I add the device-tree scripts from Xilinx [1], You need to

        1. copy the `bsp` directory in your hardware project
        2. In xilinx XPS goto Software->Software Platform settings
        3. In OS & library settings select `device-tree`
        4. Run Software -> Generate libraries and bsp

        And this will create the the device tree file that is missing in your hardware project.

        At xilinx wiki [2] thereś more details of device tree generator

        [1] http://git.xilinx.com/?p=device-tree.git;a=summary [2] http://xilinx.wikidot.com/device-tree-generator

  2. Dear Alonso!

    Did you get Temac v2.00.a in Angstrom Linux work?
    With default Angstrom OE distribution it looks like it detects carrier loss if I unplug the cable and on if I plug it, but it can’t send packets (and possibly receive).

    I generated BSP for linux_2_6 and see that OE lltemac driver is really outdated comparing to Xilinx 11.5 XPS’s generated driver.

    Did anybody update the driver and it’s hidden from “stable” OE linux distribution, don’t you know?

    I’m looking at 2.6.34 vanilla Linux kernel and see that it’s ll_temac is marked as compatible with xps-ll-temac-2.00.a. How can I use new Linux kernel? what is the option to enforce 2.6.34 or I could run into the problems with it?
    May be it’s better to try to setup old ll_temac-1.01.b in my XPS?

    What’s your advice? Sorry for a lot of questions. 🙂

    1. In my first reference project [1] I’m integrating xps-ll-temac hardware module version 2.03.a and works on OE distribution; One of the tricky parts is how is interconnected in hardware I had problems with `llink` it was connected with something else that I don’t remember instead of DMA from device tree

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s