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 [2015/05/02 08:36] (current)
theoradicus [Troubleshooting]
Line 12: Line 12:
 ==== Download ==== ==== Download ====
 You should find bz2-archives ready for download in the corresponding download directory: You should find bz2-archives ready for download in the corresponding download directory:
-  * e.g. [[http://​downloads.openwrt.org/​backfire/​10.03.1-rc5/​ar71xx/​OpenWrt-SDK-ar71xx-for-Linux-i686-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2|OpenWrt '​Backfire'​ 10.03.1-RC5 • ar71xx]] 
  
-==== Create one ==== +  * trunk SDK [[http://​downloads.openwrt.org/​snapshots/​trunk/​ar71xx/​OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2|OpenWrt trunk x86-64 • ar71xx]] 
-->[[build#​configuration]] +  * 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]] 
-Choose ​you Target System and then+  * 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 |''​[x] Build the OpenWrt SDK
 ''​| ''​|
-After the compilation,​ you will find in  <build root>/​bin/<​arch>/​+After the compilation,​ you will find it in <build root>/​bin/<​arch>/​
  
  
Line 53: Line 57:
   * ''​make package///​example///​clean''​ - clean the sourcecode   * ''​make package///​example///​clean''​ - clean the sourcecode
   * ''​make package/​index''​ - build a repository index to make the output directory usable as local //opkg// source   * ''​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: The common command to recompile a package //example// and enable verbose output is:
Line 71: Line 79:
 $ grep DEPENDS package/​nano/​Makefile ​ $ grep DEPENDS package/​nano/​Makefile ​
   DEPENDS:​=+libncurses   DEPENDS:​=+libncurses
-$ svn export svn://​svn.openwrt.org/​openwrt/​trunk/​package/​ncurses package/​ncurses+$ svn export svn://​svn.openwrt.org/​openwrt/​trunk/​package/libs/ncurses package/​ncurses
 A    package/​ncurses A    package/​ncurses
 A    package/​ncurses/​patches A    package/​ncurses/​patches
Line 95: Line 103:
 ==== Build your own packages ==== ==== Build your own packages ====
 See [[doc/​devel/​packages|Creating packages]] See [[doc/​devel/​packages|Creating packages]]
-===== from Oldwiki ===== 
- 
-{{page>​meta:​infobox:​outdated&​noheader&​nofooter&​noeditbtn}} 
- 
-====== oldwiki: About the OpenWrt SDK ====== 
-This howto is for people who would like to port/​package applications to OpenWrt with the OpenWrt Software Development Kit (SDK). 
- 
-When using the SDK you don't require a full buildroot. The SDK is a stripped down version of it, which includes the toolchain and all the required library and header files to cross-compile applications for OpenWrt. 
- 
-====== Requirements ====== 
-  * a recent GNU/Linux distribution 
-  * GNU Make (at least 3.80 with the Debian patch) 
-  * wget 
-  * patch 
- 
-These packages suffice for the "Hello world" program described below 
- 
-====== Using the OpenWrt SDK ====== 
-**TIP:** Before you begin porting your own package to OpenWrt, check if it has not been already done by someone else. To check that [[http://​dev.openwrt.org/​browser/​trunk/​package/​|browse the subversion repository]] of the development version in your web browser and see if the package is already there. Don't do the work twice. 
- 
-Let's start with porting and packaging the well known "Hello world" program as an example. 
- 
-You can download an existing example here: https://​forum.openwrt.org/​viewtopic.php?​pid=198460. Another useful resource is http://​fleshandmachines.wordpress.com/​2011/​08/​22/​openwrt-cc-programing/​. ​ 
- 
-===== Obtaining and installing the SDK ===== 
-The SDK can be downloaded from http://​downloads.openwrt.org/​whiterussian/​newest/​. 
- 
-Download it into your home directory (don't use the root account) and untar the tarball. After that change into the new directory. 
- 
-<​code>​ 
-cd ~ 
-wget http://​downloads.openwrt.org/​whiterussian/​newest/​OpenWrt-SDK-Linux-i686-1.tar.bz2 
-bzcat OpenWrt-SDK-Linux-i686-1.tar.bz2 | tar -xvf - 
-cd ~/​OpenWrt-SDK-Linux-i686-1 
-</​code>​ 
- 
-===== Creating the directories ===== 
-Create the following directories:​ 
- 
-<​code>​ 
-cd ~/​OpenWrt-SDK-Linux-i686-1 
-mkdir -p package/​helloworld/​ipkg 
-mkdir -p package/​helloworld/​patches 
-</​code>​ 
- 
-Directories and their contents: 
- 
-<​code>​ 
-#!CSV 
-Directory; Description 
-ipkg; Control file which contains information about your package 
-patches; Patch files for example 100-foo.patch 
-</​code>​ 
- 
-**TIP:** To compile more than one package in a special order do: 
- 
-<​code>​ 
-cd ~/​OpenWrt-SDK-Linux-i686-1 
-mkdir -p package/​100-packagename/​ipkg 
-mkdir -p package/​100-packagename/​patches 
-mkdir -p package/​200-packagename/​ipkg 
-mkdir -p package/​200-packagename/​patches 
-</​code>​ 
- 
-===== Creating the required files ===== 
-**TIP:** If you intend to 'copy & paste' the text from this Wiki to create files on your system, then use the Unix command <​code>​unexpand</​code>​ 
- to translate the leading spaces into tabs. 
- 
-<​code>​ 
-unexpand --first-only - >​package/​helloworld/​Config.in 
-</​code>​ 
- 
- 
-After pasting it into a text editor, press <​code>​ENTER</​code>​ 
- and then <​code>​CTRL-D</​code>​ 
- keys to save the file. 
- 
-You can also create your own files in the <​code>​package/​helloworld</​code>​ 
- ​directory (for example config files). That files you can access in your <​code>​package/​helloworld/​Makefile</​code>​ 
- with <​code>​./​filename</​code>​ 
- and copy it to your <​code>​$(PKG_INSTALL_DIR)</​code>​ 
- ​directory. 
- 
-==== package/​helloworld/​Config.in ==== 
-<​code>​ 
-config BR2_PACKAGE_HELLO 
-        prompt "​hello............................. The classic greeting, and a good example"​ 
-        tristate 
-        default m if CONFIG_DEVEL 
-        help 
-              The GNU hello program produces a familiar, friendly greeting. ​ It 
-              allows non-programmers to use a classic computer science tool which 
-              would otherwise be unavailable to them. 
-               * 
-              Seriously, though: this is an example of how to do a Debian package. 
-              It is the Debian version of the GNU Project'​s `hello world' program 
-              (which is itself an example for the GNU Project). 
-              http://​www.wheretofindpackage.tld 
-</​code>​ 
- 
- 
-You need to create a Config.in file. It identifies the package name. 
-In the above example BR2_PACKAGE_HELLO identifes that this is a '​BR2'​(??​) formatted '​PACKAGE'​ whose name is '​HELLO'​. The final executable is '​hello'​. 
- 
-==== package/​helloworld/​Makefile ==== 
-The Makefile determines the way the software package is shipped. Basically we can divide the software into 2 main categories : 
- 
-  * C (or ANSI-C) programs 
-   * shipped with configure script 
-   * shipped with Makefile script (with references to gcc or $(CC) ) 
-   * sources files only 
-  * C++ programs 
-   * potentially uClibc++ linkables 
-   * not uClibc++ linkables 
-**TIP:** Use the <​code>​md5sum</​code>​ 
- ​command to create the <​code>​PKG_MD5SUM</​code>​ 
- from the original tarball. Use <​code>​@SF/​hello</​code>​ 
- ​(choose a and expanded random SourceForge mirror) for the <​code>​PKG_SOURCE_URL</​code>​ 
- when your program has a download location on SourceForge. 
- 
-If PKG_SOURCE_URL and PKG_SOURCE are correctly identified, then the file will be downloaded into the ~/​OpenWrt-SDK-Linux-i686-1/​dl/​ directory. It will be expanded into the ~/​OpenWrt-SDK-Linux-i686-1/​build_mipsel/​ directory for compilation and processing. 
- 
- 
-=== Sample Makefile for C/C++ programs shipped with configure script === 
-<​code>​ 
-include $(TOPDIR)/​rules.mk 
-PKG_NAME:​=hello 
-PKG_VERSION:​=2.1.1 
-PKG_RELEASE:​=1 
-PKG_MD5SUM:​=70c9ccf9fac07f762c24f2df2290784d 
-PKG_SOURCE_URL:​=ftp://​ftp.cs.tu-berlin.de/​pub/​gnu/​hello \ 
-        http://​mirrors.sunsite.dk/​gnu/​hello \ 
-        http://​ftp.gnu.org/​gnu/​hello 
-PKG_SOURCE:​=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
-PKG_CAT:​=zcat 
-PKG_BUILD_DIR:​=$(BUILD_DIR)/​$(PKG_NAME)-$(PKG_VERSION) 
-PKG_INSTALL_DIR:​=$(PKG_BUILD_DIR)/​ipkg-install 
-include $(TOPDIR)/​package/​rules.mk 
-$(eval $(call PKG_template,​HELLO,​$(PKG_NAME),​$(PKG_VERSION)-$(PKG_RELEASE),​$(ARCH))) 
-$(PKG_BUILD_DIR)/​.configured:​ $(PKG_BUILD_DIR)/​.prepared 
-        (cd $(PKG_BUILD_DIR);​ \ 
-                $(TARGET_CONFIGURE_OPTS) \ 
-                CFLAGS="​$(TARGET_CFLAGS)"​ \ 
-                CPPFLAGS="​-I$(STAGING_DIR)/​usr/​include -I$(STAGING_DIR)/​include"​ \ 
-                LDFLAGS="​-L$(STAGING_DIR)/​usr/​lib -L$(STAGING_DIR)/​lib"​ \ 
-                 ​*/​configure \ 
-                        --target=$(GNU_TARGET_NAME) \ 
-                        --host=$(GNU_TARGET_NAME) \ 
-                        --build=$(GNU_HOST_NAME) \ 
-                        --prefix=/​usr \ 
-                        --without-libiconv-prefix \ 
-                        --without-libintl-prefix \ 
-                        --disable-nls \ 
-        ); 
-        ## Add software specific configurable options above 
-        ## See : ./configure --help 
-        touch $@ 
-$(PKG_BUILD_DIR)/​.built:​ 
-        rm -rf $(PKG_INSTALL_DIR) 
-        mkdir -p $(PKG_INSTALL_DIR)/​usr/​bin 
-        $(MAKE) -C $(PKG_BUILD_DIR)/​src \ 
-                $(TARGET_CONFIGURE_OPTS) \ 
-                prefix="​$(PKG_INSTALL_DIR)/​usr"​ 
-        $(CP) $(PKG_BUILD_DIR)/​src/​hello $(PKG_INSTALL_DIR)/​usr/​bin 
-        touch $@ 
-$(IPKG_HELLO):​ 
-        install -d -m0755 $(IDIR_HELLO)/​usr/​bin 
-        $(CP) $(PKG_INSTALL_DIR)/​usr/​bin/​hello $(IDIR_HELLO)/​usr/​bin 
-        $(RSTRIP) $(IDIR_HELLO) 
-        $(IPKG_BUILD) $(IDIR_HELLO) $(PACKAGE_DIR) 
-mostlyclean:​ 
-        make -C $(PKG_BUILD_DIR) clean 
-        rm $(PKG_BUILD_DIR)/​.built 
-</​code>​ 
- 
-=== Sample Makefile for C/C++ software shipped with a Makefile containing references to gcc or $(CC) === 
-If you Makefile contains harcoded "​gcc"​ commands, then you will have to patch the makefile and replace gcc with $(CC) in order to define at "make time" the cross-compiler to use. 
- 
-/!\ **Note this Makefile is provided as an example only; it will not compile** 
- 
-<​code>​ 
-include $(TOPDIR)/​rules.mk 
-PKG_NAME:​=hello 
-PKG_VERSION:​=2.1.1 
-PKG_RELEASE:​=1 
-PKG_MD5SUM:​=70c9ccf9fac07f762c24f2df2290784d 
-PKG_SOURCE_URL:​=ftp://​ftp.cs.tu-berlin.de/​pub/​gnu/​hello \ 
-        http://​mirrors.sunsite.dk/​gnu/​hello \ 
-        http://​ftp.gnu.org/​gnu/​hello 
-PKG_SOURCE:​=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
-PKG_CAT:​=zcat 
-PKG_BUILD_DIR:​=$(BUILD_DIR)/​$(PKG_NAME)-$(PKG_VERSION) 
-PKG_INSTALL_DIR:​=$(PKG_BUILD_DIR)/​ipkg-install 
-include $(TOPDIR)/​package/​rules.mk 
-$(eval $(call PKG_template,​HELLO,​$(PKG_NAME),​$(PKG_VERSION)-$(PKG_RELEASE),​$(ARCH))) 
-$(PKG_BUILD_DIR)/​.configured:​ $(PKG_BUILD_DIR)/​.prepared 
-        #Since there is no configure script, we can directly go to the building step 
-        touch $@ 
-$(PKG_BUILD_DIR)/​.built:​ 
-        rm -rf $(PKG_INSTALL_DIR) 
-        mkdir -p $(PKG_INSTALL_DIR)/​usr/​bin 
-        #Note here that we pass cross-compiler as default compiler to use 
-        $(MAKE) -C $(PKG_BUILD_DIR)/​src \ 
-                CC=$(TARGET_CC) \ 
-                $(TARGET_CONFIGURE_OPTS) \ 
-                prefix="​$(PKG_INSTALL_DIR)/​usr"​ 
-        $(CP) $(PKG_BUILD_DIR)/​src/​hello $(PKG_INSTALL_DIR)/​usr/​bin 
-        touch $@ 
-$(IPKG_HELLO):​ 
-        install -d -m0755 $(IDIR_HELLO)/​usr/​bin 
-        $(CP) $(PKG_INSTALL_DIR)/​usr/​bin/​hello $(IDIR_HELLO)/​usr/​bin 
-        $(RSTRIP) $(IDIR_HELLO) 
-        $(IPKG_BUILD) $(IDIR_HELLO) $(PACKAGE_DIR) 
-mostlyclean:​ 
-        make -C $(PKG_BUILD_DIR) clean 
-        rm $(PKG_BUILD_DIR)/​.built 
-</​code>​ 
- 
-=== Sample Makefile for C/C++ programs without makefiles (usually one or two source files) === 
-/!\ **Note this Makefile is provided as an example only; it will not compile** 
- 
-<​code>​ 
-include $(TOPDIR)/​rules.mk 
-PKG_NAME:​=hello 
-PKG_VERSION:​=2.1.1 
-PKG_RELEASE:​=1 
-PKG_MD5SUM:​=70c9ccf9fac07f762c24f2df2290784d 
-PKG_SOURCE_URL:​=ftp://​ftp.cs.tu-berlin.de/​pub/​gnu/​hello \ 
-        http://​mirrors.sunsite.dk/​gnu/​hello \ 
-        http://​ftp.gnu.org/​gnu/​hello 
-PKG_SOURCE:​=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
-PKG_CAT:​=zcat 
-PKG_BUILD_DIR:​=$(BUILD_DIR)/​$(PKG_NAME)-$(PKG_VERSION) 
-PKG_INSTALL_DIR:​=$(PKG_BUILD_DIR)/​ipkg-install 
-include $(TOPDIR)/​package/​rules.mk 
-$(eval $(call PKG_template,​HELLO,​$(PKG_NAME),​$(PKG_VERSION)-$(PKG_RELEASE),​$(ARCH))) 
-$(PKG_BUILD_DIR)/​.configured:​ $(PKG_BUILD_DIR)/​.prepared 
-        #Since there is no configure script, we can directly go to the building step 
-        touch $@ 
-$(PKG_BUILD_DIR)/​.built:​ 
-        rm -rf $(PKG_INSTALL_DIR) 
-        mkdir -p $(PKG_INSTALL_DIR)/​usr/​bin 
-        $(TARGET_CC) $(PKG_BUILD_DIR)/​src/​$(PKG_NAME).c -o $(PKG_BUILD_DIR)/​$(PKG_NAME) ## -lyourlib #Note we directly call the cross-compiler and define its output 
-        $(CP) $(PKG_BUILD_DIR)/​src/​hello $(PKG_INSTALL_DIR)/​usr/​bin 
-        touch $@ 
-$(IPKG_HELLO):​ 
-        install -d -m0755 $(IDIR_HELLO)/​usr/​bin 
-        $(CP) $(PKG_INSTALL_DIR)/​usr/​bin/​hello $(IDIR_HELLO)/​usr/​bin 
-        $(RSTRIP) $(IDIR_HELLO) 
-        $(IPKG_BUILD) $(IDIR_HELLO) $(PACKAGE_DIR) 
-mostlyclean:​ 
-        make -C $(PKG_BUILD_DIR) clean 
-        rm $(PKG_BUILD_DIR)/​.built 
-</​code>​ 
- 
-=== Sample Makefile for C++ shipped with configure script, and uClibc++ linkables === 
-/!\ **Note this Makefile is provided as an example only; it will not compile** 
- 
-<​code>​ 
-include $(TOPDIR)/​rules.mk 
-PKG_NAME:​=hello 
-PKG_VERSION:​=2.1.1 
-PKG_RELEASE:​=1 
-PKG_MD5SUM:​=70c9ccf9fac07f762c24f2df2290784d 
-PKG_SOURCE_URL:​=ftp://​ftp.cs.tu-berlin.de/​pub/​gnu/​hello \ 
-        http://​mirrors.sunsite.dk/​gnu/​hello \ 
-        http://​ftp.gnu.org/​gnu/​hello 
-PKG_SOURCE:​=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
-PKG_CAT:​=zcat 
-PKG_BUILD_DIR:​=$(BUILD_DIR)/​$(PKG_NAME)-$(PKG_VERSION) 
-PKG_INSTALL_DIR:​=$(PKG_BUILD_DIR)/​ipkg-install 
-include $(TOPDIR)/​package/​rules.mk 
-$(eval $(call PKG_template,​HELLO,​$(PKG_NAME),​$(PKG_VERSION)-$(PKG_RELEASE),​$(ARCH))) 
-$(PKG_BUILD_DIR)/​.configured:​ $(PKG_BUILD_DIR)/​.prepared 
-        (cd $(PKG_BUILD_DIR);​ \ 
-                $(TARGET_CONFIGURE_OPTS) \ 
-                CFLAGS="​$(TARGET_CFLAGS)"​ \ 
-                CPPFLAGS="​-I$(STAGING_DIR)/​usr/​include -I$(STAGING_DIR)/​include"​ \ 
-                LDFLAGS="​-L$(STAGING_DIR)/​usr/​lib -L$(STAGING_DIR)/​lib"​ \ 
-                 ​*/​configure \ 
-                        CXXFLAGS="​$(TARGET_CFLAGS) -fno-builtin -fno-rtti -nostdinc++"​ \ 
-                        CPPFLAGS="​-I$(STAGING_DIR)/​usr/​include -I$(STAGING_DIR)/​include"​ \ 
-                        LDFLAGS="​-nodefaultlibs -L$(STAGING_DIR)/​usr/​lib -L$(STAGING_DIR)/​lib"​ \ #do not use default libraries since we want uClibc++ linking 
-                        LIBS="​-luClibc++ -lc -lm -lgcc" \ # You may need to add other libraries : lpcap, lssl ... # 
-                        --target=$(GNU_TARGET_NAME) \ 
-                        --host=$(GNU_TARGET_NAME) \ 
-                        --build=$(GNU_HOST_NAME) \ 
-                        --prefix=/​usr \ 
-                        --without-libiconv-prefix \ 
-                        --without-libintl-prefix \ 
-                        --disable-nls \ 
-        ); 
-        ## Add software specific configurable options above 
-        ## See : ./configure --help 
-        touch $@ 
-$(PKG_BUILD_DIR)/​.built:​ 
-        rm -rf $(PKG_INSTALL_DIR) 
-        mkdir -p $(PKG_INSTALL_DIR)/​usr/​bin 
-        $(MAKE) -C $(PKG_BUILD_DIR)/​src \ 
-                $(TARGET_CONFIGURE_OPTS) \ 
-                prefix="​$(PKG_INSTALL_DIR)/​usr"​ 
-        $(CC) $(PKG_BUILD_DIR)/​src/​hello $(PKG_INSTALL_DIR)/​usr/​bin 
-        touch $@ 
-$(IPKG_HELLO):​ 
-        install -d -m0755 $(IDIR_HELLO)/​usr/​bin 
-        $(CP) $(PKG_INSTALL_DIR)/​usr/​bin/​hello $(IDIR_HELLO)/​usr/​bin 
-        $(RSTRIP) $(IDIR_HELLO) 
-        $(IPKG_BUILD) $(IDIR_HELLO) $(PACKAGE_DIR) 
-mostlyclean:​ 
-        make -C $(PKG_BUILD_DIR) clean 
-        rm $(PKG_BUILD_DIR)/​.built 
-</​code>​ 
- 
-==== package/​helloworld/​ipkg/​hello.control ==== 
-The control file, as you might have guessed, controls the package information reported by ipkg. 
- 
-Anyone familiar with Debian packaging will be aware of the format - a deeper description than provided here is available in the [[http://​handhelds.org/​moin/​moin.cgi/​BuildingIpkgs|ipkg documentation]]. 
- 
-<​code>​ 
-Package: hello 
-Priority: optional 
-Section: misc 
-Description:​ The GNU hello world program 
-</​code>​ 
- 
-The following fields are available: 
- 
-  * **Package** - should be the package name, as in the Makefile. 
- ​**Priority** - should be set to //​optional//​ for almost all packages. 
- ​**Section** - indicates the type of package - useful sections include //comm//, //​editors//,​ //​graphics//,​ //libs//, //net//, //text//, //web//, or if you can't decide, //misc//. 
- ​**Description** - a short description of the package. (You can include a longer description here in a similar manner to the help text in Config.in. Start a new line after the short description,​ and use a line containing a single full stop ('​.'​) as a replacement for blank lines. 
- ​**Depends** (not in the example above) - a list of package names that this package //​requires//​ to operate. Use package names without versions here where possible (e.g. //​openssh-client//​). 
- 
-Note: had to modify package/​rules.mk changing ./ipkg/$(2) to the real directory ./ did not work for me 
-==== package/​helloworld/​patches/​100-hello.patch ==== 
-This example applies a Debian patch, which isn't essential for (so you can skip this point). 
- 
-Other Linux and free UNIX distributions are often an excellent source of patches for non-portable programs. You might like to try searching for packages from [[http://​packages.ubuntu.com/​dapper/​source/​|Ubuntu]],​ [[http://​sources.gentoo.org/​|Gentoo]],​ or [[http://​www.freshports.org/​|FreeBSD'​s Ports]]. 
- 
-<​code>​ 
-cd package/​helloworld/​patches 
-wget http://​ftp.debian.org/​debian/​pool/​main/​h/​hello/​hello_2.1.1-4.diff.gz 
-gunzip hello_2.1.1-4.diff.gz 
-mv hello_2.1.1-4.diff 100-hello.patch 
-</​code>​ 
- 
-**TIP:** You can apply as many patches as you like. To apply them in a special order name them like: 
- 
-<​code>​ 
-100-xxx.patch 
-200-xxx.patch 
-</​code>​ 
- 
-===== Compile the package ===== 
-The <​code>​make</​code>​ 
- ​command below compiles every package that you have created in the <​code>​package</​code>​ 
- ​directory. 
- 
-<​code>​ 
-cd ~/​OpenWrt-SDK-Linux-i686-1 
-make clean && make world 
-</​code>​ 
- 
- 
-Note that there is a fault in the default package/​rules.mk file. There is "​.."​ following the "​$(PKG_BUILD_DIR)/"​ which causes the files to be extracted to the wrong directory. Here is the corrected version: 
-<​code>​ 
-ifneq ($(strip $(PKG_CAT)),​) 
-$(PKG_BUILD_DIR)/​.prepared:​ $(DL_DIR)/​$(PKG_SOURCE) 
- rm -rf $(PKG_BUILD_DIR) 
- mkdir -p $(PKG_BUILD_DIR) 
- $(PKG_CAT) $(DL_DIR)/​$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/​ $(TAR_OPTIONS) 
- if [ -d ./patches ]; then \ 
- $(PATCH) $(PKG_BUILD_DIR) ./patches ; \ 
- fi 
- touch $(PKG_BUILD_DIR)/​.prepared 
-endif 
-</​code>​ 
- 
-**NOTE:** If you are using GNU make 3.80 (current "​latest"​) and get a "​virtual memory exhausted"​ message while making, see [[http://​gamecontractor.org/​Make|this page]]. 
- 
-For Slackware users there is a fixed make package [[http://​internetghetto.org/​files/​index.php?​download=./​make-fix/​make-fixed-3.80-i386-1.tgz|here]] and sources + patch are [[http://​internetghetto.org/​files/​index.php?​dir=./​make-fix/​orig/​|here]]. 
- 
-When the compiling is finished you have a ready to use ipkg package for OpenWrt in the <​code>​~/​OpenWrt-SDK-Linux-i686-1/​bin/​packages</​code>​ 
- ​directory. 
- 
-<​code>​ 
-cd bin/​packages;​ ls -al hello_2.1.1-1_mipsel.ipk 
--rw-r--r-- ​ 1 openwrt-dev openwrt-dev 3976 Sep 14 13:03 hello_2.1.1-1_mipsel.ipk 
-</​code>​ 
- 
-====== Contribute your new ported program ====== 
-When you like you can contribute your program/​package to the OpenWrt community. It may be included in further versions of OpenWrt. 
- 
-To do this create a patch from your <​code>​package/</​code>​ 
- ​directory with: 
- 
-<​code>​ 
-cd ~/​OpenWrt-SDK-Linux-i686-1 
-diff -ruN package/​.orig package/ > -.patch 
-</​code>​ 
- 
-Once you have created a patch [[https://​dev.openwrt.org/​newticket|open a ticket]] and submit your new package (the patch). 
- 
-====== Native Development ====== 
-You need 150Mb storage unit (USB or SD Card) 
- 
-- Download the file [[http://​www.uclibc.org/​downloads/​root_fs_mipsel.ext2.bz2|Native Mipsel Toolchain]] (24Mb) 
- 
-- Bunzip2 (120mb) it to the storage unit in a ext2 partition. 
- 
-- unmount partition 
- 
-- Execute this script, I have it at /​sbin/​devel.sh 
- 
-<​code>​ 
-#!/bin/sh 
-# Kill unusefull tasks (uncoment it) we need memory 
-#killall logger 
-#killall syslogd 
-#killall telnetd 
-#killall crond 
-#killall klogd 
-#killall udhcpc 
-#killall httpd 
-#rmmod ext3 
-#rmmod jbd 
-#My SD card have 2 partitions 1.ext2 ​ 2.swap 
-mount /​dev/​mmc/​disc0/​part1 /mnt -o noatime async 
-# Swap for large sources. I have 30Mb 
-#swapoff -a 
-#​mkswap ​ /​dev/​mmc/​disc0/​part2 
-#​swapon ​ /​dev/​mmc/​disc0/​part2 
-mount -o move /tmp /mnt/tmp 
-echo " *** exit *** to back - Para volver al sistema"​ 
-chroot /mnt/ /bin/ash - 
-echo " *** Me are here again - De vuelta al sistema original ***" 
-mount -o move /mnt/tmp/ /tmp/ 
-umount /mnt 
-</​code>​ 
- 
-- Go /home 
- 
-- download the source. Example: [[http://​www.didiwiki.org/​sources/​didiwiki-0.5.tar.gz|Didiwiki-0.5.tar.gz]] from http://​www.didiwiki.org 
- 
-- tar -xvzf didiwiki-0.5.tar.gz 
- 
-- cd didiwiki-0.5 
- 
-- configure ​    (1 minute) 
- 
-- make          (1 minute) 
- 
-- You have your new Binary in the SRC directory (didiwiki) 
- 
-- copy it to the /tmp directori 
  
-- type exit+===== Troubleshooting =====
  
-You have the binary in /tmp directorycopy it to /usr/bin+:!: Some SDK versions ​have bugs.
  
-The result [[http://gepage.googlepages.com/didiwiki.mipsel.binary.gz|didiwiki.mipsel.binary.gz]] a small wiki for our router at 8000 port. If you don't use storage unit, you must create /home to store new pages. /​home/​.didiwiki/*+Bug: BB SDK for BRCM2708: wants to compile with "​ccache_cc"​  
 +see https://dev.openwrt.org/ticket/13949
  
-====== Links =====+Bug: BB SDK for BRCM2708: static compilation broken 
-You can find an useful reference for the packaging process in nbd's paper to the '​OpenWrt Hacking'​ talk on the 22C3: \\ - http://​events.ccc.de/​congress/​2005/​fahrplan/​attachments/​567-Paper_HackingOpenWRT.pdf+===== Links =====
  
-Full buildroot documentation (for compiling kernel modules and such things, for the rest the SDK should be used) \\ - http://downloads.openwrt.org/​docs/​buildroot-documentation.html+Archive ​[[obtain.firmware.sdk.old]]
doc/howto/obtain.firmware.sdk.1366034779.txt.bz2 · Last modified: 2013/04/15 16:06 by mapisto