RBMTX-Lite OpenWrt SDK Exmaple: Różnice pomiędzy wersjami

Z Elproma Wiki Knowledge Base
Skocz do: nawigacja, szukaj
Linia 29: Linia 29:
  <pre> mkdir modbus_server
  <pre> mkdir modbus_server
  cd modbus_server</pre></li>
  cd modbus_server</pre></li>
<li>Create the Makfile file to build your custom package. Exmaple Makefile shown below.</li>
 
<li>
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.
* It is important to change all '''modbus_server''' string with your package name.
* In the SOURCE_DIR section add path to your package sources.
* 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:
* If you use external library it is important to complete the dependency sections e.g:
   
   
TARGET_LDFLAGS=-lmodbus
<pre>TARGET_LDFLAGS=-lmodbus
DEPENDS:= +libmodbus
DEPENDS:= +libmodbus
PKG_BUILD_DEPENDS+= libs/libmodbus
PKG_BUILD_DEPENDS+= libs/libmodbus</pre>
   
   
[[Plik:MakefileNew.png|2000x1000px|lewo]]
</li>


[[Plik:MakefileNew.png|2000x1000px|lewo]]
<li value="4"> After Makefile file perpartion. It is important to install dependency library. In this example it is libmodbus library. To install library run:  
<pre>/scripts/feeds install libmodbus</pre></li>

Wersja z 14:45, 19 kwi 2023

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 directory, where the SDK will be extrated e.g RBMTX_SDK.
  2. Open terminal in created folder and unpack 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. To create custom package, when you are in the SDK directory go to the package directory.
    cd package
  2. Make new directory where the package Makefile should be placed.
     mkdir modbus_server
     cd modbus_server
  3. 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
  4. After Makefile file perpartion. It is important to install dependency library. In this example it is libmodbus library. To install library run:
    /scripts/feeds install libmodbus