0, Setup a workstation with 64-bit Linux OS installed (Ubuntu 14.04 and newer recommended)

Make sure the workstation has the ssh key authorized by ASR.
Make sure the ASR openwrt repositories are already cloned and updated

Works below are all based on above two prerequisites.

1, update the repos

$  cd openwrt
$  ./ugit.sh pull

2, install the host prerequisites by openwrt

$ apt-get install build-essential bison flex zlib1g-dev libncurses5-dev subversion quilt intltool ruby fastjar zip unzip gawk git-core

3, update the feeds

this is required at the first build, and the build after running 'make distclean'

$  ./scripts/feeds update -a
$  ./scripts/feeds  install -a

4, build the image

First of first, let OpenWrt Buildroot check for missing packages on your build-system using

$ make prereq

Now, choose the proper defconfig files from the config directory according to the product profile.
There are many profiles supported by default based on ASR DKB/EVB designs, i.e.
  - pxa1826, for type A DKB, called nand profile in documents as well
  - pxa1826spinand, for type A DKB with SPI flash, called spinand profile in documents as well
  - pxa1826spinor, for data module, called spinor profile in documents as well
  - pxa1826p601, for new designed EVB board, called p601 profile in documents as well

Other profiles are not based on ASR DKB/EVB.

Take pxa1826 nand profile for example,

$make defconfig_pxa1826

Then start the build
$ make  -j2 V=99

After build finished, you can find the images at folder bin/pxa1826

In the following development, just a simple build is enough if profile and config file are not changed.
$ make  -j2 V=99

5, distclean uasge

After the first build it will generate the toolchain and host tools, creating openwrt/host, openwrt/owtoolchain.
In case you want to refresh those toolchains when some toolchain related configuration changed.

$ make distclean
$  ./scripts/feeds update -a
$  ./scripts/feeds  install -a
$ make defconfig_pxa1826
$ make  -j2  V=99

6, dirclean usage

If you want to change the profile, for example, to pxa1826p601

$make dirclean    //make preclean is similar to dirclean but keeps the bin folder.
$make defconfig_pxa1826p601
$make  -j2  V=99

7, collect and check the build logs

To save the build logs,

$ make  -j2  V=99  2>&1 | tee build.log

To check error when build fails,

$ make  -j2  V=99  2>&1 | tee build.log | grep -i Error
or
$ grep -i Error build.log

8, How to clean?

- To clean the bin folder:
   $ make clean

- To clean the folders generated during build process:
   $ make dirclean

- To clean the folders generated during build process except the images:
   $ make preclean

- To clean everything, downloads, **configurations**, feeds,etc.
   $ make distclean

Only use distclean when necessary to save build time.

9, How to build a specific package?

It depends on where the package is located, following examples,

      $ make package/obm-mmp/clean V=99
      $ make package/obm-mmp/compile V=99
      $ make package/obm-mmp/install V=99
      or
      $ make package/obm-mmp/{clean,compile,install} V=99

      $ make package/feeds/packages/nginx/{clean, compile, install} V=99

      $ make tools/automake/compile

      $ make toolchain/{clean, compile, install}

You can recompile only the kernel modules by issuing:

      $ make target/linux/compile

To recompile the static part of the kernel, issuing:

      $ make target/linux/install

Usually, you can do this for a complete kernel build,

      $ make target/linux/{clean, compile, install}

