[Openwrt Project Development Notes]: openwrt platform construction (1)

Source: Internet
Author: User

Recently, I started to design the IOT gateway for the openwrt platform. The idea is a bit messy. I recorded and sorted it through notes.

Disclaimer: In this article, I have integrated some content from the Internet, so the source is unknown. I apologize to the author of the original article!

----------------------------------------------------- (Split line )-------------------------------------------------------

I. Reasons for choosing the openwrt Platform

The traditional router firmware is officially provided. These firmware files are not open-source, and the functions of these routers are also relatively simple, and it is difficult to meet the ever-changing smart home needs. Therefore, a third-party firmware platform must be considered when building the IOT core.

Openwrt, DD-WRT, and tomato are three of the most famous third-party router firmware platforms. Of course there are other minor versions, and a lot of modified firmware versions derived from these three major firmware versions, I will not go into detail here.

The reason for choosing openwrt instead of DD-WRT or tomato is as follows:

1. DD-WRT: Three firmware platform third-party software support the most abundant one platform.

The support for new routers is also very rapid. However, it is because of the addition of a variety of software or tools, resulting in unstable DD-WRT system, there are often bugs, making the user experience unfriendly. Bugs that have been fixed in a version are often encountered during the next version check, which is a headache for developers.

In addition, the DD-WRT for wireless signal processing capabilities are weak, QoS function is more by many players. (QoS is important because smart home requires multiple devices to be connected at the same time and traffic conflicts may occur between different devices)

2. Tomato: the official tomato firmware is the most stable among the three platforms.

Tomato is relatively closed and does not provide sufficient support for new routers, especially for the atheros master. So I gave up tomato.

3. openwrt: The most extensible among the three major firmware versions.

For the version of the control is more rigorous, usually in the past appeared in the new version of the Bug rarely appear, in the stability compared with the DD-WRT has greatly improved.

Openwrt optimizes QoS functions, and its performance is comparable to that of tomato.

Openwrt is based on Linux and is suitable for developers for secondary development. (In addition, the firmware of openwrt has many features that far exceed the functions of the router itself, such as samba local area network file sharing, transmission offline download, ushare, UPnP, etc ), this is exactly what I want !!

Of course, openwrt itself web, Luci interface is ugly, the system settings are not convenient DD-WRT, ease of use is not very good. (This problem can be improved through third-party software. It is not a problem for me)

4. I did not go into details about the firmware of other platforms (I declare that the firmware of other platforms is not bad, but it is easy to develop and the usage of general-purpose firmware is higher, problems encountered during development are also easier to find ).

 

2. openwrt Platform Construction

1. Before building the platform, you need to describe the following points:

The so-called platform construction includes not only firmware burning and writing, but also development, compilation and debugging environments.

The openwrt platform is based on Linux and supports Virtual Machine installation. For those who do not have any devices at hand, you can install the Virtual Machine (the graphic interface is available on the wood and requires command line control ).

2. openwrt development environment building process (only list the environment I have set upAtheros 9344For example ):

(1) Operating System: ubuntu12.04. (The version is a little old. We recommend that you use a version later ).

(2) Build an openwrt development environment under Ubuntu:

Install the dependency Library:

apt-get install g++apt-get install libncurses5-dev apt-get install zlib1g-dev apt-get install bison apt-get install flex apt-get install unzip apt-get install autoconf apt-get install gawk apt-get install make apt-get install gettext apt-get install gccapt-get install binutils apt-get install patch apt-get install bzip2 apt-get install libz-dev apt-get install asciidoc apt-get install subversion

Download the official source code (taking atheros9344 as an example ):

cd /home/XXX# XXX: user name mkdir attitude_adjustment svn co svn://svn.openwrt.org/openwrt/tags/attitude_adjustment_12.09

The above command will check the source code on SVN to the local attitude_adjustment directory.

I am using the attitude_adjustment version, which is relatively stable and

Update source code:

cd attitude_adjustment/svn up./scripts/feeds update -a ./scripts/feeds install -a

So far, the openwrt development environment has been set up.

(3) The first compilation of openwrt System (p.s. During the compilation process, the program automatically downloads the corresponding dependent files online through the feed mechanism, which requires the compiler to be in a good network environment !) :

Check the environment to check whether all the dependent libraries required for compilation are installed:

Make defconfig

If you are prompted that a dependency library is not installed, follow the prompts to follow the corresponding dependency library until no response is returned for the above check.

Compile the Configuration:

Make menuconfig

Configure the target firmware. because it takes a long time to compile the firmware for the first time, I create a firmware without additional software: (the following three images correspond to target system, subtarget, and target profile respectively)

 

Finally, save the settings:

It will take a long time to compile:

Make # default installation, no prompt make v = 99 # Show the compilation log, and print it in Shell

After a long period of time, if it succeeds, you can compile the bin/

You can see multiple. binfiles.

Openwrt-ar71xx-generic-db120-kernel.bin: corresponds to burning only kernel firmware

Openwrt-ar71xx-generic-db120-rootfs-squashfs.bin: corresponds to file system firmware

Openwrt-ar71xx-generic-db120-squashfs-sysupgrade.bin: corresponds to the complete firmware

So far, a firmware that can be burned and written is compiled. Of course, it can be seen that this system can only start the router and can power up normally, but it does not have any function. (In the future, we need to add various software support to it, or even add software applications by compiling the kernel)

(4) firmware burning

There are several methods for writing firmware:

++ Online web firmware upgrade, which is generally applicable to the original factory firmware upgrade or openwrt image burning. This method is difficult. If there is no problem with the firmware and there is no power failure in the process, the firmware can be burned successfully.

++ The TFTP method is upgraded. I use the atheros9344 route. The fuselage has a Console port. You can directly use the network cable to directly burn and write data through the PC.

This process is difficult and requires a certain development foundation.

In addition, there are many methods that can be found online. I will not list them one by one because I do not need them for the time being.

(5) Route restart and Test

In this step, the entire process of development, compilation, debugging, and burning is complete.

In subsequent articles, I will sort out the basic openwrt settings, USB mounting, USB startup, Samba LAN file sharing, FTP server, transmission offline download, and other functions.

 

Reprint please indicate the source: http://www.cnblogs.com/double-win/ thank you!

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.