Open parsley72 opened 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
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
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: