Skip to main content.

Compiling and Running Xenomai on AMCC PPC 440GX "Taishan" Board

Author

This document was written by Detlev Zundel (dzu {at} denx {dot} de).

Context

Although our ELDK contains a Xenomai-enabled kernel and a Xenomai RPM, it is of interest to show how to compile and run Xenomai from freshly built sources.

We will use the ELDK 4.2 as the toolchain and we will install our new copy of Xenomai into its NFS root filesystem to immediately test it out. So a working installation of it is required in /opt/eldk-4.2

In this application note I will still use an ARCH=ppc kernel as to keep the discussion focused to Xenomai. The general approach is perfectly fine for ARCH=powerpc kernels as well of course.

As usual for multiuser system, we'll be doing all the compiling below the homedirectory, but any place should do really:

$ cd ~
$ mkdir xenomai-on-taishan
$ cd xenomai-on-taishan

Getting the sources

Get Xenomai

We'll use a fresh Subversion checkout for this application note, so let's get it.

$ svn co svn://svn.gna.org/svn/xenomai/tags/v2.4.2 xenomai-v2.4.2

Get Linux kernel DENX-v2.6.24-stable

Also the latest v2.6.24 stable branch from our repository is used.

$ git clone git://git.denx.de/git/linux-2.6-denx linux-2.6-xenomai

Bulding the Linux kernel and Xenomai

Prepare Linux kernel

Note that I'll use the DENX-ELDK-4.2-1 tag to be reproducible, whereas if you want the latest stable, you should use the origin/DENX-v2.6.24-stable branch. Also we'll be working on a newly created branch taishan-xenomai-2.6.24 in which we configure the kernel according to the provided defaults.

$ cd linux-2.6-xenomai
$ git checkout -b taishan-xenomai-2.6.24 DENX-ELDK-4.2-1
$ make ARCH=ppc taishan_defconfig

Now setup the environment variables neccessary to use the ELDK toolchain:

$ export ARCH=ppc
$ export PATH=/opt/eldk-4.2/usr/bin:$PATH
$ export CROSS_COMPILE=ppc_4xx-

Now let's patch the kernel with the Xenomai kernel parts:

$ cd ../xenomai-v2.4.2
$ scripts/prepare-kernel.sh --linux=/home/dzu/xenomai-on-taishan/linux-2.6-xenomai/ --arch=ppc

The perpare-kernel.sh script correctly guesses what patch we need, so we simply press Enter to accept the choice:

Adeos patch [default /home/dzu/xenomai-on-taishan/xenomai-v2.4.2/ksrc/arch/powerpc/patches/adeos-ipipe-2.6.24-powerpc-DENX-2.1-00.patch]: 
patching file Makefile
patching file arch/powerpc/kernel/cputable.c
patching file arch/powerpc/kernel/idle.c
patching file arch/powerpc/kern
....

Compile Linux Kernel

Now we update our .config by accepting the Xenomai default options and compile the kernel:

$ cd ../linux-2.6-xenomai
$ yes "" | make oldconfig
$ make -j4 uImage
$ cp arch/ppc/boot/images/uImage /tftpboot/dzu/taishan/uImage-xeno

Compile Xenomai

Having a Xenomai-enabled kernel, we still need the userspace support, especially the libraries:

$ cd ../xenomai-v2.4.2
$ ./configure --host=ppc-linux --prefix=/usr/local/xenomai-2.4.2
$ make

Install Xenomai

If you cannot write to the ELDK NFS root directory, you'll need to add a sudo to the following command line

$ make DESTDIR=/opt/eldk-4.2/ppc_4xx install

Running it

Having prepared the Xenomai enabled kernel and the Xenomai userspace inside the ELDK NFS, we can boot the new kernel and run a simple Xenomai application, namely the version of cyclictest which comes with Xenomai.

Please note that details of booting are beyond the scope of this application note and can be found in the general DULG documentation.

U-Boot 1.2.0-g6db7d0af (Apr  2 2007 - 11:51:04)

CPU:   AMCC PowerPC 440GX Rev. F at 800 MHz (PLB=160, OPB=80, EBC=80 MHz)
       I2C boot EEPROM enabled
       Bootstrap Option H - Boot ROM Location I2C (Addr 0x50)
       Internal PCI arbiter enabled
       32 kB I-Cache 32 kB D-Cache
Board: Taishan - AMCC PPC440GX Evaluation Board
I2C:   ready
DTT:   1 is 41 C
DRAM:  256 MB
FLASH: 64 MB
PCI:   Bus Dev VenId DevId Class Int
In:    serial
Out:   serial
Err:   serial
LCD:   ready
Net:   ppc_4xx_eth0, ppc_4xx_eth1

Type "run flash_nfs" to mount root filesystem over NFS

Hit any key to stop autoboot:  0 
=> setenv rootpath /opt/eldk-4.2/ppc_4xx
=> setenv bootfile dzu/taishan/uImage-xeno
=> run net_nfs
Waiting for PHY auto negotiation to complete.. done
ENET Speed is 100 Mbps - FULL duplex connection (EMAC2)
Using ppc_4xx_eth0 device
TFTP from server 192.168.1.1; our IP address is 192.168.80.17
Filename 'dzu/taishan/uImage-xeno'.
Load address: 0x200000
Loading: #################################################################
    #################################################################
    #################################################################
    #################################################################
    #########################
done
Bytes transferred = 1457499 (163d5b hex)
## Booting image at 00200000 ...
   Image Name:   Linux-2.6.24.2-dirty
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1457435 Bytes =  1.4 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Linux version 2.6.24.2-dirty (dzu@pollux.denx.de) (gcc version 4.2.2) #1 Thu Mar 6 16:14:30 MET 2008
AMCC PowerPC 440GX Taishan Platform
Zone PFN ranges:
  DMA             0 ->    65536
  Normal      65536 ->    65536
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0:        0 ->    65536
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: root=/dev/nfs rw nfsroot=192.168.1.1:/opt/eldk-4.2/ppc_4xx ip=192.168.80.17:192.168.1.1::255.255.0.0:taishan:eth0:off panic=1 console=ttyS1,115200
PID hash table entries: 1024 (order: 10, 4096 bytes)
I-pipe 2.1-00: pipeline enabled.
console [ttyS1] enabled
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 256640k available (2288k kernel code, 792k data, 140k init, 0k highmem)
Mount-cache hash table entries: 512
net_namespace: 64 bytes
NET: Registered protocol family 16
PCI: Probing PCI hardware
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
I-pipe: Domain Xenomai registered.
Xenomai: hal/powerpc started.
Xenomai: real-time nucleus v2.4.2 (One Big Rush) loaded.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.
JFFS2 version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.3 $ 4 ports, IRQ sharing enabled
serial8250: ttyS0 at MMIO 0x0 (irq = 0) is a 16550A
serial8250: ttyS1 at MMIO 0x0 (irq = 1) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 65536K size 1024 blocksize
PPC 4xx OCP EMAC driver, version 3.54
mal0: initialized, 4 TX channels, 4 RX channels
rgmii0: input 0 in RGMII mode
eth0: emac2, MAC 00:0c:4f:35:00:4a
eth0: found ET1011C Gigabit Ethernet PHY (0x01)
rgmii0: input 1 in RGMII mode
eth1: emac3, MAC 00:0c:4f:35:00:4b
eth1: found ET1011C Gigabit Ethernet PHY (0x03)
e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
PPP generic driver version 2.4.2
NET: Registered protocol family 24
physmap platform flash device: 04000000 at 1fc000000
physmap-flash.0: Found 2 x16 devices at 0x0 in 32-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
physmap-flash.0: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Using physmap partition information
Creating 5 MTD partitions on "physmap-flash.0":
0x00000000-0x00180000 : "kernel"
0x00180000-0x00380000 : "root"
0x00380000-0x03f40000 : "user"
0x03f40000-0x03fc0000 : "env"
0x03fc0000-0x04000000 : "u-boot"
i2c /dev entries driver
IBM IIC driver v2.1
ibm-iic0: using standard (100 kHz) mode
ibm-iic1: using standard (100 kHz) mode
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
eth0: link is down
IP-Config: Complete:
      device=eth0, addr=192.168.80.17, mask=255.255.0.0, gw=255.255.255.255,
     host=taishan, domain=, nis-domain=(none),
     bootserver=192.168.1.1, rootserver=192.168.1.1, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.1
eth0: link is up, 100 FDX, pause enabled
Looking up port of RPC 100005/1 on 192.168.1.1
VFS: Mounted root (nfs filesystem).
Freeing unused kernel memory: 140k init
INIT: version 2.86 booting
      Welcome to DENX Embedded Linux Environment
      Press 'I' to enter interactive startup.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Setting clock : Thu Jan  1 01:00:04 CET 1970 [  OK  ]
Building the cache [  OK  ]
Setting hostname taishan:  [  OK  ]
Mounting local filesystems:  [  OK  ]
Enabling /etc/fstab swaps:  [  OK  ]
INIT: Entering runlevel: 3
Entering non-interactive startup
FATAL: Module ipv6 not found.
Bringing up loopback interface:  [  OK  ]
FATAL: Module ipv6 not found.
Starting system logger: [  OK  ]
Starting kernel logger: [  OK  ]
Starting rpcbind: [  OK  ]
Mounting NFS filesystems:  [  OK  ]
Mounting other filesystems:  [  OK  ]
Starting xinetd: [  OK  ]

DENX ELDK version 4.2 build 2007-11-27
Linux 2.6.24.2-dirty on a ppc

taishan login: root
Last login: Thu Jan  1 01:01:06 on console
-bash-3.2# /usr/local/xenomai-2.4.2/bin/cyclictest -t 3
0.18 0.05 0.01 1/27 1548          

T: 0 ( 1543) P:99 I:    1000 C:   34004 Min:       0 Act:       0 Avg:       3 Max:      17
T: 1 ( 1544) P:98 I:    1500 C:   22670 Min:       0 Act:       0 Avg:       6 Max:      30
T: 2 ( 1545) P:97 I:    2000 C:   17002 Min:       3 Act:       7 Avg:      12 Max:      36