• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Dockerfile
  • Created almost 6 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Docker container to build OpenWrt images

Docker OpenWrt Build Environment

Build OpenWrt images in a Docker container. This is sometimes necessary when building OpenWrt on the host system fails, e.g. when some dependency is too new. The docker image is based on Debian 10 (Buster).

Build tested:

  • Openwrt-23.05.0-rc1
  • OpenWrt-22.03.5
  • OpenWrt-21.02.2
  • OpenWrt-19.07.8
  • OpenWrt-18.06.9

A smaller container based on Alpine Linux is available in the alpine branch. But it does not build the old LEDE images.

Prerequisites

  • Docker installed
  • running Docker daemon
  • build Docker image:
git clone https://github.com/mwarning/docker-openwrt-builder.git
cd docker-openwrt-builder
docker build -t openwrt_builder .

Now the docker image is available. These steps only need to be done once.

Usage GNU/Linux

Create a build folder and link it into a new docker container:

mkdir ~/mybuild
docker run -v ~/mybuild:/home/user -it openwrt_builder /bin/bash

In the container console, enter:

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j4

After the build, the images will be inside ~/mybuild/openwrt/bin/target/.

Usage MacOSX

OpenWrt requires a case-sensitive filesystem while MacOSX uses a case-insensitive filesystem by default.

Create a sparse disk image (to limit space usage):

mkdir ~/Documents/openwrt
cd ~/Documents/openwrt
hdiutil create -size 64g -fs "Case-sensitive HFS+" -type SPARSEBUNDLE -volname openwrt-dev-env openwrt-dev-env.dmg 
hdiutil attach openwrt-dev-env.dmg

Then run:

docker run -v /Volumes/openwrt-dev-env:/home/user -it openwrt_builder /bin/bash

Inside the container shell create a image file that will be formatted in ext4 then mounted (thanks to HowellBP for the inspiration):

cd /home/user # not really needed
dd if=/dev/zero of=ext4openwrtfs.img bs=1G count=0 seek=60 # set "seek=" to however many gigabytes you want, always less than the created dmg image
mkfs.ext4 ext4openwrtfs.img # create filesystem

mkdir ./openwrt-fs # create mount folder
losetup -fP --show ext4openwrtfs.img # this will return a /dev/loop ID, e.g. /dev/loop1, change line below with the correct one
sudo mount /dev/loop1 ./openwrt-fs # mount support folder
sudo chown -R user:user ./openwrt-fs # change ownership to user
cd ./openwrt-fs # $(pwd) should be /home/user/openwrt-fs

At this point you can proceed with the same commands of the Linux usage:

git clone https://git.openwrt.org/openwrt/openwrt.git # repo will be in /home/user/openwrt-fs/openwrt
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make -j4 # adapt to the number of cores you want to use 

After the build, the images will be inside /home/user/openwrt-fs/openwrt/bin/target/ in the container, inside the .img file. To export them to your Mac you need to copy/move them in /home/user then you'll be able to access them from outside the container, in /Volumes/openwrt-dev-env/

(Source)

Usage Windows

TODO

Other Projects

Other, but very similar projects:

More Repositories

1

zerotier-openwrt

A OpenWrt package for ZeroTier One - Pull requests are welcome!
Shell
675
star
2

KadNode

P2P DNS with content key, crypto key and PKI support. DynDNS alternative.
C
408
star
3

openwrt-examples

Examples for creating OpenWrt programs&packages.
Makefile
192
star
4

meshnet-lab

Emulate huge mobile ad-hoc mesh networks using Linux network namespaces.
Python
147
star
5

SimpleDNS

A very simple and small DNS Server to help understanding the protocol basics.
C
135
star
6

trigger

Android app to lock/unlock/ring doors. Supports generic HTTPS/SSH/Bluetooth/MQTT and Nuki Smartlock.
Kotlin
133
star
7

UDP-hole-punching-examples

A small collection of examples for UDP hole punching.
C
104
star
8

chaos-sticker-collection

A collection of chaos event / nerd culture related stickers.
HTML
96
star
9

MeshNetSimulator

A simulator for sketching and testing mesh network routing strategies
Rust
78
star
10

netlink-examples

Linux kernel Netlink examples inspired by "Why and How to Use Netlink Socket"
C
59
star
11

openwrt-firmware-selector

OpenWrt firmware selector. With custom image builder support.
JavaScript
39
star
12

device-observatory

Discover what your phone does on the Internet.
C
31
star
13

SimpleOctree

A simple and very fast Octree Implementation that supports Nearest Neigbour Search
C++
28
star
14

libsodium-example

A simple example on how to use the libsodium crypto library
C
20
star
15

testmesh

A collection of mesh routing protocols.
C
17
star
16

MeshGraphViewer

Visualize mesh graphs as forcegraph and on OpenStreetMap
JavaScript
16
star
17

dhtd

Utilize the BitTorrent network for hash identifier storage and lookup
C
15
star
18

p2p-gui

A remote web interface for MLdonkey, aMule, rTorrent, Transmission and giFT.
D
14
star
19

mtdRW

A small Linux kernel module that makes all MTD partitions writeable at runtime.
C
12
star
20

mbedtls_ecp_compression

Elliptic Curve Point compression/decompression for mbedtls
C
11
star
21

dat-c

A hobby implementation of the dat protocol in C
C
9
star
22

libsodium-openwrt

libsodium package for OpenWrt
Makefile
6
star
23

web-torrent

Experimental web browser with P2P capabilities
Python
4
star
24

guest-counter

A shell script to count active devices on the local network.
Shell
3
star
25

monty-hall-problem

Monty Hall Problem in Python
Python
2
star
26

mwarning.de

My Website :-)
JavaScript
1
star
27

plain-prpl

A simplistic protocol plugin for Pidgin / libpurple
C
1
star
28

titanion

Titanion is a classic 2.5D shooter game.
Rust
1
star
29

PyQt4-Examples

Some Qt4 examples translated to PyQt4/Python
Python
1
star
30

shell_copy_progress

A simple wrapper around the cp command to show the progress.
Shell
1
star
31

openwrt-autoconnect

A small openwrt script/package to connect to an SSID from a configured list
Shell
1
star
32

Hyperbolic-Graph-Generator

A Rust port of https://github.com/named-data/Hyperbolic-Graph-Generator
Rust
1
star