Add support to Unifi Switch - BCM53343

Got the same results here on my Mac:

cesarvog@Cesars-Mac-Pro ~ % file
Usage: file [-bcCdEhikLlNnprsSvzZ0] [--extension] [--mime-encoding]
[--mime-type] [-e ] [-F ] [-f ]
[-m ] [-M magicfiles] [-P <parameter=value>] [--exclude-quiet]
...
file -C [-m ]
file [--help]
Try `file --help' for more information.
cesarvog@Cesars-Mac-Pro ~ % file ~/Desktop/openwrt-bcm53xx-generic-asus_rt-ac68u-initramfs.trx
/Users/cesarvog/Desktop/openwrt-bcm53xx-generic-asus_rt-ac68u-initramfs.trx: data

Sorry you lost me there... I suppose you're saying that we need to take the above trx file and run it through some sort of utility, that will add some kind of header to it and make it compatible with u-boot... Is that it?
Where can I get this mkimage? It's not available on my Mac. Do I have to download it on Linux, or does it come with some developer tools I need to apt install?

1 Like

yeah... debian is;

apt-get install u-boot-tools

although there is also one compiled within the buildroot when you build it...

generally something like this off the top of my head...

mkimage -A arm -O linux -T kernel -C none -a 0xLOADADDR -e 0xLOADADDR -n linux -d ./openwrt-bcm53xx-generic-asus_rt-ac68u-initramfs.trx out.bin

here is your likely loadaddr? and why -C none

Ok, will install a Debian VM with no desktop on my VmWare fusion, and also install u-boot-tools, then get back to you.

Just occurred to me, should I have opted for a 32bit Debian install?

nao, 64 is correct

1 Like

Wow, just noticed you are based on the other side of the Globe. Don't you ever sleep? :wink:

1 Like

one day I hope to... :wink:

adding this here for reference... seems to be an upstream dts sample intree for this soc ( switch8 / hurricane2 ) ( correction it's BCM53342 yours is BCM53343 but close )

build_dir/toolchain-arm_cortex-a9_gcc-8.4.0_musl_eabi/linux-5.4.106/arch/arm/boot/dts/bcm53340-ubnt-unifi-switch8.dts

may come in handy further down the track...

( I know 3 words in brazillian... and the 3rd is berimbau :wink: )

1 Like

Took me quite a while to be able to get the out.bin file, because stubborn Debian on the VM would not cope with the VMWare Tools, that make copy/paste operations between host and VM easy...
Will report back in a few more minutes, once this file transfer is done.
3 More Portuguese Brazilian Words for your growing vocabulary:
OBRIGADO = thank you (when used by males, OBRIGADA, if used by females)
POR FAVOR = Please
DESCULPE-ME = Forgive me

By the way, here is the terminal output of the mkimage command:

1 Like

Since you know this word, I suppose you are fairly young and somehow came to play "Capoeira" (Brazilian martial art)

It tries to boot, but apparently hangs:

> u-boot> loady           
> ## Ready for binary (ymodem) download to 0x01000000 at 115200 bps...
> CCCCRC mode, 51203(SOH)/0(STX)/0(CAN) packets, 6 retries
> ## Total Size      = 0x00640040 = 6553664 Bytes
> u-boot> bootm 0x01000000
> ## Booting kernel from Legacy Image at 01000000 ...
>    Image Name:   linux
>    Image Type:   ARM Linux Kernel Image (uncompressed)
>    Data Size:    6553600 Bytes = 6.3 MiB
>    Load Address: 01000000
>    Entry Point:  01000000
>    Verifying Checksum ... OK
>    XIP Kernel Image ... OK
> OK
> boot_prep_linux commandline: console=ttyS0,115200 mem=128M@0x0 mem=128M@0x68000000 mtdparts=spi1.0:768k(u-boot),64k(u-boot-env),64k(shmoo),15360k(kernel0),15424k(kernel1),1024k(cfg),64k(EEPROM)
> 
> Starting kernel ...
> 
> Disabling outer cache

2 years..., they called me catatau... (a bird?)... not so young any more... :wink:

ok... the good news...

  • you almost setup for a buildroot so you can generate stuff if you need to ( homework )
  • you've learn't the mkimage command so you can format initramfs in a way that uboot expects to find them

why didn't it work?

  • wrong cpu?
  • wrong serial in dts ( may be working and no output )
  • wrong loadaddr
  • wrong format within the initramfs ( ubnt checks or expects to find something else there that we have not included )

at this point we should probably wait for someone more wise to DESCULPE us... they will probably say whether or not [BCM53343] is actually supported in the linux driver tree...

otherwise you can;

  • keep learning go through the buildroot basic tutorial...
  • research that board 'switch8' and maybe see of there are any internet references to it's hardware / .bin loading etc...
  • possibly get the flash partition layout... ( actually I think it's already in the boot stuff you posted above )
1 Like

Catatau is a friendly nickname for short/young fellas. Remember Yogy the bear cartoon. Catatau is what they named it's shorter and smarter sidekick when it aired in Brazil several years ago...

Screen Shot 2021-03-24 at 15.48.25

Muito Obrigado! (Many Thanks!)
I will try to move on with the homework and see if I can get any further.

1 Like

That device has a Broadcom Hurricane 2 SoC. Support for the SOC was added around Linux 4.16. Currently the only DTS I am aware of that makes use of the SOC support is for the Ubiquiti UniFi Switch 8 (bcm53340-ubnt-unifi-switch8.dts).

1 Like

I thought I would add a complete Serial boot log, obtained from another US-16-150 switch I have here, this second one in perfect working condition, in case someone more experienced can spot something obvious an unexperienced fella like me would leave unnoticed (diff anyone :wink:):

U-Boot usw-v1.1.4.115-g14af1ee6 (Feb 14 2017 - 18:50:54)

DEV ID= 0000db56
SKU ID = 0x8343
DDR type: DDR3
MEMC 0 DDR speed = 667MHz
Validate Shmoo parameters stored in flash ..... OK
Press Ctrl-C to run Shmoo ..... skipped
Restoring Shmoo parameters from flash ..... done
Running simple memory test ..... OK
DDR Tune Completed
DRAM:  256 MiB
WARNING: Caches not enabled

 soc_pcie_hw_init : port->reg_base = 0x18012000 , its value = 0x1 
PCIe port 0 in RC mode

 pos is 172
==>PCIE: LINKSTA reg 0xbe val 0x1001

**************
 port 0 is not active!!
**************
In:    serial
Out:   serial
Err:   serial
Unlocking L2 Cache ...Done
arm_clk=400MHz, axi_clk=200MHz, apb_clk=50MHz, arm_periph_clk=200MHz
Disabling outer cache
Net:   Board Net Initialization Failed
No ethernet found.
Hit any key to stop autoboot:  0 
ubnt_bootsel_init: bootsel magic=a34de82b, bootsel = 1 
UBNT application initialized 
Boot partition selected = 1 
Loading Kernel Image @ 1000000, size = 15728640 
Verifying 'kernel1' parition:OK
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   Ubiquiti 5.43.34.12682
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    15117632 Bytes = 14.4 MiB
   Load Address: 00018000
   Entry Point:  00018000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK
boot_prep_linux commandline: console=ttyS0,115200 mem=128M@0x0 mem=128M@0x68000000 mtdparts=spi1.0:768k(u-boot),64k(u-boot-env),64k(shmoo),15360k(kernel0),15424k(kernel1),1024k(cfg),64k(EEPROM) ubntbootid=1

Starting kernel ...

Disabling outer cache
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.6.5 (builder@link-owrt1505-builder) (gcc version 4.7.2 (OpenWrt GCC 4.7.2 unknown) ) #2 SMP Thu Mar 18 04:10:33 UTC 2021
[    0.000000] CPU: ARMv7 Processor [414fc091] revision 1 (ARMv7), cr=10c53c7d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Broadcom iProc
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] BUG: mapping for 0x18000000 at 0xf0000000 out of vmalloc space
[    0.000000] BUG: mapping for 0x19000000 at 0xf1000000 out of vmalloc space
[    0.000000] PERCPU: Embedded 7 pages/cpu @c1cbb000 s6272 r8192 d14208 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 61952
[    0.000000] Kernel command line: console=ttyS0,115200 mem=128M@0x0 mem=128M@0x68000000 mtdparts=spi1.0:768k(u-boot),64k(u-boot-env),64k(shmoo),15360k(kernel0),15424k(kernel1),1024k(cfg),64k(EEPROM) ubntbootid=1 ubootver=usw-v1.1.4.115-g14af1ee6
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 128MB 128MB = 256MB total
[    0.000000] Memory: 244944k/244944k available, 17200k reserved, 131072K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xf0000000   ( 632 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0018000 - 0xc034d7f8   (3286 kB)
[    0.000000]       .init : 0xc034e000 - 0xc0e58880   (11307 kB)
[    0.000000]       .data : 0xc0e5a000 - 0xc0e82d40   ( 164 kB)
[    0.000000]        .bss : 0xc0e82d64 - 0xc0eb1354   ( 186 kB)
[    0.000000] SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=1.
[    0.000000] NR_IRQS:292
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
[    0.010000] Calibrating delay loop... 795.44 BogoMIPS (lpj=3977216)
[    0.050000] pid_max: default: 4096 minimum: 301
[    0.050000] Mount-cache hash table entries: 512
[    0.050000] CPU: Testing write buffer coherency: ok
[    0.050000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.050000] Setting up static identity map for 0x2823d0 - 0x282428
[    0.050000] L310 cache controller enabled
[    0.050000] l2x0: 8 ways, CACHE_ID 0x410000c9, AUX_CTRL 0x0a120000, Cache size: 131072 B
[    0.050000] Brought up 1 CPUs
[    0.050000] SMP: Total of 1 processors activated (795.44 BogoMIPS).
[    0.050000] devtmpfs: initialized
[    0.060000] NET: Registered protocol family 16
[    0.060000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.060000] GENPLL[5] mdiv=40 rate=2000000000
[    0.060000] Sel=1 Ovr=1 Div=48
[    0.060000] UART clock rate 50000000
[    0.080000] bio: create slab <bio-0> at 0
[    0.080000] Bluetooth: Core ver 2.16
[    0.080000] NET: Registered protocol family 31
[    0.080000] Bluetooth: HCI device and connection manager initialized
[    0.080000] Bluetooth: HCI socket layer initialized
[    0.080000] Bluetooth: L2CAP socket layer initialized
[    0.080000] Bluetooth: SCO socket layer initialized
[    0.080000] Switching to clocksource iproc_gtimer
[    0.090000] NET: Registered protocol family 2
[    0.090000] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.090000] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    0.090000] TCP: Hash tables configured (established 4096 bind 4096)
[    0.090000] TCP: reno registered
[    0.090000] UDP hash table entries: 128 (order: 0, 4096 bytes)
[    0.090000] UDP-Lite hash table entries: 128 (order: 0, 4096 bytes)
[    0.090000] NET: Registered protocol family 1
[   14.460000] pm_init: Initializing Power Management ....
[   14.460000] iproc gpiochip add GPIOA
[   14.460000] GPIOA:ioaddr f0000060 
[   14.460000] GPIOA:intr_ioaddr f0000000 dmu_ioaddr   (null)
[   14.710000] PCIE0: LINKSTA reg 0xbe val 0x1001
[   14.710000] reg[0xac]=0x10, reg[0xae]=0x42, reg[0xb0]=0x8000, reg[0xb4]=0x2c10, reg[0xb6]=0x10, reg[0xb8]=0x5c12, reg[0xba]=0x65, reg[0xbe]=0x1001, reg[0xc6]=0x40, reg[0xca]=0x1, reg[0xd0]=0x1f, reg[0xd2]=0x8, reg[0xdc]=0x1, PCIE0 link=0
[   14.960000] PCIe port 1 in End-Point mode - ignored
[   14.960000] Registering iproc_pmu_device
[   14.960000] bounce pool size: 64 pages
[   14.980000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[   14.980000] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[   14.980000] msgmni has been set to 222
[   14.980000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[   14.980000] io scheduler noop registered
[   14.980000] io scheduler deadline registered (default)
[   14.980000] io scheduler cfq registered
[   14.980000] Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
[   14.990000] serial8250.0: ttyS0 at MMIO 0x18000400 (irq = 123) is a 16550A
[   15.460000] console [ttyS0] enabled
[   15.470000] serial8250.0: ttyS1 at MMIO 0x18000300 (irq = 123) is a 16550A
[   15.500000] brd: module loaded
[   15.510000] loop: module loaded
[   15.520000] nbd: registered device at major 43
[   15.540000] tun: Universal TUN/TAP device driver, 1.6
[   15.550000] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
[   15.550000] Bluetooth: HCI UART driver ver 2.2
[   15.560000] Bluetooth: HCI H4 protocol initialized
[   15.560000] Bluetooth: HCI BCSP protocol initialized
[   15.570000] TCP: cubic registered
[   15.570000] NET: Registered protocol family 10
[   15.580000] sit: IPv6 over IPv4 tunneling driver
[   15.590000] NET: Registered protocol family 17
[   15.590000] Bluetooth: RFCOMM TTY layer initialized
[   15.600000] Bluetooth: RFCOMM socket layer initialized
[   15.600000] Bluetooth: RFCOMM ver 1.11
[   15.610000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   15.610000] Bluetooth: BNEP filters: protocol multicast
[   15.620000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[   15.620000] 8021q: 802.1Q VLAN Support v1.8
[   15.630000] GENPLL[5] mdiv=40 rate=2000000000
[   15.630000] qspi_iproc qspi_iproc.1: 1-lane output, 3-byte address
[   15.640000] m25p80 spi1.0: found mx25l25635e, expected m25p80
[   15.650000] m25p80 spi1.0: mx25l25635e (32768 Kbytes)
[   15.650000] 7 cmdlinepart partitions found on MTD device spi1.0
[   15.660000] Creating 7 MTD partitions on "spi1.0":
[   15.660000] 0x000000000000-0x0000000c0000 : "u-boot"
[   15.670000] 0x0000000c0000-0x0000000d0000 : "u-boot-env"
[   15.680000] 0x0000000d0000-0x0000000e0000 : "shmoo"
[   15.680000] 0x0000000e0000-0x000000fe0000 : "kernel0"
[   15.690000] 0x000000fe0000-0x000001ef0000 : "kernel1"
[   15.700000] 0x000001ef0000-0x000001ff0000 : "cfg"
[   15.710000] 0x000001ff0000-0x000002000000 : "EEPROM"
[   15.740000] Freeing init memory: 11304K
[   15.810000] ubnt_common: module license 'Proprietary' taints kernel.
[   15.810000] Disabling lock debugging due to kernel taint
[   15.890000] Data abort at addr=0xc8a00000, fsr=0x1406 ignored.
[   15.910000] gpiodev: reset_timeout=3
...running /sbin/init
init started: BusyBox v1.23.2 (2021-03-18 04:04:53 UTC)
+ exec
[   25.470000] [ubntconf] log_err route add default gw 192.168.1.1 failed
[   25.470000] [ubntconf] log_err route del default gw 192.168.1.1 failed
Restoring EEPROM data from ubnthal
MAC: <obfuscated>
Validating the active image /dev/mtd4..."5.43.34.12682"
Validating the backup image /dev/mtd3..."5.43.23.12533"
DMA pool size: 4194304
AXI unit 0: Dev 0x8343, Rev 0x01, Chip BCM53343_A0, Driver BCM56150_A0
SOC unit 0 attached to PCI device BCM53343_A0


(Unit 1)>

Applying Global configuration, please wait ...

Applying Interface configuration, please wait ...
[   47.630000] device eth0 entered promiscuous mode

Please press Enter to activate this console. inform not sent: reporter not start
inform not sent:[   52.600000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (45 sec left)
 reporter not start
[   52.620000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.620000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.640000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (46 sec left)
inform not sent:[   52.660000] mca-ctrl[1071]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (47 sec left)
 reporter not st[   52.670000] mca-ctrl[1071]: [info ] mca-proto.service_json(): failed to contact mcad
art
[   52.680000] mca-ctrl[1071]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.690000] mca-ctrl[1071]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (48 sec left)
[   52.700000] mca-ctrl[1071]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.700000] mca-ctrl[1071]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
inform not sent: reporter not start
[   52.730000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.730000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.750000] mca-ctrl[1071]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (50 sec left)
[   52.760000] mca-ctrl[1071]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.770000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (47 sec left)
[   52.780000] mca-ctrl[1071]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.800000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.800000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.820000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (48 sec left)
[   52.840000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.840000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.860000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (49 sec left)
[   52.870000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.880000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
[   52.890000] mca-ctrl[1030]: [error] mca-ctrl.mca_control_main(): service_json inform fail, retry (50 sec left)
[   52.900000] mca-ctrl[1030]: [info ] mca-proto.service_json(): failed to contact mcad
[   52.910000] mca-ctrl[1030]: [error] mca-proto.service(): Failed sending request to '/tmp/.mcad' - 'No such file or directory'
inform sent
inform not sent: reporter not start
inform sent

Hey @anon50098793 ,

Would you be so kind as restore that initramfs file you provided yesterday?
I just noticed that I made a beginners mistake and used the whole trx file available for the rt-68U, and not the one you provided for download. I don't know what happened, I think I was a little too anxious and ended up choosing the wrong file when I copied from my Mac to the VM. And worst of all, I then erased the correct file!
As I was reviewing my steps yesterday I noticed the file had the following name "openwrt-19.07.6-bcm53xx-asus-rt-ac68u-squashfs.trx" and not "openwrt-bcm53xx-generic-asus_rt-ac68u-initramfs.trx" as per your link above.
I tried downloading again from the above link, but it did not work. I guess you may already removed it...
TIA

use the meraki one... its a closer match...

ROFL... bastards told me it was a bird :shushing_face: :face_with_hand_over_mouth:

so when you install the debian prerequisites... apart from selecting your target/device... two things and one directory you should be aware of...

(make menuconfig)

  1. enable 'ramdisk' (initramfs) images


    2-ramdisk

  2. enable logs ( useful to grep for the actual image creation commands and paths )


  3. Once you do a build with the options above enabled... you will find raw kernel / initramfs building blocks under build_dir > target* > linux-*

$ ls build_dir/target-arm_cortex-a9_musl_eabi/linux-bcm53xx_generic/ | grep -E '(zImage|vmlinux)'
vmlinux
vmlinux.debug
vmlinux.elf
vmlinux-initramfs
vmlinux-initramfs.debug
vmlinux-initramfs.elf
zImage
zImage-initramfs

these will come in handy later if you attempt to append manually the 'switch8' dts/dtb...

( note: remember to use a normal user for all buildroot operations )

OpenWrt will boot on this device (did so with an ES-8-150w) and most if not all peripherals can be made to work, but you won't be able to get very far with networking. Believe you need to look at porting Broadcom's OpenNSL for switch support.

1 Like

Tks for chiming in. Definitively out of my league...

Thanks again!
Same results. It tries to boot and hangs at the same point as my previous attemp.