murata-wireless / cyw-fmac

Cypress' backported "fmac" driver enabling Murata's Wi-Fi/Bluetooth modules. For support, post questions to: https://community.murata.com
Other
10 stars 12 forks source link

Build fails on WSL2 #4

Open parsley72 opened 1 year ago

parsley72 commented 1 year ago

We're using the imx-zeus-spiga branch with backporttool-linux_1.0.bb for our Yocto build. This works fine in a Linux-based build like Ubuntu 22.04, but I've tried doing the same build in Microsoft's WSL2 (from Windows 11) on Ubuntu 22.04 and it fails:

DEBUG: Executing python function extend_recipe_sysroot
NOTE: Direct dependencies are ['virtual:native:poky/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'poky/meta/recipes-devtools/binutils/binutils-cross_2.34.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-support/lzop/lzop_1.04.bb:do_populate_sysroot', 'poky/meta/recipes-devtools/gcc/gcc-cross_9.5.bb:do_populate_sysroot', 'poky/meta/recipes-devtools/gcc/gcc-runtime_9.5.bb:do_populate_sysroot', 'poky/meta/recipes-devtools/gcc/libgcc_9.5.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-extended/xz/xz_5.2.4.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-devtools/bison/bison_3.5.4.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', 'poky/meta/recipes-core/glibc/glibc_2.31.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-devtools/flex/flex_2.6.4.bb:do_populate_sysroot', 'poky/meta/recipes-kernel/kmod/kmod-native_git.bb:do_populate_sysroot', 'virtual:native:poky/meta-layer/recipes-connectivity/openssl/openssl_1.1.1t.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-support/gmp/gmp_6.2.0.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-extended/bc/bc_1.07.1.bb:do_populate_sysroot', 'virtual:native:poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', 'poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot', 'poky/meta/recipes-devtools/quilt/quilt-native_0.66.bb:do_populate_sysroot', 'poky/meta-oclea-open/recipes-kernel/linux/linux-oclea_5.4.bb:do_populate_sysroot']
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: ['patch-native', 'binutils-cross-aarch64', 'lzop-native', 'gcc-cross-aarch64', 'gcc-runtime', 'libgcc', 'xz-native', 'bison-native', 'pseudo-native', 'glibc', 'flex-native', 'kmod-native', 'openssl-native', 'gmp-native', 'bc-native', 'pkgconfig-native', 'kern-tools-native', 'quilt-native', 'linux-oclea', 'automake-native', 'attr-native', 'autoconf-native', 'gnu-config-native', 'libtool-native', 'lzo-native', 'linux-libc-headers', 'gettext-minimal-native', 'texinfo-dummy-native', 'm4-native', 'zlib-native', 'python3-native', 'gtk-doc-native', 'mpfr-native', 'libmpc-native', 'readline-native', 'util-linux-native', 'libffi-native', 'gdbm-native', 'libtirpc-native', 'bzip2-native', 'sqlite3-native', 'libnsl2-native', 'ncurses-native', 'libpcre2-native', 'libcap-ng-native']
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing shell function do_install
NOTE: make -j 16 KLIB_BUILD=poky/build/tmp/work-shared/oclea-cv25/kernel-source KLIB=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/image DESTDIR=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/image DEPMOD=echo INSTALL_MOD_PATH=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/image KERNEL_SRC=poky/build/tmp/work-shared/oclea-cv25/kernel-source CC=aarch64-oclea-linux-gcc   -fuse-ld=bfd -fmacro-prefix-map=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0=/usr/src/debug/murata-backporttool-linux/1.0.ORG-r0                      -fdebug-prefix-map=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0=/usr/src/debug/murata-backporttool-linux/1.0.ORG-r0                      -fdebug-prefix-map=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/recipe-sysroot=                      -fdebug-prefix-map=poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/recipe-sysroot-native=  -fdebug-prefix-map=poky/build/tmp/work-shared/oclea-cv25/kernel-source=/usr/src/kernel -fdebug-prefix-map=poky/build/tmp/work-shared/oclea-cv25/kernel-build-artifacts=/usr/src/kernel LD=aarch64-oclea-linux-ld.bfd   CFLAGS=-Ipoky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/git/drivers/net/wireless/broadcom/brcm80211/include modules_install
  Building modules, stage 2.
  MODPOST 4 modules
  INSTALL poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/git/compat/compat.ko
  INSTALL poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/git/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko
  INSTALL poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/git/drivers/net/wireless/broadcom/brcm80211/brcmutil/brcmutil.ko
  INSTALL poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/git/net/wireless/cfg80211.ko
  DEPMOD  5.4.215
Warning: modules_install: missing 'System.map' file. Skipping depmod.
modinfo: ERROR: Module alias mac80211 not found.
depmod will prefer updates/ over kernel/ -- OK!
depmod: ERROR: could not open directory /lib/modules/5.15.90.1-microsoft-standard-WSL2: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
make[1]: *** [Makefile.real:96: install] Error 1
make: *** [Makefile:42: modules_install] Error 2
ERROR: oe_runmake failed
WARNING: exit code 1 from a shell command.
ERROR: Execution of 'poky/build/tmp/work/oclea_cv25-oclea-linux/murata-backporttool-linux/1.0.ORG-r0/temp/run.do_install.27755' failed with exit code 1
parsley72 commented 1 year ago

I found a fix: https://community.nxp.com/t5/i-MX-Processors/zeus-build-under-WSL/m-p/1054109

In WSL2 just do:

sudo apt-get install -y linux-headers-generic
ll /lib/modules
# Note the directory that has been installed here, e.g. `5.15.0-67-generic/
# Run `uname -r` or note the directory the build above failed to find, e.g. `/lib/modules/5.15.90.1-microsoft-standard-WSL2`
sudo ln -s /lib/modules/5.15.0-67-generic /lib/modules/5.15.90.1-microsoft-standard-WSL2
parsley72 commented 1 year ago

Just created a script for this:

#!/bin/bash

set -e

WSL2_VERSION=$(uname -r)
echo "WSL2_VERSION = $WSL2_VERSION"

WSL2_LINK="/lib/modules/$WSL2_VERSION"
if [ -L "${WSL2_LINK}" ]; then
    if [ -e "${WSL2_LINK}" ]; then
        echo "Good link"
        exit 0
    else
        echo "Broken link"
        rm "${WSL2_LINK}"
    fi
elif [ -e "${WSL2_LINK}" ]; then
    echo "Not a link"
    exit 1
else
    echo "Missing"
fi

shopt -s nullglob
for filename in /lib/modules/*; do
    echo "$filename"
    if [ -z "$HEADERS_DIR" ]; then
        HEADERS_DIR="$filename"
    else
        echo "HEADERS_DIR already set to $HEADERS_DIR, fail"
        exit 1
    fi
done

if [ -n "$HEADERS_DIR" ]; then
    echo "Create symbolic link $WSL2_LINK => $HEADERS_DIR"
    ln -s "$HEADERS_DIR" "$WSL2_LINK"
fi