OnionIoT / openwrt-buildsystem-wrapper

Easily build packages, firmware, and more using the OpenWRT Build System
GNU General Public License v3.0
9 stars 1 forks source link

File system layout for building #16

Closed feamsr00 closed 1 year ago

feamsr00 commented 1 year ago

Silly question maybe.

First congrats on this tool. Its more painless to get running then expected! However, I'm not quite grokking how to use the new build tool's file system. I'm looking for the location to store custom files (https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#custom_files). I'd assume I'd find a "./files" folder that has other onion customizations that produced the new beta image. (For example files/etc/uci-defaults/12_onion_defaults I assume exists somewhere which is how it would end up in /rom/uci-defaults/12_onion_defaults)

I've tried creating and populating openwrt-buildsystem-wrapper/onion/files/ but this doesn't seem to make it into the baked image.

So where are custom files hiding?

greenbreakfast commented 1 year ago

@feamsr00 Not a silly question at all, I totally get where the confusion is coming from.

Short answer

Don't use this repo to build your firmware, instead use OnionIoT/openwrt-imagebuilder-wrapper.

It has support for adding custom files to the firmware. See this section of the readme: https://github.com/OnionIoT/openwrt-imagebuilder-wrapper#the-additions-directory On top of that, builds are much quicker - on the order of minutes.

Long Answer

This repo, the buildsystem wrapper, actually isn't used to build the beta firmware. Rather, we use it to build customized versions of the OpenWRT SDK and image builder.

From there building the beta firmware is a two-step process: 1) we use the OnionIoT/openwrt-sdk-wrapper to build the packages from the openwrt-22.03 branch of OnionIoT/openwrt-packages, then 2) we use the OnionIoT/openwrt-imagebuilder-wrapper to build firmware images that include the packages from step 1.

(There's a little more info about this on our community: https://community.onion.io/topic/4993/beta-firmware-update-nodejs-v16-19-openwrt-22-03-3-and-more)

I've created an issue to make sure we document the build process properly: https://github.com/OnionIoT/OpenWRT-Packages/issues/60

So where are custom files hiding?

In addition to the new build process, we've also started moving away from having loose custom files!

Instead, we put our custom files into packages. If the custom files involve changing existing config files, our packages use uci-default scripts to make those changes on the first boot. Check out the omega2-base package for examples: https://github.com/OnionIoT/OpenWRT-Packages/blob/openwrt-22.03/omega2-base/Makefile

Ofc making a package is more work than simply using the files feature, so that's still a viable option. Completely up to you!

feamsr00 commented 1 year ago

@greenbreakfast First off, awesome! Second off, that time to build time dropping by an order of magnitude is excellent.

I'm pleased to report that we baked our very first image with OnionIoT/openwrt-imagebuilder-wrapper. There some things to work out as I can't quite get my uci-defaults script to apply consistently.

Also we have a unit that crashes every time the beta firmware tries to load the Wi-Fi driver. Where should I file a bug on that and/or get maximum details for you guys?

I look forward to more extensive documentation especially on the image baking side. One of the reasons we selected Onion was that the Omega really seems to be the best turnkey modules\packages out there. I haven't seen anything with a better combination of price accessibility (in unit price and no MOQ), module performance (CPU, RAM, Bus IO), welcoming in resources (source availability, documentation, community etc), and relevancy (keeping units available, versions up-to-date, documenting common and foundational use cases, etc.)

I know relevancy was something Onion was somewhat weaker on, but getting this new image out quashes that. Kudos to you guys for building this ecosystem on top of the MT7688 SoC.

I'd really look forward to future documentation that brings some of this exiting information together to specifically discuss the path through proof of concept to commercialization. Now that, I believe, would put onion back on the map. :)

greenbreakfast commented 1 year ago

I'm pleased to report that we baked our very first image with OnionIoT/openwrt-imagebuilder-wrapper. There some things to work out as I can't quite get my uci-defaults script to apply consistently.

Glad to hear it! The uci-default scripts will execute based on their alphabetical order. So it's possible the configuration set by your uci-default scripts is being overwritten by other uci-default scripts.

Check out /rom/etc/uci-defaults/ on the device to see the order of execution. As well as https://github.com/OnionIoT/OpenWRT-Packages/tree/openwrt-22.03/omega2-base/files/etc/uci-defaults to see the uci-default scripts we add.

I recommend setting your uci-default script name so that it runs after the ones added by Onion.

Also we have a unit that crashes every time the beta firmware tries to load the Wi-Fi driver. Where should I file a bug on that and/or get maximum details for you guys?

Does it also crash running the latest stable v0.3.4 Omega2 firmware? And how are you providing power? With an Omega2 dock or something custom? Making a post on the Onion Community is your best bet for debugging.

I know relevancy was something Onion was somewhat weaker on, but getting this new image out quashes that. Kudos to you guys for building this ecosystem on top of the MT7688 SoC.

Thanks for the kind words :) We're very excited about the new firmware and the Omega2 improvement initiative overall!

I'd really look forward to future documentation that brings some of this exiting information together to specifically discuss the path through proof of concept to commercialization.

Yep, this type of documentation is on our roadmap!

We will be leaning on Omega2 users to help us determine what should be documented and in what priority.

As a first step, you can submit issues in our OnionIoT/OpenWRT-Packages repo requesting documentation on a specific topic and we will do our best to turn it around.

We'll also go about creating documentation in a more systematic way in the future, so keep your eyes peeled for news in the mid-term

greenbreakfast commented 1 year ago

Closing this issue, feel free to get in touch anytime