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



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


Build OpenWrt / LEDE from source


Attached Image
In this topic, you must post images under the 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
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.
For convenience, create a directory, for example, with the name 1 and go into it
mkdir 1 && cd ~ / 1

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 have downloaded. Our initial path was ~ / 1 and we ran the command above along this path, we created the openwrt directory, we need to go to it to continue
cd ~ / 1 / 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 a 4-core processor, to include all cores, the command will be as follows:
make -j5 V = -1

Attached Image

We are waiting, in half an hour or an hour we find our firmware in the directory ~ / 1 / 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

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
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 - 30.07.19, 00:39
Reason for editing: OpenWrt release 06/18/04



Rep: (10)
collect better on lede, takes up less space

There is enough space there. Therefore, you can take 06/18/2.

AndrueUkr @ 03/13/19, 3:17 PM*
I ask for help from the community
I collect firmware on
dir-825 b

Why collect? You can just put the official assembly and put these packages there.
https: //downloads.open…. 1-squashfs-factory.bin

Packages are in the same place.
https: //downloads.open...71xx/generic/packages/

Post has been editedPilot6 - 13.03.19, 16:17



Rep: (3)
Why collect?

Well, I did so - they do not interfere with packages
especially since I don’t need anything concerning
wifi, firewall, luci, etc ..
but you need the most free space.
What is the easiest build to be
(and how to put lede - poke your nose where to read)

I put off assembly 18.06.2 - maybe there just
delete packets (only what?)

Post has been editedAndrueUkr - 13.03.19, 16:42



Rep: (10)
AndrueUkr @ 03/13/19, 16:39*
Well, I did so - they do not interfere with packages
especially since I don’t need anything concerning

This is strange. There is not a super-large flash drive, but the packages you need should fit. I have the same router, you can put it decently there.
And what doesn’t fit in you?

AndrueUkr @ 03/13/19, 16:39*
delete packets (only what?)

If you do not need Wi-Fi, Lucy, fire, etc., then you can delete almost everything))



Rep: (3)
Pilot6 @ 03/13/19, 16:03*
And what doesn’t fit in you?

Well, from the start it was free 1.5MB of 2.4
now 760Kb
does not fit mbtools
list of installed
base-files - 194.2-r7676-cddd7b4c77
block-mount - 2018-12-28-af93f4b8-3
busybox - 1.28.4-2
collectd - 5.8.1-1
collectd-mod-modbus - 5.8.1-1
dnsmasq - 2.80-1.2
dropbear - 2017.75-7.1
e2fsprogs - 1.44.1-1
firewall - 2018-08-13-1c4d5bcd-1
fstools - 2018-12-28-af93f4b8-3
fwtool - 1
hostapd-common - 2018-05-21-62566bc2-5
ip6tables - 1.6.2-1
iptables - 1.6.2-1
iw - 4.14-1
iwinfo - 2018-07-31-65b8333f-1
jshn - 2018-07-25-c83a84af-2
jsonfilter - 2018-02-04-c7e938d6-1
kernel - 4.9.152-1-def6b4b6fd5b0fd8587fe8dbf55baf5c
kmod-ath - 4.9.152 + 2017-11-01-9
kmod-ath9k - 4.9.152 + 2017-11-01-9
kmod-ath9k-common - 4.9.152 + 2017-11-01-9
kmod-cfg80211 - 4.9.152 + 2017-11-01-9
kmod-crypto-crc32c - 4.9.152-1
kmod-crypto-hash - 4.9.152-1
kmod-fs-ext4 - 4.9.152-1
kmod-fs-vfat - 4.9.152-1
kmod-gpio-button-hotplug - 4.9.152-2
kmod-ip6tables - 4.9.152-1
kmod-ipt-conntrack - 4.9.152-1
kmod-ipt-core - 4.9.152-1
kmod-ipt-nat - 4.9.152-1
kmod-lib-crc-ccitt - 4.9.152-1
kmod-lib-crc16 - 4.9.152-1
kmod-mac80211 - 4.9.152 + 2017-11-01-9
kmod-nf-conntrack - 4.9.152-1
kmod-nf-conntrack6 - 4.9.152-1
kmod-nf-ipt - 4.9.152-1
kmod-nf-ipt6 - 4.9.152-1
kmod-nf-nat - 4.9.152-1
kmod-nf-reject - 4.9.152-1
kmod-nf-reject6 - 4.9.152-1
kmod-nls-base - 4.9.152-1
kmod-nls-cp437 - 4.9.152-1
kmod-nls-iso8859-1 - 4.9.152-1
kmod-nls-utf8 - 4.9.152-1
kmod-ppp - 4.9.152-1
kmod-pppoe - 4.9.152-1
kmod-pppox - 4.9.152-1
kmod-scsi-core - 4.9.152-1
kmod-slhc - 4.9.152-1
kmod-usb-core - 4.9.152-1
kmod-usb-ehci - 4.9.152-1
kmod-usb-ledtrig-usbport - 4.9.152-1
kmod-usb-ohci - 4.9.152-1
kmod-usb-serial - 4.9.152-1
kmod-usb-serial-ch341 - 4.9.152-1
kmod-usb-storage - 4.9.152-1
kmod-usb2 - 4.9.152-1
kmod-usb3 - 4.9.152-1
libattr - 20170915-1
libblkid - 2.32-2
libblobmsg-json - 2018-07-25-c83a84af-2
libc - 1.1.19-1
libcomerr - 1.44.1-1
libext2fs - 1.44.1-1
libffi - 3.2.1-3
libgcc - 7.3.0-1
libip4tc - 1.6.2-1
libip6tc - 1.6.2-1
libiwinfo - 2018-07-31-65b8333f-1
libiwinfo-lua - 2018-07-31-65b8333f-1
libjson-c - 0.12.1-2
libjson-script - 2018-07-25-c83a84af-2
libltdl - 2.4.6-1
liblua - 5.1.5-1
liblucihttp - 2018-05-18-cb119ded-1
liblucihttp-lua - 2018-05-18-cb119ded-1
libmodbus - 3.1.4-1
libnl-tiny - 0.1-5
libpthread - 1.1.19-1
librt - 1.1.19-1
libss - 1.44.1-1
libubox - 2018-07-25-c83a84af-2
libubus - 2018-10-06-221ce7e7-1
libubus-lua - 2018-10-06-221ce7e7-1
libuci - 2018-08-11-4c8b4d6e-1
libuclient - 2018-11-24-3ba74ebc-1
libusb-1.0 - 1.0.22-1
libuuid - 2.32-2
libxtables - 1.6.2-1
logd - 2018-02-14-128bc35f-2
lua - 5.1.5-1
luci - git-19.020.41695-6f6641d-1
luci-app-firewall - git-19.020.41695-6f6641d-1
luci-base - git-19.020.41695-6f6641d-1
luci-lib-ip - git-19.020.41695-6f6641d-1
luci-lib-jsonc - git-19.020.41695-6f6641d-1
luci-lib-nixio - git-19.020.41695-6f6641d-1
luci-mod-admin-full - git-19.020.41695-6f6641d-1
luci-proto-ipv6 - git-19.020.41695-6f6641d-1
luci-proto-ppp - git-19.020.41695-6f6641d-1
luci-theme-bootstrap - git-19.020.41695-6f6641d-1
mtd - 23
netifd - 2018-11-19-4b83102d-2
odhcp6c - 2018-07-14-67ae6a71-15
odhcpd-ipv6only - 1.15-3
openwrt-keyring - 2018-05-18-103a32e9-1
opkg - 2019-01-18-7708a01a-1
ppp - 2.4.7-12
ppp-mod-pppoe - 2.4.7-12
procd - 2018-03-28-dfb68f85-1
rpcd - 2018-11-28-3aa81d0d-1
rpcd-mod-rrdns - 20170710
swconfig - 11
uboot-envtools - 2018.03-1
ubox - 2018-02-14-128bc35f-2
ubus - 2018-10-06-221ce7e7-1
ubusd - 2018-10-06-221ce7e7-1
uci - 2018-08-11-4c8b4d6e-1
uclient-fetch - 2018-11-24-3ba74ebc-1
uhttpd - 2018-11-28-cdfc902a-2
usbutils - 007-9
usign - 2015-07-04-ef641914-1
wireless-regdb - 2017-10-20-4343d359
wpad-mini - 2018-05-21-62566bc2-5
zlib - 1.2.11-2



Rep: (10)
It makes no sense to remove packages from the finished assembly, as the space will not be freed.
I can advise you to put a snapshot, it is without a muzzle and weighs less. Well, or really collect it. There, more than half can definitely be removed.

Snapshot on ath79 here

https: //downloads.open...quashfs-sysupgrade.bin

It can be flashed on top of the one that is now standing. Packets will fly away.

Post has been editedPilot6 - 13.03.19, 17:24



Rep: (10)
In addition, there is also a fat option. There is more space being freed. Only I did not on ath79.



Rep: (3)
Pilot6
set your snapshot. Places 2.1 out of 2.4Mb
and this is without luci. Not much.
And if you collect - how much space can you still free up?
And then maybe it’s not worth it
especially on ubunt packages are not going
M4 version 1.4.17 is not going to
especially since the system already has m4 version 1.4.18



Rep: (10)
AndrueUkr @ 03/13/19, 18:03*
And if you collect - how much space can you still free up?

Yes dofiga can be freed. In addition, if packages are added immediately during assembly, they take up much less space than if they were later installed.
You can remove almost everything there.

Well, there is still a fat build option when the flash drive is all in use. There is a fun breakdown from the factory when there are two copies of caldata and an empty space between them. You can free this place.
At 8 MB, you can shove a lot.



Rep: (26)
Pilot6 @ 03/13/19, 10:10 PM*
If packages are added immediately during assembly, they take up much less space than if they were later installed.

Clarify, well, a hundred, due to what?



Rep: (70)
* yoric-k, briefly ....
Most of the firmware that you see comes with a note in the file name "... squashfs ...", this file system supports good compression, such as XZ, but in read-only mode.
To write the configuration, an additional section is used for the rest of the flash memory in jffs2 format, with more modest compression. It hangs over the main file system as a layer (overlay).
All changes in file systems (new files, deletion marks) are written to jffs2. A section in squashfs is always untouched.



Rep: (79)
Long time did not collect. That was due to the increase in flash. After teammake toolchain / install the laptop has not been responding for 12 hours, but the hard drive is spinning, it works ... I’m doing on Lubunru 18.04 x64 (AMD E-350 (2 x 1.6 GHz, 4 GB of RAM)) True, at the time the command was launched, Google Chrome was opened with a bunch of tabs, which eating memory .. I just didn’t think that it was such a voracious operation ... In general, how long does the make toolchain / install take?

Post has been editedv111v111 - 14.03.19, 08:24



Rep: (33)
* v111v111, ancient laptop based on Celeron M 370 (1 core x 1.5GHz, 1MB cache), RAM DDR2 2GB, Ubuntu 16.04 (32-bit) - for OpenWrt 18.06.x the whole process is from scratch (and not only toolchain / install ) takes ~ 7 hours

Post has been editedsalexa - 14.03.19, 08:51



Rep: (178)
Just advice for those who have nothing to collect on - register in azure, they give you a month of tests and 12k rubles to your account.
Make the virtual machine more powerful and compile the firmware as much as you like. Loot is removed only during the virtual machine.
p.s. after a month the freebie ends, but you can register again;)



Rep: (2)
Just advice for those who have nothing to collect on - register in azure, they give you a month of tests and 12k rubles to your account.
Make the virtual machine more powerful and compile the firmware as much as you like. Loot is removed only during the virtual machine.
p.s. after a month the freebie ends, but you can register again;)

Another variant. If at work, or where else, there is an affordable productive computer, then you can put ubuntu on it in a virtual machine and make openwrt assemblies as much as you like .. It takes me an average of 30-40 minutes from scratch .. :)



Rep: (3)
Pilot6 @ 03/13/19, 17:10*
Well, there’s also a fat build option,

But will this fit?
https: //www.gargoyle-r...quashfs-sysupgrade.bin



Rep: (79)
* salexa Pancake, then it's all the brakes because of the open Google chrome ... This lame horse bit off to see decently operatives .. But there is no way to close the system is not responsive .. I will wait ... Thank you ... For more than 12 hours, the toolchain has been sausage. ..

Post has been editedv111v111 - 14.03.19, 11:34



Rep: (3)
Along the way
who got an error on the ubunt during assembly
"Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread, ungetc on your system, then report this to bug-gnulib."
here in the topic 2 questions and unanswered
In the assembly, m4 v1.4.17 can not normally assemble (and it did not assemble in versions 12.09 15 18.06)
it helped me
make clean
make defconfig
make prereq
make menuconfig
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

and then as usual
make



Rep: (10)
AndrueUkr @ 03/14/19, 11:50*
it helped me

You need to update feeds after each pull. And then it will be so, then one is "not going to", then another.

And then, as in a joke:

- Doctor, the whole body is itchy!
- You did not try to wash?
- I tried, but after a month it starts again.

Post has been editedPilot6 - 14.03.19, 12:04



Rep: (3)
H.Pilot6
Please clarify.
1 In my dir-825, 2.4 Mb anyway
flash memory for programs
After flashing, uninstalling preinstalled programs
Does not increase free space.
The only win is assembling your firmware with the necessary packages
there will be space savings due to squashfs
2 In the openwrt stock firmware, even with luci installed
2.1 Mb free space
3 From here I see the only way out - fat firmware.
However, not one was delivered to me (I tried the gargoyle, lantisproject.com)

It's like that?

Post has been editedAndrueUkr - 14.03.19, 16:46



Rep: (10)
1. You can assemble the firmware with the necessary packages and without unnecessary ones. You have a specific task, so you can delete a lot. It does not make sense to delete already from the assembled firmware, since there will not be more space for this.
2. I did not understand the question. Well, probably it is. But what prevents you from assembling your firmware, where there are packages you need.
3. I do not see that this is the only way out, but an option. I did not try to bet, because I always had enough space.


Full version    

Help     rules

Now: 09/13/19, 09:13