Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:external_toolchain [2018/02/17 18:55] – ↷ Page moved from doc:howto:external_toolchain to docs:guide-developer:external_toolchain bobafetthotmaildocs:guide-developer:external_toolchain [2022/09/10 12:53] (current) – [Step 2: Build Firmware] ansuel
Line 3: Line 3:
 ===== Use OpenWrt as External Toolchain ===== ===== Use OpenWrt as External Toolchain =====
  
-Goal: Reduce build time when starting with a cleaned-up source tree. Useful when using an automated build system like Hudson/Tinderbox. \\ +Using an external toolchain reduce build time when starting with a cleaned-up source tree. Useful when using an automated build system like Hudson/Tinderbox. \\ 
-Requirements: +
-  * based on Subversion revision 27109 +
-  * two OpenWrt build directories - one which represents the toolchain and another one to build the firmware+
  
 ==== Step 1: Build Toolchain ==== ==== Step 1: Build Toolchain ====
  
-Just do the same as everytime you (re)compile OpenWrt. Checkout svn/git, set your options in .config and build the whole thing. Only difference this time: you call the directory **toolchain**.+Just do the same as everytime you (re)compile OpenWrt. Checkout openwrt repo, set your options in .config and build the whole thing. Only difference you have to select ''Package the OpenWrt-based Toolchain'' in the main view of ''make menuconfig'' 
 + 
 +Alternatively you can download precompiled toolchain from openwrt download page by searching for the correct toolchain for your target. 
 +For example if you need precompiled toolchain for openwrt 22.03.0 for target ipq806x/generic [[https://downloads.openwrt.org/releases/22.03.0/targets/ipq806x/generic/openwrt-toolchain-22.03.0-ipq806x-generic_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz|this is the link to use]]
  
 ==== Step 2: Build Firmware ==== ==== Step 2: Build Firmware ====
  
-We start at the same point as the toolchain. Checkout OpenWrt into directory **openwrt** (or anything else than **toolchain**). Now we need some patching, because at the moment (rev 27109) it is not possible to use OpenWrt for both. +  - Checkout OpenWrt into directory **openwrt** 
- +  - Follow normal instruction for openwrt prereq 
-Apply these patches in the order listet here: +  - Use the utility script to setup your buildroot <code> 
-  * 1[[https://lists.openwrt.org/pipermail/openwrt-devel/2011-June/011142.html|[PATCH] Resend: base-files: copy uClibc files from ext. toolchain]] ([[http://mcbachmann.de/openwrt/0001-base-files-copy-uClibc-files-from-ext.-toolchain.patch|Direct-Download from mcbachmann.de]], [[https://dev.openwrt.org/ticket/9157|Ticket #9157]]+   ./scripts/ext-toolchain.sh \ 
-  * 2. [[https://dev.openwrt.org/ticket/8786|Ticket #8786 Zlib 1.2.5 compilation is failing]] ([[http://mcbachmann.de/openwrt/0001-rules.mk-always-enable-fhonour-copts.patch|Direct-Download from mcbachmann.de]]) (Patch maybe not compatible with non-OpenWrt-Toolchains as **xMff** pointed out in IRC)  +            --toolchain TOOLCHAIN_FILE_LOCATION \ 
- +            --config TARGET_NAME (example ipq806x/generic
-After this, copy the .config-file from the toolchain directory into this build directory and do a **make menuconfig**. +  </code> 
- +  Use your buildroot like a normal oneEdit your config with ''make menuconfig'' and run ''make'' to compile your image
-  * [*] **Advanced configuration options (for developers)** +
-    * [*] **Use external toolchain** +
-      * Target name: arm-openwrt-linux-uclibcgnueabi (in my case, yours may vary) +
-      * Toolchain prefix: arm-openwrt-linux-uclibcgnueabi- (mind the dash at the end) +
-      * Toolchain root: /path/to/toolchain/staging_dir/toolchain-arm_v5te_gcc-linaro_uClibc-0.9.32_eabi+
  
-Save and compile. For my case, the full toolchain build now needs about 1 1/2 hour and the normal firmware takes only 1 hour. 
  
 +If you want to update a .config to use an external toolchain you can use the ''--overwrite-config''. For example:
 +<code>
 +   ./scripts/ext-toolchain.sh \
 +            --toolchain TOOLCHAIN_FILE_LOCATION \
 +            --overwrite-config
 +            --config TARGET_NAME (example ipq806x/generic)
 +</code>
  • Last modified: 2018/02/17 18:55
  • by bobafetthotmail