b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | 0, Setup a workstation with 64-bit Linux OS installed (Ubuntu 14.04 and newer recommended) |
| 2 | |
| 3 | Make sure the workstation has the ssh key authorized by ASR. |
| 4 | Make sure the ASR openwrt repositories are already cloned and updated |
| 5 | |
| 6 | Works below are all based on above two prerequisites. |
| 7 | |
| 8 | 1, update the repos |
| 9 | |
| 10 | $ cd openwrt |
| 11 | $ ./ugit.sh pull |
| 12 | |
| 13 | 2, install the host prerequisites by openwrt |
| 14 | |
| 15 | $ apt-get install build-essential bison flex zlib1g-dev libncurses5-dev subversion quilt intltool ruby fastjar zip unzip gawk git-core |
| 16 | |
| 17 | 3, update the feeds |
| 18 | |
| 19 | this is required at the first build, and the build after running 'make distclean' |
| 20 | |
| 21 | $ ./scripts/feeds update -a |
| 22 | $ ./scripts/feeds install -a |
| 23 | |
| 24 | 4, build the image |
| 25 | |
| 26 | First of first, let OpenWrt Buildroot check for missing packages on your build-system using |
| 27 | |
| 28 | $ make prereq |
| 29 | |
| 30 | Now, choose the proper defconfig files from the config directory according to the product profile. |
| 31 | There are many profiles supported by default based on ASR DKB/EVB designs, i.e. |
| 32 | - pxa1826, for type A DKB, called nand profile in documents as well |
| 33 | - pxa1826spinand, for type A DKB with SPI flash, called spinand profile in documents as well |
| 34 | - pxa1826spinor, for data module, called spinor profile in documents as well |
| 35 | - pxa1826p601, for new designed EVB board, called p601 profile in documents as well |
| 36 | |
| 37 | Other profiles are not based on ASR DKB/EVB. |
| 38 | |
| 39 | Take pxa1826 nand profile for example, |
| 40 | |
| 41 | $make defconfig_pxa1826 |
| 42 | |
| 43 | Then start the build |
| 44 | $ make -j2 V=99 |
| 45 | |
| 46 | After build finished, you can find the images at folder bin/pxa1826 |
| 47 | |
| 48 | In the following development, just a simple build is enough if profile and config file are not changed. |
| 49 | $ make -j2 V=99 |
| 50 | |
| 51 | 5, distclean uasge |
| 52 | |
| 53 | After the first build it will generate the toolchain and host tools, creating openwrt/host, openwrt/owtoolchain. |
| 54 | In case you want to refresh those toolchains when some toolchain related configuration changed. |
| 55 | |
| 56 | $ make distclean |
| 57 | $ ./scripts/feeds update -a |
| 58 | $ ./scripts/feeds install -a |
| 59 | $ make defconfig_pxa1826 |
| 60 | $ make -j2 V=99 |
| 61 | |
| 62 | 6, dirclean usage |
| 63 | |
| 64 | If you want to change the profile, for example, to pxa1826p601 |
| 65 | |
| 66 | $make dirclean //make preclean is similar to dirclean but keeps the bin folder. |
| 67 | $make defconfig_pxa1826p601 |
| 68 | $make -j2 V=99 |
| 69 | |
| 70 | 7, collect and check the build logs |
| 71 | |
| 72 | To save the build logs, |
| 73 | |
| 74 | $ make -j2 V=99 2>&1 | tee build.log |
| 75 | |
| 76 | To check error when build fails, |
| 77 | |
| 78 | $ make -j2 V=99 2>&1 | tee build.log | grep -i Error |
| 79 | or |
| 80 | $ grep -i Error build.log |
| 81 | |
| 82 | 8, How to clean? |
| 83 | |
| 84 | - To clean the bin folder: |
| 85 | $ make clean |
| 86 | |
| 87 | - To clean the folders generated during build process: |
| 88 | $ make dirclean |
| 89 | |
| 90 | - To clean the folders generated during build process except the images: |
| 91 | $ make preclean |
| 92 | |
| 93 | - To clean everything, downloads, **configurations**, feeds,etc. |
| 94 | $ make distclean |
| 95 | |
| 96 | Only use distclean when necessary to save build time. |
| 97 | |
| 98 | 9, How to build a specific package? |
| 99 | |
| 100 | It depends on where the package is located, following examples, |
| 101 | |
| 102 | $ make package/obm-mmp/clean V=99 |
| 103 | $ make package/obm-mmp/compile V=99 |
| 104 | $ make package/obm-mmp/install V=99 |
| 105 | or |
| 106 | $ make package/obm-mmp/{clean,compile,install} V=99 |
| 107 | |
| 108 | $ make package/feeds/packages/nginx/{clean, compile, install} V=99 |
| 109 | |
| 110 | $ make tools/automake/compile |
| 111 | |
| 112 | $ make toolchain/{clean, compile, install} |
| 113 | |
| 114 | You can recompile only the kernel modules by issuing: |
| 115 | |
| 116 | $ make target/linux/compile |
| 117 | |
| 118 | To recompile the static part of the kernel, issuing: |
| 119 | |
| 120 | $ make target/linux/install |
| 121 | |
| 122 | Usually, you can do this for a complete kernel build, |
| 123 | |
| 124 | $ make target/linux/{clean, compile, install} |
| 125 | |