User Tools

Site Tools


doc:howto:obtain.firmware.sdk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
doc:howto:obtain.firmware.sdk [2013/04/15 16:06]
mapisto Added hello world example links
doc:howto:obtain.firmware.sdk [2016/01/06 13:12] (current)
chtseac Escape double slashes
Line 1: Line 1:
 +====== Using the SDK ======
 +The [[wp>​Software_development_kit|SDK]] is a relocatable,​ precompiled OpenWrt [[wp>​Toolchain|toolchain]] suitable to [[wp>​Cross_compile|cross compile]] single [[wp>​User_space|userspace]] packages for a specific target without compiling the whole system from scratch.
  
 +Reasons for using the SDK are:
 +  * Compile custom software for a specific release while ensuring binary and feature compatibility
 +  * Compile newer versions of certain packages
 +  * Recompile existing packages with custom patches or different features
 +
 +===== Obtain SDK =====
 +You can either download an already compiled SDK, or compile it yourself by using the "make menuconfig"​ command.
 +
 +==== Download ====
 +You should find bz2-archives ready for download in the corresponding download directory:
 +
 +  * trunk SDK [[https://​downloads.openwrt.org/​snapshots/​trunk/​ar71xx/​generic/​OpenWrt-SDK-ar71xx-generic_gcc-4.8-linaro_musl-1.1.11.Linux-x86_64.tar.bz2|OpenWrt trunk x86-64 • ar71xx]]
 +  * stable SDK [[https://​downloads.openwrt.org/​barrier_breaker/​14.07/​brcm47xx/​generic/​OpenWrt-SDK-brcm47xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2| OpenWrt '​Barrier Breaker'​ x86-64 • brcm47xx]]
 +  * Legacy SDKs e.g.  [[http://​downloads.openwrt.org/​attitude_adjustment/​12.09/​brcm47xx/​generic/​OpenWrt-SDK-brcm47xx-for-linux-i486-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2| OpenWrt '​Attitude Adjustment'​ i686 • brcm47xx]], [[http://​downloads.openwrt.org/​backfire/​10.03.1/​ar71xx/​OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3%2bcs_uClibc-0.9.30.1.tar.bz2|OpenWrt '​Backfire'​ 10.03.1 • ar71xx]]
 +
 +==== Build SDK ====
 +After [[buildroot.exigence|Buildroot installation]] run [[build#​configuration]]
 +Choose your Target System and then
 +|''​[x] Build the OpenWrt SDK
 +''​|
 +After the compilation,​ you will find it in <build root>/​bin/<​arch>/​
 +
 +
 +===== Usage =====
 +By default the SDK ships with no package definitions.
 +Makefiles for packages to compile must be checked out from the OpenWrt repository and placed into the ''​package/''​ directory first.
 +
 +==== Obtain Definitions ====
 +Use the ''​svn export''​ command to obtain package definitions.
 +OpenWrt'​s Trunk package feed is located at ''​%%svn://​svn.openwrt.org/​openwrt/​packages%%'', ​
 +the [[https://​dev.openwrt.org/​browser/​packages|Trac browser]] can be used to find the appropriate subdirectory.
 +
 +The example below checks out the //nano// editor from the repository:
 +| ''​$ svn export %%svn://​svn.openwrt.org/​openwrt/​packages/​utils/​nano package/​nano%%
 +A    package/​nano
 +A    package/​nano/​Makefile
 +Exported revision 20365.''​ |
 +
 +Many packages require additional dependencies which can be found in the package Makefile:
 +
 +| ''​$ grep DEPENDS package/​nano/​Makefile ​
 +  DEPENDS:​=+libncurses''​ |
 +
 +If there are additional dependencies,​ those need to be fetched and compiled as well.
 +
 +
 +==== Compile Packages ====
 +After the Makefile is in place, the usual buildroot commands apply:
 +
 +  * ''​make package///​example///​download''​ - download the soures of //example//
 +  * ''​make package///​example///​prepare''​ - extract the sources, apply patches and download if necessary
 +  * ''​make package///​example///​compile''​ - compile //​example//,​ prepare and download if necessary
 +  * ''​make package///​example///​clean''​ - clean the sourcecode
 +  * ''​make package/​index''​ - build a repository index to make the output directory usable as local //opkg// source
 +
 +Some packages are built on host:
 +
 +| ''​$ make package///​example///​host/​{clean,​compile} V=99''​ |
 +
 +The common command to recompile a package //example// and enable verbose output is:
 +
 +| ''​$ make package///​example///​{clean,​compile} V=99''​ |
 +
 +After the compilation is finished, the generated .ipk files are placed in the bin directory.
 +
 +The output of make might contain ''​WARNING:​ your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!''​. That warning is misleading and wrong in the SDK case. Since everything is precompiled you cannot run oldconfig (see [[https://​forum.openwrt.org/​viewtopic.php?​id=43055|Why is the SDK configuration out of sync?]]).
 +
 +==== Example: existing package ====
 +The example below rebuilds //nano//.
 +
 +<​code>​$ svn export svn://​svn.openwrt.org/​openwrt/​packages/​utils/​nano package/​nano
 +A    package/​nano
 +A    package/​nano/​Makefile
 +Exported revision 20365.
 +$ grep DEPENDS package/​nano/​Makefile ​
 +  DEPENDS:​=+libncurses
 +$ svn export svn://​svn.openwrt.org/​openwrt/​trunk/​package/​libs/​ncurses package/​ncurses
 +A    package/​ncurses
 +A    package/​ncurses/​patches
 +A    package/​ncurses/​patches/​100-ncurses-5.6-20080112-urxvt.patch
 +A    package/​ncurses/​patches/​900-terminfo.patch
 +A    package/​ncurses/​patches/​101-ncurses-5.6-20080628-kbs.patch
 +A    package/​ncurses/​patches/​500-cross.patch
 +A    package/​ncurses/​Makefile
 +Exported revision 20365.
 +$ make package/​ncurses/​compile
 +Collecting package info: done
 + ​make[1] package/​ncurses/​compile
 + ​make[2] -C package/​ncurses compile
 +$ make package/​nano/​compile
 + ​make[1] package/​nano/​compile
 + ​make[2] -C package/​ncurses compile
 + ​make[2] -C package/​nano compile
 +$ make package/​index
 + ​make[1] package/​index
 +$ ls bin/​packages/​mipsel/​
 +libncurses_5.7-2_mipsel.ipk ​ nano_2.2.3-1_mipsel.ipk ​ Packages Packages.gz</​code>​
 +
 +==== Build your own packages ====
 +See [[doc/​devel/​packages|Creating packages]]
 +
 +===== Troubleshooting =====
 +
 +:!: Some SDK versions have bugs.
 +
 +Bug: BB SDK for BRCM2708: wants to compile with "​ccache_cc" ​
 +see https://​dev.openwrt.org/​ticket/​13949
 +
 +Bug: BB SDK for BRCM2708: static compilation broken
 +===== Links =====
 +
 +Archive : [[obtain.firmware.sdk.old]]