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/08/14 14:11] – Page based on old revision of a previous linked page and due to reorganized content of that linked page. jauser:ja [2021/11/26 00:37] – Table tested routers modified and message added. ja
Line 1: Line 1:
-====== My OpenWrt firmware image building guide ====== +====== My OpenWrt firmware image build guide ====== 
-Mainly based on [[https://openwrt.org/docs/guide-developer/quickstart-build-images?rev=1618756598|an old revision of the document "Quick Image Building Guide"]].+<WRAP important> 
 +This method is NOT OFFICIALLY supported. 
 +A native [[docs:guide-developer:build-system:install-buildsystem|GNU/Linux environment]] is recommended. 
 +</WRAP> 
 +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"]]. 
 ===== 1. Prerequisites ===== ===== 1. Prerequisites =====
 [[faq:what_system_can_i_build_openwrt_on|A suitable case-sensitive file system]].\\ [[faq:what_system_can_i_build_openwrt_on|A suitable case-sensitive file system]].\\
-For [[docs:guide-developer:build-system:wsl|WSL on Windows]] with [[https://www.microsoft.com/en-us/p/debian/9msvkqc78pk6|Debian]] these are the steps+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)]]
-==== 1.1 Download package list information ====+<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: Debian terminal command:
 <code> <code>
 sudo apt update sudo apt update
 </code> </code>
-==== 1.2 Install required dependencies ==== +<hidden onHidden="Click to display more info" onVisible="Click to hide the extra info"> 
-See [[docs:guide-developer:build-system:install-buildsystem#examples_of_package_installations|examples of package installations]].+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>
  
-If package list information is not downloaded ([[user:ja#download_package_list_information|step 1.1]]), message can be:\\+==== 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'' ''E: Unable to locate package''
 +</hidden>
 ==== 1.3 Leave privileged mode  ==== ==== 1.3 Leave privileged mode  ====
 Debian terminal command: Debian terminal command:
Line 19: Line 59:
 exit exit
 </code> </code>
 +
 ===== 2. Get OpenWrt source code ===== ===== 2. Get OpenWrt source code =====
 ==== 2.1 Clone repository ==== ==== 2.1 Clone repository ====
-Debian terminal command:+<columns 100% 50% -> 
 +For OpenWrt 19.07 Debian terminal command:
 <code> <code>
-git clone https://git.openwrt.org/openwrt/openwrt.git+git clone -b openwrt-19.07 --single-branch https://git.openwrt.org/openwrt/openwrt.git openwrt_19.07
 </code> </code>
-For more info see: [[docs:guide-developer:source-code:start|the OpenWrt source code]]. +<newcolumn> 
- +For OpenWrt 21.02 Debian terminal command: 
-If dependency is not installed ([[user:ja#install_required_dependencies|step 1.2]]), message can be:\\+<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''\\ ''-bash: git: command not found''\\
-If trying second time, message can be:\\ +If trying Debian terminal command second time, message can be one of these:\\ 
-''fatal: destination path 'openwrt' already exists and is not an empty directory.'' +''fatal: destination path 'openwrt_19.07' already exists and is not an empty directory.''\\ 
-==== 2.2 Change directory ==== +''fatal: destination path 'openwrt_21.02' already exists and is not an empty directory.'' 
-For the following steps go to the openwrt directory.\\ +</hidden> 
-Debian terminal command:+ 
 +==== 2.2 Change working directory ==== 
 +<columns 100% 50% -> 
 +For OpenWrt 19.07 Debian terminal command:
 <code> <code>
-cd openwrt+cd openwrt_19.07
 </code> </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>
  
-If repository is not cloned ([[user:ja#clone_repository|step 2.1]]), message can be:\\ +==== 2.3 Update local branch==== 
-''-bash: cd: openwrt: No such file or directory'' +If there is a new release in the branch, update local branch repository with Debian terminal command: 
-==== 2.Select branch (optional) ==== +<code> 
-See info about [[faq:difference_between_a_release_and_a_trunk_build|snapshots, releases and branches]].\\ +git pull 
-Debian terminal command:+</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.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> <code>
 git branch git branch
-git checkout <branch name> 
 </code> </code>
-==== 2.4 Update and install feeds ==== +See [[https://manpages.debian.org/git-man/git-branch.html|Debian git branch manpage]].\\ 
-Debian terminal command:+Or show working tree status with Debian terminal command:
 <code> <code>
-./scripts/feeds update -a +git status
-./scripts/feeds install -a+
 </code> </code>
 +See [[https://manpages.debian.org/git-man/git-status.html|Debian git status manpage]].
 +</hidden>
  
-If dependencies are not installed ([[user:ja#install_required_dependencies|step 1.2]]), messages can be:\\+==== 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.''\\ ''Can't exec "make": No such file or directory at ./scripts/feeds line 22.''\\
 ''Unsupported version of make found: make''\\ ''Unsupported version of make found: make''\\
Line 68: Line 166:
 ''Checking 'python'... failed.''\\ ''Checking 'python'... failed.''\\
 ''Checking 'python3'... failed.''\\ ''Checking 'python3'... failed.''\\
-''Checking 'file'... failed.'' +''Checking 'file'... failed.''\\ 
- +If directory is wrong ([[#change_working_directory|step 2.2]]), message can be:\\
-If directory is wrong ([[user:ja#change_directory|step 2.2]]), message can be:\\+
 ''-bash: ./scripts/feeds: No such file or directory'' ''-bash: ./scripts/feeds: No such file or directory''
 +</hidden>
 +
 ===== 3. OpenWrt Configuration ===== ===== 3. OpenWrt Configuration =====
 Debian terminal command: Debian terminal command:
Line 77: Line 176:
 make menuconfig make menuconfig
 </code> </code>
 +
 ==== 3.1 Configure target system ==== ==== 3.1 Configure target system ====
-E.g. for hardware from table +For router hardware select corresponding values in menu (:!: link to router hardware table):
-<sortable 1> +
-^[[toh:start|Hardware]] ^Target System ^Subtarget ^Target Profile ^Target directory ^ +
-|[[toh:belkin:f5d8235-4|Belkin F5D8235-4]] v1 |MediaTek Ralink MIPS |RT288x based boards |Belkin F5D8235 V1 |? | +
-|[[toh:d-link:dir-615|D-Link DIR-615]] rev D3 |MediaTek Ralink MIPS |RT3x5x/RT5350 based boards |D-Link DIR-615 D |? | +
-|[[toh:tp-link:archer_mr200|TP-Link Archer MR200]] v1.0 |? |? |? |? | +
-|[[toh:tp-link:tl-wa730re|TP-Link TL-WA730RE]] v1 |Atheros AR7xxx/AR9xxx |Devices with small flash |TP-LINK TL-WA730RE v1 |ar71xx/generic/+
-</sortable> +
-use corresponding values from menu:+
   * “Target System” ⇒ “Select” ⇒ <target system> ⇒ “Select”   * “Target System” ⇒ “Select” ⇒ <target system> ⇒ “Select”
   * “Subtarget” ⇒ “Select” ⇒ <subtarget> ⇒ “Select”   * “Subtarget” ⇒ “Select” ⇒ <subtarget> ⇒ “Select”
   * “Target Profile” ⇒ “Select” ⇒ <target profile> ⇒ “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 ==== ==== 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 ==== ==== 3.3 Exit configuration ====
 To exit OpenWrt Configuration and save target with options settings do following: To exit OpenWrt Configuration and save target with options settings do following:
   * “Exit” ⇒ "Yes"   * “Exit” ⇒ "Yes"
 +
 ===== 4. Build image ===== ===== 4. Build image =====
 Debian terminal command: Debian terminal command:
 <code> <code>
-make+make V=s 2>&1 | tee build.log
 </code> </code>
 Completion can take time. If successful, the images are in the directory ./bin/targets/<target directory>  Completion can take time. If successful, the images are in the directory ./bin/targets/<target directory> 
Line 104: Line 228:
   * The *-sysupgrade.bin image file is for updating an existing OpenWrt installation.   * 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 ([[user:ja#build image|step 4]]) again.+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.) 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 ([[user:ja#build image|step 3]]) and then build image ([[user:ja#build image|step 4]]) again.+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]]. Also more hardware info on [[hwinfo>User:JA|wikidevi]].
Line 114: Line 238:
 Other OpenWrt pages: Other OpenWrt pages:
   * [[docs:guide-developer:start|Developer guide]]   * [[docs:guide-developer:start|Developer guide]]
-  * [[docs:guide-user:additional-software:beginners-build-guide|Beginners guide to building your own firmware]]+  * [[docs:guide-developer:toolchain:beginners-build-guide|Beginners guide to building your own firmware]]
  • Last modified: 2021/11/27 12:31
  • by ja