Compare commits
9 Commits
lede-17.01
...
openwrt-18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85e367523a | ||
|
|
38a96e37e0 | ||
|
|
0381c6f40b | ||
|
|
a761fb7630 | ||
|
|
e96f2d38cc | ||
|
|
4a1e765a85 | ||
|
|
31d0688c7c | ||
|
|
68a222edc6 | ||
|
|
8e64a64186 |
49
README.md
49
README.md
@@ -1,9 +1,8 @@
|
|||||||
# What
|
# What
|
||||||
|
|
||||||
It's a script to build a customized [LEDE](https://lede-project.org/)
|
It's a script to build a customized OpenWRT firmware image on a Linux x86_64 host
|
||||||
firmware image using a Linux x86_64 host (basic familiarity with
|
(basic familiarity with [OpenWRT](https://wiki.openwrt.org/doc/howto/user.beginner)
|
||||||
[LEDE](https://lede-project.org/) is assumed). LEDE is a fork of
|
is assumed).
|
||||||
[OpenWRT](https://openwrt.org/).
|
|
||||||
|
|
||||||
If the generated image is flashed on a device it will try to automatically
|
If the generated image is flashed on a device it will try to automatically
|
||||||
set up [extroot](http://wiki.openwrt.org/doc/howto/extroot) on **any
|
set up [extroot](http://wiki.openwrt.org/doc/howto/extroot) on **any
|
||||||
@@ -18,17 +17,20 @@ So that e.g. customers can buy a router on their own, flash our custom
|
|||||||
firmware, plug in a pendrive, and manage their SIP (telephony) node
|
firmware, plug in a pendrive, and manage their SIP (telephony) node
|
||||||
from our webapp.
|
from our webapp.
|
||||||
|
|
||||||
|
I've extracted the generic parts from the above mentioned auto-provision
|
||||||
|
project because I thought it's useful enough for making it public.
|
||||||
|
|
||||||
# How
|
# How
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
To build issue the following command: `./build.sh architecture variant device-profile`, e.g.:
|
To build it, issue the following command: `./build.sh architecture variant device-profile`, e.g.:
|
||||||
* `./build.sh ar71xx generic tl-wdr4300-v1`
|
* `./build.sh ar71xx generic tl-wr1043nd-v2`
|
||||||
|
|
||||||
Results will be under `build/lede-imagebuilder-${release}-${architecture}-${variant}.Linux-x86_64/bin/`.
|
Results will be under `build/openwrt-imagebuilder-${release}-${architecture}-${variant}.Linux-x86_64/bin/`.
|
||||||
|
|
||||||
To see a list of available targets, run `make info` in the ImageBuilder dir.
|
To see a list of available targets, run `make info` in the ImageBuilder dir.
|
||||||
|
|
||||||
If you want to change which LEDE version is used, then edit the relevant variable(s) in `build.sh`.
|
If you want to change which OpenWRT version is used, then edit the relevant variable(s) in `build.sh`.
|
||||||
|
|
||||||
### Setup stages
|
### Setup stages
|
||||||
|
|
||||||
@@ -37,7 +39,7 @@ sources for details: [autoprovision-functions.sh](image-extras/common/root/autop
|
|||||||
|
|
||||||
#### Stage 1: setup extroot
|
#### Stage 1: setup extroot
|
||||||
|
|
||||||
At the first boot after flashing the firmware the autoprovision script will
|
When the custom firmware first boots, the autoprovision script will
|
||||||
wait for anything (!) in `/dev/sda` to show up (that is >= 512M), then erase
|
wait for anything (!) in `/dev/sda` to show up (that is >= 512M), then erase
|
||||||
it and set up a `swap`, an `extroot`, and a `data`filesystem (for the remaining
|
it and set up a `swap`, an `extroot`, and a `data`filesystem (for the remaining
|
||||||
space), and then reboot.
|
space), and then reboot.
|
||||||
@@ -45,8 +47,8 @@ space), and then reboot.
|
|||||||
#### Stage 2: download and install some packages from the internet
|
#### Stage 2: download and install some packages from the internet
|
||||||
|
|
||||||
Once it booted into the new extroot, it will continuously attempt to install
|
Once it booted into the new extroot, it will continuously attempt to install
|
||||||
some LEDE packages until an internet connection is set up on the router
|
some OpenWRT packages until an internet connection is set up on the router
|
||||||
(either by using ssh or LuCI if you could fit it into the firmware).
|
(either by using ssh or the web UI (LuCI)).
|
||||||
|
|
||||||
### Login
|
### Login
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ By default the root passwd is not set, so the router will start telnet with
|
|||||||
no password. If you want to set up a password, then edit the stage 2 script:
|
no password. If you want to set up a password, then edit the stage 2 script:
|
||||||
[autoprovision-stage2.sh](image-extras/common/root/autoprovision-stage2.sh#L53).
|
[autoprovision-stage2.sh](image-extras/common/root/autoprovision-stage2.sh#L53).
|
||||||
|
|
||||||
If a password is set, then telnet is disabled by LEDE and SSH will listen
|
If a password is set, then telnet is disabled by OpenWRT and SSH will listen
|
||||||
using the keys specified in [authorized_keys](image-extras/common/etc/dropbear/authorized_keys).
|
using the keys specified in [authorized_keys](image-extras/common/etc/dropbear/authorized_keys).
|
||||||
|
|
||||||
Once connected, you can read the log with `logread -f`.
|
Once connected, you can read the log with `logread -f`.
|
||||||
@@ -70,42 +72,37 @@ probably want to customize this script here and there; search for
|
|||||||
|
|
||||||
Most importantly, **set up a password and maybe an ssh key**.
|
Most importantly, **set up a password and maybe an ssh key**.
|
||||||
|
|
||||||
I've extracted this from a project of mine where OpenWRT nodes auto-provision
|
|
||||||
themselves in 3 stages (stage 3 was a Python script for an app-level sync feature),
|
|
||||||
but I thought it's useful enough for making it public.
|
|
||||||
|
|
||||||
At the time of writing it only supports a few `ar71xx` routers out of the box,
|
At the time of writing it only supports a few `ar71xx` routers out of the box,
|
||||||
but it's easy to extend it.
|
but it's easy to extend it.
|
||||||
|
|
||||||
## Tested with
|
## Tested with
|
||||||
|
|
||||||
[LEDE 17.01.1](https://downloads.lede-project.org/releases/17.01.1/)
|
[OpenWRT 17.01.4](https://downloads.openwrt.org/releases/)
|
||||||
on a TP-Link WDR4300.
|
on a TP-Link WR-1043nd-v2.
|
||||||
|
|
||||||
# Troubleshooting
|
# Troubleshooting
|
||||||
|
|
||||||
## Which file should I flash?
|
## Which file should I flash?
|
||||||
|
|
||||||
You should consult the documentation at [LEDE](https://lede-project.org/docs/start) and/or at
|
You should consult the [OpenWRT documentation](https://wiki.openwrt.org/doc/howto/user.beginner).
|
||||||
[OpenWRT](https://wiki.openwrt.org/doc/howto/user.beginner).
|
The produced firmware files should be somewhere around ```build/openwrt-imagebuilder-17.01.4-ar71xx-generic.Linux-x86_64/bin/ar71xx```.
|
||||||
The produced firmware files should be somewhere around ```build/lede-imagebuilder-17.01.1-ar71xx-generic.Linux-x86_64/bin/ar71xx```.
|
|
||||||
|
|
||||||
In short:
|
In short:
|
||||||
|
|
||||||
* You need a file with the name ```-factory.bin``` or ```-sysupgrade.bin```. The former is to
|
* You need a file with the name ```-factory.bin``` or ```-sysupgrade.bin```. The former is to
|
||||||
be used when you first install LEDE, the latter is when you upgrade an already installed
|
be used when you first install OpenWRT, the latter is when you upgrade an already installed
|
||||||
LEDE.
|
OpenWRT.
|
||||||
|
|
||||||
* You must carefully pick the proper firmware file for your **hardware version**! I advise you
|
* You must carefully pick the proper firmware file for your **hardware version**! I advise you
|
||||||
to look up the wiki page for your hardware on the [OpenWRT wiki](https://wiki.openwrt.org),
|
to look up the wiki page for your hardware on the [OpenWRT wiki](https://wiki.openwrt.org),
|
||||||
because most of them have a table of the released hardawre versions with comments on their
|
because most of them have a table of the released hardware versions with comments on their
|
||||||
status (sometimes new hardware revisions are only supported by the latest LEDE, which is
|
status (sometimes new hardware revisions are only supported by the latest OpenWRT, which is
|
||||||
not released yet).
|
not released yet).
|
||||||
|
|
||||||
## Help! The build has finished but there's no firmware file!
|
## Help! The build has finished but there's no firmware file!
|
||||||
|
|
||||||
If the build doesn't yield a firmware file (```*-factory.bin``` and/or ```*-sysupgrade.bin```):
|
If the build doesn't yield a firmware file (```*-factory.bin``` and/or ```*-sysupgrade.bin```):
|
||||||
when there's not enough space in the flash memory of the target device to install everything
|
when there's not enough space in the flash memory of the target device to install everything
|
||||||
then the LEDE ImageBuilder prints a hardly visible error into its flow of output and
|
then the OpenWRT ImageBuilder prints a hardly visible error into its flow of output and
|
||||||
silently continues. Look into [build.sh](build.sh#L31) and try to remove some packages
|
silently continues. Look into [build.sh](build.sh#L31) and try to remove some packages
|
||||||
that you can live without.
|
that you can live without.
|
||||||
|
|||||||
17
build.sh
17
build.sh
@@ -25,22 +25,21 @@ BUILD=`absolutize $BUILD`
|
|||||||
###
|
###
|
||||||
### chose a release
|
### chose a release
|
||||||
###
|
###
|
||||||
#RELEASE="15.05.1"
|
RELEASE="18.06.1"
|
||||||
RELEASE="17.01.1"
|
|
||||||
|
|
||||||
IMGBUILDER_NAME="lede-imagebuilder-${RELEASE}-${TARGET_ARCHITECTURE}-${TARGET_VARIANT}.Linux-x86_64"
|
IMGBUILDER_NAME="openwrt-imagebuilder-${RELEASE}-${TARGET_ARCHITECTURE}-${TARGET_VARIANT}.Linux-x86_64"
|
||||||
IMGBUILDER_DIR="${BUILD}/${IMGBUILDER_NAME}"
|
IMGBUILDER_DIR="${BUILD}/${IMGBUILDER_NAME}"
|
||||||
IMGBUILDER_ARCHIVE="${IMGBUILDER_NAME}.tar.xz"
|
IMGBUILDER_ARCHIVE="${IMGBUILDER_NAME}.tar.xz"
|
||||||
|
|
||||||
IMGTEMPDIR="${BUILD}/openwrt-build-image-extras"
|
IMGTEMPDIR="${BUILD}/image-extras"
|
||||||
#https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/lede-imagebuilder-ar71xx-generic.Linux-x86_64.tar.xz
|
IMGBUILDERURL="https://downloads.openwrt.org/releases/${RELEASE}/targets/${TARGET_ARCHITECTURE}/${TARGET_VARIANT}/${IMGBUILDER_ARCHIVE}"
|
||||||
#https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/lede-imagebuilder-ar71xx-generic.Linux-x86_64.tar.xz
|
|
||||||
IMGBUILDERURL="https://downloads.lede-project.org/releases/${RELEASE}/targets/${TARGET_ARCHITECTURE}/${TARGET_VARIANT}/${IMGBUILDER_ARCHIVE}"
|
|
||||||
|
|
||||||
if [ -z ${TARGET_DEVICE} ]; then
|
if [ -z ${TARGET_DEVICE} ]; then
|
||||||
echo "Usage: $0 architecture variant device-profile"
|
echo "Usage: $0 architecture variant device-profile"
|
||||||
echo " e.g.: $0 ar71xx generic tl-wr1043nd-v2"
|
echo " e.g.: $0 ar71xx generic tl-wr1043nd-v2"
|
||||||
echo " $0 ramips mt7621 zbt-wg3526"
|
echo " $0 ramips mt7621 zbt-wg3526"
|
||||||
|
echo " $0 bcm53xx generic dlink-dir-885l"
|
||||||
|
echo " (this last one will not work without editing build.sh, details: https://github.com/attila-lendvai/openwrt-auto-extroot/pull/15#issuecomment-405847440)"
|
||||||
echo " to get a list of supported devices issue a 'make info' in the OpenWRT image builder directory:"
|
echo " to get a list of supported devices issue a 'make info' in the OpenWRT image builder directory:"
|
||||||
echo " '${IMGBUILDER_DIR}'"
|
echo " '${IMGBUILDER_DIR}'"
|
||||||
kill -INT $$
|
kill -INT $$
|
||||||
@@ -83,8 +82,8 @@ pushd ${IMGBUILDER_DIR}
|
|||||||
|
|
||||||
make image PROFILE=${TARGET_DEVICE} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR}
|
make image PROFILE=${TARGET_DEVICE} PACKAGES="${PREINSTALLED_PACKAGES}" FILES=${IMGTEMPDIR}
|
||||||
|
|
||||||
pushd bin/${TARGET_ARCHITECTURE}/
|
pushd bin/targets/${TARGET_ARCHITECTURE}/
|
||||||
ln -s ../../packages .
|
ln -s ../../../packages .
|
||||||
popd
|
popd
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|||||||
Reference in New Issue
Block a user