Jump to content

Template:Networking rutos software development kit software development kit instructions: Difference between revisions

(12 intermediate revisions by 5 users not shown)
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.
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__
__TOC__
==Introduction==
==Introduction==


This article contains instructions on how to utilize Teltonika SDK packages for RUT2xx, RUT850 and RUT9xx routers. The resources used in the provided examples are:
This article contains instructions on how to utilize Teltonika SDK packages for RUTx series routers. The resources used in the provided examples are:


<ul>
<ul>
     <li>A [[RUTx]] router</li>
     <li>A RUTOS supported router</li>
     <li>[http://releases.ubuntu.com/ Ubuntu 16.04 OS]</li>
     <li>[http://releases.ubuntu.com/ Ubuntu 18.04 OS]</li>
     <li>SDK version RUTX_R_00.02.01.1</li>
     <li>SDK version <b>R_00.07.03.x</b></li>
</ul>
</ul>


However, the examples apply to other routers, SDK versions and operating systems. In most cases the difference will only be that of a visual nature.
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.


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|Prerequisites]]" and "[[#Compiling_a_standard_firmware|Compiling a standard firmware]]" sections first as they contain information that will be necessary in order to understand some aspects of the other examples.
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|Prerequisites]]" and "[[#Compiling_a_standard_firmware|Compiling a standard firmware]]" sections first as they contain information that will be necessary in order to understand some aspects of the other examples.
Line 23: Line 25:


<ul>
<ul>
     <li>A PC, laptop or virtual machine running Linux OS (We recommend using Ubuntu 16.04 LTS)</li>
     <li>A PC, laptop or virtual machine running Linux OS (We recommend using Ubuntu 18.04 LTS)</li>
     <li>A RUTx series router RUTx08, RUTx09, RUTx10 or RUTx11</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>
     <li>An SDK intended for your router, which can be downloaded here: <b>[[Software Development Kit]]</b></li>
</ul>
</ul>
Line 34: Line 36:
  sudo apt update
  sudo apt update


  sudo apt install -y binutils binutils-gold build-essential bzip2 curl device-tree-compiler devscripts file flex fuse g++ gawk gcc gcc-multilib gengetopt gettext git groff libc6-dev libncurses5-dev libpcre3-dev libssl-dev libxml-parser-perl make ocaml ocaml-findlib ocaml-nox patch pkg-config python2.7 python-dev python-yaml sharutils subversion u-boot-tools unzip vim-common wget zlib1g-dev
  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_GPL</i> found at <i>~/Desktop/</i>) and extract the SDK archive inside it. You can achieve this with drag and drop or by executing this command via Terminal:
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. You can achieve this with drag and drop or by executing this command via Terminal:


  tar -xf ~/Downloads/RUTX_R_GPL_00.XX.YY.Y.tar.gz -C ~/Desktop/RUTX_R_GPL
  tar -xf ~/Downloads/RUTX_R_GPL_00.XX.YY.Y.tar.gz -C ~/RUTX_R


<b>Note</b>: don't forget to replace the file name and path in accordance with your own circumstances
<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 either change the directory in your current terminal (<i>cd ~/Desktop/RUTX_R_GPL/openwrt-gpl-ipq40xx.Linux-x86_64</i>) or open the directory, right click any white space and click <i>Open in Terminal</i>:
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


[[File:Networking_rutx_sdk_instructions_2.png|border|class=tlt-border|1100x1100px]]
Now you can compile a standard firmware by executing this command in the terminal:


Once you open the Terminal you can compile a standard firmware by executing the <i>make</i> command. If all is in order, the output should look something like this:
make


[[File:Networking_rutx_sdk_instructions_1.gif]]
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>two hours</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.
<b>Note</b>: the first time you compile a firmware file it may take up to <b>two hours</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]]


==Changing default settings==
==Changing default settings==
Line 68: Line 86:


[[File:Networking_rutx_sdk_instructions_4.png|border|class=tlt-border]]
[[File:Networking_rutx_sdk_instructions_4.png|border|class=tlt-border]]
==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]]