I've been working on developing a custom image for my WG3526 router. I used the menuconfig while I was starting out, and got it tweaked with all the custom packages I wanted. If I include any custom files in the files/ folder, it builds and installs no problem.
However, I recently decided I wanted to use the imagebuilder because I have an IPK package I wanted to install by default. Everything works great when using the image builder. The problem I'm facing is I cannot include custom files in the image builder.
When I compile firmware with just additional packages it loads onto the router just fine. I've tried to compile the same image but with some replaced files (namely the config/network file), and it compiles just fine but when I flash it onto the router, it gets stuck with the IP of 169.254.145.88 and subnet mask 255.255.0.0 with no router ip.
I've tried putting custom files in different folders, I even tried just adding a custom file and not even replacing an existing one. It's still the same thing of the router not booting on.
The command I'm running inside my image builder folder is: make FILES="files/" I've also tried it with make FILES=files/ just in case it shouldn't have quotes. But every time, it compiles just fine but it will not boot on the router. However when I do just make it boots just fine on the router. So there seems to be a specific problem with the custom files being added in.
Currently the only custom file I'm testing with is /etc/config/network.
Reading into that looks like it'll be a solution to my problem.
I'm having a bit of a struggle on how to edit an existing file though. So in the case of the config/network file, how would I go about editing the wan interface name from wan to wan0?
So far I see how you can add to the file just using cat << EOF >> ... but I'm having a hard time finding how to actually edit a specific section.
Even with just that addition, I'm still having the problem with the router not booting up. If you notice, I even put the 99_xxx which was recommended to make sure it was run last.
I ran the updated code with the cat << 'EOF' > ... on the firmware image which doesn't have the updated files and it went through just fine. I then restarted the router and it restarted perfectly. However, when I build the image with that command in the 99_network it will not boot.
@vgaetera If I'm understanding fully, you're saying to replace my script, and put your script into the 99_network file?
For sake of testing I removed all the contents of the 99_network file and rebuilt the image. The .bin file was the exact same size as my previous .bin file which had the contents in the 99_network file.
Even with a completely blank file, the router still won't power on.
I also created a blank file named network1 and pushed it to /etc/config, however that also causes the router to not power on. Any thoughts on that?
@WilliamCellTech, this might be a bug if you are building a snapshot.
You can check if the issue persists when building a stable release.
Or try building from sources.
@pwned, these scripts are sourced, thus they don't need shebang or executable bit.