Build OpenWrt / LEDE from source codes | [firmware] OpenWrt / LEDE compilation from source codes



Rep: (575)
OpenWrt / LEDE (General theme) | DD-WRT FIRMWARE | Collect bin (dump) for the programmer | Upgraded UBOOT loaders


Build OpenWrt / LEDE from source


Attached Image
This topic should be placed under the image and logs spoilerPicture


Description / What is discussed in the topic, and what is not
OpenWrt is an embedded Linux kernel-based operating system designed primarily for home routers. Core components include the Linux kernel, util-linux, uClibc or musl, and BusyBox. The source code is open. Distributed under licenseGNU GPL

The LEDE project is developed on the basis of Linux, an embedded meta-distribution based on OpenWRT, focused on a wide range of SOHO wireless routers and non-network devices. “Linux Embedded Development Environment”.
LEDE turned away from the parent project in May 2016, with the goal of continuing to develop better software in an open management model and encouraging new developers to contribute and development efforts.


  • This topic is intended to discuss the build process, discuss the components of the firmware for inclusion in the finished file for the firmware of your router and everything that is not related to the compilation of the firmware.
  • In this topicdon't discuss OpenWrt / LEDE settings, installation process of ready-made assemblies on your router. Questions like: "I installed OpenWrt and now I don’t know what to do, how to set up the Internet" is offtopic and will be deleted without any warnings. There is a general theme for such questions. OpenWrt / LEDE - alternative firmware

Initial instruction with pictures. Buildroot Build Method
Quick reminder for those who already know how to do it. Who is not in the theme, read below in detail
Fast downloads and all the steps to begin compiling
Download the desired branchfrom here and inserted before the first && then everything will be executed automatically
&& cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq


Cook faster team
19.07.4
git clone git: //github.com/openwrt/openwrt.git -b v19.07.4 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

19.07.3
git clone git: //github.com/openwrt/openwrt.git -b v19.07.3 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

19.07.2
git clone git: //github.com/openwrt/openwrt.git -b v19.07.2 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

19.07.1
git clone git: //github.com/openwrt/openwrt.git -b v19.07.1 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

19.07.0
git clone git: //github.com/openwrt/openwrt.git -b v19.07.0 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.7
git clone git: //github.com/openwrt/openwrt.git -b v18.06.7 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.6
git clone git: //github.com/openwrt/openwrt.git -b v18.06.6 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.5
git clone git: //github.com/openwrt/openwrt.git -b v18.06.5 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.4
git clone git: //github.com/openwrt/openwrt.git -b v18.06.4 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.3
git clone git: //github.com/openwrt/openwrt.git -b v18.06.3 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.2
git clone git: //github.com/openwrt/openwrt.git -b v18.06.2 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.1
git clone git: //github.com/openwrt/openwrt.git -b v18.06.1 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

18.06.0
git clone git: //github.com/openwrt/openwrt.git -b v18.06.0 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.6
git clone git: //github.com/openwrt/openwrt.git -b v17.01.6 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.5
git clone git: //github.com/openwrt/openwrt.git -b v17.01.5 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.4
git clone git: //github.com/openwrt/openwrt.git -b v17.01.4 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.3
git clone git: //github.com/openwrt/openwrt.git -b v17.01.3 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.2
git clone git: //github.com/openwrt/openwrt.git -b v17.01.2 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.1
git clone git: //github.com/openwrt/openwrt.git -b v17.01.1 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq

17.01.0
git clone git: //github.com/openwrt/openwrt.git -b v17.01.0 && cd ~ / openwrt && ./scripts/feeds update -a && ./scripts/feeds install -a && make prereq




All manipulations are done on a computer with linux (in our example it will be for Debian / Ubuntu)
First, install everything you need.

Open the console and copy the commands there.
sudo apt-get install subversion git

Further
sudo apt-get install g ++ libncurses5-dev zlib1g-dev gawk libssl-dev unzip make

Is done.

Next you need to download the source of the firmware (see spoilerGit-repositories of OpenWrt and LEDE projects )

Download the branch we need (in this example, it is OpenWrt v17.01.4)

git clone git: //github.com/openwrt/openwrt.git -b v17.01.4


Next, go to the directory so that we download. ~ / (Ie home, he's home directory) we created openwrt directory, you need to go into it to continue
cd ~ / openwrt /

In Ubuntu, you can:
Attached Image

Now you need to run
./scripts/feeds update -a


After the update process is completed, we perform
./scripts/feeds install -a

Almost everything is ready, then we perform
make prereq

If everything is ok, then there will be this message: Collecting package info: done
Starting the interface for selecting the firmware components (in the latest versions it appears automatically after the previous step)
make menuconfig

Moving through the points is done with the keyboard keys: up-down, space and esc.
Target system
Attached Image

Target Profile can be selected for the desired model, if you leave the default profile then a lot of compiled firmware will be created for all devices at once from the Target System profile
Attached Image

Now a few simple explanations:
We put the web-interface
Attached Image

Attached Image

Attached Image

and Russian language to him
Attached Image

Attached Image

Attached Image

To support L2TP, you need to select the xl2tpd package.
Attached Image

Attached Image

Attached Image

Also the necessary protocols pptp and so on are selected here:
Network --->
<*>ppp
<*>ppp-mod-pppoe
<*>ppp-mod-pppol2tp
<*>ppp-mod-pptp
Attached Image

Add busybox components:
Attached Image

Attached Image

Attached Image

Well, then be guided by your needs, remember that the place in the router is not rubber and you often need to keep within 4 mb., So do not overdo it.
When everything is finished, save our configuration with the button<Save>
We proceed to the assembly:
make

And for 4-core processor, to enable all cores, the team will be: (number of cores 1, and here it turns out -j5)
make -j5 V = -1

Attached Image

Waiting over half an hour find its firmware in the directory ~ / openwrt /bin

If the correct target is selected before the build, but the firmware is obtained in a size larger than the size allowed for the flash of your router - the files * sysupgrade.bin and * factory.bin will not be created.

Cleaning
make clean

Removes the contents of the bin and build_dir directories.

make dirclean

Removes the contents of the / bin and / build_dir directories, as well as the addition of / staging_dir and / toolchain (cross-compilation tools). 'Dirclean' is the main command for a thorough cleanup.

make distclean

Removes everything that you have collected or configured, and also removes everything downloaded from the repository and the source codes of the packages.
ATTENTION: Among other things, your build configuration (.config), your toolchain, and all other source codes will be erased. Use with caution!

Addresses of the repositories used are in the file feeds.conf.default

Git-repositories of OpenWrt and LEDE projects
19.07.4
git clone git: //github.com/openwrt/openwrt.git -b v19.07.4

19.07.3
git clone git: //github.com/openwrt/openwrt.git -b v19.07.3

19.07.2
git clone git: //github.com/openwrt/openwrt.git -b v19.07.2

19.07.1
git clone git: //github.com/openwrt/openwrt.git -b v19.07.1

19.07.0
git clone git: //github.com/openwrt/openwrt.git -b v19.07.0

18.06.7
git clone git: //github.com/openwrt/openwrt.git -b v18.06.7

18.06.6
git clone git: //github.com/openwrt/openwrt.git -b v18.06.6

18.06.5
git clone git: //github.com/openwrt/openwrt.git -b v18.06.5

18.06.4
git clone git: //github.com/openwrt/openwrt.git -b v18.06.4

18.06.3
git clone git: //github.com/openwrt/openwrt.git -b v18.06.3

18.06.2
git clone git: //github.com/openwrt/openwrt.git -b v18.06.2

18.06.1
git clone git: //github.com/openwrt/openwrt.git -b v18.06.1

18.06.0
git clone git: //github.com/openwrt/openwrt.git -b v18.06.0

17.01.6
git clone git: //github.com/openwrt/openwrt.git -b v17.01.6

17.01.5
git clone git: //github.com/openwrt/openwrt.git -b v17.01.5

17.01.4
git clone git: //github.com/openwrt/openwrt.git -b v17.01.4

17.01.3
git clone git: //github.com/openwrt/openwrt.git -b v17.01.3

17.01.2
git clone git: //github.com/openwrt/openwrt.git -b v17.01.2

17.01.1
git clone git: //github.com/openwrt/openwrt.git -b v17.01.1

17.01.0
git clone git: //github.com/openwrt/openwrt.git -b v17.01.0

15.05.1
git clone git: //github.com/openwrt/archive.git -b v15.05.1

15.05
git clone git: //github.com/openwrt/archive.git -b v15.05

14.07
git clone git: //github.com/openwrt/archive.git -b v14.07

12.09
git clone git: //github.com/openwrt/archive.git -b v12.09





Useful programs
WinSCPgraphical client SFTP and SCP
Settings for connecting to a router with LEDE (dropbear must be enabled)
Attached Image

Tftpd32
TFTP for Linux using Ubuntu as an example
Configure tftpd-hpa TFTP server

Install the tftpd-hpa package:
sudo apt-get install tftpd-hpa

After installation, edit the file
sudo nano / etc / default / tftpd-hpa
containing server settings. Let's bring it to the following form:

TFTP_USERNAME = "tftp"
TFTP_DIRECTORY = "/ var / tftp"
TFTP_ADDRESS = "0.0.0.0:69"
TFTP_OPTIONS = "- ipv4 --secure --create --umask 027 --permissive"


In the settings are additional options:
create allows the server to create new files,
ipv4 instructs it to wait for connections only on IPv4 addresses,
umask instructs to reset the write bit for the group and all access bits for other users,
permissive instructs not to carry out any file permissions checks in excess of the operating system.

Create a directory for the tftp server, give the server access to the directory:

sudo mkdir / var / tftp

sudo chown tftp: tftp / var / tftp


You can also change the home directory of the tftp user in the / etc / passwd file to / var / tftp.

Now we just write the ip addresses we need through the gnome network manager and that's it.

It remains to restart the daemon to start working with the new directory:
sudo /etc/init.d/tftpd-hpa restart


Instructions
Useful topics
OpenWrt project news


Post has been editedstp101 - 18.09.20, 23:04
Reason for editing: Issue OpenWrt 19.07.4



Rep: (142)
Darksnow @ 09/12/18, 05:45*
Change cinnamon on the rat

So it turns out ashere: lol:

Post has been editedA123l - 12.09.18, 20:40



Rep: (29)
Routir @ 09/11/18, 16:16*
On the OpenWRT forum, I read about Zram-SWAP, allegedly for small devices helps to expand memory
Read in other places, and even in Russian. It is called Zram and Zswap, individual things. There is something in it, undoubtedly, but only if there are prerequisites for their use, in the sense if not enough memory. And you can do it, but do not notice the effect.



Rep: (505)
I have a lot less frequently from ZSWAP to crawl into Transmission



Rep: (7)
I did not find information in the header. Question on the assembly of firmware using Image Generator (Image Builder). To turn on the driven USB port on DIR 615 E4, you need to make changes to the AR71xx / Files / Arch / MIPS / AR71xx / Mach-DIR-600-A1.C file, namely add #include "dev-usb.h" after #include "dev-leds-gpio.h" and add ar71xx_add_device_usb (); After ar71xx_add_device_eth (1). I understand the * .c files is the code on C, and if you want to change something there, you will have to fully compile in Buildroot. Thus, image Builder is useless for me. Or, after all, you can take some correct file somewhere, and sign it in Image Builder?



Rep: (169)
Yoric-K @ 09/12/18, 14:05*
And so you can do, but do not notice the effect

Activated ZRAM through Buildroot (BusyBox>Zram), stitched, and my horse - TP-LINK 841 - rushed to gallop.
The house lives: TV prefix, computer and four android. A multicast translation is always on the console, t.ch. Any peaks of the router processor are noticeable immediately. With the activated ZRAM system works noticeably faster and not overloaded.
Collected from the branch 18.0.6.1, added OpenVPN + Adblock. ZRAM himself can be seen on the status page, occupies<14MB.

Post has been editedroutir - 12.09.18, 17:48



Rep: (7)
Installed on its DIR-615 E4 Zram-SWAP. SWAP 14332 KB appeared. To load the router so that Svap began to go with me. For some reason, the sambo is written at a speed of all about 1 move / s, and the memory does not have time to end.



Rep: (3)
Routir @ 09/12/18, 17:19*
Any peaks of the router processor are noticeable.

Especially considering that on the compression of memory and \ or storage \ unpacking (with zswap) again, part of the projects leaves)))) zra with a lack of RAM use, and the ZSVOP with a shortage of memory for the swap



Rep: (169)
* DarkSnow,
Whatever it was, everything works fine: D

Attached images
Attached Image
Attached Image



Rep: (58)
Routir @ 09/12/18, 17:19*
I stitched, and my horse - TP-Link 841 - rushed to gallop

Flash 4, and operatives 32?



Rep: (7)
A.R.C.H.E.R. @ 09/13/18, 03:34*
Flash 4, and operatives 32?

TL-WR841ND V8 AR9341 535 MHz, 4 Flash, 32 RAM. I certainly not an expert, but I would not have something newer than BB IMHO.



Rep: (969)
* Xander81,
Why did it happen? I have a perfectly perfect image of LEDE on the V9, and if you collect the handles and remove everything, then the place will also appear.

Post has been editedtribal2008 - 13.09.18, 09:53



Rep: (58)
Tribal2008 @ 09/13/18, 09:53*
And if you collect the knobs and remove everything, then the place will also appear.

What removed? How much free space appeared after?

Posted on 09/13/2018, 10:20:

Xander81 @ 09/13/18, 09:07*
But I would not have something newer than BB to put IMHO

If in terms of costs to the upgrade do not need to spend more value of the device, then why not, I do not know how much it will cost if you give away somewhere.



Rep: (7)
Tribal2008 @ 09/13/18, 13:53*
Why did it happen? I have a perfectly perfect image of LEDE on the V9, and if you collect the handles and remove everything, then the place will also appear.

Well, KABE on V9 is QCA9533-AL3A, which issues 366 bogomips, against V8 AR9341 on which is only 266. Therefore, it is not surprising. It just has experience on TL-WR741ND already CC started to slow down. But in general, we are wildly offtopim.



Rep: (58)
Routir @ 09/12/18, 17:19*
Activated ZRAM through Buildroot (BusyBox>ZRAM), stitched,

So you collected a new firmware from Zram and after sewed it? You can tell you more, how and what did you do?



Rep: (11)
A.R.C.H.E.R. @ 09/13/18, 14:18*
What removed? How much free space appeared after?


Here is how an exampleCrestfallen_soul Message # 380 01/15/18, 02:58
You can throw out LUCI and the description of the packages will be even less.



Rep: (169)
* A.r.c.h.e.r.,
I experiment a week, I used ten times already: happy:

Disabled: IPv6, Debug Core, Opkg.
Included: LUCIMINI, UDPXY, OpenVPN, Adblock.
Squashfs did not touch - causes the peaks of the projects.
GCC Compiler Version - also did not change.
As for Zram, I'm not sure yet - I check.


How to do through Menu Config for TP-Link 841V8 on the example of the branch 18.06.1
First choose Target:
Attached Image

Then in turn:
Kernel modules --->Wireless Drivers --- KMOD-ATH ->
[] Enable DFS Support [/ B]
Kernel modules --->Wireless Drivers --->KMOD-MAC80211 --->
[] EXPORT MAC80211 INTERNALS IN DEBUGFS

[b] GLOBAL BUILD SETTINGS --->
[*] Remove IPKG / Opkg Status Data Files in Final Images
Kernel Build Options --->
[] Enable Support for Printk
[] Crash Logging
[] Support for Paging Of Anonymous Memory (SWAP)
[] COMPILE THE KERNEL WITH DEBUG INFORMATION
[] COMPILE THE KERNEL WITH SYSRQ SUPPORT
[] Enable Process Core Dump Support
[] Enable Printk TimeStamps
< ---
[] Enable IPv6 support in packages
[*] Strip unnecessary exports from the kernel image
[*] Strip unnecessary functions from libraries

Base system --->
<*>busybox --->
[*] Customize busybox options
Networking Utilities --->
[] Enable IPv6 support
Base system --->
<>opkg

Network --->
<>odhcpd-ipv6only

Kernel modules --->Netfilter Extensions --->
<>kmod-nf-ipt6

Libraries --->Firewall --->
<>libip6tc

LuCI --->Collections --->
<*>luci
LuCI --->Modules --->
[*] Minify Lua Sources
LuCI --->Applications --->
<*>luci-app-adblock
<*>luci-app-openvpn
<*>luci-app-udpxy

Network --->VPN --->openvpn-mbedtls
Libraries - Libustream-Mbedtls

Config below:
CONFIG_TARGET_ar71xx = y
CONFIG_TARGET_ar71xx_tiny = y
Config_target_ar71xx_tiny_device_tl-WR841-V8 = Y
CONFIG_BUSYBOX_CUSTOM = y
# CONFIG_BUSYBOX_CONFIG_FEATURE_IPV6 is not set
Config_clean_ipkg = y.
# CONFIG_IPV6 is not set
# Config_kernel_CrashLog is not set
# Config_kernel_debug_fs is not set
# CONFIG_KERNEL_DEBUG_INFO is not set
# CONFIG_KERNEL_DEBUG_KERNEL is not set
# CONFIG_KERNEL_ELF_CORE is not set
# CONFIG_KERNEL_IPV6 is not set
# CONFIG_KERNEL_MAGIC_SYSRQ is not set
# Config_kernel_Printk is not set
# Config_kernel_printk_time is not set
# CONFIG_KERNEL_SWAP is not set
Config_luci_srcdiet = y.
CONFIG_OPENVPN_mbedtls_ENABLE_DEF_AUTH = y
CONFIG_OPENVPN_mbedtls_ENABLE_FRAGMENT = y
CONFIG_OPENVPN_mbedtls_ENABLE_HTTP = y
CONFIG_OPENVPN_mbedtls_ENABLE_LZ4 = y
CONFIG_OPENVPN_mbedtls_ENABLE_LZO = y
CONFIG_OPENVPN_mbedtls_ENABLE_MULTIHOME = y
CONFIG_OPENVPN_mbedtls_ENABLE_PF = y
CONFIG_OPENVPN_mbedtls_ENABLE_PORT_SHARE = ​​y
CONFIG_OPENVPN_mbedtls_ENABLE_SERVER = y
CONFIG_OPENVPN_mbedtls_ENABLE_SMALL = y
CONFIG_OPENVPN_mbedtls_ENABLE_SOCKS = y
# Config_Package_ath_dfs is not set
# Config_package_mac80211_debugs is not set
Config_package_adblock = y.
# CONFIG_PACKAGE_kmod-nf-ipt6 is not set
CONFIG_PACKAGE_kmod-tun = y
# CONFIG_PACKAGE_libip6tc is not set
CONFIG_PACKAGE_libiwinfo-lua = y
CONFIG_PACKAGE_liblua = y
CONFIG_PACKAGE_liblucihttp = y
CONFIG_PACKAGE_liblucihttp-lua = y
CONFIG_PACKAGE_liblzo = y
CONFIG_PACKAGE_libmbedtls = y
# Config_Package_libpThread Is Not Set
CONFIG_PACKAGE_libubus-lua = y
Config_package_libustream-mbedtls = y
CONFIG_PACKAGE_lua = y
CONFIG_PACKAGE_luci = y
Config_package_luci-app-adblock = y
CONFIG_PACKAGE_luci-app-firewall = y
CONFIG_PACKAGE_luci-app-openvpn = y
Config_package_luci-app-udpxy = y
CONFIG_PACKAGE_luci-base = y
CONFIG_PACKAGE_luci-lib-ip = y
CONFIG_PACKAGE_luci-lib-jsonc = y
CONFIG_PACKAGE_luci-lib-nixio = y
CONFIG_PACKAGE_luci-mod-admin-full = y
CONFIG_PACKAGE_luci-proto-ppp = y
CONFIG_PACKAGE_luci-theme-bootstrap = y
# Config_Package_odhcpd-ipv6only is not set
CONFIG_PACKAGE_openvpn-mbedtls = y
# Config_Package_OPKG is not set
CONFIG_PACKAGE_rpcd = y
CONFIG_PACKAGE_rpcd-mod-rrdns = y
Config_package_udpxy = y.
CONFIG_PACKAGE_uhttpd = y
Config_strip_kernel_exports = y.
Config_use_mklibs = y.

Free place
Attached Image


Post has been editedroutir - 08.10.18, 10:04
Reason for editing: added



Rep: (11)
Routir @ 09/13/18, 15:16*
Squashfs did not touch - causes the peaks of the projects.

Explain more, please, what to touch / do not touch, what causes the peaks of Prots?



Rep: (169)
* CrestFallen_Soul,
By default, the size of the SquashFS blocks is 256kib (Target for my router, for others I will not say) to shove as many packages as possible, the value is changed by 512 or 1024kib. The latter guarantees the maximum file system compression and almost megabytes of freedom, but the work with such blocks is much loading the processor. On third-party assemblies (SquashFS1024), which I experienced, the router often goes to the reboot, on our own "pancakes" - less often, but the Program is lit (IPTV is choking). Therefore, I collected without compression.

ATthe confirmationmy words
Increase Block Size from the Default 256 KB to Improve Compression. Warning: by Default 3 Blocks Will Be Cached So This Will Also Make The Router Use More Ram (IF 3 Blocks Are Cached, And A Block Size Of 1024 KB IS Used, This Will Use 2,304 KB More Ram (3 * 1024 KB - 3 * 256 Kb)). IT MAY ALSO Make The Router Use More CPU to Decompress The Larger Blocks.


Attached images
Attached Image


Post has been editedroutir - 11.02.19, 20:45



Rep: (7)
Somethinghttp://archive.openwrt.org.not available. Often it happens?



Rep: (25)
Hello everyone, Ktoto came across the MT7612E wifi? What is the speed of consideration in the OpenWart?


Full version    

Help     rules

Now: 31.10.20, 13:31