Cross compilation for broadband routers

Lately, I'm interested to know what we can do with broadband devices or home stations that ISPs install in our houses and what kind of traffic we have inside our houses because if I could sniff my neighbour's FTTH, everybody could do it. These thought, about analyzing broadband devices, come from two or three years ago when I wanted to install applications and services in an ONT manufactured by ZTE. However, those years were vivid and exhausted because I was learning english, thinking and writing for the ISACA Challenge, writing in this blog, studying for ISACA certifications and working as well, thus I didn't have enough time to think about it, but this year is being more relaxing and from time to time I go back to think about this field, home networks.

Most Cisco routers, ZTE routers, Huawei routers, Alcatel-Lucent routers, etc work with small embedded operating systems with a set of Unix tools which come from the Busybox software package. These devices usually have very limited resources and they are made with MIPS microprocessors which are based on a System On a Chip (SoC) because CPU is integrated with memory, ethernet NICs, wireless interface, PCI, USB, etc.

MIPS devices
It's interesting to know the large number of protocols that ISPs use to maintain, configure and deploy automatically devices inside our homes, like TR-069 which is used for instance to deploy the ISP configuration from Auto Configuration Servers (ACS) to the end-user devices like routers or VoIP phones. TR-069 was published by the Broadband Forum and entitled as the CPE WAN Management Protocol (CWMP).

TR-069 Family of Remote Management Specifications
Once we know that most broadband devices have MIPS CPUs, if we have developed an application or service and we want to run it in the embedded operating system, we have to compile it in the MIPS architecture. The steps to make cross compilation in a Ubuntu laptop for MIPS architectures are the next:

Add the next line to the repositories:
  • deb squeeze main
Run the next:
  • dpkg -i libgmp3c2_4.3.2+dfsg-1_amd64.deb
  • apt-get update
  • apt-get install emdebian-archive-keyring
  • apt-get install linux-libc-dev-mips-cross libc6-mips-cross libc6-dev-mips-cross binutils-mips-linux-gnu gcc-4.4-mips-linux-gnu g++-4.4-mips-linux-gnu
Our development platform is ready, then we write the application and compile it.

Developing and compiling

Finally, we have seen that the Hello World application fails in my machine, that is normal because my laptop has not a MIPS architecture. We'll see in a Huawei router:

Application "Hello World" for MIPS architecture

Ooooh …. it isn't work either, I have to study and test more, we'll see in next posts.

Regards my friends and remember, test your thought and test whatever you are thinking.