The--SDK of OpenWrt development

Source: Internet
Author: User

In order to achieve their own writing a program packaged into IPK, and able to run on openwrt purposes. I found some information on the Internet.

My reference is: How to do the development on the OpenWrt

Thank the Netizen's patient answer. Although there are ready-made steps, bloggers prefer to practice it yourself and write down their own practice process.


First step: Build the SDK

Make Menuconfig Select "Build the OpenWRT SDK"

In the trunk directory, do the following:

$ make Menuconfig

Select the corresponding "Target System" with "target profile" and choose "Build the OpenWrt SDK".


Then Save, exit. Make one more time.

$ make v=99

After make is complete, the SDK's compressed file is generated in the bin/ar71xx/directory:

openwrt-sdk-ar71xx-generic_gcc-4.8-linaro_uclibc-0.9.33.2.linux-i686.tar.bz2

Step Two: Install the SDK

The openwrt-sdk-ar71xx-generic_gcc-4.8-linaro_uclibc-0.9.33.2.linux-i686.tar.bz2 generated above is Copy it to another path (meaning it can not be in the OpenWrt source path), and then extract it.

For example, I put it under the ~/workspace/openwrt/path:

$ CP bin/ar71xx/openwrt-sdk-ar71xx-generic_gcc-4.8-linaro_uclibc-0.9.33.2.linux-i686.tar.bz2 ~/Workspace/OpenWRT$ CD ~/workspace/openwrt$ tar jxvf openwrt-sdk-ar71xx-generic_gcc-4.8-linaro_uclibc-0.9.33.2.linux-i686.tar.bz2

The openwrt-sdk-ar71xx-generic_gcc-4.8-linaro_uclibc-0.9.33.2.linux-i686 directory is generated under the ~/workspace/openwrt/path.

It is said that this directory structure is similar to the OPENWRT source directory structure.


Step three: Create a project program

In fact, this can be any of the programs we want to join, libraries and so on. Here, take Helloword as an example.

Under any path, create a Helloword project. For example, this is still under the ~/workspace/opewrt directory.

$ cd ~/workspace/openwrt$ mkdir helloword$ cd helloword$ touch helloword.c Makefile

The Helloword directory is created under the ~/workspace/openwrt/directory and generates HELLOWORD.C and makefile files.

The following are the contents of HELLOWORLD.C:

#include <stdio.h>int main () {printf ("This is my Hello word!\n"); return 0;}

Content of Makefile:

HELLOWORLD:HELLOWORLD.O $ (CC) $ (ldflags) Helloworld.o-o HELLOWORLDHELLOWORLD.O:HELLOWORLD.C $ (cc) $ (CFLAGS)-C HELLOWORLD.CCLEAN:RM *.O HelloWorld

First, make sure that the program is OK, and that it can be properly compiled locally. In order to test, you can make a bit in-place to see if the program itself has problems.

This program is simple, I made a bit, OK, then run a bit, normal.


Fourth Step: Add the project to OpenWrt's packages

Tomorrow continues ~



The--SDK of OpenWrt development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.