Project

General

Profile

Instructions for cross-compiling OpenSplice DDS for PPC

  1. Download OpenSpliceDDSV4.3-src.tar.gz
  2. extract 'tar -zxvf OpenSpliceDDSV4.3-src.tar.gz'
  3. 'cd OpenSplice/setup/'
  4. 'cp x86_64.linux2.6-default.mak PPC.linux2.6-default.mak'
  5. edit PPC.linux2.6-default.mak
    • line 4: 'gcc' => 'powerpc-603-linux-gnu-gcc'
    • line 5: 'g++' => 'powerpc-603-linux-gnu-g++'
    • line 23: '/usr/bin/ar' => 'powerpc-603-linux-gnu-ar'
    • line 27: 'cpp' => 'powerpc-603-linux-gnu-cpp'
    • line 28: 'g++ -E' => 'powerpc-603-linux-gnu-g++ -E'
    • line 64: '-m64 -DOSPL_ENV_$(SPECIAL) -D_XOPEN_SOURCE=500' => '-DOSPL_ENV_$(SPECIAL)'
    • Note here: for cross compile with gcc 4.5.0 and glibc 2.5 after, '-D_XOPEN_SOURCE=500' must present, which opens up an optimization in the pthread
  6. 'cd environment'
  7. 'cp x86_64.linux2.6-release PPC.linux2.6-release'
  8. 'chmod +x PPC.linux2.6-release'
  9. edit PPC.linux2.6-release
    • line 4: 'SPLICE_TARGET=x86_64.linux2.6-release' => 'SPLICE_TARGET=PPC.linux2.6-release'
  10. 'cd ..'
  11. 'mkdir PPC.linux2.6-release'
  12. 'cp ./x86_64.linux2.6-release/config.mak ./PPC.linux2.6-release/'
  13. 'cd PPC.linux2.6-release'
  14. edit config.mak
    • line 2: 'PROC = x86_64' => 'PROC = PPC'
  15. 'cd ..'
  16. 'cd configuration'
  17. 'cp setup_x86_64.linux2.6 setup_PPC.linux2.6'
  18. 'cd ../..'
  19. 'cd src/abstraction/pa'
  20. 'cp -r ./x86_64 ./PPC'
  21. 'cd PPC/code'
  22. edit pa_abstract.c
    • the file will look like:
      #if defined(__powerpc64__)
      #    define LWSYNC    lwsync
      #elif defined(CONFIG_E500)
      #    define LWSYNC                    \
          START_LWSYNC_SECTION(96);            \
          sync;                        \
          MAKE_LWSYNC_SECTION_ENTRY(96, __lwsync_fixup);
      #else
      #    define LWSYNC    sync
      #endif
      
      #ifdef CONFIG_SMP
      #define ISYNC_ON_SMP    "\n\tisync\n" 
      #define LWSYNC_ON_SMP    stringify_in_c(LWSYNC) "\n" 
      #else
      #define ISYNC_ON_SMP
      #define LWSYNC_ON_SMP
      #endif
      
      os_uint32
      pa_increment(
          os_uint32 *count)
      {
          os_uint32 value;
      
          __asm__ __volatile__(
                  LWSYNC_ON_SMP
          "1:     lwarx    %0,0,%1    # atomic_inc\n \
                  addic    %0,%0,1\n" 
          "       stwcx.   %0,0,%1 \n\
                  bne-     1b" 
                  ISYNC_ON_SMP
                  : "=&r" (value)
                  : "r" (count)
                  : "cc", "xer", "memory");
      
          return value;
      }
      
      os_uint32
      pa_decrement(
          os_uint32 *count)
      {
          os_uint32 value;
      
          __asm__ __volatile__(
                  LWSYNC_ON_SMP
          "1:     lwarx    %0,0,%1    # atomic_dec\n \
                  addic    %0,%0,-1\n" 
          "       stwcx.   %0,0,%1 \n\
                  bne-     1b" 
                  ISYNC_ON_SMP
                  : "=&r" (value)
                  : "r" (count)
                  : "cc", "xer", "memory");
      
          return value;
      }
      
  23. 'cd ../../../../..'
  24. 'setup nova_crosscompiler -q powerpc-603'
  25. 'source configure'
    • select 1 when prompt
  26. 'make'
  27. 'make install'