Wednesday, March 29, 2017

Build TI Z-Stack Linux Home Gateway reference design for x86 Linux

The following steps show you hot to build TI Z-Stack Linux Home Gateway reference design for x86 Linux.

1. Download Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run from http://www.ti.com/tool/z-stack-archive.

2. Setup a 32 bit Ubuntu and run Z-Stack_Linux_Gateway-1.0.1-src-linux-installer.run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src

3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”

...
#Target platform:
    #export TARGET_PLATFORM="BEAGLEBONE_BLACK"
    export TARGET_PLATFORM="x86"

...
    cd $NPI_SOURCE/Projects/tools/LinuxHost
    make clean
    make create_output
    #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE
    make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE

...
# *** Copy resources ***********************************************************************************

#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server
cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_${PLATFORM_SUBSTRING}_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server


4.a Install protobuf by doing the following two apt-get install

       sudo apt-get install protobuf-c-compiler
       sudo apt-get install protobuf-compiler

4.b Create a new folder "tools" and export TCLIB to it using the following lines:
  
       cd ~
       mkdir tools
       export TCLIB=~/tools/

5. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all

6. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.

7. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called ). Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "sudo ./zigbeeHAgw x86"

8. If you run it successfully, you will see the results like the following screen shot.


2 comments:

  1. Thank you for the post. I am getting errors from compiling app zstackpb/zstack.pb-c.c. See below for a example:

    In file included from ../zstackpb/zstack.pb-c.c:8:0:
    ../zstackpb/zstack.pb-c.h:11:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’
    typedef struct _AFAddr AFAddr;
    ^
    ../zstackpb/zstack.pb-c.h:498:3: error: unknown type name ‘AFAddr’
    AFAddr *dstaddr;

    So most of the executables in server folder is not build (except for NPI_lnx_x86_server). Please help.

    For protobuf, did you modify the path in build_all file? Also it doesn't really matter where you point TCLIB right? If seems that path just need to be specified.

    ReplyDelete
  2. I have followed your guide. But it shows missing server files: file ZLSZNP_X86 is missing ...and other three such as OTA server. I do not know why they are missing. Maybe, does the PC need tool to rebuild the package? Looking forwards your reply. Thx!

    ReplyDelete