RBMTX-Lite OpenWrt SDK Exmaple

Z Elproma Wiki Knowledge Base
Skocz do: nawigacja, szukaj

Prerequisites

You will need:

  • A PC, laptop or virtual machine running Linux OS (preferably Ubuntu distro)
  • An SDK intended for your router, which can be downloaded here: Software Development Kit

Preparation

  1. Create a directory, where the SDK will be extrated, e.g. RBMTX_SDK.
  2. Open a terminal in the folder you created folder and unzip the SDK.
tar -xf ~/Downloads/rbmtx3-owrt-sdk-....Linux-x86_64.tar.xz
  1. Go to the SDK directory.
cd rbmtx3-owrt-sdk-22.10.14-rbmtx3_gcc-8.4.0_musl_eabi.Linux-x86_64/
  1. Update the feeds.
./scripts/feeds update -a


Compiling a custom package

In this example we are going to show you how to generate OpenWrt package base on the simple Modbus client and server application.

  1. Install dependency library. In this example it is libmodbus library. To install library run:
    ./scripts/feeds install libmodbus
  2. To create custom package, when you are in the SDK directory go to the package directory.
    cd package
  3. Make new directory where the package Makefile should be placed.
     mkdir modbus_server
     cd modbus_server
  4. Create the Makfile file to build your custom package. Exmaple Makefile shown below.
    • It is important to change all modbus_server string with your package name.
    • In the SOURCE_DIR section add path to your package sources.
    • If you use external library it is important to complete the dependency sections e.g:
    TARGET_LDFLAGS=-lmodbus
    DEPENDS:= +libmodbus
    PKG_BUILD_DEPENDS+= libs/libmodbus

    MakefileNew.png

  5. Now we are ready to select packages and libraries which we want to compile. Go back to the SDK root directory and execute command:
     make menuconfig

    You should see a view like in the picture below. RBMTX-Lite Menuconfig.png

  6. Then turn off in Global build settings option Cryptographically sign package lists Turn off cryptograpy.png
  7. Then go to the Libraries section and make sure the libraries you want to use are checked. RBMTX-Lite Libraries.png
  8. Next go to the section where you ppleaced the package to compliation. The name of section depends on the name that was placed in the CATTEGORY: option in the package's Makefile. In our case, it is Example section. Make sure that your castom package is checked. RBMTX-Lite Cutom Package.png
  9. At the end, save all settings - leave the default name of the configuration.
  10. Exit the menuconfig.
  11. Now, we are ready to complie our custom package. Type comamnd make in the terminal and wait for compilation finish. You should see the output like in the picture below: RBMTX-Lite Compilation Output.png
  12. After complilation process, you can find package in the directory bin/packages/arm_cortex-a7_neon/base.
    cd bin/packages/arm_cortex-a7_neon/base
    RBMTX-Lite Packages.png

OpenWrt Package upload