I try to geht some additional stuff (Perl, snmpd...) on a 8 MB flash device.
To make place, I have to get rid of some things I do not need for e.g. a specialized mere WLAN Access-Point.
One of the candidates is firewall / nftables, but also luci modules e.g for ppp or ipv6 - where I'd like to leave out the targets anyway.
Online creator was down last days, so I installed a local ImageBuilder on my debian workstation.
There are ample similiar reports all over the forum, but no real solution. Many singular advices, that helped in on case but not in the other, or the hint to manual scrutinisation of all package dependencies. Just did a 'wc' of my latest build: 144 pacakges, a mere 20k of possible combinations....
Obviously, the imageBuilder must somehow perform skd of processing these dependencies and making decisions what to pull in and what to leave out.
So my Idea was, if it would be possible to enable some debug output on this process.
With such help, I think the task of cuttiong down flash size might be done much more efficient.
The ImageBuilder uses a host build of the package manager that will be used on the device (opkg or apk as appropriate) to configure the image, so has no native intelligence about package contents, format or dependencies. ImageBuilder simply runs opkg install fw4 or whatever, and that does the right thing.
To figure out what depends on what, you either need to read the Makefile for the package of interest, or run the package manager's info command on each package.
ehemmm .... may sound idotic to you ...
But do I have the targets opkg available at my debian?
Or is a translated variant available somewhere in the the imagaBuilder tree?
OK, pointed to the right question, at least I found an executable binary - up to the help text.
~/test/openwrt/imageBuilder/openwrt-imagebuilder-23.05.5-ath79-generic.Linux-x86_64$ ./staging_dir/host/bin/opkg info fwtools
Collected errors:
* opkg_conf_load: Couldn't stat /etc/opkg.conf: No such file or directory.
started reading the root Makefile first, and find that
by just typing make I might had grown smarter, earlier
there is a wrapper at least for manifest, depends, what_depends
when I call this, I get loads of noise ...
I easily might throw away ...
:~/test/openwrt/imageBuilder/openwrt-imagebuilder-23.05.5-ath79-generic.Linux-x86_64$ make package_whatdepends PACKAGE=fwtool 2>/dev/null
Root set:
fwtool
What depends on root set
base-files 1562-r24106-10cc5fcd00 depends on fwtool
OK, may be not precisely the way I envisioned, but may be a way to solve my challenge.
Directed search in O(1) ist quite faster than random walk in O(2) ....
Just for example:
I assumed fwtool was to manage firewall.
Wanna get rid of that, and so I type
...$ make package_whatdepends PACKAGE=fwtool 2>/dev/null
Root set:
fwtool
What depends on root set
base-files 1562-r24106-10cc5fcd00 depends on fwtool
...$ make package_whatdepends PACKAGE=base-files 2>/dev/null
Root set:
base-files
What depends on root set
...$ make package_whatdepends PACKAGE=firewall4 2>/dev/null
Root set:
firewall4
What depends on root set
banip 1.0.1-2 depends on firewall4
luci-app-banip git-24.346.66847-1bb28ba depends on banip
....
luci-app-firewall git-24.346.66847-1bb28ba depends on uci-firewall
....
luci-light git-24.346.66847-1bb28ba depends on luci-app-firewall
great to learn that I might configure whatever web security in luci.
But for sure not in my access points, where I'm going to deploy close to a dozen of. That's to go on the router.
So I don't want to be forced to use that.
You could try hacking up the Makefile, adding targets that do more specific analysis of the packages in question. It's pretty clean code, just look down at the package_whatdepends target near the end.
Alternatively, use the Makefile's definition of $(OPKG) to create an alias, so you could just make arbitrary opkg calls.
$ make --trace package_whatdepends PACKAGE=fwtool 2> /dev/null | grep 'opkg.*whatdepends'
fwtool is FirmWare tool, so part of the sysupgrade suite.
Right, LuCI depends luci-app-firewall which in turn depends on the firewall, so you'll have to hack up LuCI if you want to build without the firewall.
How near the 8MB limit are you? firewall4 is about 239KB in size, that's about the same size as just the luci-mod-network package all by itself, you'd save a lot more space by ditching LuCI altogether an just doing CLI config. (That's the usual strategy for such devices.)
overlayfs:/overlay 448 236 212 53% /
still safe, for the moment I think .. but cant get https for whatever reason
Just looking for wireless analysis ....
So maybe I'll have to switch from hostapd to wpad to be able to receive signals?
Yeah, looks like that's the decision at the end of the journey.
At least, nobody can blame me not to have tried it.
Synced admin on a bunch of APs is much easier in cmdline, anyway.
Luci is fine to work out some new config variants.
But for that purpose, I have my DAP X1860 with ample of flash.
It's also nice for a quick check of space requirements of a package including its dependencies.
That's hardly delegeated to another platform, with a different base of installed packages.
But in the end, it can be manually collected on the console as well.
So, lucy ends up as "nice to have" for bare APs.
May be there is an easy cmdline solution available?
(I see, I'm extending the scope of the thread right now)
On my main router, I'd not like to miss luci, for sure.
Let alone the firewall configuration....
But this one is running on x86 with 16 GB of flash (I think), and it's on msata, so easy to enlarge.
The solution is not exactly what I was asking for, but imho enough to resolve dependecy issues of packages in the imageBuilder.
There is an opkg binary running on the host: /openwrt-imagebuilder-23.05.5-ath79-generic.Linux-x86_64$ la staging_dir/host/bin/opkg
but obviously, it needs proper setup to deliver correct results.
A simple call of make without any arguments in the imageBuilder root prints a help text /imageBuilder/openwrt-imagebuilder-23.05.5-ath79-generic.Linux-x86_64$ make
which reveals that make provides a wrapper for opkg with proper setup at least for
make package_whatdepends PACKAGE="<pkg>"
make package_depends PACKAGE="<pkg>"
This way, we ca essentially perform opkg depends / opkg whatdepends on the imageBuilder host, referring to the selected target, without access to a running device.
Thus I could e.g.quickly reveal that for whatever reasons luci pulls in firewall, even if not required otherwise on the sytem, e.g. in case of a dumb WLAN access point.
With make manifest, we can list which packages would go into the Image without really building or even installing it.
Appending 2>/dev/null lets sort out build noise printed to STDERR.
add on:
To keep track of progress in tuning image content, I diff current installed-packages to manifest of new build (looks like they have same syntax and sorting):
(In this case, I deliberately decided to perform diff on the target, to test both diff and sftp-server on running target.
We might as well instead scp from taget to imageBuilder workstation and diff there.)