Recompiling broadcom-wl to arm

seems broadcom never provided dkms driver for arm

i can't work on my router currently so can somebody test this?

i found that binary is too small compared to original, hope it doesn't matter

i would like to give mcsema a try but i don't have IDA pro

Those precompiled drivers are client mode only, it is a waste of time trying to get them running on OpenWrt.

root@OpenWrt:~# ls -lh
-rw-r--r--    1 root     root       26.8K May 16 03:48 aaa
-rw-r--r--    1 root     root      920.9K May 20 11:50 emf.ko
-rw-r--r--    1 root     root      911.6K May 20 14:49 igs.ko
-rw-r--r--    1 root     root        5.7M May 20 14:50 wl.ko
root@OpenWrt:~# uname -a
Linux OpenWrt 5.10.113 #0 SMP Fri May 13 15:58:36 2022 armv7l GNU/Linux
root@OpenWrt:~# dmesg | wc -l
356
root@OpenWrt:~# insmod emf.ko
root@OpenWrt:~# dmesg | wc -l
358
root@OpenWrt:~# insmod igs.ko
root@OpenWrt:~# dmesg | wc -l
358
root@OpenWrt:~# dmesg | tail -n 2
[  342.401134] emf: module license 'Proprietary' taints kernel.
[  342.406902] Disabling lock debugging due to kernel taint
root@OpenWrt:~# insmod wl.ko
**system stalls**

i tried this approach replacing some functions in wl_apsta.o and making compatibility layer
didn't worked at first try

however i'm throwing away this approach, since i found source of
https://github.com/RMerl/asuswrt-merlin.ng/tree/0d9a7c3bdf9242abf386098ab6292f2429e966a6/release/src-rt-5.04axhnd.675x/bcmdrivers/broadcom/net/wl

according to it's Makefile it's for kernel version 4.1.0
which is quite modern than i expected
found too late; wasted my time :frowning_face:

seems it requires more sources, using it from dd-wrt

i've got it to compile and run at least

BusyBox v1.35.0 (2022-05-11 10:18:45 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r19616-f9d2a9bf12
 -----------------------------------------------------
root@OpenWrt:~# cat a.sh
echo "0000:01:00.0" > /sys/bus/pci/drivers/bcma-pci-bridge/unbind
echo "0001:01:00.0" > /sys/bus/pci/drivers/bcma-pci-bridge/unbind
root@OpenWrt:~# ./a
a.sh  aaa
root@OpenWrt:~# ./a.sh
root@OpenWrt:~# insmod wl.ko
root@OpenWrt:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.113 (sodo@DESKTOP-S799JDR) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r19616-345af4ee4a) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Fri May 13 15:58:36 2022
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: ipTIME A5004ns
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   HighMem  [mem 0x0000000008000000-0x000000008fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000007ffffff]
[    0.000000]   node   0: [mem 0x0000000088000000-0x000000008fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000008fffffff]
[    0.000000] On node 0 totalpages: 65536
[    0.000000]   Normal zone: 288 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 32768 pages, LIFO batch:7
[    0.000000]   HighMem zone: 32768 pages, LIFO batch:7
[    0.000000] percpu: Embedded 14 pages/cpu s27212 r8192 d21940 u57344
[    0.000000] pcpu-alloc: s27212 r8192 d21940 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 65248
[    0.000000] Kernel command line: console=ttyS0,115200
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 250496K/262144K available (5654K kernel code, 560K rwdata, 1360K rodata, 1024K init, 289K bss, 11648K reserved, 0K cma-reserved, 131072K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000]  Tracing variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] L2C: DT/platform modifies aux control register: 0x0a130000 -> 0x3a530000
[    0.000000] L2C-310 enabling early BRESP for Cortex-A9
[    0.000000] L2C-310 full line of zeros enabled for Cortex-A9
[    0.000000] L2C-310 ID prefetch enabled, offset 1 lines
[    0.000000] L2C-310 dynamic clock gating enabled, standby mode enabled
[    0.000000] L2C-310 cache controller enabled, 16 ways, 256 kB
[    0.000000] L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x7e530001
[    0.000000] random: get_random_bytes called from start_kernel+0x360/0x510 with crng_init=0
[    0.000011] sched_clock: 64 bits at 400MHz, resolution 2ns, wraps every 4398046511103ns
[    0.000038] clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x5c4093a7d1, max_idle_ns: 440795210635 ns
[    0.000068] Switching to timer-based delay loop, resolution 2ns
[    0.000329] Calibrating delay loop (skipped), value calculated using timer frequency.. 800.00 BogoMIPS (lpj=4000000)
[    0.000349] pid_max: default: 32768 minimum: 301
[    0.000498] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000512] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001409] CPU: Testing write buffer coherency: ok
[    0.001466] CPU0: Spectre v2: using BPIALL workaround
[    0.001743] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.002400] Setting up static identity map for 0x100000 - 0x10003c
[    0.002566] rcu: Hierarchical SRCU implementation.
[    0.002739] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
[    0.002949] smp: Bringing up secondary CPUs ...
[    0.003819] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.003833] CPU1: Spectre v2: using BPIALL workaround
[    0.003976] smp: Brought up 1 node, 2 CPUs
[    0.003992] SMP: Total of 2 processors activated (1600.00 BogoMIPS).
[    0.004002] CPU: WARNING: CPU(s) started in wrong/inconsistent modes (primary CPU mode 0x13)
[    0.004010] CPU: This may indicate a broken bootloader or firmware.
[    0.006899] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.006934] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.007129] pinctrl core: initialized pinctrl subsystem
[    0.007560] NET: Registered protocol family 16
[    0.008559] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.009409] thermal_sys: Registered thermal governor 'step_wise'
[    0.039846] clocksource: Switched to clocksource arm_global_timer
[    0.041251] NET: Registered protocol family 2
[    0.041493] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.042169] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.042245] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.042275] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.042301] TCP: Hash tables configured (established 1024 bind 1024)
[    0.042474] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.042536] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.042855] NET: Registered protocol family 1
[    0.042921] PCI: CLS 0 bytes, default 64
[    0.045917] workingset: timestamp_bits=14 max_order=16 bucket_order=2
[    0.049156] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.049177] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.049960] bounce: pool size: 64 pages
[    0.052078] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
[    0.053029] printk: console [ttyS0] disabled
[    0.053150] 18000300.serial: ttyS0 at MMIO 0x18000300 (irq = 26, base_baud = 6250000) is a 16550
[    0.556920] printk: console [ttyS0] enabled
[    0.562411] bcm2835-rng 18004000.rng: hwrng registered
[    0.871516] bcm_iproc 18029200.spi: using bspi-mspi mode
[    0.879707] spi-nor spi0.0: mx25l25635e (32768 Kbytes)
[    0.911554] random: fast init done
[    1.065403] random: crng init done
[    1.184922] 3 bcm47xxpart partitions found on MTD device spi0.0
[    1.190830] Creating 3 MTD partitions on "spi0.0":
[    1.195603] 0x000000000000-0x000000040000 : "boot"
[    1.201254] 0x000000040000-0x000001ff0000 : "firmware"
[    1.207383] 2 trx partitions found on MTD device firmware
[    1.212812] Creating 2 MTD partitions on "firmware":
[    1.217765] 0x00000000001c-0x000000286400 : "linux"
[    1.222633] mtd: partition "linux" doesn't start on an erase/write block boundary -- force read-only
[    1.232563] 0x000000286400-0x000001fb0000 : "rootfs"
[    1.237530] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    1.247972] mtd: device 3 (rootfs) set to be root filesystem
[    1.253754] 1 squashfs-split partitions found on MTD device rootfs
[    1.259946] 0x000000640000-0x000001fb0000 : "rootfs_data"
[    1.266171] 0x000001ff0000-0x000002000000 : "nvram"
[    1.276932] iproc-mdio 18003000.mdio: Broadcom iProc MDIO bus registered
[    1.285192] b53-srab-switch 18007000.ethernet-switch: found switch: BCM53011, rev 5
[    1.293188] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
[    1.299462] bcma-host-soc 18000000.axi: bus0: Found chip with id 53010, rev 0x00 and package 0x02
[    1.308474] bcma-host-soc 18000000.axi: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2A, class 0x0)
[    1.319050] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.319065] bcma-host-soc 18000000.axi: bus0: Core 1 found: Chipcommon B (manuf 0x4BF, id 0x50B, rev 0x01, class 0x0)
[    1.329827] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.329845] bcma-host-soc 18000000.axi: bus0: Core 2 found: DMA (manuf 0x4BF, id 0x502, rev 0x01, class 0x0)
[    1.339855] bcma-host-soc 18000000.axi: bus0: Core 3 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    1.350275] bcma-host-soc 18000000.axi: bus0: Core 4 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    1.360704] bcma-host-soc 18000000.axi: bus0: Core 5 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    1.371142] bcma-host-soc 18000000.axi: bus0: Core 6 found: GBit MAC (manuf 0x4BF, id 0x82D, rev 0x05, class 0x0)
[    1.381476] bcma-host-soc 18000000.axi: bus0: Core 7 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    1.391991] bcma-host-soc 18000000.axi: bus0: Core 8 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    1.402529] bcma-host-soc 18000000.axi: bus0: Core 9 found: PCIe Gen 2 (manuf 0x4BF, id 0x501, rev 0x01, class 0x0)
[    1.413090] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.413104] bcma-host-soc 18000000.axi: bus0: Core 10 found: ARM Cortex A9 core (ihost) (manuf 0x4BF, id 0x510, rev 0x01, class 0x0)
[    1.425128] bcma-host-soc 18000000.axi: bus0: Core 11 found: USB 2.0 (manuf 0x4BF, id 0x504, rev 0x01, class 0x0)
[    1.435515] bcma-host-soc 18000000.axi: bus0: Core 12 found: USB 3.0 (manuf 0x4BF, id 0x505, rev 0x01, class 0x0)
[    1.445901] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.445914] bcma-host-soc 18000000.axi: bus0: Core 13 found: SDIO3 (manuf 0x4BF, id 0x503, rev 0x01, class 0x0)
[    1.456119] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.456132] bcma-host-soc 18000000.axi: bus0: Core 14 found: ARM Cortex A9 JTAG (manuf 0x4BF, id 0x506, rev 0x01, class 0x0)
[    1.467453] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.467466] bcma-host-soc 18000000.axi: bus0: Core 15 found: Denali DDR2/DDR3 memory controller (manuf 0x4BF, id 0x507, rev 0x01, class 0x0)
[    1.480188] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.480201] bcma-host-soc 18000000.axi: bus0: Core 16 found: ROM (manuf 0x4BF, id 0x508, rev 0x01, class 0x0)
[    1.490268] bcma-host-soc 18000000.axi: bus0: Core 17 found: NAND flash controller (manuf 0x4BF, id 0x509, rev 0x01, class 0x0)
[    1.501860] bcma-host-soc 18000000.axi: bus0: bcma_of_get_irq() failed with rc=-22
[    1.501873] bcma-host-soc 18000000.axi: bus0: Core 18 found: SPI flash controller (manuf 0x4BF, id 0x50A, rev 0x01, class 0x0)
[    1.513247] bcma-host-soc 18000000.axi: bus0: Flash type not supported
[    1.558632] bcma-host-soc 18000000.axi: bus0: Using SPROM revision 8 provided by platform.
[    1.559020] bgmac_bcma bcma0:3: Found PHY addr: 30 (NOREGS)
[    1.564615] bgmac_bcma bcma0:3: Support for Roboswitch not implemented
[    1.572456] b53-srab-switch b53-srab-switch: invalid resource
[    1.578214] b53-srab-switch: probe of b53-srab-switch failed with error -22
[    1.586144] bgmac_bcma bcma0:4: Found PHY addr: 0
[    1.590902] bgmac_bcma bcma0:4: Support for Roboswitch not implemented
[    1.597415] bgmac_bcma bcma0:4: Invalid MAC addr: 00:00:00:00:00:00
[    1.603683] bgmac_bcma bcma0:4: Using random MAC: aa:1c:39:3d:c8:d7
[    1.611980] bgmac_bcma bcma0:5: Found PHY addr: 0
[    1.616701] bgmac_bcma bcma0:5: Support for Roboswitch not implemented
[    1.623264] bgmac_bcma bcma0:5: Invalid MAC addr: 00:00:00:00:00:00
[    1.629512] bgmac_bcma bcma0:5: Using random MAC: 6e:ca:ec:95:6d:76
[    1.637890] bgmac_bcma bcma0:6: Unsupported core_unit 3
[    1.643232] bgmac_bcma: probe of bcma0:6 failed with error -524
[    1.649311] pcie_iproc_bcma bcma0:7: host bridge /axi@18000000/pcie@12000 ranges:
[    1.656841] pcie_iproc_bcma bcma0:7:   No bus range found for /axi@18000000/pcie@12000, using [bus 00-ff]
[    1.666411] OF: /axi@18000000/pcie@12000: Missing device_type
[    1.672154] pcie_iproc_bcma bcma0:7: non-prefetchable memory resource required
[    1.799826] pcie_iproc_bcma bcma0:7: link: UP
[    1.804334] pcie_iproc_bcma bcma0:7: PCI host bridge to bus 0000:00
[    1.810623] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.816090] pci_bus 0000:00: root bus resource [mem 0x08000000-0x0fffffff]
[    1.822982] pci 0000:00:00.0: [14e4:8011] type 01 class 0x060400
[    1.828967] pci_bus 0000:00: 2-byte config write to 0000:00:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    1.838652] pci 0000:00:00.0: PME# supported from D0 D3hot D3cold
[    1.845819] PCI: bus0: Fast back to back transfers disabled
[    1.851401] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    1.859558] pci 0000:01:00.0: [14e4:4360] type 00 class 0x028000
[    1.865583] pci_bus 0000:01: 2-byte config write to 0000:01:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    1.875230] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    1.882116] pci 0000:01:00.0: supports D1 D2
[    1.887413] PCI: bus1: Fast back to back transfers disabled
[    1.892996] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    1.899617] pci 0000:00:00.0: BAR 8: assigned [mem 0x08000000-0x080fffff]
[    1.906395] pci 0000:01:00.0: BAR 0: assigned [mem 0x08000000-0x08007fff 64bit]
[    1.913689] pci 0000:00:00.0: PCI bridge to [bus 01]
[    1.918638] pci 0000:00:00.0:   bridge window [mem 0x08000000-0x080fffff]
[    1.925724] pcie_iproc_bcma bcma0:8: host bridge /axi@18000000/pcie@13000 ranges:
[    1.933223] pcie_iproc_bcma bcma0:8:   No bus range found for /axi@18000000/pcie@13000, using [bus 00-ff]
[    1.942774] pcie_iproc_bcma bcma0:8: non-prefetchable memory resource required
[    2.079825] pcie_iproc_bcma bcma0:8: link: UP
[    2.084333] pcie_iproc_bcma bcma0:8: PCI host bridge to bus 0001:00
[    2.090628] pci_bus 0001:00: root bus resource [bus 00-ff]
[    2.096095] pci_bus 0001:00: root bus resource [mem 0x40000000-0x47ffffff]
[    2.102989] pci 0001:00:00.0: [14e4:8011] type 01 class 0x060400
[    2.108972] pci_bus 0001:00: 2-byte config write to 0001:00:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    2.118659] pci 0001:00:00.0: PME# supported from D0 D3hot D3cold
[    2.125807] PCI: bus0: Fast back to back transfers disabled
[    2.131394] pci 0001:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    2.139554] pci 0001:01:00.0: [14e4:a8db] type 00 class 0x028000
[    2.145581] pci_bus 0001:01: 2-byte config write to 0001:01:00.0 offset 0x4 may corrupt adjacent RW1C bits
[    2.155229] pci 0001:01:00.0: reg 0x10: [mem 0x00000000-0x00007fff 64bit]
[    2.162036] pci 0001:01:00.0: enabling Extended Tags
[    2.167084] pci 0001:01:00.0: supports D1 D2
[    2.172410] PCI: bus1: Fast back to back transfers disabled
[    2.177978] pci_bus 0001:01: busn_res: [bus 01-ff] end is updated to 01
[    2.184615] pci 0001:00:00.0: BAR 8: assigned [mem 0x40000000-0x400fffff]
[    2.191398] pci 0001:01:00.0: BAR 0: assigned [mem 0x40000000-0x40007fff 64bit]
[    2.198691] pci 0001:00:00.0: PCI bridge to [bus 01]
[    2.203657] pci 0001:00:00.0:   bridge window [mem 0x40000000-0x400fffff]
[    2.210749] pcie_iproc_bcma bcma0:9: host bridge /axi@18000000/pcie@14000 ranges:
[    2.218226] pcie_iproc_bcma bcma0:9:   No bus range found for /axi@18000000/pcie@14000, using [bus 00-ff]
[    2.227784] pcie_iproc_bcma bcma0:9: non-prefetchable memory resource required
[    2.349827] pcie_iproc_bcma bcma0:9: PHY or data link is INACTIVE!
[    2.355984] pcie_iproc_bcma bcma0:9: no PCIe EP device detected
[    2.363117] bcm47xx-wdt bcm47xx-wdt.0: BCM47xx Watchdog Timer enabled (30 seconds, Software Timer)
[    2.372154] bcma-host-soc 18000000.axi: bus0: Bus registered
[    2.378409] pci 0000:00:00.0: enabling device (0140 -> 0142)
[    2.384104] bcma-pci-bridge 0000:01:00.0: enabling device (0140 -> 0142)
[    2.390832] bcma-pci-bridge 0000:01:00.0: bus1: Found chip with id 0x4360, rev 0x03 and package 0x01
[    2.399974] bcma-pci-bridge 0000:01:00.0: bus1: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2B, class 0x0)
[    2.410581] bcma-pci-bridge 0000:01:00.0: bus1: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x2A, class 0x0)
[    2.421260] bcma-pci-bridge 0000:01:00.0: bus1: Core 2 found: ARM CR4 (manuf 0x4BF, id 0x83E, rev 0x02, class 0x0)
[    2.431593] bcma-pci-bridge 0000:01:00.0: bus1: Core 3 found: PCIe Gen2 (manuf 0x4BF, id 0x83C, rev 0x01, class 0x0)
[    2.442089] bcma-pci-bridge 0000:01:00.0: bus1: Core 4 found: USB 2.0 Device (manuf 0x4BF, id 0x81A, rev 0x11, class 0x0)
[    2.453057] bcma-pci-bridge 0000:01:00.0: bus1: Found rev 17 PMU (capabilities 0x10A22B11)
[    2.453140] bcma-pci-bridge 0000:01:00.0: bus1: SPROM offset 0x800
[    2.484576] bcma-pci-bridge 0000:01:00.0: bus1: Invalid SPROM read from the PCIe card, trying to use fallback SPROM
[    2.501110] bcma-pci-bridge 0000:01:00.0: bus1: Using SPROM revision 11 provided by platform.
[    2.501130] bcma-pci-bridge 0000:01:00.0: bus1: PMU resource config unknown or not needed for device 0x4360
[    2.503665] bcma-pci-bridge 0000:01:00.0: bus1: Workarounds unknown or not needed for device 0x4360
[    2.503688] bcma-pci-bridge 0000:01:00.0: bus1: Switched to core: 0x83C
[    2.504034] bcma-pci-bridge 0000:01:00.0: bus1: Bus registered
[    2.510271] pci 0001:00:00.0: enabling device (0140 -> 0142)
[    2.515932] bcma-pci-bridge 0001:01:00.0: enabling device (0140 -> 0142)
[    2.522700] bcma-pci-bridge 0001:01:00.0: bus2: Found chip with id 43217, rev 0x00 and package 0x08
[    2.531760] bcma-pci-bridge 0001:01:00.0: bus2: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x27, class 0x0)
[    2.542356] bcma-pci-bridge 0001:01:00.0: bus2: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x1E, class 0x0)
[    2.553048] bcma-pci-bridge 0001:01:00.0: bus2: Core 2 found: PCIe (manuf 0x4BF, id 0x820, rev 0x14, class 0x0)
[    2.563177] bcma-pci-bridge 0001:01:00.0: bus2: Found rev 12 PMU (capabilities 0x108C260C)
[    2.576808] can not parse nvram name 0:ag2(null) with value 0xff got -34
[    2.583497] can not parse nvram name 0:ag3(null) with value 0xff got -34
[    2.606453] bcma-pci-bridge 0001:01:00.0: bus2: Using SPROM revision 8 provided by platform.
[    2.606473] bcma-pci-bridge 0001:01:00.0: bus2: PMU resource config unknown or not needed for device 0xA8D1
[    2.609000] bcma-pci-bridge 0001:01:00.0: bus2: Workarounds unknown or not needed for device 0xA8D1
[    2.617383] bcma-pci-bridge 0001:01:00.0: bus2: Bus registered
[    2.624211] NET: Registered protocol family 10
[    2.630125] Segment Routing with IPv6
[    2.633863] NET: Registered protocol family 17
[    2.638561] 8021q: 802.1Q VLAN Support v1.8
[    2.642829] Registering SWP/SWPB emulation handler
[    2.651930] b53-srab-switch 18007000.ethernet-switch: found switch: BCM53011, rev 5
[    2.814681] b53-srab-switch 18007000.ethernet-switch wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY] (irq=POLL)
[    2.827441] b53-srab-switch 18007000.ethernet-switch lan4 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY] (irq=POLL)
[    2.840308] b53-srab-switch 18007000.ethernet-switch lan3 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY] (irq=POLL)
[    2.853291] b53-srab-switch 18007000.ethernet-switch lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY] (irq=POLL)
[    2.866167] b53-srab-switch 18007000.ethernet-switch lan1 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY] (irq=POLL)
[    2.878287] b53-srab-switch 18007000.ethernet-switch: Using legacy PHYLIB callbacks. Please migrate to PHYLINK!
[    2.888771] DSA: tree 0 setup
[    2.899637] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    2.907930] Freeing unused kernel memory: 1024K
[    2.950028] Run /sbin/init as init process
[    2.954111]   with arguments:
[    2.954115]     /sbin/init
[    2.954119]   with environment:
[    2.954124]     HOME=/
[    2.954127]     TERM=linux
[    3.390391] init: Console is alive
[    3.394085] init: - watchdog -
[    4.434746] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    4.572270] usbcore: registered new interface driver usbfs
[    4.577839] usbcore: registered new interface driver hub
[    4.583302] usbcore: registered new device driver usb
[    4.593090] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    4.604602] SCSI subsystem initialized
[    4.613532] ehci-fsl: Freescale EHCI Host controller driver
[    4.620612] ehci-platform: EHCI generic platform driver
[    4.630104] ehci-platform 18021000.usb: EHCI Host Controller
[    4.633995] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    4.635799] ehci-platform 18021000.usb: new USB bus registered, assigned bus number 1
[    4.643636] ohci-platform: OHCI generic platform driver
[    4.650070] ehci-platform 18021000.usb: irq 45, io mem 0x18021000
[    4.655329] ohci-platform 18022000.usb: Generic Platform OHCI controller
[    4.667909] ohci-platform 18022000.usb: new USB bus registered, assigned bus number 2
[    4.675923] ohci-platform 18022000.usb: irq 45, io mem 0x18022000
[    4.689917] ehci-platform 18021000.usb: USB 2.0 started, EHCI 1.00
[    4.696804] hub 1-0:1.0: USB hub found
[    4.700824] hub 1-0:1.0: 2 ports detected
[    4.764642] hub 2-0:1.0: USB hub found
[    4.768474] hub 2-0:1.0: 2 ports detected
[    4.786646] usbcore: registered new interface driver usb-storage
[    4.793219] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    4.807575] init: - preinit -
[    6.054630] b53-srab-switch 18007000.ethernet-switch lan1: configuring for phy/gmii link mode
[    6.063268] bgmac_bcma bcma0:3 eth0: Link is Up - 1Gbps/Full - flow control off
[    6.070786] 8021q: adding VLAN 0 to HW filter on device lan1
[    6.129990] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   10.616382] jffs2: notice: (595) jffs2_build_xattr_subsystem: complete building xattr subsystem, 27 of xdatum (27 unchecked, 0 orphan) and 42 of xref (2 dead, 0 orphan) found.
[   10.634413] mount_root: switching to jffs2 overlay
[   10.646432] overlayfs: upper fs does not support tmpfile.
[   10.662876] urandom-seed: Seeding with /etc/urandom.seed
[   10.939450] procd: - early -
[   10.942641] procd: - watchdog -
[   11.573127] procd: - watchdog -
[   11.577508] procd: - ubus -
[   11.656872] procd: - init -
[   12.536237] urngd: v1.0.2 started.
[   12.672881] kmodloader: loading kernel modules from /etc/modules.d/*
[   12.966974] PPP generic driver version 2.4.2
[   12.972939] NET: Registered protocol family 24
[   12.985969] kmodloader: done loading kernel modules from /etc/modules.d/*
[   23.457747] bgmac_bcma bcma0:3 eth0: Link is Up - 1Gbps/Full - flow control off
[   23.466441] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   23.478238] b53-srab-switch 18007000.ethernet-switch lan1: configuring for phy/gmii link mode
[   23.488880] 8021q: adding VLAN 0 to HW filter on device lan1
[   23.560458] br-lan: port 1(lan1) entered blocking state
[   23.565694] br-lan: port 1(lan1) entered disabled state
[   23.571403] device lan1 entered promiscuous mode
[   23.576017] device eth0 entered promiscuous mode
[   23.722827] b53-srab-switch 18007000.ethernet-switch lan2: configuring for phy/gmii link mode
[   23.732054] 8021q: adding VLAN 0 to HW filter on device lan2
[   23.790513] br-lan: port 2(lan2) entered blocking state
[   23.795741] br-lan: port 2(lan2) entered disabled state
[   23.801447] device lan2 entered promiscuous mode
[   23.895094] b53-srab-switch 18007000.ethernet-switch lan3: configuring for phy/gmii link mode
[   23.907050] 8021q: adding VLAN 0 to HW filter on device lan3
[   24.010281] br-lan: port 3(lan3) entered blocking state
[   24.015564] br-lan: port 3(lan3) entered disabled state
[   24.021497] device lan3 entered promiscuous mode
[   24.114215] b53-srab-switch 18007000.ethernet-switch lan4: configuring for phy/gmii link mode
[   24.123437] 8021q: adding VLAN 0 to HW filter on device lan4
[   24.209941] br-lan: port 4(lan4) entered blocking state
[   24.215164] br-lan: port 4(lan4) entered disabled state
[   24.221020] device lan4 entered promiscuous mode
[   24.347125] b53-srab-switch 18007000.ethernet-switch wan: configuring for phy/gmii link mode
[   24.356000] 8021q: adding VLAN 0 to HW filter on device wan
[   24.363058] b53-srab-switch 18007000.ethernet-switch wan: Link is Up - 100Mbps/Full - flow control rx/tx
[   24.419997] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready
[  104.541843] wl: module license 'Proprietary' taints kernel.
[  104.547418] Disabling lock debugging due to kernel taint
[  104.616525] wl_module_init: msglevel set to 0x1
[  104.621108] wl_module_init: msglevel2 set to 0x0
[  104.625702] wl_module_init: phymsglevel set to 0x1
[  104.630694] wl0: online cpus 2
[  104.633814] Found chip type AI (0x15134360)
[  104.638086] Chipc: rev 43, caps 0x58680001, chipst 0x9a6d pmurev 17, pmucaps 0x10a22b11
[  104.646390] wl0: wlc_bmac_attach: Unsupported Broadcom board type (0x0) or revision level (0x0)
[  104.655163] wlc_bmac_attach, deviceid 0x4360 nbands 1
[  104.660700] wl0: wlc_bmac_attach: chiprev 3 corerev 42 cccap 0x58680001 maccap 0x30518c05 band 2.4G, phy_type 11 phy_rev 1
[  104.671895] wl0: wlc_get_macaddr: macaddr getvar(il0macaddr) not found
[  104.678406] wl0: wlc_bmac_attach: macaddr not found
[  104.683431] wl0: wlc_stf_txcore_shmem_write: No clock
[  104.688468] wl0: wlc_attach_stf_ant_init: Invalid antennas available in srom (0x0), using 3.
[  104.697028] wlc_ol_cap: Offload support disabled since PCI BAR1 not found
[  104.704407] Using Wireless Extension
[  104.709094] wl_init_rfkill: rfkill registered
[  104.713524] wl0: Error setting led duty-cycle
[  104.717956] eth3: Broadcom BCM4360 802.11 Wireless Controller 6.30.163.23 (r382482)
[  104.717962]  (Compiled in . at 19:29:42 on May 22 2022)
[  104.725708]
[  104.732937] wl1: online cpus 2
[  104.736129] Found chip type AI (0x1380a8d1)
[  104.740578] Chipc: rev 39, caps 0x18500000, chipst 0x6 pmurev 12, pmucaps 0x108c260c
[  104.761274] wl1: wlc_bmac_attach: Unsupported Broadcom board type (0x0) or revision level (0x0)
[  104.770033] wlc_bmac_attach, deviceid 0xa8db nbands 1
[  104.775347] wl1: wlc_bmac_attach: chiprev 0 corerev 30 cccap 0x18500000 maccap 0x30a06405 band 2.4G, phy_type 4 phy_rev 17
[  104.794751] wl1: wlc_get_macaddr: macaddr getvar(il0macaddr) not found
[  104.801276] wl1: wlc_bmac_attach: macaddr not found
[  104.806176] wl1: wlc_attach_stf_ant_init: Invalid antennas available in srom (0x0), using 3.
[  104.814800] wlc_ol_cap: Offload support not present for core 30
[  104.821307] Using Wireless Extension
[  104.825908] wl_init_rfkill: rfkill registered
[  104.830585] wl1: Error setting led duty-cycle
[  104.835071] eth4: Broadcom BCMa8db 802.11 Wireless Controller 6.30.163.23 (r382482)
[  104.835077]  (Compiled in . at 19:29:42 on May 22 2022)
[  104.842832]
root@OpenWrt:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether aa:1c:39:3d:c8:d7 brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 6e:ca:ec:95:6d:76 brd ff:ff:ff:ff:ff:ff
5: wan@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether 90:9f:33:65:3b:61 brd ff:ff:ff:ff:ff:ff
6: lan4@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
7: lan3@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
8: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
9: lan1@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br-lan state LOWERLAYERDOWN qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
10: br-lan: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 90:9f:33:65:3b:60 brd ff:ff:ff:ff:ff:ff
11: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether ff:ff:ff:ff:ff:02 brd ff:ff:ff:ff:ff:ff
12: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether ff:ff:ff:ff:ff:02 brd ff:ff:ff:ff:ff:ff

modification is horrible(as well as the original code)

mac address detection problem (probably related to nvram)

eth3 and eth4 appeared after driver load

source is at branch "leaked2"

i have no idea how should i get mac address work and make openwrt to detect it

commit log is tainted

look around at src/wl/sys/wlc_bmac.c find where bcm_ether_atoe is being called

@jow do you have any idea?

i'm able to scan 5g/2.4g wifi now

support 4360 for was disabled if flag PCOEM_LINUXSTA
was enabled, i assume this flag is for building consumer grade driver
is that possible brcm80211 can support these cards but disabled because it isn't consumer grade?