How to build with no wifi support (Feature request?)

Hi folks,

First post... please be gentle :wink: I have some experience using pre-built images, and i've compiled kernels before (albeit, over 10 years ago that i did it in earnest!)

I'm trying to turn a 4/32 device (Netgear WNR2000v2) into either a simple load balancer (for internal services, not WAN, possibly using ipvsadm?) or possibly a VPN server.

I realise i'm going to have to save some space to do this. I've disabled IPv6 and PPP support via the following options (in make menuconfig):

Global build settings  ---> Enable IPv6 support in packages
Kernel modules  --->    Network Support  ---> kmod-ppp
Network  ----> ppp

This builds an image roughly 200k smaller. Not bad to start with i guess :slight_smile: I've not actually flashed this image to test yet however.

But i would also like to completely disable wifi support (partly to save space, partly for security reasons), making it an ethernet-only device.

I've tried disabling the following (in make menuconfig):


     -> Kernel modules                                                                                           │  
   -> Wireless Drivers
kmod-b43
kmod-mac80211
kmod-cfg80211

Firmware  ---> wireless-regdb

I couldn't find any options for disabling userspace wifi configuration tools, so tried to build. But the build fails as follows:

Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-leds-gpio:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-leds-gpio.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ledtrig-netdev:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ledtrig-netdev.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ledtrig-default-on:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ledtrig-default-on.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ledtrig-timer:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ledtrig-timer.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-lib-crc-ccitt:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-lib-crc-ccitt.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-reject:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-reject.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-ipt:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-ipt.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-ipt6:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-ipt6.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ipt-core:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ipt-core.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-conntrack:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-conntrack.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-nat:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-nat.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-nf-flow:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-nf-flow.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ipt-conntrack:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ipt-conntrack.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ipt-offload:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ipt-offload.
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ipt-nat:
 * 	kernel (= 4.14.167-1-d25c9dcf1a85670894a3aca2dbc1c8e7)
 * opkg_install_cmd: Cannot install package kmod-ipt-nat.
package/Makefile:65: recipe for target 'package/install' failed
make[2]: *** [package/install] Error 255
make[2]: Leaving directory '/home/rbshep/OPENWRT/NetgearWNR2000v2/openwrt'
package/Makefile:108: recipe for target '/home/rbshep/OPENWRT/NetgearWNR2000v2/openwrt/staging_dir/target-mipsel_74kc_musl/stamp/.package_install' failed
make[1]: *** [/home/rbshep/OPENWRT/NetgearWNR2000v2/openwrt/staging_dir/target-mipsel_74kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory '/home/rbshep/OPENWRT/NetgearWNR2000v2/openwrt'
/home/rbshep/OPENWRT/NetgearWNR2000v2/openwrt/include/toplevel.mk:225: recipe for target 'world' failed
make: *** [world] Error 2

Is there any way to do this without substantially changing the build system / uci / other code? If it does require changes, would it be possible for this to go into a feature request?

I know it's quite ironic given the projects' name and tag line, but i'm sure there must be other use cases for removing Wi-Fi support from an image.

Thanks to all the developers and the community for creating a great way to upcycle otherwise useless routers :slight_smile:

you can remove these modules and related packages ...

removing ipv6 support :

echo net.ipv6.conf.all.disable_ipv6=1 >> /etc/sysctl.conf
opkg remove ip6tables
opkg remove kmod-ip6tables
opkg remove odhcp6c
opkg remove 6relayd
opkg remove kmod-nf-ipt6 --force-removal-of-dependent-packages
opkg remove kmod-nf-conntrack6 --force-removal-of-dependent-packages
opkg remove kmod-ipv6 --force-removal-of-dependent-packages

remove wifi firmware and other packages ... :

opkg remove wireless-regdb 
opkg remove wpad-basic
opkg remove iw
opkg remove iwinfo

remove ppp :

opkg remove ppp-mod-pppoe
opkg remove luci-proto-ppp
opkg remove kmod-ppp
opkg remove kmod-pppoe
opkg remove kmod-pppox
opkg remove luci-proto-ipv6
reboot
1 Like

No, using opkg remove for packages included in the original image won't save any space. In reality, this will actually consume a small amount of space, as it cannot remove the files from ROM, but must then mark them (in the R/W storage partition) as 'deleted' so that they are not loaded/available as the OS boots/runs.

I know that this seems counter-intuitive, but to make a silly analogy, think of a highly redacted document (say with national security or corporate proprietary information) -- the redactions usually take the form of blacked out text/graphics, rather than removing objects or even full pages from the original document. So at first you might think you'd save paper and ink/toner when you go to print it, it will actually consume the same amount of paper and more ink/toner than the original document would have.

The proper way to remove packages that are part of the original image, would be to build your own image using the image builder tool. You can specify all of the packages you want to include/omit and make a new image.

That said:

You can simply disable wifi and be done with it from a security standpoint. Removing the packages won't change your security profile. It may save some space, though.

You might want to reconsider, as this device has only 100Mbps ethernet ports, very little RAM, and a very slow CPU, so load balancing is going to be highly limited by the throughput of the device which may be well below your desired network throughput. Also, as a general rule, anything on the same network will just simply be switched through the network rather than routed/firewalled/load-balanced as switched traffic never reaches the CPU in the first place.

2 Likes

Hey thanks @khokooli :slight_smile:

I appreciate the list of packages, though isn't that how you would remove from a running system? In that case it wouldn't save me any space on the flash?

I tried commenting out some CONFIG_PACKAGE_ entries with names similar to the packages you suggested, but the build still fails with the same errors :frowning:

It's only for a webserver on home VDSL, so i'm not bothered / would still like to do it. I'm only really wanting failover between two boxes, so i'd imagine i could just switch between two firewall configuration files (each port forwarding to the appropriate server) for a simple setup.

Good news everyone :wink: The build no-longer fails! I removed hostapd, wpad-basic, libiwinfo, iwinfo and iw from the config (albeit manually!), did a make clean, and then a make.

I know nothing about the build system, but i noticed that was a pretty long version number for the kernel listed as a dependency :wink: So i was guessing it might be a hash of the generated kernel binary, so perhaps make clean has thoroughly rebuilt / rehashed it.

So there's no b43 driver module or 802.11 stack in the kernel, and i'm guessing no userspace tools left at all - build size is down to 2.8mib, roughly 900k from stock, so I might be able to add one or two extra things now :wink:

I still need to actually flash and check the image, hope nothing breaks in userspace (is uci going to mind a missing iw binary?), and then check out a new tree and document exactly what i changed in the build configuration.

But i'm pleased with the space savings, thanks again @khokooli for suggestions on what not to include!

@psherman may not saving any space but for security reasons, reduce memory usage and unwanted tasks could be useful ...

you are right about filesystem , these opkg removing not save any space, only create a file under overlay (in my case mik rb2011) directory to modify, add or delete files before runing procd

and @rbshep please use this link to build custom image without compiling kernel for smaller flash
https://openwrt.org/docs/guide-user/additional-software/imagebuilder

1 Like