Adding a kernel module for USB wifi adapter
-
I'm finally able to build without errors again. I didn't do anything with
menuconfig
this time though, justmake clean && source build/envsetup.sh && mka
. Again, it looks like the driver did not end up in the output:root@ubports:~/ubp-5.1# cout root@ubports:~/ubp-5.1/out/target/product/hammerhead# find . |grep mt7601u root@ubports:~/ubp-5.1/out/target/product/hammerhead#
There is, however,
obj/KERNEL_OBJ/include/config/wlan/vendor/mediatek.h
. Which is empty.Sidenote: I learned of the existence of
ppa:ubuntu-toolchain-r/test
, which I can use to install newer versions of GCC. No need to compile.most ubports devices are flashed aiming at a fixed partition size, dependant on the partition layout that the installer expects at first flash.
Sounds like more pain.
-
Running
make ARCH=arm menuconfig
and choosing to save on exit results in a.config
file being created, which contains a setting to include the module I want. Will try to build with this file present now. So, immediately after the previous build I did this:make clean
in top directory to remove results of previous build.make ARCH=arm menuconfig
inkernel/lge/hammerhead
.mka
in top directory to build again.
-
It does not like that
.config
file being there.Using /root/ubp-5.1/kernel/lge/hammerhead as source for kernel /root/ubp-5.1/kernel/lge/hammerhead is not clean, please run 'make mrproper' in the '/root/ubp-5.1/kernel/lge/hammerhead' directory. Copy: /root/ubp-5.1/out/target/product/hammerhead/system/etc/audio_policy.conf Copy xml: /root/ubp-5.1/out/target/product/hammerhead/system/etc/mixer_paths.xml /root/ubp-5.1/kernel/lge/hammerhead/Makefile:976: recipe for target 'prepare3' failed make[2]: *** [prepare3] Error 1 Makefile:130: recipe for target 'sub-make' failed make[1]: *** [sub-make] Error 2 make[1]: Leaving directory '/root/ubp-5.1/kernel/lge/hammerhead' Copy xml: /root/ubp-5.1/out/target/product/hammerhead/system/etc/media_codecs_google_audio.xml build/core/tasks/kernel.mk:277: recipe for target 'TARGET_KERNEL_BINARIES' failed
As further evidenced by what running the command it wants does:
root@ubports:~/ubp-5.1/kernel/lge/hammerhead# make mrproper CLEAN scripts/basic CLEAN scripts/kconfig CLEAN include/config CLEAN .config
But that file is supposed to be there, and I am doing this correctly, according to this article on kernel configuration.
-
This time I used the
make_defconfig.sh
script inhammerhead/
instead ofmake ARCH=arm menuconfig
. This script wants a config file fromarch/arm/configs/
to edit. The problem is that there are 3 different configs for hammerhead:- cyanogenmod_hammerhead_defconfig
- hammerhead_defconfig
tct_hammer_defconfig(I guess this one says "hammer", not "hammerhead")
When I do
uname -a
on my Nexus, it sayscyanogenmod
in there, so I picked that one. Building now. -
Build was successful. Still no driver in the output though.
root@ubports:~/ubp-5.1/out/target/product/hammerhead# find . |grep -i mt76 root@ubports:~/ubp-5.1/out/target/product/hammerhead# find . |grep -i mediatek ./obj/KERNEL_OBJ/include/config/wlan/vendor/mediatek.h root@ubports:~/ubp-5.1/out/target/product/hammerhead# cat ./obj/KERNEL_OBJ/include/config/wlan/vendor/mediatek.h root@ubports:~/ubp-5.1/out/target/product/hammerhead#
-
This time I did
./make_defconfig.sh hammerhead_defconfig
. Note how the changes made to the cyanogenmod file remain despitemake clean
andmake mrproper
:modified: arch/arm/configs/cyanogenmod_hammerhead_defconfig modified: arch/arm/configs/hammerhead_defconfig
Another potentially relevant thing I noticed: In the configuration menu provided by
make_defconfig.sh
, only a Mediatek group is shown. There is no entry for themt7601u
. This was not the case when I usedmake ARCH=arm menuconfig
. Perhaps an indication of a configuration issue that is causing the driver to not be detected? But then why was it detected in the other case? Assuming this build fails to produce the desired result, I will investigate this next. -
I assumed correctly. Here is the section referencing Mediatek in the
.config
thatmake_defconfig.sh
would generate:CONFIG_WLAN_VENDOR_MEDIATEK=y
Compare the Broadcom (I think) drivers section:
CONFIG_BCMDHD=y CONFIG_BCM4339=y CONFIG_BCMDHD_FW_PATH="/vendor/firmware/fw_bcmdhd.bin" CONFIG_BCMDHD_NVRAM_PATH="/etc/wifi/bcmdhd.cal"
And the Mediatek section in a
.config
I generated withmake ARCH=arm menuconfig
:CONFIG_WLAN_VENDOR_MEDIATEK=y CONFIG_MT7601U=m
I'll try to simply manually add these two lines to
hammerhead_defconfig
andcyanogenmod_hammerhead_defconfig
for the next build. -
Found this in the
mt7601u
'sKconfig
:depends on MAC80211 depends on USB
mac80211
is something that can be selected in the config menu in Networking support → Wireless. It is not selected by default. When you select it, themt7601u
driver appears in the Mediatek wireless driver section of the menu as it should.I edited both
hammerhead_defconfig
andcyanogenmod_hammerhead_defconfig
like this (usingmake_defconfig.sh
of course). Building again. -
Build finished. Seemingly no change. Maybe
out/
is supposed to be like this. Will flash tomorrow and check. -
Flashed and checked with
lsmod
,modinfo
andfind
. It looks like, despite everything, the module was still not installed. -
device/lge/hammerhead/BoardConfig.mk
confirms that the configuration file I've been working with is the right one:# Define kernel config for inline building TARGET_KERNEL_CONFIG := cyanogenmod_hammerhead_defconfig TARGET_KERNEL_SOURCE := kernel/lge/hammerhead
device/lge/hammerhead/init.hammerhead.rc
has something that could be relevant:# wifi chown wifi system /persist/wifi insmod /system/lib/modules/bcmdhd.ko
I'll add another
insmod
line formt7601u
and see what happens. My guess is it will either break something or do nothing. -
I tried
mkap
, which failed to push anything to the device, but it did create./out/target/product/hammerhead/obj/KERNEL_OBJ/include/config/mt7601u.h
. I also noticed that all the.h
files inobj/KERNEL_OBJ/include/config/
are empty.Flashed, replaced system image, no change.
-
I am literally unable to tell you what happened next, because all my posts are being flagged as spam.
-
@zehkira maybe because of external links. Happens sometimes.
-
I'm out of ideas.
-
@zehkira I congratulate you on your remarkable persistence, even though I have little understanding of what you have been doing.