Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshed and face-lifted README. Tested with Chaos Calmer. Worked wit... #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 119 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,166 @@
meshbox
=======

This is the OpenWRT package feed for the [meshbox][meshbox] project. It provides UCI and LuCI integration for [cjdns][cjdns]. Tested with OpenWRT Barrier Breaker (trunk).
This is the OpenWrt package feed for the [meshbox][meshbox] project.

Use it to turn a OpenWrt device into a mesh networking device using cjdns.
It provides UCI and LuCI integration for [cjdns][cjdns].

Tested with OpenWrt Chaos Calmer (r42153).

[meshbox]: http://fund.meshwith.me
[cjdns]: https://github.com/cjdelisle/cjdns

Integration into the OpenWRT buildroot is simple.
###(Before we begin)

If you are using Debian / Ubuntu, you may want to ensure that these packages are installed:

libncurses5-dev gawk subversion git mercurial tftp

---

#Integrating the package with OpenWrt

## Clone OpenWrt


$ git clone git://git.openwrt.org/openwrt.git
$ cd openwrt

$ cp feeds.conf.default feeds.conf

## Add meshbox to the buildroot

####Option 1: Add the meshbox git repository to the OpenWrt feeds list.

$ echo 'src-git meshbox git://github.com/seattlemeshnet/meshbox.git' >> feeds.conf

####Option 2: Clone the meshbox repo and use your local copy.

$ echo 'src-link meshbox /path/to/meshbox' >> feeds.conf

## Update the feeds and install the package

Whichever option you've chosen, you'll need to update your feeds:

$ ./scripts/feeds update
$ ./scripts/feeds install luci-cjdns

Then configure your firmware image: enable the luci-cjdns module, in addition to your usual settings, such as target system and profile. As usual, you'll need to hit space twice to make it `[*]` rather than `[M]`.

#Building

You'll need to know the chipset of the device for which you intend to build your OpenWrt with meshbox.

You're going to use menuconfig to set a few settings for the build.

(not as root!)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need to be specified? Is there any reason it won't work as root? If it absolutely must be here, then IMO it shouldn't be indented like code

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to be? No, of course not. At the end of the day, though, this is a fairly substantial vector for people who haven't, or have only rarely, run make. It's quite plausible that they might get permission denied errors and try to sudo. If they do, they'll be in a pretty bad permissions situation. So why not gently remind them in one line. There's no prompt before it; they aren't going to mistake it for code (similar to the menu selection description). It's fine.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ehh, I feel like if it becomes an issue we could just put a big bold thing at the top of the doc that says HEY IDIOTS: DONT DO THIS SHIT AS ROOT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know you, so I'll give you the benefit of the doubt and assume
you're kidding.

On Tue, Aug 12, 2014 at 9:10 PM, Finn [email protected] wrote:

In README.md:

+#Building
+
+You'll need to know the chipset of the device for which you intend to build your OpenWrt with meshbox.
+
+You're going to use menuconfig to set a few settings for the build.
+

  • (not as root!)

ehh, I feel like if it becomes an issue we could just put a big bold thing
at the top of the doc that says HEY IDIOTS: DONT DO THIS SHIT AS ROOT


Reply to this email directly or view it on GitHub
https://github.com/SeattleMeshnet/meshbox/pull/17/files#r16153161.

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, kidding about the particular phrasing, but not the overall concepts

$ make menuconfig

Once menuconfig is open, you have two primary goals:

####1. Apply your typical OpenWrt build settings, such as target system and profile.

For help on this part, see the "Image Configuration" section of this document: http://wiki.openwrt.org/doc/howto/build

####2. Enable the luci-dns module

(using the menus in menuconfig)
LuCI -> Collections -> [*] luci
LuCI -> Collections -> [*] luci-ssl (if you want ssl)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"if you want ssl" should be phrased more like "if you want LuCI to have SSL" and maybe a comment about the additional space requirements. "if you want ssl" sounds like it could be misinterperted.

Just my two cents. Would be interested in hearing other's thoughts.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'm not clear here: If openssl isn't installed, will this option
not appear? If that's so, it seems reasonable to add that as well.

On Tue, Aug 12, 2014 at 9:03 PM, Finn [email protected] wrote:

In README.md:

 LuCI -> Collections -> [*] luci
  • LuCI -> Collections -> [*] luci-ssl (if you want ssl)

"if you want ssl" should be phrased more like "if you want LuCI to have
SSL" and maybe a comment about the additional space requirements. "if you
want ssl" sounds like it could be misinterperted.

Just my two cents. Would be interested in hearing other's thoughts.


Reply to this email directly or view it on GitHub
https://github.com/SeattleMeshnet/meshbox/pull/17/files#r16153016.

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we shouldnt mention luci-ssl at all

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Won't most people want ssl? Presumably they're not able to connect to their AP through CJDNS yet.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like ssl on the router web interface is just going to waste space on the device and not serve much of a purpose. IIRC cjdns will auto-start and enable autopeering on the LAN interfaces, so cjdns will be set up

LuCI -> Project Meshnet -> [*] luci-cjdns
Network -> Routing and Redirection ---> -*- cjdns

(for your local language)
LuCI -> Tranlations ---> luci-i18n-<your language>

(You'll need to hit space twice to make these `[*]` rather than `[M]`.)

Then save and close the configuration menu, and allow OpenWRT to resolve dependencies:

##Almost there - final steps

Save and close the configuration menu, and allow OpenWrt to resolve dependencies:

$ make defconfig

Then build:

$ make

If you have a multicore processor, you can build faster using `-j`, however the OpenWRT build process is not highly parallelized so your milage may vary.
If you have a multicore processor, you can build faster using `-j`, however the OpenWrt build process is not highly parallelized so your milage may vary. In any case, it takes a good minute to compile, so you might want to cuddle up with the CJDNS whitepaper: https://github.com/cjdelisle/cjdns/blob/master/doc/Whitepaper.md

$ make -j 4
$ make -j4 V=s 1>output.log 2>error.log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally say not to to redirect the output as its mostly useless unless something goes wrong, and this way you get no idea of the progress

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like "If it fux up, do this to get more debugging info" but just make -j 4 by default? That's what most OpenWRT docs seem to suggest IIRC

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we were divided here as well. My sense is that it's a fairly big
pain point to have to restart the compile just to get an error on which to
seek help (you watched me drain an hour to this today), so it makes sense
to tell them how to pipe it.

Also, people who are using this project are probably about at the point
where they can use a (re-)fresher on piping stdout and sterr. :-)

One solution if we want to report progress is to add & tail -f output.log
error.log

On Tue, Aug 12, 2014 at 9:04 PM, Finn [email protected] wrote:

In README.md:

  • $ make -j 4
  • $ make -j4 V=s 1>output.log 2>error.log

I would personally say not to to redirect the output as its mostly useless
unless something goes wrong, and this way you get no idea of the progress


Reply to this email directly or view it on GitHub
https://github.com/SeattleMeshnet/meshbox/pull/17/files#r16153044.

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed the space between the j and the 4 - on GNU make 3.1, you get a
warning with the space telling you that it's dropping to -j1.

On Tue, Aug 12, 2014 at 9:05 PM, Finn [email protected] wrote:

In README.md:

  • $ make -j 4
  • $ make -j4 V=s 1>output.log 2>error.log

Maybe something like "If it fux up, do this to get more debugging info"
but just make -j 4 by default? That's what most OpenWRT docs seem to
suggest IIRC


Reply to this email directly or view it on GitHub
https://github.com/SeattleMeshnet/meshbox/pull/17/files#r16153061.

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, or tee the output. I still prefer saying make -j4 then falling back to that on errors

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly about it, so whatever you like is fine.

On Tue, Aug 12, 2014 at 9:09 PM, Justin Holmes [email protected]
wrote:

On Tue, Aug 12, 2014 at 9:08 PM, Finn [email protected] wrote:

In README.md:

  • $ make -j 4
  • $ make -j4 V=s 1>output.log 2>error.log

right, or tee the output. I still prefer saying make -j4 then falling
back to that on errors


Reply to this email directly or view it on GitHub
https://github.com/SeattleMeshnet/meshbox/pull/17/files#r16153132.

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

Justin Holmes
Chief Chocobo Breeder, slashRoot

slashRoot: Coffee House and Tech Dojo
New Paltz, NY 12561
845.633.8330

(Use four cores, log stdout and stderror to separate files)

To update:
# Flashing

$ ./scripts/feeds update
##Use a compiled binary to flash with OpenWrt

If the build is successful you will have compiled firmware binaries in the following directory:

bin/<name of target system>/<chipset binary>

ie: `openwrt/bin/ar7xx/openwrt-ar71xx-generic-tl-wdr3500-v1-squashfs-factory.bin`

On some AP's, you can use the OpenWrt firmware upgrade tool to flash the binary from a web interface (LuCi)
`http://192.168.1.1`

(Tested on: TP-Link WDR-3500 v1)

Development
-----------
# Advanced Topics (only tested on Barrier Breaker)

You can point the OpenWRT buildroot to a local meshbox clone by editing `<openwrt>/feeds.conf`:
## Flash using the flash.sh script:

src-link meshbox /path/to/meshbox
you can use the flash.sh script to flash your device via tftp.

If you want to use a local clone of cjdns itself as well, edit `<meshbox>/cjdns/Makefile`:
The script is located in `/scripts/flashing/flash.sh`

Usage: ./flash.sh firmware vendor

## Using a local copy of CJDNS to compile:


If you want to use a local clone of cjdns itself, edit `<meshbox>/cjdns/Makefile`:

PKG_SOURCE_URL:=file:///path/to/cjdns
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=master

You can then build a fresh package, that you can copy to the device, and then install. You need to delete the last clone everytime.
*Make sure to commit your changes to cjdns before building the
package. The OpenWrt buildroot will clone the local cjdns into
the build directory, omitting uncommitted changes.*

$ cd <path to cjdns>
$ git add <name of .config file> && git commit -a -m "<commit message>"

Then continue with the "Building" section above.

## Building an .ipkg for opkg install:

Alternativly to flashing via tftp, you can integrate meshbox and cjdns into an
existing OpenWrt installation.

Build a fresh package from the compiled firmware to copy and install via ssh.

$ cd <path to OpenWrt>

####You'll need to delete the last clone everytime you compile the .ipkg.

$ rm dl/cjdns-*

####Now, make the .ipkg.

rm dl/cjdns-*
make package/cjdns/{clean,compile} V=s
scp bin/<target>/packages/cjdns-*.ipkg root@<ip>:/tmp/cjdns.ipkg

This will write a number of chipset specific binaries to `<openWrt>/bin/<name of target system>`

####Then, scp the package to your device.

scp bin/<name of target system>/packages/cjdns*.ipkg root@<ip>:/tmp/cjdns.ipkg

####Finally, remotely install the .ipkg from the device.

ssh root@<ip> 'opkg install /tmp/cjdns.ipkg'

Make sure to commit your changes to cjdns before building the package. The OpenWRT buildroot will clone the local cjdns into the build directory, omitting uncommitted changes.



TODO
Expand Down