Building custom firmware for onion with extra files
We are trying to deploy a number of Omega Onion 2 Pro devices out to the field (which could end up becoming quite a large number in the future). We'd like to make the setup process as streamlined as possible. We need:
-Bundled Python 3, with some python pip modules
-Custom scripts configured to start on boot
-Ability to carry out further updates of our software offline from a usb stick (we have a working script for this but again, it needs bundling in and setting up for the first time)
At the moment this is configurable manually by installing python and creating some init files to start the scripts custom scripts on boot. Ideally though we'd be able to just replicate it on other Onion devices without having to do loads of manual setting up.
When I've done this using Raspberry Pis and similar devices before, I've been able to automate this process very easily by just cloning the disk images onto different sd cards or internal MMC storage. This doesn't seem to be possible for the Onion.
I've also tried building the Onion firmware from source and trying to add files to the "files" folder to be included, but this doesn't seem to work correctly. If this could work, it could be quite a good solution as it would mean python could be added very easily from the menuconfig. However when I try to build it, I only get a omega2...sysupgrade.bin file, rather than the omega2...factory.bin file that I need to do a flash of the firmware from uboot. I've tried changing various options but can't get it to generate the factory.bin file and there are no warnings or anything that would cause it not to do that. Does anyone have any ideas how to fix this issue? And does making a firmware image with custom software shipped with it sound like a good solution to automating installation? Or is there a better idea? The devices in the field will not always have internet access so being able to set them up offline is desirable.
@Joshua-O-Leary I build my own firmware based upon the Onion image, I uses the files directory extensively, what exactly is not working?
I don't know that the name of the firmware name is any issue unless you are trying to use the reset procedure to load it from USB. I load mine using tftp method.
Hi @crispyoz, the problem is both images are not generating. When building firmware, normally a squashfs-factory.bin image and a squashfs-sysupgrade.bin image are generated, for a clean flash and an upgrade respectively. However when I run make world (after configuring with make menuconfig), only the sysupgrade file is generated but I need the factory one. The factory firmware is not generated at all.
To put files on the image, I was trying to add them in the "files" directory in the root of the source, maintaining the Linux filesystem hierarchy.
@Joshua-O-Leary what version of the build system, are you using?
Just for clarity, assuming your build system is in /home/your_login/source, you will place your files in /home/your_login/source/files and treat that as your root file system. My build system has as follows:
I had an issue where I was including a custom banner file in files/etc and it was being overwritten by the build system so I need to add a hotplug script to resolve the issue on first boot.
This works on a newly installed build system, there is nothing you need to tweak.
With regard to factory.bin sorry I have no idea, I never have the need.
@crispyoz , thanks for your response, I'm using the latest version of the branch openwrt-18.06 from the OnionIoT/source repo.
Regarding the files directory, I have found in the past that sometimes the build system does not pick up changes unless i run make clean then make