RUTOS Software Development Kit (SDK) Instruction: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
A <b>software development kit</b> (<b>SDK</b>) is a set of software development tools that provides the possibility to create applications for a certain software package, software framework, computer system or similar development platform. | |||
<b>Note:</b> The information in this page is in accordance to using SDK version <b>R_00.07.03</b>. The included Readme file in SDK archive file contains information for each separate SDK version and might differ from the older version or information provided in this wiki page. Please always follow the provided Readme file. | |||
__TOC__ | |||
==Introduction== | ==Introduction== | ||
Line 19: | Line 20: | ||
It should also be noted early that the first time you compile a firmware it may take up to a few hours to complete. Once the initial compilation is complete, packages will not be re-compiled next time, therefore the duration will decrease significantly. Please be aware that this also depends on your machine. | It should also be noted early that the first time you compile a firmware it may take up to a few hours to complete. Once the initial compilation is complete, packages will not be re-compiled next time, therefore the duration will decrease significantly. Please be aware that this also depends on your machine. | ||
== | ==Prerequisites== | ||
== | |||
You will need: | |||
<ul> | |||
<li>A PC, laptop or virtual machine running Linux OS (We recommend using Ubuntu 22.04.3 LTS)</li> | |||
<li>A RUTOS supported router (version R_00.07.00 and up)</li> | |||
<li>An SDK intended for your router, which can be downloaded here: <b>[[Software Development Kit]]</b></li> | |||
</ul> | |||
==Ubuntu Installation and Pre-requisite== | |||
Compiling the firmware should be achievable on any Linux-based machine. Alternatively, options like Oracle's VirtualBox or Windows' WSL can be used, though the setup process may vary slightly. For this example, I will be using VMWare. | |||
You can download the '''VMWare''' here: [https://www.vmware.com/mena/products/workstation-pro/workstation-pro-evaluation.html VMWare] | |||
1. You must download latest '''Ubuntu''' version can be found here: [https://ubuntu.com/download/desktop Ubuntu] | |||
[[File:Ubunto.png|border|class=tlt-border]] | |||
2. After initiating VMware, click Create a New Virtual Machine | |||
[[File:Ubuntu2.jpg|border|class=tlt-border]] | |||
3. Choose Typical -> choose the downloaded Ubuntu .iso file | |||
[[File:Ubuntu3.jpg|border|class=tlt-border]] | |||
then click Next. | |||
4. Input Name, username, and password. Then input the Virtual Machine Name and the save path. | |||
'''Note:''' allocate at least 30-50GB GB for disk size and click Store virtual disk as a single file. | |||
[[File:Ubuntu4.jpg|border|class=tlt-border]] | |||
Then click Next. | |||
5. Select Customize Hardware. Allow for 4GB or more of memory and 2 or more processors *more is preferable* depending on your machine. | |||
[[File:Ubuntu5.jpg|border|class=tlt-border]] | |||
Finally, click Finish. | |||
Ubuntu will initialize. Choose your language. The example will be in English. | |||
6. Choose Minimal installation and check Install third-party software for graphics and Wi-Fi hardware and additional media formats. | |||
[[File:Ubuntu6.jpg|border|class=tlt-border]] | |||
Click Continue | |||
7. Once installion is done, click on Restart Now. | |||
8. Once Ubuntu is now running. Open a browser and download the SDK file from Teltonika Networks wiki. You can find it out here: [https://wiki.teltonika-networks.com/view/Software_Development_Kit Software Development Kit] | |||
==Compiling a standard firmware== | |||
First, you must install the packages required for the SDK to work. Open the Terminal application (<b>Ctrl + ALT + T</b>) and execute the following commands: | |||
sudo apt update | |||
sudo apt install nodejs | |||
sudo apt install npm | |||
sudo apt install build-essential ccache ecj fastjar file flex g++ gawk \ gettext git java-propose-classpath java-wrappers jq libelf-dev \ libffi-dev libncurses5-dev libncursesw5-dev libssl-dev libtool \ python python2.7-dev python3 python3-dev python3-distutils \ python3-setuptools rsync subversion swig time u-boot-tools \ unzip wget xsltproc zlib1g-dev bison | |||
Create a new folder (for this example I'll be using a directory called <i>RUTX_R</i> found at my <b>home</b> directory) and extract the SDK archive inside it. | |||
[[File:SDK_EXTRACT.jpg|border|class=tlt-border]] | |||
You can achieve this with drag and drop or by executing this command via Terminal: | |||
Navigate to the "Downloads" folder: | |||
cd ~/Downloads | |||
Extract the tar.gz file: | |||
tar -xzvf RUTX_R_GPL_00.07.05.X.tar.gz | |||
This command will extract the contents of the RUTX_R_GPL_00.07.05.X.tar.gz file into the current directory, After running this command, you should find the extracted files in the same directory where you ran the command. | |||
<b>Note</b>: don't forget to replace the file name and path in accordance with your own circumstances | |||
Open a Terminal inside the SDK directory. You can change the directory in your current terminal (<i>cd ~/RUTX_R/openwrt-gpl-ipq40xx.Linux-x86_64</i>) | |||
Once you open the Terminal, update the feeds: | |||
./scripts/feeds update -a | |||
Now you can compile a standard firmware by executing this command in the terminal: | |||
make | |||
If all is in order, the output should look something like this: | |||
[[File:Make_without_jobs_v1.gif]] | |||
<b>Note</b>: the first time you compile a firmware file it may take up to <b>30 minutes</b> before it is complete. Don't close the Terminal window up until then. Once it is finished, you will find the firmware in the <i>./bin/targets/ipq40xx/generic</i> directory. It should contain a file openwrt-ipq40xx-qcom-ipq4018-rutx-squashfs-apps.bin, it can be used to upgrade your router's firmware via its web interface. | |||
---- | |||
You can speed up this process by passing an extra argument <b>-j</b>. This argument then compiles the necessary packages in parallel. | |||
To know how much jobs you can pass to the compiling process execute this command in the terminal: | |||
nproc | |||
This commands output should be a number. This number tells how much processing units are available to the current process. Now execute this command in the terminal: | |||
make -j<nproc_output> | |||
[[File:make_with_jobs_v1.gif]] | |||
'''Troubleshooting tips:''' | |||
1. If you get error on first ‘make’, do ./scripts/feeds update -a once more. | |||
2. Once you extract the SDK files, Rename rutos-ipq40xx-rutx-gpl to a different file name and move it to home directory. | |||
3. Try running `make distclean` if you believe that your SDK installation is corrupt. This will recompile the firmware from scratch. | |||
4. Allowing us to run command. “make -j<nproc_output> V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues. | |||
==Changing default settings== | |||
To create a firmware with different default settings, you must change the default in the config files, which are contained in <b>/openwrt-gpl-ipq40xx.Linux-x86_64/package/</b>. However, there is no unifying system regarding where one should look for config files related to specific services. Therefore, it is very important to acquaint yourself with the <b>UCI system</b> (RutOS configuration file system) in order to successfully navigate through the files: | |||
<ul> | |||
<li>[[UCI_command_usage#Configuration_hierarchy|Click here]] for information on the configuration hierarchy</li> | |||
<li>[[UCI_command_usage#Configuration_files|Click here]] to find what configs are related to which services</li> | |||
</ul> | |||
---- | |||
In many cases you will find that service names as they are displayed in the router's WebUI are similar to the names of the programs responsible for these services. For instance, [[RUTX11_Firewall|Firewall]] settings can be changed in the /openwrt-gpl-ipq40xx.Linux-x86_64/package/<b>network/config/firewall/files</b> directory. However, if you open the aforementioned directory, you will find that it contains four files: | |||
[[File:Networking_rutx_sdk_instructions_3.png|border|class=tlt-border]] | |||
As you can see from the image above, only one of the files holds the Firewall configuration, while other files contain scripts related to the service. This will be different for each case. For example, among Mobile Utilities files, which can be found in /openwrt-gpl-ipq40xx.Linux-x86_64/package/mobutils/src/, you will find even more items, including different config files which serve a different purpose: | |||
[[File:Networking_rutx_sdk_instructions_4.png|border|class=tlt-border]] | |||
==Changing Default Password== | |||
To change the default device password, changes need to be made inside: | |||
"RUTX_R_GPL_00.07.05/package/base-files/files/lib/preinit/84_set_password" | |||
[[File:PasswordCHANGE.jpg|border|class=tlt-border]] | |||
Change "admin01" to your password on line [ -z "$passwd" ] && passwd="$(mkpasswd | |||
admin01)" | |||
After making changes and saving them to the directory, we may build compile using the following commands: | |||
1- ./scripts/feeds update -a | |||
2- make clean | |||
3- Following that, we must execute the "nproc" command to determine the number of processors, and it will return a number, such as 1, allowing us to run command. “make -j1 V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues. | |||
==Changing Default IP Address== | |||
To modify the default IP address, you can make use of a dedicated menu in the firmware configuration, which is accessed through the "menuconfig" interface. To access this configuration menu, follow these steps from the root directory of your project: | |||
Open a terminal and execute the following command: | |||
make menuconfig | |||
After entering the "make menuconfig" command, it will launch a new interface known as the "OpenWrt Configuration." In this interface, navigate to the "Target Firmware options" section. | |||
[[File:IPAddress.jpg|border|class=tlt-border]] | |||
You will then be presented with the option to modify the Default IP address, allowing you to input your desired value. By default, it is set to (192.168.1.1). | |||
[[File:IPAddress2.jpg|border|class=tlt-border]] | |||
You will then be presented with the option to modify the Default IP address, allowing you to input your desired value. | |||
[[File:IPAddress3.jpg|border|class=tlt-border]] | |||
After making the desired changes to the Default IP address, you can then save those modifications. | |||
[[File:IPAddress4.jpg|border|class=tlt-border]] | |||
After making changes and saving them to the directory, we may build compile using the following commands: | |||
1- ./scripts/feeds update -a | |||
2- make clean | |||
3- Following that, we must execute the "nproc" command to determine the number of processors, and it will return a number, such as 1, allowing us to run command. “make -j1 V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues. | |||
The firmware can then be found in the directory listed below *Depends on the target*: | |||
rutos-ath79-rut9-gpl>bin>targets>ath79>generic>tltFws>RUTX_R_GPL_00.07.05.3_WEBUI | |||
'''file name''': RUTX_R_GPL_00.07.05.3_WEBUI | |||
==Selecting packages== | |||
To select which packages should be compiled into the firmware is through a special menu called <b>Kconfig</b>. | |||
To enter the <b>Kconfig</b>, standing in your projects root directory execute this command in the terminal: | |||
make menuconfig | |||
After executing this command you should see a view like in the picture below. | |||
[[File:menuconfig_main_page_v1.png|border|class=tlt-border|700px]] | |||
To move around in the <b>Kconfig</b> use the arrows on the keyboard, space bar to select or to unselect the package, and enter key to enter sub directories of packages. | |||
<b>Note</b>: Do not unselect any package if you do not know what you are doing. | |||
---- | |||
<li>Packages have three markings: | |||
<ol> | |||
<li><*> - this symbol says that the package will be compiled an added to the firmware</li> | |||
<li><M> - this symbol says that the package will be compiled but will not be added to the firmware</li> | |||
<li>< > - this symbols says that the package will not be compiled and will not be added to the firmware</li> | |||
</ol>[[File:menuconfig_package_marking_v1.png|border|class=tlt-border|700px]] | |||
</li> | |||
---- | |||
By default all packages that were marked as to be compiled in the process, can be found separately from the firmware. Packages can be found in directory <b>~/RUT_X/openwrt-gpl-ipq40xx.Linux-x86_64/bin/packages/arm_cortex-a7_neon-vfpv4</b>. | |||
This directory also has five sub directories. Packages are categorized in these directories by there type. | |||
==Compiling a single package== | |||
If you ever need to compile a single package you do not need to compile the whole firmware. As an example we will try to compile a text editor called <b>Nano</b>. | |||
---- | |||
<li>Now we need to do this steps:</li> | |||
<ol> | |||
<li>Open the <b>Kconfig</b> by executing this command in the terminal: | |||
<pre>make menuconfig</pre></li> | |||
<li>Navigate to the menu section of <b>Nano</b> text editor. It can be found under “Utilities→Editors”</li> | |||
<li>Select <b>nano</b> package</li> | |||
<li>Three times press the “<b>Exit</b>” entry</li> | |||
[[File:selecting_nano_package_v1.png|border|class=tlt-border|700px]] | |||
<li>Save the configuration by selecting “<b>Yes</b>” in the prompted window</li> | |||
[[File:saving_menuconfig_v1.png|border|class=tlt-border|700px]] | |||
</ol> | |||
</li> | |||
---- | |||
<li>When the package is selected we need to compile and install it: | |||
<ol> | |||
<li>While standing in root directory of the project execute this command in the terminal: | |||
<pre>make package/nano/compile</pre></li> | |||
[[File:nano_compile.gif]] | |||
<li>The compiled package can be found in the directory <b>~/RUT_X/openwrt-gpl-ipq40xx.Linux-x86_64/bin/packages/arm_cortex-a7_neon-vfpv4/packages</b>. Upload the <b>nano</b> install file into the router by executing this command in the terminal: | |||
<pre>scp bin/packages/arm_cortex-a7_neon-vfpv4/packages/nano_4.3-1_arm_cortex-a7_neon-vfpv4.ipk root@<router_ip_addr>:/tmp</pre></li> | |||
<li>Connect to your routers command line interface by executing this command in the therminal: | |||
<pre>ssh root@<router_ip_addr></pre></li> | |||
<li>Change your directory to <b>/tmp</b> directory</li> | |||
<li>Install the <b>nano</b> text editor by executing this command in the terminal: | |||
<pre>opkg install nano_4.3-1_arm_cortex-a7_neon-vfpv4.ipk</pre></li> | |||
<li>Try out the nano text editor by executing this command: | |||
<pre>nano example</pre></li> | |||
</ol>[[File:nano_install_v1.gif]] | |||
</li> | |||
<b>Note:</b> If the package that you want to compile isn't selected in the <b>Kconfig</b>, the install file of the package will not be created | |||
[[Category:Other Topics]] |
Revision as of 12:08, 14 November 2023
Main Page > FAQ > Other Topics > RUTOS Software Development Kit (SDK) InstructionA software development kit (SDK) is a set of software development tools that provides the possibility to create applications for a certain software package, software framework, computer system or similar development platform.
Note: The information in this page is in accordance to using SDK version R_00.07.03. The included Readme file in SDK archive file contains information for each separate SDK version and might differ from the older version or information provided in this wiki page. Please always follow the provided Readme file.
Introduction
This article contains instructions on how to utilize Teltonika SDK packages for RUTx series routers. The resources used in the provided examples are:
- Teltonika Router running RutOS
- Ubuntu 22.04.3 LTS OS
- SDK version R_00.07.05.x
The examples apply to various RUTOS routers, SDK versions and operating systems. In most cases the difference will only be that of a visual nature, The availability of SDK Firmware branding begins from version 7.05, although some of these modifications may be accessible on earlier firmware versions.
Most examples provided in this page are independent from each other. But it is highly recommended to acquaint yourself with the basics by reading the "Prerequisites" and "Compiling a standard firmware" sections first as they contain information that will be necessary in order to understand some aspects of the other examples.
It should also be noted early that the first time you compile a firmware it may take up to a few hours to complete. Once the initial compilation is complete, packages will not be re-compiled next time, therefore the duration will decrease significantly. Please be aware that this also depends on your machine.
Prerequisites
You will need:
- A PC, laptop or virtual machine running Linux OS (We recommend using Ubuntu 22.04.3 LTS)
- A RUTOS supported router (version R_00.07.00 and up)
- An SDK intended for your router, which can be downloaded here: Software Development Kit
Ubuntu Installation and Pre-requisite
Compiling the firmware should be achievable on any Linux-based machine. Alternatively, options like Oracle's VirtualBox or Windows' WSL can be used, though the setup process may vary slightly. For this example, I will be using VMWare.
You can download the VMWare here: VMWare
1. You must download latest Ubuntu version can be found here: Ubuntu
2. After initiating VMware, click Create a New Virtual Machine
3. Choose Typical -> choose the downloaded Ubuntu .iso file
then click Next.
4. Input Name, username, and password. Then input the Virtual Machine Name and the save path.
Note: allocate at least 30-50GB GB for disk size and click Store virtual disk as a single file.
Then click Next.
5. Select Customize Hardware. Allow for 4GB or more of memory and 2 or more processors *more is preferable* depending on your machine.
Finally, click Finish.
Ubuntu will initialize. Choose your language. The example will be in English.
6. Choose Minimal installation and check Install third-party software for graphics and Wi-Fi hardware and additional media formats.
Click Continue
7. Once installion is done, click on Restart Now.
8. Once Ubuntu is now running. Open a browser and download the SDK file from Teltonika Networks wiki. You can find it out here: Software Development Kit
Compiling a standard firmware
First, you must install the packages required for the SDK to work. Open the Terminal application (Ctrl + ALT + T) and execute the following commands:
sudo apt update
sudo apt install nodejs
sudo apt install npm
sudo apt install build-essential ccache ecj fastjar file flex g++ gawk \ gettext git java-propose-classpath java-wrappers jq libelf-dev \ libffi-dev libncurses5-dev libncursesw5-dev libssl-dev libtool \ python python2.7-dev python3 python3-dev python3-distutils \ python3-setuptools rsync subversion swig time u-boot-tools \ unzip wget xsltproc zlib1g-dev bison
Create a new folder (for this example I'll be using a directory called RUTX_R found at my home directory) and extract the SDK archive inside it.
You can achieve this with drag and drop or by executing this command via Terminal:
Navigate to the "Downloads" folder:
cd ~/Downloads
Extract the tar.gz file:
tar -xzvf RUTX_R_GPL_00.07.05.X.tar.gz
This command will extract the contents of the RUTX_R_GPL_00.07.05.X.tar.gz file into the current directory, After running this command, you should find the extracted files in the same directory where you ran the command.
Note: don't forget to replace the file name and path in accordance with your own circumstances
Open a Terminal inside the SDK directory. You can change the directory in your current terminal (cd ~/RUTX_R/openwrt-gpl-ipq40xx.Linux-x86_64)
Once you open the Terminal, update the feeds:
./scripts/feeds update -a
Now you can compile a standard firmware by executing this command in the terminal:
make
If all is in order, the output should look something like this:
Note: the first time you compile a firmware file it may take up to 30 minutes before it is complete. Don't close the Terminal window up until then. Once it is finished, you will find the firmware in the ./bin/targets/ipq40xx/generic directory. It should contain a file openwrt-ipq40xx-qcom-ipq4018-rutx-squashfs-apps.bin, it can be used to upgrade your router's firmware via its web interface.
You can speed up this process by passing an extra argument -j. This argument then compiles the necessary packages in parallel. To know how much jobs you can pass to the compiling process execute this command in the terminal:
nproc
This commands output should be a number. This number tells how much processing units are available to the current process. Now execute this command in the terminal:
make -j<nproc_output>
Troubleshooting tips:
1. If you get error on first ‘make’, do ./scripts/feeds update -a once more.
2. Once you extract the SDK files, Rename rutos-ipq40xx-rutx-gpl to a different file name and move it to home directory.
3. Try running `make distclean` if you believe that your SDK installation is corrupt. This will recompile the firmware from scratch.
4. Allowing us to run command. “make -j<nproc_output> V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues.
Changing default settings
To create a firmware with different default settings, you must change the default in the config files, which are contained in /openwrt-gpl-ipq40xx.Linux-x86_64/package/. However, there is no unifying system regarding where one should look for config files related to specific services. Therefore, it is very important to acquaint yourself with the UCI system (RutOS configuration file system) in order to successfully navigate through the files:
- Click here for information on the configuration hierarchy
- Click here to find what configs are related to which services
In many cases you will find that service names as they are displayed in the router's WebUI are similar to the names of the programs responsible for these services. For instance, Firewall settings can be changed in the /openwrt-gpl-ipq40xx.Linux-x86_64/package/network/config/firewall/files directory. However, if you open the aforementioned directory, you will find that it contains four files:
As you can see from the image above, only one of the files holds the Firewall configuration, while other files contain scripts related to the service. This will be different for each case. For example, among Mobile Utilities files, which can be found in /openwrt-gpl-ipq40xx.Linux-x86_64/package/mobutils/src/, you will find even more items, including different config files which serve a different purpose:
Changing Default Password
To change the default device password, changes need to be made inside:
"RUTX_R_GPL_00.07.05/package/base-files/files/lib/preinit/84_set_password"
Change "admin01" to your password on line [ -z "$passwd" ] && passwd="$(mkpasswd admin01)"
After making changes and saving them to the directory, we may build compile using the following commands:
1- ./scripts/feeds update -a
2- make clean
3- Following that, we must execute the "nproc" command to determine the number of processors, and it will return a number, such as 1, allowing us to run command. “make -j1 V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues.
Changing Default IP Address
To modify the default IP address, you can make use of a dedicated menu in the firmware configuration, which is accessed through the "menuconfig" interface. To access this configuration menu, follow these steps from the root directory of your project: Open a terminal and execute the following command:
make menuconfig
After entering the "make menuconfig" command, it will launch a new interface known as the "OpenWrt Configuration." In this interface, navigate to the "Target Firmware options" section.
You will then be presented with the option to modify the Default IP address, allowing you to input your desired value. By default, it is set to (192.168.1.1).
You will then be presented with the option to modify the Default IP address, allowing you to input your desired value.
After making the desired changes to the Default IP address, you can then save those modifications.
After making changes and saving them to the directory, we may build compile using the following commands:
1- ./scripts/feeds update -a
2- make clean
3- Following that, we must execute the "nproc" command to determine the number of processors, and it will return a number, such as 1, allowing us to run command. “make -j1 V=sc” for verbose output. This way you will see more logs that may help to troubleshoot compilation issues.
The firmware can then be found in the directory listed below *Depends on the target*:
rutos-ath79-rut9-gpl>bin>targets>ath79>generic>tltFws>RUTX_R_GPL_00.07.05.3_WEBUI
file name: RUTX_R_GPL_00.07.05.3_WEBUI
Selecting packages
To select which packages should be compiled into the firmware is through a special menu called Kconfig. To enter the Kconfig, standing in your projects root directory execute this command in the terminal:
make menuconfig
After executing this command you should see a view like in the picture below.
To move around in the Kconfig use the arrows on the keyboard, space bar to select or to unselect the package, and enter key to enter sub directories of packages.
Note: Do not unselect any package if you do not know what you are doing.
- <*> - this symbol says that the package will be compiled an added to the firmware
- <M> - this symbol says that the package will be compiled but will not be added to the firmware
- < > - this symbols says that the package will not be compiled and will not be added to the firmware
By default all packages that were marked as to be compiled in the process, can be found separately from the firmware. Packages can be found in directory ~/RUT_X/openwrt-gpl-ipq40xx.Linux-x86_64/bin/packages/arm_cortex-a7_neon-vfpv4.
This directory also has five sub directories. Packages are categorized in these directories by there type.
Compiling a single package
If you ever need to compile a single package you do not need to compile the whole firmware. As an example we will try to compile a text editor called Nano.
- Open the Kconfig by executing this command in the terminal:
make menuconfig
- Navigate to the menu section of Nano text editor. It can be found under “Utilities→Editors”
- Select nano package
- Three times press the “Exit” entry
- Save the configuration by selecting “Yes” in the prompted window
- While standing in root directory of the project execute this command in the terminal:
make package/nano/compile
- The compiled package can be found in the directory ~/RUT_X/openwrt-gpl-ipq40xx.Linux-x86_64/bin/packages/arm_cortex-a7_neon-vfpv4/packages. Upload the nano install file into the router by executing this command in the terminal:
scp bin/packages/arm_cortex-a7_neon-vfpv4/packages/nano_4.3-1_arm_cortex-a7_neon-vfpv4.ipk root@<router_ip_addr>:/tmp
- Connect to your routers command line interface by executing this command in the therminal:
ssh root@<router_ip_addr>
- Change your directory to /tmp directory
- Install the nano text editor by executing this command in the terminal:
opkg install nano_4.3-1_arm_cortex-a7_neon-vfpv4.ipk
- Try out the nano text editor by executing this command:
nano example
Note: If the package that you want to compile isn't selected in the Kconfig, the install file of the package will not be created