ImageBuilder equivalent of CONFIG_TARGET_PREINIT_IP?

Is there a simple ImageBuilder equivalent of CONFIG_TARGET_PREINIT_IP and CONFIG_TARGET_PREINIT_BROADCAST?
My goal is to build my own images that in their default configuration use a different RFC1918 /24 network as their default LAN address used on first boot with no preserved config files.

I've kludged it by scripting the extraction of bin/config_generate from the base-files*.ipk package file, machine editing the IP address range in there, and supplying the modified xxx/bin/config_generate to the build with make FILES=xxx image.

But perhaps there's a cleaner way to do it through some other ImageBuilder option?

As Imagebuilder uses readily compiled components as a base, there is no easy to modify the config generation in base-files.

The easiest way might be that custom files method, but not for the config_generate script, but to attach a clean /etc/config/network. That would then prevent the config generation from running and you config would be used.

However, that would not help the preinit stage, but just the normal operation. I am not quite sure if you really target the preinit phase, or just the normal operations.

The config option CONFIG_TARGET_PREINIT_IP specifically targets the preinit phase, failsafe mode etc.,
But not normal operation.

Iirc the recommend was is providing an init boot uci script. At least I'm under the impression to have read this somewhere in the wiki. It makes at least sense if you don't know the targets init network conf upfront.

My goal here is the preinit phase, for firmware that is booted without any previous config files saved. Particularly, on my home network, upgrading an ipq40xx system used as an AP from 22.03.3 (swconfig) to SNAPSHOT (DSA), where I need the preinit phase to generate a new /etc/config/network.

That's when I want the LAN side to use a different IP range at first boot. That lets me connect the AP to the home network (uses 192.168.1.x) on the WAN port and connect my computer's second ethernet to the AP's LAN (uses some other RFC1918 /24 range), and reconfigure the AP there before returning it to service.

For normal operations, I'm fine with a standard ImageBuilder output, since I'll then be upgrading with preserved configuration files.

Thanks for the hint, I found it: https://openwrt.org/docs/guide-developer/uci-defaults

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.