Compiling a NIC kernel module - where to start?

Thank you for your input.
I tried again from scratch. Installed Ubuntu 20.04 in Virtualbox and then compiled OpenWRT:

sudo apt update
sudo apt dist-upgrade

### Prerequisites for buildroot
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev
sudo apt-get install gawk gcc-multilib flex git-core gettext libssl-dev

### Prerequisite for master on Ubuntu as master needs python3 libs
sudo apt-get install python3-distutils

### Prerequisite for 18.06 and 19.07 on Ubuntu 17.10+ as it has python3 by default
# sudo apt-get install python


git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt

mkdir ./package/kernel/aquantia
nano ./package/kernel/aquantia/Makefile
# add makefile text in file

./scripts/feeds update -a
./scripts/feeds install -a

git fetch --tags
git tag -l
git checkout v19.07.3

make menuconfig
# Set Target/subtarget etc
# Kernel modules > Network Devices

make -j9 V=s

That gave me an error I also saw when trying compile under Debian 10:

install -d -m0755 /home/xxx/openwrt/bin/targets/x86/64/packages
/home/xxx/openwrt/scripts/ipkg-build -c -o 0 -g 0 /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-vxlan /home/xxx/openwrt/bin/targets/x86/64/packages
Packaged contents of /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-vxlan into /home/xxx/openwrt/bin/targets/x86/64/packages/kmod-openvswitch-vxlan_4.14.180+2.13.0-5_x86_64.ipk
rm -rf /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan.installed /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan/etc/modules.d; ( echo "vport-vxlan"; ) > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan/etc/modules.d/openvswitch-vxlan; 
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan.installed
mkdir -p /home/xxx/openwrt/bin/targets/x86/64/packages /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve/CONTROL /home/xxx/openwrt/staging_dir/target-x86_64_musl/pkginfo
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve/etc/modules.d; ( echo "vport-geneve"; ) > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve/etc/modules.d/openvswitch-geneve; 
find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
export CROSS="x86_64-openwrt-linux-musl-"  NO_RENAME=1 ; NM="x86_64-openwrt-linux-musl-nm" STRIP="/home/xxx/openwrt/staging_dir/host/bin/sstrip" STRIP_KMOD="/home/xxx/openwrt/scripts/strip-kmod.sh" PATCHELF="/home/xxx/openwrt/staging_dir/host/bin/patchelf" /home/xxx/openwrt/scripts/rstrip.sh /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve
rstrip.sh: /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve/lib/modules/4.14.180/vport-geneve.ko: relocatable
(cd /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve/CONTROL; ( echo "$CONTROL"; printf "Description: "; echo "$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; ) > control; chmod 644 control; ( echo "#!/bin/sh"; echo "[ \"\${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; echo "[ -x "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_postinst \$0 \$@"; ) > postinst; ( echo "#!/bin/sh"; echo "[ -x "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_prerm \$0 \$@"; ) > prerm; chmod 0755 postinst prerm;  )
install -d -m0755 /home/xxx/openwrt/bin/targets/x86/64/packages
/home/xxx/openwrt/scripts/ipkg-build -c -o 0 -g 0 /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve /home/xxx/openwrt/bin/targets/x86/64/packages
Packaged contents of /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/ipkg-x86_64/kmod-openvswitch-geneve into /home/xxx/openwrt/bin/targets/x86/64/packages/kmod-openvswitch-geneve_4.14.180+2.13.0-5_x86_64.ipk
rm -rf /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve.installed /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve/etc/modules.d; ( echo "vport-geneve"; ) > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve/etc/modules.d/openvswitch-geneve; 
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve.installed
mkdir -p /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp
SHELL= flock /home/xxx/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-gre/. /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/'
touch /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp/.kmod-openvswitch-gre_installed
mkdir -p /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp
SHELL= flock /home/xxx/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-vxlan/. /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/'
touch /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp/.kmod-openvswitch-vxlan_installed
mkdir -p /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp
SHELL= flock /home/xxx/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/openvswitch-2.13.0/.pkgdir/kmod-openvswitch-geneve/. /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/'
touch /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp/.kmod-openvswitch-geneve_installed
make[3]: Leaving directory '/home/xxx/openwrt/feeds/packages/net/openvswitch'
time: package/feeds/packages/openvswitch/compile#127.76#11.75#153.52
make[2]: Leaving directory '/home/xxx/openwrt'
make[1]: *** [package/Makefile:107: /home/xxx/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/xxx/openwrt'
make: *** [/home/xxx/openwrt/include/toplevel.mk:227: world] Error 2

Line 227 in toplevel.mk is "cp .config tmp/.config; ". Context:

%::
        @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
        @./scripts/config/conf --defconfig=.config Config.in
        @+$(ULIMIT_FIX) $(SUBMAKE) -r $@

else

%::
        @+$(PREP_MK) $(NO_TRACE_MAKE) -r -s prereq
        @( \
                cp .config tmp/.config; \
                ./scripts/config/conf --defconfig=tmp/.config -w tmp/.config Config.in > /dev/null 2>&1; \
                if ./scripts/kconfig.pl '>' .config tmp/.config | grep -q CONFIG; then \
                        printf "$(_R)WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!$(_N)\n" >&2; \
                fi \
        )
        @+$(ULIMIT_FIX) $(SUBMAKE) -r $@ $(if $(WARN_PARALLEL_ERROR), || { \
                printf "$(_R)Build failed - please re-run with -j1 to see the real error message$(_N)\n" >&2; \
                false; \
        } )

When using your latest Makefile I only see the option for kmod-atalantic in the menuconfig, not an option for aquantia:

Since I did everything from scratch there must be something that I'm missing.
I'm running the commands as the default user, not as root - so that should not be the problem.

The error output you posted is not helpful since it results from a parallel compile. You need to recompile with a make V=s to see the real error.

Yes, that is correct and to be expected as I added a HIDDEN:=1 to the kmod-aquantia package and made the atlantic kmod auto-select it, so it will be built automatically. This simply ensures that the user only needs to select one kmod option to build the requisite support; if done the other way round, it's possible to select only the one and not the other. I've made that scenario impossible by hiding the option and auto-selecting it.

EDIT: I will note that I'm compiling this on master and not on 19.07.

I have a question that arises from the screenshot of your make menuconfig. Why are you compiling everything but the kitchen sink? You can't possibly need to compile all those modules.

I'd suggest removing your .config, doing a make defconfig, then selecting your x86_64 target, then selecting the atlantic kmod and then trying to compile. You've got way too many things selected to be able to debug the build easily.

So build with a default configuration that has only the kmod-atlantic package selected.

If I understand you correctly then the problem is that I'm not compiling the kitchen sink?
After looking around in menuconfig I found it under Kernel modules > Libraries (second last option):

I'll try again and see it there is a difference.

The kitchen sink didn't make a difference but I got an error when running make V=s:

make[4]: Entering directory '/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.180'
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bat_algo.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bat_iv_ogm.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bat_v.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bat_v_elp.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bat_v_ogm.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bitarray.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/bridge_loop_avoidance.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/distributed-arp-table.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/fragmentation.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/gateway_client.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/gateway_common.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/hard-interface.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/hash.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/main.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/multicast.o
  CC [M]  /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.o
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1346:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1346:15: error: 'GENL_DONT_VALIDATE_STRICT' undeclared here (not in a function); did you mean 'MACSEC_VALIDATE_STRICT'?
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
               ^~~~~~~~~~~~~~~~~~~~~~~~~
               MACSEC_VALIDATE_STRICT
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1346:43: error: 'GENL_DONT_VALIDATE_DUMP' undeclared here (not in a function); did you mean 'GENL_DONT_VALIDATE_STRICT'?
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
                                           ^~~~~~~~~~~~~~~~~~~~~~~
                                           GENL_DONT_VALIDATE_STRICT
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1353:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1360:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1367:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1373:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1382:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1388:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1394:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1400:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1406:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1412:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1418:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1424:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1430:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1436:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1443:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1451:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1459:4: error: 'const struct genl_ops' has no member named 'validate'
   .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
    ^~~~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1472:3: error: 'struct backport_genl_family' has no member named 'policy'
  .policy = batadv_netlink_policy,
   ^~~~~~
/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.c:1472:2: warning: the address of 'batadv_netlink_policy' will always evaluate as 'true' [-Waddress]
  .policy = batadv_netlink_policy,
  ^
make[5]: *** [scripts/Makefile.build:327: /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv/netlink.o] Error 1
make[4]: *** [Makefile:1542: _module_/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/net/batman-adv] Error 2
make[4]: Leaving directory '/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/linux-4.14.180'
make[3]: *** [Makefile:95: /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/batman-adv-2020.1/.built] Error 2
make[3]: Leaving directory '/home/xxx/openwrt/feeds/routing/batman-adv'
time: package/feeds/routing/batman-adv/compile#7.73#0.78#8.75
make[2]: *** [package/Makefile:113: package/feeds/routing/batman-adv/compile] Error 2
make[2]: Leaving directory '/home/xxx/openwrt'
make[1]: *** [package/Makefile:107: /home/xxx/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/xxx/openwrt'
make: *** [/home/xxx/openwrt/include/toplevel.mk:227: world] Error 2

Some related info about it is probably here.

I'll exclude the Batman stuff and try again.

The reason I compile everything, including the kitchen sink, might be because of lack of understanding of the building process. I'm not exactly sure what I need for the setup I want and as far as I understand if I don't include it to begin with then I can't just add it later but I need to compile everything again.
But if I compile everything as modules then I have the option to load/unload what I want at a later stage.
...but for debugging I should have compiled only the basics, but I thought it was going to work when doing it freshly in Ubuntu.

Lol, I'm sorry. The expression "everything but the kitchen sink" means that you seem to be compiling pretty much every package.

I had no idea whatsoever that there was a package called "kitchen sink" and certainly didn't mean you to include this.

1 Like

Sorry about that, I could not help myself.
I photoshopped that option in to the menu. :slightly_smiling_face:

2 Likes

After only de-selecting the batman options in the menu (still compiling everything except the kitchen sink) I get this:

make[3]: Leaving directory '/home/xxx/openwrt/feeds/telephony/net/rtpengine'
time: package/feeds/telephony/rtpengine/no-transcode/compile#1.77#0.21#2.49
make[3]: Entering directory '/home/xxx/openwrt/package/kernel/aquantia'
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.prepared_302d388366c93946a59c5d04f9451a0f_6664517399ebbbc92a37c5bb081b5c53_check
true
[ ! -d ./src/ ] || cp -fpR ./src/. /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.prepared_302d388366c93946a59c5d04f9451a0f_6664517399ebbbc92a37c5bb081b5c53
rm -f /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.configured_*
rm -f /home/xxx/openwrt/staging_dir/target-x86_64_musl/stamp/.aquantia_installed
(cd /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/./; if [ -x ./configure ]; then find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ -name config.guess | xargs -r chmod u+w; find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ -name config.guess | xargs -r -n1 cp --remove-destination /home/xxx/openwrt/scripts/config.guess; find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ -name config.sub | xargs -r chmod u+w; find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ -name config.sub | xargs -r -n1 cp --remove-destination /home/xxx/openwrt/scripts/config.sub; AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0:kmod-aquantia-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" RANLIB="x86_64-openwrt-linux-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-openwrt-linux-musl-size CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0:kmod-aquantia-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -iremap/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0:kmod-aquantia-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro " CPPFLAGS="-I/home/xxx/openwrt/staging_dir/target-x86_64_musl/usr/include -I/home/xxx/openwrt/staging_dir/target-x86_64_musl/include -I/home/xxx/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/usr/include -I/home/xxx/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include/fortify -I/home/xxx/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/include " LDFLAGS="-L/home/xxx/openwrt/staging_dir/target-x86_64_musl/usr/lib -L/home/xxx/openwrt/staging_dir/target-x86_64_musl/lib -L/home/xxx/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/usr/lib -L/home/xxx/openwrt/staging_dir/toolchain-x86_64_gcc-7.5.0_musl/lib -znow -zrelro "   ./configure --target=x86_64-openwrt-linux --host=x86_64-openwrt-linux --build=x86_64-pc-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.configured_68b329da9893e34099c7d8ad5cb9c940
rm -f /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.built
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.built_check
cat /dev/null > /home/xxx/openwrt/staging_dir/target-x86_64_musl/pkginfo/kmod-aquantia.symvers; for subdir in .; do cat /home/xxx/openwrt/staging_dir/target-x86_64_musl/pkginfo/*.symvers 2>/dev/null > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/$subdir/Module.symvers; done
for subdir in .; do realdir=$(readlink -f /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0); grep -F /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0 /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/$subdir/Module.symvers >> /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/Module.symvers.tmp; [ "/home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0" = "$realdir" ] || grep -F $realdir /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/$subdir/Module.symvers >> /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/Module.symvers.tmp; done; sort -u /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/Module.symvers.tmp > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/Module.symvers; mv /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/Module.symvers /home/xxx/openwrt/staging_dir/target-x86_64_musl/pkginfo/kmod-aquantia.symvers
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.built
rm -rf /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia.installed /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia/etc/modules.d; ( echo "aquantia"; ) > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia/etc/modules.d/35-aquantia; 
touch /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia.installed
mkdir -p /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp
SHELL= flock /home/xxx/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/.pkgdir/kmod-aquantia/. /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/'
touch /home/xxx/openwrt/staging_dir/target-x86_64_musl/root-x86/stamp/.kmod-aquantia_installed
mkdir -p /home/xxx/openwrt/bin/targets/x86/64/packages /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ipkg-x86_64/kmod-aquantia/CONTROL /home/xxx/openwrt/staging_dir/target-x86_64_musl/pkginfo
mkdir -p /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ipkg-x86_64/kmod-aquantia/etc/modules.d; ( echo "aquantia"; ) > /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ipkg-x86_64/kmod-aquantia/etc/modules.d/35-aquantia; 
find /home/xxx/openwrt/build_dir/target-x86_64_musl/linux-x86_64/kmod-aquantia-1.0/ipkg-x86_64/kmod-aquantia -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package kmod-aquantia is missing dependencies for the following libraries:
libphy.ko
make[3]: *** [Makefile:50: /home/xxx/openwrt/bin/targets/x86/64/packages/kmod-aquantia_4.14.180+1.0-1_x86_64.ipk] Error 1
make[3]: Leaving directory '/home/xxx/openwrt/package/kernel/aquantia'
time: package/kernel/aquantia/compile#0.15#0.02#0.19
make[2]: *** [package/Makefile:113: package/kernel/aquantia/compile] Error 2
make[2]: Leaving directory '/home/xxx/openwrt'
make[1]: *** [package/Makefile:107: /home/xxx/openwrt/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/xxx/openwrt'
make: *** [/home/xxx/openwrt/include/toplevel.mk:227: world] Error 2

So the problem seems to be Package kmod-aquantia is missing dependencies for the following libraries: libphy.ko

I'll try a clean compile with minimum options next to see if that makes a difference.

If you're getting that error on 19.07 which uses a 4.x kernel, then the original author of this Makefile got it wrong.

Change the line

DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-hwmon-core +LINUX_5_4:kmod-libphy

to

DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-hwmon-core +kmod-libphy

So here is the Makefile with the change....

include $(TOPDIR)/rules.mk
  
PKG_NAME:=kmod-aquantia
PKG_VERSION:=1.0
PKG_RELEASE:=1

include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk

define KernelPackage/aquantia
  SUBMENU:=Network Devices
  TITLE:=aQuantia device support
  DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-hwmon-core +kmod-libphy
  KCONFIG:=CONFIG_AQUANTIA_PHY
  HIDDEN:=1
  FILES:=$(LINUX_DIR)/drivers/net/phy/aquantia.ko
  AUTOLOAD:=$(call AutoLoad,35,aquantia)
endef

define KernelPackage/aquantia/description
 Kernel modules for aQuantia Ethernet adapters.
endef

define KernelPackage/atlantic
  SUBMENU:=Network Devices
  TITLE:=aQuantia AQtion(tm) Support
  DEPENDS:=@PCI_SUPPORT @TARGET_x86_64 +kmod-i2c-core +kmod-i2c-algo-bit +kmod-ptp +kmod-aquantia
  KCONFIG:=CONFIG_AQTION
  FILES:=$(LINUX_DIR)/drivers/net/ethernet/aquantia/atlantic/atlantic.ko
  AUTOLOAD:=$(call AutoLoad,35,atlantic)
endef

define KernelPackage/atlantic/description
 Kernel modules for the aQuantia AQtion(tm) Ethernet card
endef

define Build/Compile
endef

$(eval $(call KernelPackage,aquantia))
$(eval $(call KernelPackage,atlantic))

I'm using Ubuntu 20.04, not 19.07.
I got everything compiling and running on the router but the drivers doesn't seem to be used.

The nic doesn't show up in LuCi and lspci -nk says no driver is loaded for the hardware.

I can't find any related errors in the logs.

I built the drivers as built_in and not as modules but I'm guessing that doesn't make a difference.

Well, I would use insmod or modprobe to manually load the drivers and then look at the output of dmesg to see if there is any log output.That may give more insight into the problem.

Perhaps the hardware is not compatible with the driver

I'm talking about Openwrt, not Ubuntu. Your host system is not relevant

Ok, I'll try insmod / modprobe and see if that does anything.

I did notice that the aquantia ipk-package was rather small but that might be normal?

-rw-r--r-- 1 xxx xxx  2195 jun 23 15:01 ./bin/targets/x86/64/packages/kmod-aquantia_4.14.180+1.0-1_x86_64.ipk
-rw-r--r-- 1 xxx xxx 23895 jun 23 15:01 ./bin/targets/x86/64/packages/kmod-atlantic_4.14.180+1.0-1_x86_64.ipk

Mine is 4965 in size..the uncompressed module inside the archive is 15k in size