Wifi and bluetooth on snappy ubuntu on a dragonboard?

Hi all,
I’m trying to bringup wifi and bluetooth on dragonboard 410c. ubuntu core image was built using linaro kernel by applying ubuntu core patches on top of it.Board booted succesfully,ethernet is working fine but not wifi and bluetooth. corresponding firmware and modules were present under /lib on root file system. what i observed was wifi module hasn’t loaded.manually with modprobe, module has loaded but still wlan interface not showing up.can anyone help me on this?

Regards…

do you have any log output from the time when loading the module (dmesg and syslog) ?

(bluetooth will work just fine using the bluez snap from the store, but IIRC the driver is a combined module for WLAN and BT so you need to get this working first …)

Hi,
Below is the output of syslog corresponding to wlan for snappy image
a204000.wcnss supply vddcx not found, using dummy regulator
remoteproc2: a204000.wcnss is available
remoteproc2: Direct firmware load for wcnss.mdt failed with error -2

Below is the syslog of linaro image(wifi working case)
a204000.wcnss supply vddcx not found, using dummy regulator
remoteproc2: a204000.wcnss is available
Direct firmware load for wcnss.mdt failed with error -2
remoteproc2: powering up a204000.wcnss
remoteproc2: Booting fw image wcnss.mdt, size 7260
remoteproc2: remote processor a204000.wcnss is now up
qcom_wcnss_ctrl pronto.wcnss: WCNSS Version 1.5 1.2

Thanks

How is your /lib/firmware setup organized ? on the booted image the files should be set up like:

/lib/firmware/venus.b02
/lib/firmware/venus.b04
/lib/firmware/a300_pm4.fw
/lib/firmware/venus.b01
/lib/firmware/wcnss.b09
/lib/firmware/wcnss.b10
/lib/firmware/wcnss.b01
/lib/firmware/wcnss.b06
/lib/firmware/wcnss.b00
/lib/firmware/venus.mbn
/lib/firmware/wcnss.b04
/lib/firmware/venus.b00
/lib/firmware/wcnss.b02
/lib/firmware/wcnss.mdt
/lib/firmware/venus.b03
/lib/firmware/wlan/prima/WCNSS_qcom_wlan_nv.bin
/lib/firmware/wlan/prima/WCNSS_cfg.dat
/lib/firmware/wlan/prima/WCNSS_qcom_cfg.ini
/lib/firmware/wlan/prima/WCNSS_wlan_dictionary.dat
/lib/firmware/venus.mdt
/lib/firmware/a300_pfp.fw
/lib/firmware/wcnss.b11

This is how the initialization on a build of the official Ubuntu Core image looks like in dmesg:

ogra@dragonboard:~$ dmesg|grep remoteproc
[   22.591099]  remoteproc2: powering up soc:vidc_tzpil@0
[   22.630358]  remoteproc2: Booting fw image venus.mdt, size 6812
[   22.904917]  remoteproc2: remote processor soc:vidc_tzpil@0 is now up
[   23.081302]  remoteproc1: powering up soc:pronto_rproc
[   23.099631]  remoteproc1: Booting fw image wcnss.mdt, size 7260
[   23.944184]  remoteproc1: remote processor soc:pronto_rproc is now up

I assume your kernel snap does not put the files in the right places… Is there any particular reason that you do not want to use the officially supported dragonboard-kernel snap ?

Hi,
No not like that.initially i booted using official image only.Now i just wanted to bring up using customized kernel.

Below is the listing of my /lib/firmware
a300_pfp.fw a300_pm4.fw venus.b00 venus.b01 venus.b02 venus.b03 venus.b04 wcnss.b01 wcnss.b10 venus.mdt wcnss.b00 wcnss.b02 wcnss.b04 wcnss.b06 wcnss.b09 wcnss.b11 wcnss.mdt

listing of /lib/firmware/wlan/prima
WCNSS_qcom_cfg.ini
WCNSS_cfg.dat
WCNSS_qcom_wlan_nv.bin
WCNSS_wlan_dictionary.dat

and
output of dmesg|grep remoteproc
remoteproc0: 4080000.hexagon is available
remoteproc0: Note: remoteproc is still under development and considered experimental.
remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn’t yet guaranteed.
remoteproc0: Direct firmware load for mba.mbn failed with error -2
remoteproc1: soc:vidc_tzpil@0 is available
remoteproc1: Note: remoteproc is still under development and considered experimental.
remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn’t yet guaranteed.
remoteproc1: Direct firmware load for venus.mdt failed with error -2
remoteproc1: failed to load soc:vidc_tzpil@0
remoteproc2: a204000.wcnss is available
remoteproc2: Note: remoteproc is still under development and considered experimental.
remoteproc2: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn’t yet guaranteed.
remoteproc2: Direct firmware load for wcnss.mdt failed with error -2
remoteproc1: powering up soc:vidc_tzpil@0
remoteproc1: Booting fw image venus.mdt, size 6812
remoteproc1: remote processor soc:vidc_tzpil@0 is now up

All firmware files were present as you mentioned. But remote processor not powered up.

Thanks

hmm, perhaps a missing config option or our kernel carries a patch that linaros does not … perhaps @ppisati has an idea …

in case you want to consider using the ubuntu tree as a base instead, it is here

Thanks for the info.will look in to that.

Regards

Hi ogra,
I built kernel snap with ubuntu tree and now wlan interface is showing up. Thanks for your support.

1.Now how to connect to wifi network.I’m trying to connect through snappy terminal but not finding any means to connect to wifi network. should i download any snap from store?
2.Regarding bluetooh, the status of bluetooth service is not active(not loaded). i downloaded bluez snap from store but i have no idea how to make it active.

kindly help me on this.

Regards,
Laxman

how did you create this image exactly ? normally a configuration tool (console-conf / subiquity) comes up on first boot, where you need to register the device with a user account and configure the network settings. do yoou not see this tool ?

With the bluez package the bluetoothctl tool gets installed, you can use it like below to turn on bluetooth and disover/connect devices (below it finds an old Ubuntu phone lying on my desk).

ogra@dragonboard:~$ sudo bluetoothctl
[NEW] Controller 00:00:00:00:5A:AD dragonboard [default]
[bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# power on
[CHG] Controller 00:00:00:00:5A:AD Class: 0x100000
Changing power on succeeded
[CHG] Controller 00:00:00:00:5A:AD Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:00:00:00:5A:AD Discovering: yes
[NEW] Device 43:45:C0:00:B3:E7 Pro5 Ubuntu Edition
[bluetooth]# 

There is an interface shipped by the bluez package you can connect an app snap to, to manage connections etc (called bluez:service).

Hi,
Ya i did see that . I configured using ethernet during bootup and now trying to up wifi through terminal.
“iwlist wlan0 scan” returned available networks. so trying to connect like this.As you said, i’ll try to configure with wifi during boot-up.

and regarding bluetooth i tried with bluetoothctl and getting below log
laxman1234@localhost:~$ sudo bluetoothctl
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, …) failed: Invalid argument
aborting: Invalid argument

bluetooth service is not active.i tried with systemctl enable bluetooth ,but no success

where its getting wrong?

Thanks

well, you should be able to just invoke the configuration again with:

sudo console-conf

and then configure wlan as desired …

this actually sounds like your kernel misses some configuration for seccomp support (i assume you will find additional messages in dmesg) all execution of binaries in snaps is guarded by seccomp …

generally you should see bluetoothd and obexd running right after installing the bluez snap:

ogra@dragonboard:~$ ps ax|grep blue
 1689 ?        Ss     0:00 /snap/bluez/88/usr/lib/bluetooth/bluetoothd -E
 1700 ?        Ss     0:00 /snap/bluez/88/usr/lib/bluetooth/obexd

The snap ships two systemd service files:

ogra@dragonboard:~$ systemctl |grep blue|grep service
snap.bluez.bluez.service                                                                         loaded active running   Service for snap application bluez.bluez
snap.bluez.obex.service                                                                          loaded active running   Service for snap application bluez.obex

ogra@dragonboard:~$ systemctl status snap.bluez.bluez.service
● snap.bluez.bluez.service - Service for snap application bluez.bluez
   Loaded: loaded (/etc/systemd/system/snap.bluez.bluez.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-07-13 07:37:24 CEST; 8h ago
 Main PID: 1689 (bluetoothd)
   CGroup: /system.slice/snap.bluez.bluez.service
           └─1689 /snap/bluez/88/usr/lib/bluetooth/bluetoothd -E

Hi,
Ya seccomp kernel config is missing and i built kernel snap adding that now bluetooth is working.
Thanks a lot for your support.

and one thing i observed was there is a crash when connected to ethernet or wifi. Then also everything is working fine. i just wanted to know root cause of that crash. Below is the crash log

55.811478] A link change request failed with some changes committed already. Interface wlan0 may have been left with an inconsistent configuration, please check.
[ 58.233851] systemd[1]: snap-repair.timer: Adding 1h 43min 17.449649s random time.
[ 58.233893] systemd[1]: snap-repair.timer: Adding 14min 42.270780s random time.
[ 58.235776] systemd[1]: snapd.refresh.timer: Adding 5h 24min 3.381145s random time.
[ 58.235814] systemd[1]: snapd.refresh.timer: Adding 5h 41min 45.529215s random time.
[ 58.665376] systemd[1]: snap-repair.timer: Adding 48min 7.306242s random time.
[ 58.665418] systemd[1]: snap-repair.timer: Adding 1h 19min 34.959540s random time.
[ 58.667317] systemd[1]: snapd.refresh.timer: Adding 3h 49min 57.527354s random time.
[ 58.667354] systemd[1]: snapd.refresh.timer: Adding 1h 15min 4.619772s random time.
[ 79.244603] DEBUG_LOCKS_WARN_ON(l->magic != l)
[ 79.244729] ------------[ cut here ]------------
[ 79.248125] WARNING: at kernel/locking/mutex.c:529
[ 79.252799] Modules linked in: wcn36xx smsc75xx wcn36xx_platform squashfs

[ 79.264257] CPU: 0 PID: 3107 Comm: netplan Not tainted 4.4.21-96boards+ #1
[ 79.265822] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 79.272508] task: ffffffc030469500 ti: ffffffc0304ec000 task.ti: ffffffc0304ec000
[ 79.279370] PC is at mutex_lock_nested+0x370/0x3a8
[ 79.286741] LR is at mutex_lock_nested+0x370/0x3a8
[ 79.291428] pc : [] lr : [] pstate: 600001c5
[ 79.296205] sp : ffffffc0304ef9d0
[ 79.303751] x29: ffffffc0304ef9d0 x28: ffffffc033a778d8
[ 79.312082] x27: ffffffc0311e9808 x26: 0000000000000001
[ 79.317376] x25: ffffffc030469500 x24: ffffffc0311e8e30
[ 79.322672] x23: ffffffc001b08000 x22: ffffffc0311e9808
[ 79.327966] x21: 0000000000000140 x20: ffffffc0311ea2f8
[ 79.333262] x19: ffffffc0311ea300 x18: 0000000000000000
[ 79.338557] x17: 000000000000a4e6 x16: 000000000000a4e0
[ 79.343852] x15: 0000000000000010 x14: ffffffc081b08497
[ 79.349147] x13: ffffffc0313a5060 x12: ffffffc0009836b8
[ 79.354443] x11: 0000000000010101 x10: 0000000000000031
[ 79.359737] x9 : 000000000000000d x8 : 0000000000000264
[ 79.365031] x7 : 0000000000000001 x6 : ffffffc00010f9f0
[ 79.370328] x5 : 0000000000000000 x4 : 0000000000000001
[ 79.375623] x3 : 0000000000000000 x2 : 0000000000000000
[ 79.380917] x1 : ffffffc030469500 x0 : 0000000000000022

[ 79.386388] —[ end trace c8a6a215344122bb ]—
[ 79.387956] Call trace:
[ 79.392555] [] mutex_lock_nested+0x370/0x3a8
[ 79.394755] [] wcn36xx_smd_delete_sta_self+0x28/0xf0 [wcn36xx]
[ 79.400654] [] wcn36xx_remove_interface+0x4c/0x78 [wcn36xx]
[ 79.408187] [] drv_remove_interface+0x28/0x70
[ 79.415216] [] ieee80211_do_stop+0x488/0x6f8
[ 79.420945] [] ieee80211_stop+0x14/0x20
[ 79.426849] [] __dev_close_many+0x84/0xd0
[ 79.432315] [] dev_close_many+0x74/0xf8
[ 79.437698] [] dev_close.part.15+0x28/0x40
[ 79.443254] [] dev_close+0x1c/0x28
[ 79.448984] [] cfg80211_shutdown_all_interfaces+0x3c/0xb8
[ 79.453932] [] ieee80211_remove_interfaces+0x3c/0x1c0
[ 79.460616] [] ieee80211_unregister_hw+0x50/0x108
[ 79.467234] [] wcn36xx_remove+0x38/0x78 [wcn36xx]
[ 79.473463] [] platform_drv_remove+0x24/0x58
[ 79.479714] [] __device_release_driver+0x80/0x108
[ 79.485616] [] device_release_driver+0x28/0x40
[ 79.491778] [] unbind_store+0xec/0x110
[ 79.498028] [] drv_attr_store+0x20/0x30
[ 79.503324] [] sysfs_kf_write+0x60/0x70
[ 79.508618] [] kernfs_fop_write+0x15c/0x1a0
[ 79.514003] [] __vfs_write+0x18/0x40
[ 79.519728] [] vfs_write+0x90/0x1b8
[ 79.524763] [] SyS_write+0x44/0xa0
[ 79.529885] [] el0_svc_naked+0x24/0x28
[ 79.623094] wcn36xx wcn36xx: Direct firmware load for wlan/macaddr0 failed with error -2
[ 79.623318] wcn36xx wcn36xx: Failed (-2) to read macaddressfile wlan/macaddr0, using a random address instead

Thanks

i cant really judge the first part of the error (thats a question to @ppisati) , the last two lines look unrelated to the oops and look like /run/macaddr0 has not been created.

the driver looks for /lib/firmware/wlan/macaddr0 to read its mac address. this file is linked to /run/macaddr0 on the Ubuntu Core image which in turn is generated during boot from the “androidboot.serialno” option in the kernel cmdline.

the script snippet creating it is http://paste.ubuntu.com/25087762/
perhaps you can go through the different conditions it checks to find which one is missing.

hmm thanks for the info.will look further

Hi ogra,
To add firmware
1.i added required firmware to firmware directory and changed the makefile inside firmware as
fw-shipped-$(obj-y) += “firmware-files”
with this firmware files are reflecting under /lib

2.i made below change to kernel snapcraft.yaml but firmware is not reflecting under /lib
firmware:
plugin: tar-content
source: firmware.tar
destination: lib/firmware
which is actually the correct optimized way to add the firmware.is this the right way to add firmware?

just firmware … omit the lib/ here … like:

destination: firmware

(the same goes for modules btw)

Thanks ogra. Now its showing up.

1 Like

Hi ogra,
built kernel snap from ubuntu tree with latest commit.then found below error
reading dragonboard-kernel_x1.snap/kernel.img
9263883 bytes read in 1052 ms (8.4 MiB/s)
reading dragonboard-kernel_x1.snap/dtbs/apq8016-sbc.dtb
67036 bytes read in 29 ms (2.2 MiB/s)
reading dragonboard-kernel_x1.snap/initrd.img
4820496 bytes read in 555 ms (8.3 MiB/s)
Bad Linux ARM64 Image magic
dragonboard410c =>

is it problem with kernel snap build?

Thanks

i think it is the problem with kernel image type.

Can you show us the snapcraft.yaml you used?