Page 321 - Hacking Roomba
P. 321

302       Part III — More Complex Interfacing




                             The peripherals supported by OpenWrt are constrained by the type of hardware it’s running
                             on. Obviously if the wireless router has no USB interface, it cannot support USB devices. Most
                             peripherals that both work on Linux and have some way to be hooked up to a router work in
                             OpenWrt. These include devices like IDE drives, flash drives, disk drives, serial adapters, web-
                             cams, and printers.

                             How OpenWrt Differs from Regular Linux
                             Unlike the Linux you may be familiar with, OpenWrt is pared down severely in order to fit in
                             the 4 MB flash chip. The most striking difference is the lack of permanent disk space. The disk
                             is really the flash chip, and the base OpenWrt system fills most of that up. OpenWrt also cre-
                             ates a RAM disk with the available RAM and that offers a good temporary storage location.
                             Many OpenWrt setups operate entirely in a read-only file system mode where the flash disk
                             cannot be written to. This is more secure, but makes for a miserable hacking experience.

                             To store changeable configuration information like network setup and Wi-Fi settings, a special
                             64 KB section of the flash chip is reserved for what is known as NVRAM (for non-volatile
                             RAM, even though it’s not RAM any longer). OpenWrt, the bootloader, and the stock
                             vendor firmware all use NVRAM. This means that firmware upgrades don’t erase your net-
                             work configuration.

                             When you have OpenWrt up and running, type nvram show on the command line to see all the
                             nvram variables.




                             To provide the command line tools you expect in a Linux system, OpenWrt uses BusyBox
                             (www.busybox.net/), a single program that combines most of the tiny utilities everyone uses.
                             So if you were to look in the /bin directory of an OpenWrt machine, you’d see the following:
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 ash ->
                             busybox
                             -rwxr-xr-x    1 root     root       551416 Mar 27 00:06 busybox
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 cat ->
                             busybox
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 chmod ->
                             busybox
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 cp ->
                             busybox
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 dd ->
                             busybox
                             lrwxrwxrwx    1 root     root            7 Mar 27 00:06 df ->
                             busybox
                             [...]
                             Using BusyBox saves an enormous amount of space. Another big space saver is the use of
                             uCLib (http://uclibc.org/), a C library that is much smaller than the GNU C Library
                             that is standard with Linux. The standard C library contains hundreds of useful functions like
   316   317   318   319   320   321   322   323   324   325   326