The build environment for HLK-RM04 development is quite easy to setup on a Linux computer or virtual machine. I have used Ubuntu12 for this project and I would suggest starting there because the build dependencies are already worked out for you. One small caveat is that you must use a 32 bit Ubuntu iso because the Ralink SDK tool chain is already compiled for a 32 bit architecture. All of these can be worked around; that is you can use different Linux distributions and you can force the Uboot build to use the OpenWRT tool chain which eliminates the 32 bit iso issue. If you want to change things you are on your own.
I used ubuntu-12.04.4-desktop-i386
Start by downloading and installing the Ubuntu iso image. Either install it on an old PC or try using a virtual machine running on you Windows platform. I’ve had great success with both.
Install Build Tools
The standard Ubuntu Linux is really targeted at desktop users so it does not come with all of the build tools pre-installed. To correct this we need to download and install a few extra packages on the Ubuntu machine. Open an terminal widow and issue the following command to install a few build essentials from a terminal command line.
sudo apt-get install synaptic automake libtool libncurses5-dev flex bison g++ zlib1g-dev gawk subversion git libssl-dev vsftpd gettext
Without these basic tools you will end up with endless errors when you try and proceed with compiling Uboot or OpenWRT.
Install the MIPs cross compiler
Ubuntu does not include a cross compiler for the MIPs processor that is used on the HLK-RM04 so we need to install one. I have chosen to use the compiler that was provided in the Ralink SDK because that was fairly easy to do. This is a 32bit version of the compiler.
Download the buildroot-gcc342 (change the .txt extension to .tar.bz2) and copy it to your Ubuntu12 desktop.
Install MIPs toolchain
cd Desktop
sudo cp buildroot-gcc342.tar.bz2 /opt
cd /opt
sudo tar -jxvf buildroot-gcc342.tar.bz2
sudo ln -sf buildroot-gcc342 buildroot-gdb
That’s it for now; you have installed all of the tools required to build your own images.