NanoPi K2 booting / WiFi / BT problems (partially resolvable)

  • Hi all,

    I've compiled LibreELEC for my NanoPi K2 by FriendlyArm:

    - Version: devel-20190915174406-76b3023 (master branch)

    - Command used for compiling: PROJECT=Amlogic ARCH=arm DEVICE=AMLGX UBOOT_SYSTEM=nanopi-k2 make image

    Image was created and burnt to SD card.

    PROBLEM 1: SD card did not boot

    - On powering on NanoPi K2, UART messages indicated bootloader failure (looping "BL1" messages).

    - Solution is to write the compiled bootloader manually to the SD card, as follows:

    Code
    sudo dd if=build.LibreELEC-AMLGX.arm-9.80-devel/u-boot-2019.07/fip/u-boot.bin.sd.bin of=/dev/sdX conv=fsync,notrunc bs=512 seek=1

    * Replace sdX with SD card reader device location.

    - After manually writing the bootloader, LibreELEC will start up successfully.

    - Apparently, u-boot was compiled successfully but did not get written to the image or was written wrongly. I believe this can be easily addressed in the bootloader installation script?

    PROBLEM 2: WiFi and Bluetooth firmware failed to load

    - LibreELEC failed to show WIFI connections nor detect Bluetooth on the NanoPi K2.

    - The chipset for WIFI and Bluetooth is AP6212 (brcmfmac43430a0)

    - dmesg | grep brcm shows the following line:

    Code
    [ 4582.214555] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430a0-sdio for chip BCM43430/0
    [ 4582.214818] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43430a0-sdio.bin failed with error -2

    - Solution (WIFI): The file brcmfmac43430a0-sdio.bin is missing in lib/firmware/brcm, so pull the relevant files from Armbian firmware and place them in LibreELEC's "additional firmware" directory:

    Code
    LibreELEC:/ # cd /storage/.config/
    LibreELEC:~/.config # mkdir -p firmware/brcm
    LibreELEC:~/.config # cd firmware/brcm
    LibreELEC:~/.config/firmware/brcm # wget https://github.com/armbian/firmware/raw/master/brcm/brcmfmac43430a0-sdio.bin
    LibreELEC:~/.config/firmware/brcm # wget https://github.com/armbian/firmware/raw/master/brcm/brcmfmac43430a0-sdio.txt -O brcmfmac43430a0-sdio.friendlyarm,nanopi-k2.txt

    - After doing the above, reboot and WiFi will work.

    - Bluetooth still doesn't work - maybe it's disabled in NanoPi K2's dtb?

    - Ideally, we should have these files present in the build itself. I note they are missing from LibreELEC/brcmfmac_sdio-firmware (where the firmware files are obtained during compilation).

    I have another issue with playing DRM content (e.g. Netflix). I've mentioned this in balbes150 's thread but I should probably post it under Bug Reports. As I'm not sure if it relates only to the NanoPi K2 or devices with Mali-450 GPUs in general (nobody has verified so far), I shall post a separate report.

    Thank you all for your contributions!