TechNexion / meta-tn-imx-bsp

TechNexion BSP Layer for i.MX Yocto Project
MIT License
6 stars 11 forks source link

U-boot issues building pico-imx7d-hobbit board with BRCM wifi firmware #2

Closed cjcdev closed 4 years ago

cjcdev commented 4 years ago

I'm building Yocto for my pico-imx7d on a hobbit board.

Manifest https://github.com/TechNexion/tn-imx-yocto-manifest branch: sumo_4.14.y_GA-stable

My env setup WIFI_FIRMWARE=y WIFI_MODULE=brcm DISTRO=fsl-imx-fb MACHINE=pico-imx7 BASEBOARD=hobbit source edm-setup-release.sh -b build

My Issues When I flashed it to eMMC, I had some issues in u-boot.

  1. U-boot scripts were looking for DTB files with _${boardname}, but they are stored in the FAT FS as -${boardname}.
  2. The wifi_module variable was not being properly stored in uEnv.txt, so the DTB file name the u-boot script was looking for (qca) could not be found.

My fixes

  1. For the first issue, I patched u-boot in my layer so that the 'setftd' script use the correct filename format...
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 644cac4e91..172c2de1df 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -211,10 +211,10 @@
    "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
    "setfdt=" \
        "if test -n ${wifi_module} && test ${wifi_module} = qca; then " \
-           "setenv fdtfile ${som}-${form}-${wifi_module}_${baseboard}${mcu}.dtb; " \
+           "setenv fdtfile ${som}-${form}-${wifi_module}-${baseboard}${mcu}.dtb; " \
            "setenv form ${form}-${wifi_module}; " \
        "else " \
-           "setenv fdtfile ${som}-${form}_${baseboard}${mcu}.dtb;" \
+           "setenv fdtfile ${som}-${form}-${baseboard}${mcu}.dtb;" \
        "fi\0" \
    "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdtfile}\0" \
    "mmcboot=echo Booting from mmc ...; " \
  1. For the second issue, I changed the u-boot-uenv recipe to parse the correct variable that had the list of wifi firmware from the build..
diff --git a/recipes-bsp/u-boot/u-boot-uenv_2.0.bb b/recipes-bsp/u-boot/u-boot-uenv_2.0.bb
index 3cbbbb6..144eadc 100644
--- a/recipes-bsp/u-boot/u-boot-uenv_2.0.bb
+++ b/recipes-bsp/u-boot/u-boot-uenv_2.0.bb
@@ -105,7 +105,7 @@ python do_setuenv() {
         print("machine:{} board:{} display:{}".format(machine, board, display))
         baseboard = parse_baseboard(machine, d.getVar("BASE_BOARD"))
         displayinfo = parse_display(machine, d.getVar("BASE_BOARD"), d.getVar("DISPLAY_INFO"))
-        wifi_module = parse_radio(d.getVar("WIFI_MODULES"))
+        wifi_module = parse_radio(d.getVar("RF_FIRMWARES"))
         print("displayinfo:{} wifi_module:{}".format(displayinfo, wifi_module))
         with open(envfile, 'w') as f:
             if baseboard is not None:

My question Do these changes seem right, or am I doing something else wrong?

richard-hu commented 4 years ago

@cjcoss

Thanks for your feedback. It's weekend now. I will notify my colleague to deal with this issue tomorrow.

BTW, linux 4.14.98 doesn't support Broadcom wifi(Ampak AP6212/AP6335) well. The problem is that we use BCMDHD driver(Broadcom proprietary) for AP6212/AP6335 currently. It's too legacy and the cfg80211 API is not fully compatible with linux 4.14.98.

So We plan to change to use BRCMFMAC driver(opensource) in linux 4.14.98. (Reference: https://www.spinics.net/lists/linux-wireless/msg180435.html ) But we have not completed the porting task yet.

For now, we suggest to use TechNexion linux 4.1.15 (Yocto 2.1) BSP for Broadcom WIFI user.

BR,

Richard

po-cheng-technexion commented 4 years ago

For issue 2: Feel free to patch the u-boot-uenv.bb from 18a2835dffba2c767492e41ff274d0a00e6e4013 on the -next branch to resolve the RF_FIRMWARES issue.

Also you'll need the brcm firmwares because they are packaged using recipes-kernel/linux-firmware/ linux-firmware-brcm-tn.bb recipe,

Make sure your MACHINEOVERRIDES contains brcm, or it will not correctly package the firmware otherwise (added by packagegroup-tn-wlan.bb).

Which means you may need to modify local.conf MACHINEOVERRIDES =. "${@'' if (d.getVar('RF_FIRMWARES', True) is None or len(d.getVar('RF_FIRMWARES', True)) == 0) else '%s:' % ':'.join([fw.lower() for fw in d.getVar('RF_FIRMWARES', True).split(' ') if fw])}"

There are commits (i.e. f735ea794a4cd7ea35ce254f6def47b1a959631e) that resolve RF_FIRMWARE packagings from the -next branch.

cjcdev commented 4 years ago

Hi @richard-hu, I was checking to see if you have added BRCMFMAC support? The reason I ask is because the Yocto 2.1 branch (krogoth_4.1.y_GA) doesn't work anymore because I believe NXP removed some old git repositories.

richard-hu commented 4 years ago

@cjcdev

I apologize that the porting task is pending currently.

Could you post the error message you have on Yocto Krogoth? Maybe we can provide you the missing packages to solve the problem.

BR,

Richard

cjcdev commented 4 years ago

@richard-hu

Using https://github.com/TechNexion/edm-yocto-bsp/tree/krogoth_4.1.y_GA

The repo sync fails because the following remote doesn't exists:

  <remote fetch="git://git.freescale.com/imx" name="fsl-release"/>

  <project remote="fsl-release" name="meta-fsl-bsp-release" path="sources/meta-fsl-bsp-release" revision="krogoth_4.1.y"/>

I don't have a copy of an old workspace so I am not sure what files are missing from meta-fsl-bsp-release.

richard-hu commented 4 years ago

@cjcdev

I just notice NXP has moved meta-fsl-bsp-release repo from their own server to CodeAurora. I already fix the repo link in manifest.xml. https://github.com/TechNexion/edm-yocto-bsp/commit/0573563fde98cd750f027474aab75702cf2dd3ba

Could you please try to fetch the latest manifest again?

$: repo init -u https://github.com/TechNexion/edm-yocto-bsp.git -b krogoth_4.1.y_GA
$: repo sync -j8

Thanks for your feedback :)

BR,

Richard