Turning a WiFi Router into a general-purpose Network Device

43
Turning a WiFi Router into a general-purpose Network Device Wolf Paulus

description

Embedded systems are increasingly present in our life and quite a few of them can be repurposed (a.k.a. hacked), to make them even more useful. The purpose of this session is to have fun and give you some inside of what\'s involved in turning a $30 wireless router into a general purpose embedded network device, running the LINUX OS and a full featured Java Runtime environment. We will take a closer look at some popular Router OS distributions, like OpenWrt, DD-WRT, FreeWRT, Tomato, or X-Wrt and show how to flash the Fonera (FON) WiFi router with a vanilla OpenWrt distribution. The FON is a very small, relatively simple, and inexpensive router, built on the AR531x/231x Atheros WiSoC (Wireless System-on-a-Chip) with an integrated 32-bit MIPS R4000-class processor running at 183.5 MHz, comes with 8 Mbytes Flash Memory and 16 MByte RAM. In short, it has all the attributes required to be added our digital playground. Embedded OS Development / Kernel Architecture, Implementation and port for Embedded Systems OpenWrt is a Linux distribution optimized especially for embedded devices and surprisingly, the OpenWrt kernel configuration is done with the help of a character based UI. OpenWrt also comes with a lightweight package management system (IPKG or more recently OPKG), meaning that features that have not already been built into the kernel, can be added later, at runtime. As an example, we will take a look at how a JavaVM could be built, packaged, and deployed, or built directly into the kernel.

Transcript of Turning a WiFi Router into a general-purpose Network Device

  • 1. Wolf PaulusTurning a WiFi Router into a general-purpose Network Device

2. 1. Hardware 2. Operating System 3. Runtime Environment 3. 8 MB Flash 8 to 16 MB RAM 183 MHz CPU (MIPS) 1 Ethernet Port (10 / 100 Mbit/s) Wireless: 802.11 b/g (54Mbit/s) 5V DC Power 4. FON 2201 FON 2100FON 2202US$ 43US$ 29US$ 49 5. HardwareHacking 6. USB to Serial Adapter req. RS232 Level Shifter 7. 1. Hardware 2. Operating System 3. Runtime Environment 8. Linux X-WRTDD-WRT OpenWrt LuCIFreeWRT2004 . . . . . . . Linksys WRT54GTomatoHyperWrt 9. HyperWrt based Tomato 10. OpenWrt w/ X-WRT 11. OpenWrt w/ LuCI 12. DD-Wrt 13. LinuxX-WRT DD-WRT OpenWrt LuCI FreeWRT2004 . . . . . . . Linksys WRT54G Tomato HyperWrt 14. 1. Tools for building linux kernel and root le system2. Small BusyBox / Linux distributionGPL licensed for embedded devices3. Fully writable lesystem w/ package managementIPKG or OPKG (automatic dependencies)4. UCI (universal conguration interface) for systemand package conguration 15. inaryle B Sing 16. Fully writable lesystem w/package management 17. Demo 18. SoftwareHacking 19. 1. Make rootfs and kernel available via TFTP 2. Gaining access to the Boot Loader telnet 192.168.1.254 9000 ^C3. Tell RedBoot the location of the tftp server RedBoot> ip_address -l 192.168.1.254/24 -h 192.168.1.24. Initialize the Flash Memory Partition Table Redboot> fis init5. Load and write the root lesystem RedBoot> load -r -b 0x80041000 openwrt-atheros-root.squashfs RedBoot> fis create -l 0x06F0000 rootfs6. Load and write the Linux kernel RedBoot> load -r -b 0x80041000 openwrt-atheros-vmlinux.lzma RedBoot> fis create -r 0x80041000 -e 0x80041000 vmlinux.bin.l77. Tell RedBoot which kernel to boot into RedBoot> fis load -l vmlinux.bin.l78. Boot into the new System RedBoot> exec 20. Partition Table 21. Demo 22. 1. Hardware 2. Operating System 3. Runtime Environment 23. Target devices CDC is intended for a broad range of resource- constrained devices such as smartphones, TV set- top boxes, telematics systems, and RFID readers.Typically, these devices include a 32-bit microcontroller and require about 2 MB of RAM and 2.5 MB of ROM for the Java runtime environment alone.Relationship with Java SE Each CDC version is based on a related Java SE software version. CDC 1.1 is based on J2SE version 1.4.2. 24. Foundation Prole 1.1 (JSR 219) Core Java class library No GUI support Personal Basis Prole 1.1 (JSR 217) Lightweight component support xlet support Personal Prole 1.1 (JSR 216) Full AWT support Applet support CDC optional packages RMI, Security (HTTPS), JDBC, Swing, etc. 25. Core CDC Foundation Prole 26. Java (CDC) for OpenWrt Get the phoneME source from java.net Mod. the make le to point into the OpenWrt toolchain Run make in the OpenWrt SDK folder Run make in the linux-mips-openwrt folder Create the ipkg package structure Move the le structure into the OpenWrt toolchain Run make in the OpenWrt SDK folder 27. https://phoneme.dev.java.net/ How to build phoneME for OpenWrt http://wolfpaulus.com/journal/embedded/fonera2.html How to build phoneME for Mac OS X http://markus.heberling.net/tag/phoneme/ 28. Building with phoneME javac -source 1.4 -target 1.4 *.java -classpath btclasses.zip:basis.jar 29. Demo 30. Amazon Elastic Compute Cloud (Amazon EC2) Googles Application Engine Managed Hosting EnterpriseComputing InfrastructureHome NetbooksSmart Phones ,TiVo, NetFlix Roku, AppleTV Embedded Devices, Storage (Ext. HardDrives, Drobo) 31. Thanks forcoming http://wolfpaulus.com 2003-2006 Carlsbad Cubes 2009 wolfpaulus.com