UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Adding a kernel module for USB wifi adapter

    Scheduled Pinned Locked Moved Unsolved Support
    28 Posts 3 Posters 4.6k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
      Reply
      • Reply as topic
      Log in to reply
      This topic has been deleted. Only users with topic management privileges can see it.
      • ? Offline
        A Former User
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User
          last edited by A Former User

          This time I used the make_defconfig.sh script in hammerhead/ instead of make ARCH=arm menuconfig. This script wants a config file from arch/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 says cyanogenmod in there, so I picked that one. Building now.

          1 Reply Last reply Reply Quote 0
          • ? Offline
            A Former User
            last edited by

            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# 
            
            1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User
              last edited by

              This time I did ./make_defconfig.sh hammerhead_defconfig. Note how the changes made to the cyanogenmod file remain despite make clean and make 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 the mt7601u. This was not the case when I used make 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.

              1 Reply Last reply Reply Quote 1
              • ? Offline
                A Former User
                last edited by

                I assumed correctly. Here is the section referencing Mediatek in the .config that make_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 with make ARCH=arm menuconfig:

                CONFIG_WLAN_VENDOR_MEDIATEK=y
                CONFIG_MT7601U=m
                

                I'll try to simply manually add these two lines to hammerhead_defconfig and cyanogenmod_hammerhead_defconfig for the next build.

                1 Reply Last reply Reply Quote 0
                • ? Offline
                  A Former User
                  last edited by

                  Found this in the mt7601u's Kconfig:

                  	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, the mt7601u driver appears in the Mediatek wireless driver section of the menu as it should.

                  I edited both hammerhead_defconfig and cyanogenmod_hammerhead_defconfig like this (using make_defconfig.sh of course). Building again.

                  1 Reply Last reply Reply Quote 0
                  • ? Offline
                    A Former User
                    last edited by

                    Build finished. Seemingly no change. Maybe out/ is supposed to be like this. Will flash tomorrow and check.

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User
                      last edited by

                      Flashed and checked with lsmod, modinfo and find. It looks like, despite everything, the module was still not installed.

                      1 Reply Last reply Reply Quote 0
                      • ? Offline
                        A Former User
                        last edited by

                        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 for mt7601u and see what happens. My guess is it will either break something or do nothing.

                        1 Reply Last reply Reply Quote 0
                        • ? Offline
                          A Former User
                          last edited by

                          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 in obj/KERNEL_OBJ/include/config/ are empty.

                          Flashed, replaced system image, no change.

                          1 Reply Last reply Reply Quote 0
                          • ? Offline
                            A Former User
                            last edited by

                            I am literally unable to tell you what happened next, because all my posts are being flagged as spam.

                            E 1 Reply Last reply Reply Quote 0
                            • E Offline
                              Emphrath @Guest
                              last edited by

                              @zehkira maybe because of external links. Happens sometimes.

                              1 Reply Last reply Reply Quote 0
                              • ? Offline
                                A Former User
                                last edited by

                                I'm out of ideas.

                                C 1 Reply Last reply Reply Quote 0
                                • C Offline
                                  cliffcoggin @Guest
                                  last edited by

                                  @zehkira I congratulate you on your remarkable persistence, even though I have little understanding of what you have been doing.

                                  1 Reply Last reply Reply Quote 1
                                  • First post
                                    Last post