Build guide for a firmware based on OpenWrt for HiLink HLK-RM04
HLK-RM04 is a small wifi module which is produced by HiLink.
It is based on the Ralink RT5350 with some GPIOs raised out.
HLK-RM04 has 4M flash and 16M SDRAM on-package, 1 USB port, 2 UART ports (lite and full), 1 I2C, 2 GPIO (GPIO0, RIN), and 2 Ethernet ports (LAN and WAN). In different configurations, you can get different numbers of GPIO pins (for example 8 GPIOs + 1 serial port).
Even though the module can be upgraded to have twice as much flash and RAM, our purpose is to use it without hardware modifications. Everything here is compatible with the standard 16M RAM module.
The main purpose is to have the module connected to a WiFi network and somehow access the serial port and GPIOs over TCP/IP. Eventually it should be nice to hook it up to some rellays and/or use it as a remote serial console.
There are 3 prebuild images with different features but the recommended one is mini-serial which has the following features:
16M of RAM really isn't that much and because of that the image includes bare minimum software.
git clone git@github.com:bogdanr/HLK-RM04.git
make menuconfig
make
After it compiles successfully, you'll find images in bin/ramips/
which are named openwrt-ramips-rt305x-hlk-rm04-*.bin
.
openwrt-ramips-rt305x-hlk-rm04-squashfs-sysupgrade.bin will be used for when upgrading from another OpenWRT image.
openwrt-ramips-rt305x-hlk-rm04-initramfs-factory.bin will be used only once, when upgrading the HLK-RM04 module for the first time.
The most important thing is to flash the uboot128.img bootloader image. This one will then allow you to flash system images over and over again. Accessing the device via the serial interface will also be absolutely necessary.
The standard UBoot is silent so we can't see any messages from it that would allow us to easily flash the module. At the http://192.168.16.254/adm/hlk_update_www_hlktech_com.asp address we are allowed to flash a new bootloader. Obviously this is just the standard IP address of the module. You should know what to use if you changed it. After you flash it, check if it still boots :)
With the serial cable connected and configured as 57600,8,n,1 you shouls start seeing stuff when the module boots. If this doesn't happend STOP here!
in.tftpd -L /tmp
if your image is in /tmp2
quickly and only once to enter in TFTP flash mode. Then push Y
to proceed.192.168.16.1
. Set server IP to 192.168.16.100
.192.168.16.100
./tmp/openwrt-ramips-rt305x-hlk-rm04-squashfs-sysupgrade.bin
.