OPENWRT Tutorial Chapter XI openwrt source directory Overview

Foreword

Always at this time and openwrt deal, before also I wrote a bit piecemeal, still hoping a little system. I remember just see the source code, I felt unable to start. I want to start from throughout the execution of the Makefile, compile the source code to figure out a few hours, the story of what happened in the end. 
This is the first article of this series the main openwrt talk about my understanding of the entire directory structure of our source code from the official download called the original directory from the directory, will be generated after compiling a directory called build directory, introduced in two parts each directory.


The original directory

After downloading the source, the source file as shown below, let's explain everything; 
The original directory

1. scripts

Storing some scripts that use the bash, python, perl and other scripting languages. Compilation process, feeds for third-party document management software package in this directory is also among in the compilation process, the use of the script also put unity in this directory.

2. tools

Compile time, the host needs to use some tools, tools contains the commands to get and compile these tools. Package inside the Makefile, some also contain a patch. Each of them has a Makefile $(eval $(call HostBuild)), which indicates that this tool is to compile in the host unused.

3. config

Kept the entire system configuration files

4. docs

Introduction contains the entire source code of the host file, there is also a Makefile generator docs for the target system. Use make -C docs/can generate documentation for the target system.

5. toolchain

Embedded children's shoes should know that cross-compilation chain, this file is stored in compiling cross-compilation chain packages include: binutils,gcc,libcand so on.

6. target

openwrt source code can be compiled binary files suitable for various platforms, each platform defines firmware and kernel compilation process in this directory.

7. package

Storing the package openwrt system applicable, including Makefile for each package. openwrt Makefile defines a set of templates. Each template defines this software reference their information, such as the version of the package, download, compile, the installation address. In the second development process, this folder we will often deal with. 
In fact, the ./scripts/feed update -a和./scripts/feed install -apackage will be stored in this directory.

8. include

openwrt the Makefile are stored here. File named * .mk. Here is the file to be include in the Makefile, similar library files. These files define the compilation process.

9. Other

The main directory is mentioned in the previous eight, the rest is a single file.

9.1 Makefile:

Perform at the top level directory makeentry file command.

9.2 rules.mk

It defines some common variables and functions used in Makefile

9.3 Config.in

In the include/toplevel.mkmiddle we can see, and this is make menuconfigassociated with the file.

9.4 feeds.conf.default

Some address is download third-party software packages used

9.5 LICENSE & README

Namely software licenses and software basic instructions. README which describes the basic process of compiling software and dependencies.

So far we have the original directory skim it again, let's take a look at the build directory.

Build directory

After we compiled in addition to download the source code file, the extra part of the compilation process it is clear that the newly generated as shown below: 
Build directory

1. feeds

Expansion Pack index directory openwrt additional package manager. around a bit, it is simply download management software package. The default feedsdownload there packages、management、luci、routing、telephony. To download additional package, open the source file feeds.conf.default below the root directory, a package to remove the front of the corresponding # number and the update source: 
./scripts/feeds update -a 
the installation package downloaded: 
./scripts/feeds install -a

2. build_dir

In front of the original directory, we mention the host tools, toolchain tools as well as the destination file .openwrt will expand each package in this directory, compiled so this file contains three sub-folders in the folder:

2.1 host

In that folder software tool used by the host compiler

2.2 toolchain-XXX

In this folder cross compiler tool chain

2.3 target-XXX

In this compilation target platform object files, including various packages and kernel files.

3. bin

Save the compiled binary files, including: bin full of files, all the ipk file.

4. dl

Used in the process of compiling a lot of software, download the source code and started is not included, but during compilation download from another server, here is the preservation of a unified directory

5. staging_dir

For saving build_dirsoftware catalog compiled in. So here and build_dirhave the same subdirectory structure. 
For example, target-XXXsave the target platform compiled header files in the folder, library files. When we develop own ipk file, the compilation process, the pre-header files, dynamic link library, static libraries are to this subfolder.

6.tmp

From the name of view, it is the temporary folder. During compilation, a large number of intermediate temporary files need to be saved, are here.

7.logs

This folder, you can see sometimes, sometimes not. This is because this folder is stored, the process of compiling the information wrong, wrong only when compiled to appear. We can get information from here to analyze our software Why did not complete the compilation.

So far we generally browse the directory structure openwrt again.

Last record

    1. Many contents of this article are from the Internet, a long time, I could not find the source, which is also one of the reasons I wrote the blog, I learned a lot from the Internet, now and then fed back to the network. Thanks All have the freedom to share the spirit of friends.
    2. Knowledge is constantly progressive learning process. It is part of the knowledge I currently know of a general, not impressive enough. After more in-depth study Makefile and openwrt, come slowly updated.

 

Guess you like

Origin www.cnblogs.com/vx-cg248805770/p/11583389.html