From cbf234800e1def4330e5b5f9c7a901fe31a845bd Mon Sep 17 00:00:00 2001 From: Attila Lendvai Date: Fri, 13 Nov 2015 12:26:05 +0100 Subject: [PATCH] Update README.md --- README.md | 82 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index a4df5bd..9a12dbd 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # What -It's a script to build a customized OpenWRT firmware image. +It's a script to build a customized OpenWRT firmware image +(basic familiarity with OpenWRT is assumed). If this image is flashed on a device it will try to automatically set up [extroot](http://wiki.openwrt.org/doc/howto/extroot) on **any @@ -11,30 +12,12 @@ that can be done at that point to ask the user for confirmation. # Why -So that e.g. customers can buy a router on their own, flash our +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 from our webapp. -# Status - -This is more of a template than something standalone. You most -probably want to customize this script here and there; search for -`CUSTOMIZE` for places of interest. - -I've extracted this from a project where OpenWRT nodes auto-provision -themselves in 3 stages, but I thought it's useful enough for making it -public (stage 1: extroot setup; stage 2: install packages; stage 3: a -Python script for app-level sync). - -At the time of writing it only supports a few `ar71xx` routers but -it's easy to extend it. - -## Tested with - -[OpenWRT Chaos Calmer 15.05 RC1](https://downloads.openwrt.org/chaos_calmer/15.05-rc1/) -on a TP-Link WDR4300. - -# Building +# How +### Building e.g. `./build.sh TLWDR4300` @@ -42,22 +25,57 @@ Results will be under `build/OpenWrt-ImageBuilder-ar71xx_generic-for-linux-x86_6 To see a list of available targets, run this in the ImageBuilder dir: ```make info```. -# Usage +### Setup stagesd + +Blinking leds show which phase the extroot setup scripts are in. Consult the +sources for details: [autoprovision-functions.sh](image-extras/common/root/autoprovision-functions.sh#L49). + +#### Stage 1 + +At the first boot after flashing the firmware the autoprovision script will +wait for anything (!) in `/dev/sda` to show up, then erase it and set up a +`swap`, an `extroot`, and a `data`filesystem (for the remaining space), and +then reboot. + +#### Stage 2 + +Once it booted into the new extroot, it will continuously attempt to install +some OpenWRT packages until an internet connection is set up on the router +(either by using ssh or LuCI if you could include it in the firmware). + +### Login After flashing the firmware the router will have the standard -`192.168.1.1` IP address, and SSH will listen there using the keys -specified in `image-extras/etc/dropbear/authorized_keys`. +`192.168.1.1` IP address, and SSH will listen (in all stages) using the keys +specified in [authorized_keys](image-extras/common/etc/dropbear/authorized_keys) +(**this repo contains my own ssh public key as an example, either delete it or replace +it with yours!**). + +By default the root passwd is initialized to a random string. 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). Once connected, you can read the log with `logread -f`. -The autoprovision script will wait for any `/dev/sda` to show up, then -erase it and set up a `swap`, an `extroot`, and a `data` filesystem, -and then reboots. +# Status -In stage 2 it will need an internet connection, so you should connect -to its [LuCI interface](http://192.168.1.1) to set up an Internet -upstream, and then it will automatically continue installing packages, -finishing the whole process, and then do a final reboot. +This is more of a template than something standalone. You most +probably want to customize this script here and there; search for +`CUSTOMIZE` for places of interest. + +Most importantly, **set up your own public ssh key, or delete the default**. + +I've extracted this from a project where OpenWRT nodes auto-provision +themselves in 3 stages, but I thought it's useful enough for making it +public (stage 1: extroot setup; stage 2: install packages; stage 3: a +Python script for an app-level sync feature). + +At the time of writing it only supports a few `ar71xx` routers out of the box +but it's easy to extend it. + +## Tested with + +[OpenWRT Chaos Calmer 15.05 RC1](https://downloads.openwrt.org/chaos_calmer/15.05-rc1/) +on a TP-Link WDR4300. # Troubleshooting