0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-09-19 02:00:07 +02:00

Add pages with notes on uhttpd and building an image.

Wouter R 2013-04-24 15:33:39 +02:00
parent 857c476a6f
commit a5669c9a14
2 changed files with 62 additions and 0 deletions

36
BuildOpenwrt.md Normal file

@ -0,0 +1,36 @@
# Building OpenWRT for the WifiBox
TODO: add steps to clone openwrt, install required software, create an image (on OSX) and fetch package feeds
When changing enabled packages, make sure the image has been created (check the timestamp). If not, the contents were probably too large to fit on the device.
Luci and Python (even mini) are notable for causing this.
## Configuration changes
- set target system ar7xxx/ar9xxx
- set target profile to TP-Link MR3020 or WR703N
- disable all target images except squashfs
- enable 'Build the OpenWrt SDK' (or just toolchain?) in case you want to include your own packages
- enable Base System/wireless-tools (Utilities/iwinfo not needed unless cmdline tool is needed)
- enable Languages/Lua/lua
- enable Libraries/libuci-lua
- Languages/Lua/libiwinfo-lua
- (*ignore this one, it crashes uhttpd*) enable Network/Web Servers&Proxies/uhhtpd-mod-lua and follow this: http://wiki.openwrt.org/doc/uci/uhttpd#embedded.lua
- disable Network/ppp and Network/ppp/ppp-mod-pppoe
- (Global build settings) disable kernel symbol table, debug info and sysrq support
- (Global build settings) disable ipv6
## Extra changes (optional)
- enable LuCI/Collections/luci if you want it
- enable LuCI/Themes/luci-theme-bootstrap if you like
- enable Languages/Python/python-mini if you want Python
- enable uhttpd debug messages (Network/Web Servers\/Proxies)
## Further notes on setting up an unconfigured device
- it might be necessary to remove the host key from .ssh/known_hosts to prevent an ssh error
- it might be handy to add a host entry to `.ssh/config` so you don't need to use an account name and can use a hostname instead of IP
- set password to have the device switch from telnet to ssh
- upload `.ssh/id_rsa.pub` to `/etc/dropbear/authorized_keys` for public key authorization
- change the wired IP to something not very common to avoid collisions (e.g. 192.168.5.1/24)
- upload files under <<file extra/wifibox-restore-files master>> to the device
- deploy contents of src directory to /usr/share/lua/autowifi (create the directory first with mkdir -p)
- check the <<file src/README master>> in the src directory for final setup steps

26
UhttpdCrash.md Normal file

@ -0,0 +1,26 @@
# Analyzing uhttpd crashes
TODO: describe when this happens (sometimes in portal mode and always when webroot does not exist?).
- First, enable debug support in the binary by modifying package/network/services/uhttpd/Makefile: add `TARGET_CFLAGS += -ggdb3 -O0` below `TARGET_LDFLAGS`.
- Next, enable building the toolchain (we need a gdb which understands mips images).
- Make sure symbol stripping is disabled (under Global build settings) and check that other settings are correct as well (e.g. core dumps and process debugging enabled).
- After updating with the new firmware, enable core dumps by running `ulimit -c unlimited`.
- Stop uhttpd (`/etc/init.d/uhttpd stop`).
- Run it yourself: `uhttpd -f -p 80 -h /www`.
- Do something to make it crash and voila.
- After copying the file over to the host computer, open it in gdb with this command: `<gdb-executable> uhttpd <core-file>`.
There must be a more logical place, but at least the gdb executable can be found under the `staging_dir/toolchain/<target-spec>/bin` directory.
(More likely is `build_dir/target-<spec>/OpenWrt-Toolchain-<spec>/toolchain-<spec>/bin`...add it to the PATH for easier access)
## Some handy gdb commands
From [here](http://stackoverflow.com/questions/5115613/core-dump-file-analysis).
- bt (backtrace)
- frame n (select stack frame n)
- info locals (display variables)
- list (display code)
- print v
## Further notes
- [posts about uhttpd on openwrt](https://dev.openwrt.org/search?q=uhttpd)