OpenWrt Buildroot 基础教程

Prerequisites

to generate an installable OpenWrt firmware image file with a size of e.g. 8MB:

Install OpenWrt Buildroot and its prerequisites on your OS.
ca. 3-4 GB of available hard disk space
environment variables:
SED should not be set. If it is, run unset SED before compiling. (See Ticket 10612.)
GREP_OPTIONS should not have –initial-tab or other options affecting its output
Add /staging_dir/host/bin and /staging_dir/toolchain--<gcc_ver>-<libc_ver>/bin in front of your PATH variable in ~/.bashrc. The staging directory is created shortly after starting the build and the toolchain directory is created when the toolchain build begins. The build spawns multiple shells, some of which expect the toolchain binaries to be present in the PATH.
Procedure

  1. Update OpenWrt sources.
  2. Update and install package feeds.
  3. Configure the firmware image you want to obtain.
  4. Start the build. This will automatically compile toolchain,cross-compile sources, package packages, and finally generate an image ready to be flashed.
  5. Proceed to Installing OpenWrt

Updating Sources with Git

git pull

Updating Feeds
Update feeds:

./scripts/feeds update -a

Make downloaded package/packages available in make menuconfig:
single package:

./scripts/feeds install <PACKAGENAME>

all packages:

./scripts/feeds install -a

Image Configuration
Typical actions:

  1. run make menuconfig and set target;
  2. run make defconfig;
  3. run make menuconfig and modify set of package;
  4. run scripts/diffconfig.sh >mydiffconfig (save your changes in the
    text file mydiffconfig);
  5. run make V=s (build OpenWRT with console logging, you will look
    where build failed.).

Make menuconfig
The OpenWrt Buildroot configuration interface handles the selection of the target platform, packages to be compiled, packages to be included in the firmware file, some kernel options, etc.
Start the OpenWrt Buildroot configuration interface by issuing the following command:

make menuconfig

This will update the dependencies of your existing configuration automatically, and you can now proceed to build your updated images.

You have three options: y, m, n which are represented as follows:

pressing y sets the <*> built-in label
This package will be compiled and included in the firmware image file.
pressing m sets the package label
This package will be compiled, but not included in the firmware image file. (E.g. to be installed with opkg after flashing the firmware image file to the device.)
pressing n sets the < > excluded label
The source code will not be processed.
When you save your configuration, the file /.config will be created according to your configuration.

make kernel_menuconfig CONFIG_TARGET=subtarget
make defconfig
make or make world

The make sequience

Top command make world calls the following sequence of the commands:

make target/compile
make package/cleanup
make package/compile
make package/install
make package/preconfig
make target/install
make package/index

You may run each command independency. For example, if the process of compilation of packages stops on error, you may fix problem and next continue without cleanup:

make package/compile
make package/install
make package/preconfig
make target/install
make package/index

Warnings, errors and tracing

make V=s or make V=99

本文章由http://www.wifidog.pro/2015/08/02/OpenWrt-%E7%BC%96%E8%AF%91.html整理编辑,转载请注明出处

posted on 2015-08-02 20:07  WiFiDog热点解决方案  阅读(795)  评论(0编辑  收藏  举报

导航