RBMTX-Lite OpenWrt SDK Exmaple: Różnice pomiędzy wersjami
Z Elproma Wiki Knowledge Base
Linia 25: | Linia 25: | ||
<ol> | <ol> | ||
<li> Install dependency library. In this example it is '''libmodbus''' library. To install library run: | <li> Install dependency library. In this example, it is '''libmodbus''' library. To install library run: | ||
<pre>./scripts/feeds install libmodbus</pre></li> | <pre>./scripts/feeds install libmodbus</pre></li> | ||
<li> To create custom package, when you are in the SDK directory go to the package directory. | <li> To create your custom package, when you are in the SDK directory go to the package directory. | ||
<pre>cd package</pre></li> | <pre>cd package</pre></li> | ||
<li>Make new directory where the package Makefile should be placed. | <li>Make a new directory where the package Makefile should be placed. | ||
<pre> mkdir modbus_server | <pre> mkdir modbus_server | ||
cd modbus_server</pre></li> | cd modbus_server</pre></li> | ||
Linia 39: | Linia 39: | ||
* 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.: | ||
<pre>TARGET_LDFLAGS=-lmodbus | <pre>TARGET_LDFLAGS=-lmodbus | ||
Linia 48: | Linia 48: | ||
</li> | </li> | ||
<li>Now we are ready to select packages and libraries which we want to compile. | <li>Now we are ready to select the packages and libraries which we want to compile. Return to the SDK root directory and execute command: <pre> make menuconfig</pre> | ||
You should see a view like in the picture below. | You should see a view like in the picture below. | ||
[[Plik:RBMTX-Lite Menuconfig.png|800px|border|class=tlt-border]] | [[Plik:RBMTX-Lite Menuconfig.png|800px|border|class=tlt-border]] | ||
</li> | </li> | ||
<li>Then turn off in '''Global build settings''' option ''' Cryptographically sign package lists''' | <li>Then turn off in the '''Global build settings''' option ''' Cryptographically sign package lists''' | ||
[[Plik:Turn_off_cryptograpy.png |800px|border|class=tlt-border]] | [[Plik:Turn_off_cryptograpy.png |800px|border|class=tlt-border]] | ||
</li> | </li> | ||
Linia 59: | Linia 59: | ||
[[Plik:RBMTX-Lite Libraries.png|800px|border|class=tlt-border]] | [[Plik:RBMTX-Lite Libraries.png|800px|border|class=tlt-border]] | ||
</li> | </li> | ||
<li>Next go to the section where you | <li>Next go to the section where you pleaced 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. | ||
[[Plik:RBMTX-Lite Cutom Package.png|800px|border|class=tlt-border]] | [[Plik:RBMTX-Lite Cutom Package.png|800px|border|class=tlt-border]] | ||
</li> | </li> | ||
Linia 68: | Linia 68: | ||
[[Plik:RBMTX-Lite Compilation Output.png|800px|border|class=tlt-border]] | [[Plik:RBMTX-Lite Compilation Output.png|800px|border|class=tlt-border]] | ||
</li> | </li> | ||
<li> | <li>Once the compilation process is complete, the package can be found in the directory '''bin/packages/arm_cortex-a7_neon/base'''. | ||
<pre>cd bin/packages/arm_cortex-a7_neon/base</pre> | <pre>cd bin/packages/arm_cortex-a7_neon/base</pre> | ||
[[Plik:RBMTX-Lite Packages.png|600px|center|border|class=tlt-border]] | [[Plik:RBMTX-Lite Packages.png|600px|center|border|class=tlt-border]] | ||
</li> | </li> | ||
</ol> | </ol> |
Wersja z 09:51, 20 kwi 2023
Prerequisites
You will need:
- A PC, laptop or virtual machine running Linux OS (preferably Debian/Ubuntu distro)
- An SDK intended for your router, which can be downloaded here: Software Development Kit
Preparation
- Create a directory, where the SDK will be extrated, e.g. RBMTX_SDK.
- Open a terminal in the folder you created folder and unzip the SDK.
tar -xf ~/Downloads/rbmtx3-owrt-sdk-....Linux-x86_64.tar.xz
- Go to the SDK directory.
cd rbmtx3-owrt-sdk-22.10.14-rbmtx3_gcc-8.4.0_musl_eabi.Linux-x86_64/
- 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 based on the simple Modbus client and server application.
- Install dependency library. In this example, it is libmodbus library. To install library run:
./scripts/feeds install libmodbus
- To create your custom package, when you are in the SDK directory go to the package directory.
cd package
- Make a new directory where the package Makefile should be placed.
mkdir modbus_server cd modbus_server
-
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
- Now we are ready to select the packages and libraries which we want to compile. Return to the SDK root directory and execute command:
make menuconfig
- Then turn off in the Global build settings option Cryptographically sign package lists
- Then go to the Libraries section and make sure the libraries you want to use are checked.
- Next go to the section where you pleaced 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.
- At the end, save all settings - leave the default name of the configuration.
- Exit the menuconfig.
- 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:
- Once the compilation process is complete, the package can be found in the directory bin/packages/arm_cortex-a7_neon/base.
cd bin/packages/arm_cortex-a7_neon/base