Skip to content

Commit ffca7f5

Browse files
committed
add openwrt build script openwrt-build.sh and openwrt-build.md doc
Add Dockerfile that builds openwrt for glar150 with glard add a build.sh remove RUN do not run as root mv build.sh -> openwrt-build.sh make -j nproc openwrt-build.sh: make sure feeds.conf.default has one line per entry openwrt-build.sh: remove not needed make steps openwrt-build.sh: add some comment openwrt-build.md: add some human nodes openwrt-build.md: fix syntax openwrt-build.sh: run make instead of make -j4
1 parent 938cec6 commit ffca7f5

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

Dockerfile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM ubuntu:14.04
2+
MAINTAINER Benjamin Henrion <[email protected]>
3+
4+
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y -q
5+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip wget
6+
7+
RUN useradd -d /home/openwrt -m -s /bin/bash openwrt
8+
RUN echo "openwrt ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/openwrt
9+
RUN chmod 0440 /etc/sudoers.d/openwrt
10+
11+
USER openwrt
12+
13+
WORKDIR /home/openwrt
14+
RUN git clone --quiet https://github.com/mirrors/openwrt.git
15+
WORKDIR /home/openwrt/openwrt
16+
# checking out version 48724 (svn) == 4eba46dc3a80529146329a5f28629429d6fb3cd5 (git)
17+
RUN git checkout 4eba46dc3a80529146329a5f28629429d6fb3cd5
18+
RUN echo "CONFIG_TARGET_ar71xx=y" > .config
19+
RUN make defconfig
20+
RUN make prereq
21+
RUN make -j`nproc` tools/install
22+
RUN make -j`nproc` toolchain/install
23+
RUN echo "src-git zmq https://github.com/zoobab/openwrt-zmq-packages.git" >> feeds.conf.default
24+
RUN ./scripts/feeds update zmq
25+
RUN ./scripts/feeds install -p zmq
26+
RUN ./scripts/feeds update -a
27+
RUN ./scripts/feeds install -a
28+
RUN make -j`nproc`
29+
30+
RUN echo "CONFIG_PACKAGE_glard=y" >> .config
31+
RUN make oldconfig
32+
RUN make -j`nproc`

openwrt-build.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
How to build the openwrt image
2+
==============================
3+
4+
Just run the `openwrt-build.sh` script as a user (not root), tested under
5+
ubuntu 14.04.
6+
7+
First of all, you have to be root without password prompt preferably, here an
8+
example how to add the user `joe` for sudo, those steps have to be done with
9+
the root user:
10+
11+
```
12+
$ export MYUSER="joe"
13+
$ echo "$MYUSER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$MYUSER
14+
$ chmod 0440 /etc/sudoers.d/$MYUSER
15+
```
16+
17+
This has been tested under ubuntu 14.04, if you want other distributions, look
18+
at the OpenWRT requirements here:
19+
20+
https://wiki.openwrt.org/doc/howto/buildroot.exigence
21+
22+
Then, just run the `openwrt-build.sh` script as a user (not root):
23+
24+
```
25+
./openwrt-build.sh
26+
```
27+
28+
At the end of the process, you should end up with a firmware bin file named
29+
`openwrt-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin` which
30+
contains glard and all the zmq libs in the `openwrt/bin/ar71xx` directory:
31+
32+
```
33+
zoobab@sabayonx86-64 /home/zoobab/soft/glar150/openwrt/bin/ar71xx [13]$ ls
34+
md5sums openwrt-ar71xx-generic-uImage-lzma.bin openwrt-ar71xx-generic-vmlinux.lzma
35+
openwrt-ar71xx-generic-gl-ar150-squashfs-sysupgrade.bin openwrt-ar71xx-generic-vmlinux-lzma.elf packages
36+
openwrt-ar71xx-generic-root.squashfs openwrt-ar71xx-generic-vmlinux.bin sha256sums
37+
openwrt-ar71xx-generic-root.squashfs-64k openwrt-ar71xx-generic-vmlinux.elf
38+
openwrt-ar71xx-generic-uImage-gzip.bin openwrt-ar71xx-generic-vmlinux.gz
39+
```
40+
41+
You should then upload this file in the default firmware of Gl.inet by going to
42+
the web interface of the device, -> Advanced Settings -> User+passwd -> System
43+
-> Backup/FlashFirmware -> Flash New Firmware Image -> Choose File -> Flash
44+
Image
45+
46+
Do no power up the device, and wait 3 minutes at least.
47+
48+
The device will reboot with a 192.168.1.1 IP address, you should be able to:
49+
50+
a. ping if you put a static IP on your PC (like 192.168.1.2)
51+
b. a DHCP address from your PC
52+
53+
From there, you should be able to reach the default web interface
54+
http://192.168.1.1 or telnet to the device.
55+
56+
Sometimes the previous configuration is not erased, so it will keep its default
57+
IP address (192.168.8.1), so if you want to wipe it out, you should login in
58+
telnet or ssh, and run `firstboot` to erase the previous settings.

openwrt-build.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
if [[ $(id -u) -eq 0 ]] ; then
6+
echo "Please do not run as root!";
7+
exit 1;
8+
fi
9+
10+
DEBIAN_FRONTEND=noninteractive sudo apt-get update -y -q
11+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y -q --force-yes build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip wget
12+
13+
git clone https://github.com/mirrors/openwrt.git
14+
cd openwrt/
15+
git checkout 4eba46dc3a80529146329a5f28629429d6fb3cd5
16+
17+
echo "src-git zmq https://github.com/zoobab/openwrt-zmq-packages.git" >> feeds.conf.default
18+
uniq feeds.conf.default > feeds.conf.default
19+
./scripts/feeds update zmq
20+
./scripts/feeds install -p zmq
21+
./scripts/feeds update -a
22+
./scripts/feeds install -a
23+
24+
# "=y" means in the firmware image, "=m" means as an external *.ipk package
25+
echo "CONFIG_TARGET_ar71xx_generic_GL-AR150=y" > .config
26+
echo "CONFIG_PACKAGE_glard=y" >> .config
27+
make defconfig
28+
make

0 commit comments

Comments
 (0)