[Xorp-users] Report: XORP-CT cross-compilation with PPC

Juarez Paulino juarez.paulino at gmail.com
Fri Jul 16 05:33:56 PDT 2010


I think my previous mail didn't get into the list because I have used some
formatting.

So here comes a copy... I hope it can helps someone.


On Wed, Jul 14, 2010 at 5:40 PM, Juarez Paulino <juarezpsj at gmail.com> wrote:
>
> Hi All,
>
> I'm sending this message as a report of our successful cross-compilation
of XORP-CT on a linux kernel PowerPC machine.
>
> Our group were able to cross-compile and identify some problems on the
SCONS scripts, so we have to apply some patches on them to make they work
fine.
>
> We use GDB server to debug things. It was really useful as we got into the
executable from host and checked the code from guest. It's important to
remember to use export optimize=no to correctly get the symbols on
debugging.
>
> We just test it on Multicast PIM module, so I don know if it requires more
improvements on other modules.
>
> So here are our appointments:
>
> 1) Cross-Compile important libraries:
>
> - libpcap;
> - openssl;
> - ncurses.
>
> Our buildroot toolchain already had all of them.
>
>
> 2) Merging cross-compilation environment on SConstruct:
>
> We couldn't get SCons to work with previous export/guest/build options
like:
>
> $ export
CC=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-gcc \
> export CXX=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-g++
\
> export
RANLIB=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ranlib \
> scons \
> # :( dont work yet...
>
> or:
>
> $ export
CC=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-gcc \
> export CXX=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-g++
\
> export
RANLIB=/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ranlib \
> scons build=i686-pc-linux-gnu host=powerpc-83xx-linux-uclibc
> # :P dont work either...
>
>
> -> Solution: Merging options directly on SConstruct:
>
> #SConstruct line 145,
> build = 'i686-pc-linux-gnu'               #Spider: edited here, don't use
./config.guess on build machine!
> build_cpu = 'i686'
> build_vendor = 'pc'
> build_os = 'linux-gnu'
>
> --------------------------------------
>
> #SConstruct line 155,
> host = 'powerpc-83xx-linux-uclibc'              #Spider: edited here,
Crosscompiling
> host_cpu = 'powerpc'
> host_vendor = '83xx'
> host_os = 'linux-uclibc'
>
> -------------------------------------------
>
> #line 190, SConstruct
> #Spider: edited here. Just after ''env = Environment()'' above
> #Extremely Zealous Environment!!
> env['AR'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ar'
> env['AS'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-as'
> env['CC'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-gcc'
> env['CXX'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-g++'
> env['LD'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ld'
> env['LDCONFIG'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ldconfig'
> env['LDD'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ldd'
> env['NM'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-nm'
> env['OBJCOPY'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-objcopy'
> env['OBJDUMP'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-objdump'
> env['RANLIB'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-ranlib'
> env['STRIP'] =
'/opt/ppc83xx-linux-uclibc/usr/bin/powerpc-83xx-linux-uclibc-strip'
> #Spider: edit ended
>
>
> - As you can see, we have put other environment binaries either, just to
be sure that it works!
>
>
> 3) Eliminating Endianess problem
>
> After some terrible hours of debugging, we managed to cross-compile
XORP-CT and not to get the endianess problem on FEA sockets. Our PowerPC
machine uses BIG_ENDIAN, but our host cross-compilation machine uses
LITTLE_ENDIAN, so endianess-check get wrong parameters when looking for it.
>
> Maybe there is some better ways, but we find it easy to "brute define"
things by hand to get xorp_config.h correctly identify endianess.
>
> -> Solution:
>
> # Line 37,
> # File: xorp/site_scons/config/allconfig.pym
> # Mod: Check-endianess line comented
> def DoAllConfig(env, conf, host_os):
>      ##########
>      # endian
>      # XXX Wot about cross compilation??
>      # Pedro: Disable endianness check for cross compilation success
>
>      # conf.CheckEndianness()
>
> --------------------------------------------------
>
> # Line 578
> # File: xorp/SConstruct
>       my_custom_tests = {
>       'CheckBoost' : CheckBoost,
>      'CheckBoostLibrary' : CheckBoostLibrary,
>
>       # Pedro: removing endianess check
>       # 'CheckEndianness' : CheckEndianness,
>
>       'CheckTypeMember' : CheckTypeMember,
>       'CheckSysctl' : CheckSysctl
> }
>
> ------------------------------------------------------
>
> # Line 592
> # File: xorp/SConstruct
>
>       # Juarez: Definition of endianess by force
>       conf.Define('WORDS_BIGENDIAN')
>
>
> 4) More sockets errors
>
> More debugging time and we found a warning message that FEA were packeting
PIM header with a different number of bytes that it was expected.
>
> It's due to a bad identification of our uclibc library on SConstruct
script.
>
> -> Solution: Add our linux-uclibc symbol to host_os RAW check.
>
> # Linha 204
>       # Pedro: adding the router libc in the if test
>       if host_os == 'linux-gnu' or host_os == 'openbsd' or host_os ==
'linux-uclibc':
>            conf.Define('IPV4_RAW_OUTPUT_IS_RAW')
>            conf.Define('IPV4_RAW_INPUT_IS_RAW')
>
>
>
==============================================================================
>
>
> - With these modifications, we got XORP-CT top-of-tree Ben version to
cross-compile and works fine with PIM module on PPC machine.
>
> - We've tested XORP-CT restricted space versions (only with PIM module and
necessary) and it seems to work fine too on our SSM environment.
>
> - Our last stripped working version got around ~9.6MB space:
>
> sudo scons -j4 disable_ipv6=yes disable_fw=yes disable_warninglogs=yes
disable_tracelogs=yes disable_fatallogs=yes disable_infologs=yes
disable_assertlogs=yes disable_errorlogs=yes enable_olsr=no enable_bgp=no
enable_vrrp=no enable_policy=no enable_rip=no optimize=size
enable_fea_dummy=no enable_xorpsh=no disable_profile=yes
>
> * We had to enable and configure OSPF module too, as xorp can recognize (i
think it inverts) the system metrics...
>
> Without OSPF, we got 8.4MB...
>
>
> Our next work and probably most difficult is to reduce more our XORP
version.
>
> So do you have any tips beyond Ben PATCHES (on getting out modules, xorpsh
and IPv6 code) from where we could begin?
>
>
> Thanks,
>
> Juarez Paulino
> Universidade de Brasilia, Brazil

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-users/attachments/20100716/50d1fcf3/attachment.html 


More information about the Xorp-users mailing list