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
Next revisionBoth sides next revision
user:ja [2021/05/04 09:45] – Wikidevi link added. jauser:ja [2021/11/26 00:37] – Table tested routers modified and message added. ja
Line 1: Line 1:
-My list. +====== My OpenWrt firmware image build guide ====== 
-  * [[docs:guide-developer:start|Developer guide]] +<WRAP important> 
-    * [[docs:guide-developer:quickstart-build-images|Quick Image Building Guide]] +This method is NOT OFFICIALLY supported. 
-      * [[faq:what_system_can_i_build_openwrt_on|What system can I build OpenWrt on?]] - [[docs:guide-developer:build-system:start#supported_os|Supported OS]] +A native [[docs:guide-developer:build-system:install-buildsystem|GNU/Linux environment]] is recommended. 
-        * [[docs:guide-developer:build-system:wsl|Build system setup WSL]] +</WRAP> 
-      * [[docs:guide-developer:build-system:install-buildsystem|Build system setup]] +Build guide mainly based on [[https://openwrt.org/docs/guide-developer/quickstart-build-images?rev=1618756598|an old revision of OpenWrt document "Quick Image Building Guide"]].
-  * [[toh:start|Hardware]] +
-    [[toh:belkin:f5d8235-4|Belkin F5D8235-4]] v1 +
-    * [[toh:d-link:dir-615|D-Link DIR-615]] rev D3 +
-    * [[toh:tp-link:archer_mr200|TP-Link Archer MR200]] v1.+
-    * [[toh:tp-link:tl-wa730re|TP-Link TL-WA730RE]] v1+
  
-[[hwinfo>User:JA|wikidevi]]+===== 1. Prerequisites ===== 
 +[[faq:what_system_can_i_build_openwrt_on|A suitable case-sensitive file system]].\\ 
 +Tested on [[docs:guide-developer:toolchain:wsl|WSL2 (Windows Version 10.0.19043.1202)]] with [[https://www.microsoft.com/en-us/p/debian/9msvkqc78pk6|Debian GNU/Linux 10 (buster)]]. 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +See Windows [[wp>Ver_(command)|version]] information with [[wp>Cmd.exe|cmd.exe]] command: 
 +<code> 
 +ver 
 +</code> 
 +See Debian version information with Debian command: 
 +<code> 
 +cat /etc/os-release 
 +</code> 
 +</hidden> 
 +:!: Mind issue with path! 
 + 
 +==== 1.1 Download package information ==== 
 +Debian terminal command: 
 +<code> 
 +sudo apt update 
 +</code> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +After downloading package information (**update**), optional install available upgrades (**upgrade**) with Debian terminal commands: 
 +<code> 
 +sudo apt update 
 +sudo apt upgrade 
 +</code> 
 +Or with one Debian terminal command: 
 +<code> 
 +sudo apt update && apt upgrade 
 +</code> 
 +Other commands (e.g. **upgrade**) operate on package information (**update**).\\ 
 +\\ 
 +Optional, remove obsolete packages with Debian terminal command: 
 +<code> 
 +sudo apt autoremove 
 +</code> 
 +\\ 
 +Description see [[https://manpages.debian.org/apt/apt.html | Debian apt manpage]].\\ 
 +:?: What about "sudo apt dist-upgrade"? 
 +</hidden> 
 + 
 +==== 1.2 Install required dependencies ==== 
 +See [[docs:guide-developer:toolchain:install-buildsystem#examples_of_package_installations|examples of package installations]].\\ 
 +:!: Verify link and required packages! 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +If package list information is not downloaded ([[#download_package_information|step 1.1]]), message can be:\\ 
 +''E: Unable to locate package'' 
 +</hidden> 
 +==== 1.3 Leave privileged mode  ==== 
 +Debian terminal command: 
 +<code> 
 +exit 
 +</code> 
 + 
 +===== 2. Get OpenWrt source code ===== 
 +==== 2.1 Clone repository ==== 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07 Debian terminal command: 
 +<code> 
 +git clone -b openwrt-19.07 --single-branch https://git.openwrt.org/openwrt/openwrt.git openwrt_19.07 
 +</code> 
 +<newcolumn> 
 +For OpenWrt 21.02 Debian terminal command: 
 +<code> 
 +git clone -b openwrt-21.02 --single-branch https://git.openwrt.org/openwrt/openwrt.git openwrt_21.02 
 +</code> 
 +</columns> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +This is to clone an specific OpenWrt branch/head (**-b openwrt-19.07 --single-branch** or **-b openwrt-21.02 --single-branch**) in a new directory (**openwrt_19.07** or **openwrt_21.02**).\\ 
 +See [[https://manpages.debian.org/git-man/git-clone.html|Debian git clone manpage]], [[docs:guide-developer:source-code:start|the OpenWrt source code repositories]] and [[faq:difference_between_a_release_and_a_trunk_build|difference snapshots, releases and branches]].\\ 
 +\\ 
 +If dependency is not installed ([[#install_required_dependencies|step 1.2]]), message can be:\\ 
 +''-bash: git: command not found''\\ 
 +If trying Debian terminal command second time, message can be one of these:\\ 
 +''fatal: destination path 'openwrt_19.07' already exists and is not an empty directory.''\\ 
 +''fatal: destination path 'openwrt_21.02' already exists and is not an empty directory.'' 
 +</hidden> 
 + 
 +==== 2.2 Change working directory ==== 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07 Debian terminal command: 
 +<code> 
 +cd openwrt_19.07 
 +</code> 
 +<newcolumn> 
 +For OpenWrt 21.02 Debian terminal command: 
 +<code> 
 +cd openwrt_21.02 
 +</code> 
 +</columns> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +See [[https://manpages.debian.org/tcl8.6-doc/cd.html|Debian cd manpage]].\\ 
 +\\ 
 +If repository is not cloned ([[#clone_repository|step 2.1]]), message can be one of these:\\ 
 +''-bash: cd: openwrt_19.07: No such file or directory''\\ 
 +''-bash: cd: openwrt_21.02: No such file or directory'' 
 +</hidden> 
 + 
 +==== 2.3 Update local branch==== 
 +If there is a new release in the branch, update local branch repository with Debian terminal command: 
 +<code> 
 +git pull 
 +</code> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +See [[https://manpages.debian.org/git-man/git-pull.html|Debian git pull manpage]]. 
 +</hidden> 
 + 
 +==== 2.4 Select version ==== 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07 Debian terminal command: 
 +<code> 
 +git checkout v19.07.8 
 +</code> 
 +<newcolumn> 
 +For OpenWrt 21.02 Debian terminal command: 
 +<code> 
 +git checkout v21.02.0 
 +</code> 
 +</columns> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +See [[https://manpages.debian.org/git-man/git-checkout.html|Debian git checkout manpage]].\\ 
 +\\ 
 +List branches (tags) with Debian terminal command: 
 +<code> 
 +git tag -l 
 +</code> 
 +See [[https://manpages.debian.org/git-man/git-tag.html|Debian git tag manpage]].\\ 
 +\\ 
 +Show current branch (highlighted in green and marked with an asterisk) with Debian terminal command: 
 +<code> 
 +git branch 
 +</code> 
 +See [[https://manpages.debian.org/git-man/git-branch.html|Debian git branch manpage]].\\ 
 +Or show working tree status with Debian terminal command: 
 +<code> 
 +git status 
 +</code> 
 +See [[https://manpages.debian.org/git-man/git-status.html|Debian git status manpage]]. 
 +</hidden> 
 + 
 +==== 2.5 Update and install feeds ==== 
 +Debian terminal command: 
 +<code> 
 +./scripts/feeds update -a && ./scripts/feeds install -a 
 +</code> 
 +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
 +If dependencies are not installed ([[#install_required_dependencies|step 1.2]]), messages can be:\\ 
 +''Can't exec "make": No such file or directory at ./scripts/feeds line 22.''\\ 
 +''Unsupported version of make found: make''\\ 
 +''Checking 'gcc'... failed.''\\ 
 +''Checking 'working-gcc'... failed.''\\ 
 +''Checking 'g++'... failed.''\\ 
 +''Checking 'working-g++'... failed.''\\ 
 +''Checking 'ncurses'... failed.''\\ 
 +''Checking 'awk'... failed.''\\ 
 +''Checking 'unzip'... failed.''\\ 
 +''Checking 'bzip2'... failed.''\\ 
 +''Checking 'wget'... failed.''\\ 
 +''Checking 'python'... failed.''\\ 
 +''Checking 'python3'... failed.''\\ 
 +''Checking 'file'... failed.''\\ 
 +If directory is wrong ([[#change_working_directory|step 2.2]]), message can be:\\ 
 +''-bash: ./scripts/feeds: No such file or directory'' 
 +</hidden> 
 + 
 +===== 3. OpenWrt Configuration ===== 
 +Debian terminal command: 
 +<code> 
 +make menuconfig 
 +</code> 
 + 
 +==== 3.1 Configure target system ==== 
 +For router hardware select corresponding values in menu (:!: link to router hardware table): 
 +  * “Target System” ⇒ “Select” ⇒ <target system> ⇒ “Select” 
 +  * “Subtarget” ⇒ “Select” ⇒ <subtarget> ⇒ “Select” 
 +  * “Target Profile” ⇒ “Select” ⇒ <target profile> ⇒ “Select” 
 +<hidden onHidden="Click to display more info about tested router hardware and relevant firmware image build information." onVisible="Click to hide table with tested router hardware and relevant build information."> 
 +^[[toh:start|Hardware]]                                 ^Branch  ^Target System        ^Subtarget                  ^Target Profile        ^Target directory ^ 
 +|[[toh:belkin:f5d8235-4|Belkin F5D8235-4]] v1           |21.02.0 |MediaTek Ralink MIPS |RT288x based boards        |Belkin F5D8235 V1     |ramips\rt288x    | 
 +|[[toh:d-link:dir-615|D-Link DIR-615]] rev D3           |19.07.8 |MediaTek Ralink MIPS |RT3x5x/RT5350 based boards |D-Link DIR-615 D      |ramips\rt305x    | 
 +|:::                                                    |21.02.0 |"bin is too big: 3932975 > 3866624"                                                    |||| 
 +|[[toh:tp-link:archer_mr200|TP-Link Archer MR200]] v1.0 |?       |?                    |?                          |?                     |?                | 
 +|[[toh:tp-link:tl-wa730re|TP-Link TL-WA730RE]] v1       |19.07.8 |Atheros ATH79 (DTS)  |Devices with small flash   |TP-LINK TL-WA730RE v1 |ath79\tiny       | 
 +|:::                                                    |21.02.0 |"images are too big by 306444 bytes"                                                   |||| 
 +|[[toh:ubiquiti:unifi|Ubiquiti UniFi AP-LR]]            |21.02.1 |Atheros ATH79        |Generic                    |Ubiquiti UniFi        |ath79\generic    | 
 +</hidden> 
 + 
 +==== 3.2 Options ==== 
 +To add “LuCI”:\\ 
 +  * "LuCI" ⇒ “Select” ⇒ "Collections" ⇒ “Select” ⇒ on "luci" press <Y> to include (= “*” built-in) ⇒ “Exit” ⇒ “Exit” 
 +To remove "ppp" 
 +  * "Network" ⇒ “Select” ⇒ on “ppp” press <N> to exclude (= “ ” excluded) ⇒ “Exit” 
 +To remove "wpad-mini" 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07: 
 +  * "Network" ⇒ “Select” ⇒ on "wpad-mini" press <N> to exclude (= “ ” excluded) ⇒ “Exit” 
 +<newcolumn> 
 +For OpenWrt 21.02: 
 +  * "Network" ⇒ “Select” ⇒ "WirelessAPD" ⇒ “Select” ⇒ on "wpad-basic-wolfssl" press <N> to exclude (= “ ” excluded) ⇒ “Exit” ⇒ “Exit” 
 +</columns> 
 +To add "wpad" 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07: 
 +  * "Network" ⇒ “Select” ⇒ on "wpad" press <Y> to include (= “*” built-in) ⇒ “Exit” 
 +<newcolumn> 
 +For OpenWrt 21.02: 
 +  * "Network" ⇒ “Select” ⇒ "WirelessAPD" ⇒ “Select” ⇒ on "wpad" press <Y> to include (= “*” built-in) ⇒ “Exit” ⇒ “Exit” 
 +</columns> 
 + 
 +==== 3.3 Exit configuration ==== 
 +To exit OpenWrt Configuration and save target with options settings do following: 
 +  * “Exit” ⇒ "Yes" 
 + 
 +===== 4. Build image ===== 
 +Debian terminal command: 
 +<code> 
 +make V=s 2>&1 | tee build.log 
 +</code> 
 +Completion can take time. If successful, the images are in the directory ./bin/targets/<target directory>  
 +  * The *-factory.bin image file is for the first installation of OpenWrt on the target. 
 +  * The *-sysupgrade.bin image file is for updating an existing OpenWrt installation. 
 + 
 +To recompile the images, remove files from directory ./bin/targets/<target directory> and build image ([[#build image|step 4]]) again. 
 + 
 +For faster compiling, use ''make -j N'', where N is the number of CPU cores + 1. Be aware that this method is prone to errors during compiling. In case you encounter compile errors, **your very first step is to compile again without ''-j N''**. Use of ''make download'' prior to parallel compilation is recommended to prevent some of these errors (''-jN'' is //generally// safe for the download step for those with faster Internet connectivity.) 
 + 
 +To build an OpenWrt firmware image for other hardware or with other options, use the OpenWrt Configuration ([[#build image|step 3]]) and then build image ([[#build image|step 4]]) again. 
 + 
 +Also more hardware info on [[hwinfo>User:JA|wikidevi]]. 
 + 
 +Other OpenWrt pages: 
 +  * [[docs:guide-developer:start|Developer guide]] 
 +  * [[docs:guide-developer:toolchain:beginners-build-guide|Beginners guide to building your own firmware]]
  • Last modified: 2021/11/27 12:31
  • by ja