There's a ton of pixels out there about OpenWrt. It's open source router software that can do an excellent job of expanding the capabilities of some routers way beyond what the manufacturers provide. I had an OpenWrt router for a while, it eventually went up in smoke and I've been using what the DSL provider recommends ever since. However, I ran into the HLK-RM04 <link> through the suggestion of a reader and decided to look into expanding the capabilities of this little device and OpenWrt seemed like a good choice to use as software for it.
There's a few threads on the OpenWrt forum and a couple of interesting repositories on github that relate to the device and they look reasonably promising, So, I read the threads, and all of them suggested either picking up a binary they created or building my own. There were involved instructions on the build, so I thought, "Why not?" Thus began my misadventures with building OpenWrt for the HLK-RM04.
First, I tried the binary that was created by one of the guys that frequents the OpenWrt forum. This binary seemed to have great possibilities since, once you have a version of OpenWrt running, you can add to it and update it pretty easily. So I followed the instruction to install the uboot boot loader and then installed the image that the guy put in github. This process went pretty well, but very little worked on the router. I could get an ethernet connection, but wireless and any outside access wouldn't work. When I tried to enable wireless, the rm04 ran out of memory. Fine, I'll build my own and learn about the configuration of the software while going through the process.
So, I thought to myself, I really should make sure I could restore the rm04 to factory settings. Oops, too late. Once you install uboot on the device, the factory software is gone and can't be recovered. Even though it's in a different part of the device, there just isn't any way to get to it. Sure, I could have spent about a month learning the ins and outs of the JTAG interface and bit banged myself a backup, but that didn't seem like a valuable skill to pursue. There were two reasons I was tardy in looking at a way to back it up. The first was because there really aren't any useful instructions out there on how to backup. Sure there's a OpenWrt <link> wiki page on it, but I couldn't get enough information out of it to even attempt anything. The 'How To' was full of 'could', 'maybe', and 'beware', with no real examples. Like I said, I'd have to learn the intricacies of JTAG to have a chance. The second was because there isn't a serial interface to control the chip. There's a serial line, but you can't log into it and do anything. I really don't understand why manufacturers do this, do they want to sell these things?
I guess I better make OpenWrt work.
I downloaded OpenWrt, configured it the way the instructions said and started make. Six hours later, it failed. Following the instructions, I used the V=s option to see what was failing. It turns out that OpenWrt installation only installs part of the code, the makefile goes to various servers and their mirrors and downloads more. The file it failed on was a little over two meg, so I tried it again. Of course, it failed again. I set up a little script to restart the make if it died and went to bed.
The next morning, it was still trying to load files. Yes, I got the two meg and several others, but the files were getting enormous. I watched it fail five times on an eight meg file and decide this wasn't working, so I hunted down the retry count and timeout amount in the scripts and changed them to 25 retries and a full minute timeout. Ran it again and it seemed to stumble through some of the downloads. However, when I watched the log, it was failing quite often with a 404 error on a file that it had been previously reading; what? So, I changed the retry to 50 to allow for server errors and let it go again.
It chugged along for many hours and then I noticed that the file size was getting larger and larger. There were files over 90Mb that were trying to be loaded. The internet, my little machine, and bad luck were really conspiring because at one time I noticed the load speed was two bytes (yes bytes) a second. Obviously, this wasn't going to work, at least in the time I have left on the planet.
Time to try another tactic. I saw three possibilities 1) Configure various things out of the binary version I had previously tried until I got the bare minimum and see what I could get running. 2) Download and install a version I ran across that said that they had already stripped it to almost nothing. 3) Try to get the original software from somewhere and put it back, then start off with some other tactic.
I did all three. I went to the OpenWrt image I had running, but ran out of memory, and started cutting things out. Problem with this was that when I cut something out that I shouldn't, the little board died and I had to start over cutting things out. This got tiring, but I got really good at loading software on the board and backing up the OpenWrt config files such that it was only tedious to restore it, not a real pain. However, I never did get enough out of the distribution of OpenWrt to allow wireless to run without it failing from running out of memory.
So I went to step 2 above and loaded a bare minimum system on the board. This one held some promise, but I couldn't get past the configuration changes necessary to make the board do something useful.
Step three was now the remaining option. I dropped a note to the manufacturer asking for the very latest version of the boards software. I hoped they would send it then I could try loading it on the board with uboot to see if that would get me back to the starting point. I also dropped a note to a person that had posted that he had the manufacturer's files and had used them. I fully expected to get no response from either of them, ... but:
The other customer that had the files posted them to github so folk could pick them up there. So, the last two versions of the board's OS are out there to be tried. The manufacturer actually answered me and sent a lot of documentation that appears to be correct. They said they would send me the files as well, but I haven't received them yet.
This was totally unexpected. Two total strangers responded extremely rapidly and there are possible solutions that I can try. Gathering up enough cables and wires to make a huge mess, I tried loading the factory files to the board with uboot. No luck there, I got the horrible message, "Bad Magic Number," and the boot failed. I tried to look into the magic number, thinking that I could change it and get the file to execute. No such luck. One (get this only one) person had fought the battle against this message and posted about his trials <link>. Turns out that it wasn't just a magic number, it's a 60 byte header that includes compression type, CRC checksum, and a bunch of other stuff I didn't know and couldn't think of a way to find out.
I'm out of options.
It's not as bad as it sounds though. Remember, I bought this board as a tool that I could use to monitor devices and possibly make changes with. It was truly compelling because it's relatively small and cheaper than most solutions out there. Wait, cheap? I ordered another chip for the board. Since the board is just interfaces and mounts, a new chip will give me a second chance to try and get everything I need working, and I have loads of experience with it now to keep from making some of the mistakes that got me into this mess.
Back when I started experimenting with the board I managed to make a reasonable 802.11 b/g/n gateway with it. That was a nice bonus because it meant that I definitely could get some use out of it as a wifi device. If I can get the serial port to send data over wireless, that would just be icing on the cake. That's worth another 10-12 bucks investment. If I'm lucky, the newer software, better documentation, and experience could lead to a nice versatile addition to my network.
The problem with OpenWrt is that it is too versatile. Over the years many people have contributed to the project and it has grown to the point where one needs a quad processsor running at light speed to build it the first time. Of course that also means a quantum link to the ethernet or access to the buss of the server. If you can get it loaded and built, you've actually got something that you can do something with because the ability to update it is really nice. It's that first time that will test your patience. When I finally gave up, it was over 2G and still growing; allow for this in your plans.
Now I'm waiting for the new chip and holding on to the updated manufacturer's software. I have notes on how to do things that shouldn't kill the board and understand a whole lot more about the device.
C'mon mail.
There's a few threads on the OpenWrt forum and a couple of interesting repositories on github that relate to the device and they look reasonably promising, So, I read the threads, and all of them suggested either picking up a binary they created or building my own. There were involved instructions on the build, so I thought, "Why not?" Thus began my misadventures with building OpenWrt for the HLK-RM04.
First, I tried the binary that was created by one of the guys that frequents the OpenWrt forum. This binary seemed to have great possibilities since, once you have a version of OpenWrt running, you can add to it and update it pretty easily. So I followed the instruction to install the uboot boot loader and then installed the image that the guy put in github. This process went pretty well, but very little worked on the router. I could get an ethernet connection, but wireless and any outside access wouldn't work. When I tried to enable wireless, the rm04 ran out of memory. Fine, I'll build my own and learn about the configuration of the software while going through the process.
So, I thought to myself, I really should make sure I could restore the rm04 to factory settings. Oops, too late. Once you install uboot on the device, the factory software is gone and can't be recovered. Even though it's in a different part of the device, there just isn't any way to get to it. Sure, I could have spent about a month learning the ins and outs of the JTAG interface and bit banged myself a backup, but that didn't seem like a valuable skill to pursue. There were two reasons I was tardy in looking at a way to back it up. The first was because there really aren't any useful instructions out there on how to backup. Sure there's a OpenWrt <link> wiki page on it, but I couldn't get enough information out of it to even attempt anything. The 'How To' was full of 'could', 'maybe', and 'beware', with no real examples. Like I said, I'd have to learn the intricacies of JTAG to have a chance. The second was because there isn't a serial interface to control the chip. There's a serial line, but you can't log into it and do anything. I really don't understand why manufacturers do this, do they want to sell these things?
I guess I better make OpenWrt work.
I downloaded OpenWrt, configured it the way the instructions said and started make. Six hours later, it failed. Following the instructions, I used the V=s option to see what was failing. It turns out that OpenWrt installation only installs part of the code, the makefile goes to various servers and their mirrors and downloads more. The file it failed on was a little over two meg, so I tried it again. Of course, it failed again. I set up a little script to restart the make if it died and went to bed.
The next morning, it was still trying to load files. Yes, I got the two meg and several others, but the files were getting enormous. I watched it fail five times on an eight meg file and decide this wasn't working, so I hunted down the retry count and timeout amount in the scripts and changed them to 25 retries and a full minute timeout. Ran it again and it seemed to stumble through some of the downloads. However, when I watched the log, it was failing quite often with a 404 error on a file that it had been previously reading; what? So, I changed the retry to 50 to allow for server errors and let it go again.
It chugged along for many hours and then I noticed that the file size was getting larger and larger. There were files over 90Mb that were trying to be loaded. The internet, my little machine, and bad luck were really conspiring because at one time I noticed the load speed was two bytes (yes bytes) a second. Obviously, this wasn't going to work, at least in the time I have left on the planet.
Time to try another tactic. I saw three possibilities 1) Configure various things out of the binary version I had previously tried until I got the bare minimum and see what I could get running. 2) Download and install a version I ran across that said that they had already stripped it to almost nothing. 3) Try to get the original software from somewhere and put it back, then start off with some other tactic.
I did all three. I went to the OpenWrt image I had running, but ran out of memory, and started cutting things out. Problem with this was that when I cut something out that I shouldn't, the little board died and I had to start over cutting things out. This got tiring, but I got really good at loading software on the board and backing up the OpenWrt config files such that it was only tedious to restore it, not a real pain. However, I never did get enough out of the distribution of OpenWrt to allow wireless to run without it failing from running out of memory.
So I went to step 2 above and loaded a bare minimum system on the board. This one held some promise, but I couldn't get past the configuration changes necessary to make the board do something useful.
Step three was now the remaining option. I dropped a note to the manufacturer asking for the very latest version of the boards software. I hoped they would send it then I could try loading it on the board with uboot to see if that would get me back to the starting point. I also dropped a note to a person that had posted that he had the manufacturer's files and had used them. I fully expected to get no response from either of them, ... but:
The other customer that had the files posted them to github so folk could pick them up there. So, the last two versions of the board's OS are out there to be tried. The manufacturer actually answered me and sent a lot of documentation that appears to be correct. They said they would send me the files as well, but I haven't received them yet.
This was totally unexpected. Two total strangers responded extremely rapidly and there are possible solutions that I can try. Gathering up enough cables and wires to make a huge mess, I tried loading the factory files to the board with uboot. No luck there, I got the horrible message, "Bad Magic Number," and the boot failed. I tried to look into the magic number, thinking that I could change it and get the file to execute. No such luck. One (get this only one) person had fought the battle against this message and posted about his trials <link>. Turns out that it wasn't just a magic number, it's a 60 byte header that includes compression type, CRC checksum, and a bunch of other stuff I didn't know and couldn't think of a way to find out.
I'm out of options.
It's not as bad as it sounds though. Remember, I bought this board as a tool that I could use to monitor devices and possibly make changes with. It was truly compelling because it's relatively small and cheaper than most solutions out there. Wait, cheap? I ordered another chip for the board. Since the board is just interfaces and mounts, a new chip will give me a second chance to try and get everything I need working, and I have loads of experience with it now to keep from making some of the mistakes that got me into this mess.
Back when I started experimenting with the board I managed to make a reasonable 802.11 b/g/n gateway with it. That was a nice bonus because it meant that I definitely could get some use out of it as a wifi device. If I can get the serial port to send data over wireless, that would just be icing on the cake. That's worth another 10-12 bucks investment. If I'm lucky, the newer software, better documentation, and experience could lead to a nice versatile addition to my network.
The problem with OpenWrt is that it is too versatile. Over the years many people have contributed to the project and it has grown to the point where one needs a quad processsor running at light speed to build it the first time. Of course that also means a quantum link to the ethernet or access to the buss of the server. If you can get it loaded and built, you've actually got something that you can do something with because the ability to update it is really nice. It's that first time that will test your patience. When I finally gave up, it was over 2G and still growing; allow for this in your plans.
Now I'm waiting for the new chip and holding on to the updated manufacturer's software. I have notes on how to do things that shouldn't kill the board and understand a whole lot more about the device.
C'mon mail.