First thing I did is read the RSB-docs. From this I learned the global macros are defined in defaults.mc and the config file syntax is loosely based on the RPM spec file. There are macros for common build commands like ‘make’ that will pick the correct make for your host, so use ‘%(_make}’ for universality. Most importantly I learned there are usually 3 main files controlling the build:

  1. A general config file in source-builder/config. This contains the general configure and build instructions (for say version 2.x.x release).

  2. More specific version config file in bare/config/devel which contains the source location and any patches that need to be applied before configuring (for say version 2.4.1)

  3. A .bset in bare/config/devel which specifies all the dependencies and the order in which to build them.

So following the pattern already laid out by the current qemu build, I created

  1. source-builder/config/couverture-qemu-2-1.cfg
  2. bare/config/devel/couverture-qemu-git-1.cfg
  3. bare/config/devel/couverture-qemu.bset

The -1 at the end of the file keeps track of the version of the config file.

The main changes to the original qemu files were:

source-builder/config/couverture-qemu-2-1.cfg

/*
 * Targeting specific architectures instead of building for all like the 
 * previous build.
 */
%define qemu_archs arm-softmmu,i386-softmmu,lm32-softmmu,mips-softmmu
%define qemu_archs %{qemu_archs},ppc-softmmu,sparc-softmmu

/*
 * Remove -q option from prep section as it is no longer used
 */
%source setup qemu -n qemu-%{qemu_version}

/*
 * This feature allows the user to override which architectures are built for
 * with a command line argument '--with-qemu-archs=sparc-softmmu'.
 */
--target-list=%{?with_qemu_archs:%{with_qemu_archs}}\
              %{!?with_qemu_archs:%{qemu_archs}} \
/*
 * Also a few extra disable options I found were neccessary.
 */
--disable-werror \
--disable-virtfs \
--disable-docs

bare/config/devel/couverture-qemu-git-1.cfg

/*
 * This targets the specific commit at the time of testing the latest stable
 * release of couverture-qemu.
 */
%define qemu_version e9299f7591c8ecf3389922f4e7672b6bc5deae71
/*
 * This sets the location of the source and the build system figures out how
 * to fetch this based on the protocol and extension. I tried to use the git
 * API was not able to get it to work. Also the release check is removed from
 * this section.
 */
%source set qemu https://github.com/AdaCore/qemu/archive/%{qemu_version}.tar.gz

bare/config/devel/couverture-qemu.bset

/* 
 * Couverture-qemu has the same dependencies as qemu except current qemu was
 * able to checkout the dtc submodule as a build command with the source.
 * I dont think this is possible with github so I added this into the bset
 * build list.
 */
...
devel/glib-2.39.3-1
devel/dtc-1.4.1-1
devel/couverture-qemu-git-1

I tested the build and the testsuite produced the same results as before.

There were also some patches that were being applied to the current qemu build. Two of which were still usable and another 3 set of Gaisler patches for Leon 3 no longer applied cleanly. So I went through the rejected files and moved the sections that couldn’t find a correct place automatically and created a new clean set of pathches. However there are some sections that have been completely implemented and some that haven’t. Also the Couverture-Qemu dev I had been talking to Fabien Choteau had signed off on the original set of Gaisler patches so this indicates they were aware of these and possibly have already used the solution and just rewritten some of the sections. For instance, here is one section that is the basically the same memory allocation but the Gaisler patches combine the allocation while couverture have seperated it.

/*
 * Gaisler
 */
+    /* Allocate AHB/APB PNP */
+    grlib_ambapnp_create(0xFFFFF000 /* AHB */, 0x800FF000 /* APB */);
+
/*
 * Couverture-Qemu
 */
    /* Allocate AHB PNP */
    grlib_ahbpnp_create(0xFFFFF000);

    /* Allocate APB PNP */
    grlib_apbpnp_create(0x800FF000);
/*
 * Gaisler patches wanted to make this change in grlib_apbuart.c
 */
 /* Everything is off */
   6 -    uart->control = 0;
     7 +    uart->control = 0xf;
/*
 * In the same section uart->control had now been defined differently and I 
 * decided to leave it. I am not sure if this is equivalent though.
 */
/* Enable Tx and Rx as the bootloader would do */                           
265     uart->control = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE;
/*
 * Finally there was a compile issue with an undefined reference to 'qdev_init'
 * I couldnt find the definition of qdev_init myself and the surrounding
 * are all using 'qdev_init_nofail' which I could find. So I changed..
 */
if(qdev_init(dev)){
    return NULL;
    }
/* changed to */
qdev_init_nofail(dev);

After this Couverture-Qemu compiled successfully and the RTEMS testsuite results were unaffected. So it seems successful, although i’m not sure how to actually test the USB issue it was addressing so I could be wrong. I collected the above information and forwarded it to Fabien with the new patches, I’m hoping he can clear this up if the problem has already been solved.

Next up I’m going to do some mockups of XML coverage report and leave it on the rtems devel list to gather feedback for phase 3 of my project. I’ll submit the RSB patches when I hear back from Fabien and then I’ll get back to the RTEMS Tester work.