Skip to content

Instantly share code, notes, and snippets.

@hhromic
Last active January 28, 2023 13:53
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hhromic/9de455e943a52e0a641cf5171cc18e86 to your computer and use it in GitHub Desktop.
Save hhromic/9de455e943a52e0a641cf5171cc18e86 to your computer and use it in GitHub Desktop.
Building WPE with Yocto for Raspberry Pi Zero W

Repositories Cloning

BRANCH=master  # or 'rocko'
xargs -n 1 git clone -b $BRANCH <<'__EOF__'
git://git.yoctoproject.org/poky
git://git.openembedded.org/meta-openembedded
git://github.com/agherzan/meta-raspberrypi
git://github.com/webplatformforembedded/meta-wpe
__EOF__

Patching

In rocko, fix building of mesa-gl in meta-raspberrypi for ARMv6 (source):

cat <<'__EOF__' >> meta-raspberrypi/recipes-graphics/mesa/mesa-gl_%.bbappend
CFLAGS_append_armv6 = " -DMISSING_64BIT_ATOMICS"
__EOF__

Image Building

Build dependencies (install user or system wide once):

Create build directory and add layers:

source poky/oe-init-build-env
xargs -n 1 bitbake-layers add-layer <<'__EOF__'
../meta-openembedded/meta-oe
../meta-openembedded/meta-python
../meta-openembedded/meta-multimedia
../meta-openembedded/meta-networking
../meta-raspberrypi
../meta-wpe
__EOF__

Configure the build:

cat <<'__EOF__' >> conf/local.conf
    
# configuration
MACHINE = "raspberrypi0-wifi"
SERIAL_CONSOLE = ""
DISABLE_RPI_BOOT_LOGO = "1"
DISABLE_OVERSCAN = "1"
DISABLE_SPLASH = "1"
BOOT_DELAY = "0"
GPU_MEM_256 = "128"
GPU_MEM_512 = "196"
GPU_MEM_1024 = "396"
DISTRO_FEATURES_remove = "x11"
DISTRO_FEATURES_append = " opengl"
PACKAGE_CLASSES = "package_ipk"
IMAGE_INSTALL_append = " chrony"
IMAGE_INSTALL_append = " linux-firmware-bcm43430 wpa-supplicant"
IMAGE_FSTYPES = "tar.bz2 ext4 rpi-sdimg"
SDIMG_ROOTFS_TYPE = "ext4"
__EOF__

For basic Bluetooth support:

cat <<'__EOF__' >> conf/local.conf
IMAGE_INSTALL_append = " bluez5 udev-rules-rpi"
__EOF__

Westeros Backend

Build the image:

bitbake wpe-westeros-image

EGLFS Backend

Remove wayland and set the WPE backend and platform to rpi:

cat <<'__EOF__' >> conf/local.conf
WPE_BACKEND = "rpi"
WPE_PLATFORM = "rpi"
DISTRO_FEATURES_remove = "wayland"
__EOF__

Build the image:

bitbake wpe-eglfs-image

Running Image Configuration

Networking Setup

  • Set wlan0 to auto in /etc/network/interfaces.
  • Remove auto from eth0 in /etc/network/interfaces.
  • Edit /etc/wpa_supplicant.conf to add your wireless networks configuration.

Bluetooth Setup

You need to attach the firmware to the HCI:

/usr/bin/hciattach /dev/serial1 bcm43xx 921600 noflow -
@ammmir
Copy link

ammmir commented Feb 20, 2018

thanks for the guide! does this setup support headless configuration? i.e., if i drop in a wpa_supplicant.conf into the boot partition, will it automatically copy it to /etc and join the network so i can ssh in and configure it?

@hhromic
Copy link
Author

hhromic commented Apr 26, 2018

Hi @ammmir, I didn't notice there was a comment in this gist as I mainly use it for personal records :).
Regarding your question, no, that doesn't work because this is a Yocto build and there is no support for this headless configuration like in Raspbian. I also want this and I'm thinking on adding this functionality in another layer of my application on top of meta-wpe, however I haven't done it yet.
What you can do in the meantime is to modify the recipe of wpa-supplicant to provide a custom wpa_supplicant config file during building and then it will be integrated to the image automatically. The WPE image also already includes ssh so that part is sorted out as well. Check this: http://www.lynxbee.com/how-to-enable-wifi-with-yocto-raspberry-pi3/
Good Luck!

@T94T
Copy link

T94T commented Apr 28, 2018

IMAGE_INSTALL_append = " linux-firmware-raspbian-bcm43430 wpa-supplicant"
should now be
IMAGE_INSTALL_append = " linux-firmware-bcm43430 wpa-supplicant"

@hhromic
Copy link
Author

hhromic commented Apr 30, 2018

Hi @T94T, I'm mainly using the master branch of meta-raspberrypi and in there it is linux-firmware-raspbian-bcm43430. This was decided to avoid confusion with the mainline firmware, linux-firmware-bcm43430, and make use of the Raspbian-maintained package instead. Can you point me to when this was changed back to the package you mention? Thanks!

@ajpenner
Copy link

This is an old thread, but for those (like me) who come across this later, there is support for headless configuratio. Add the following line to your local.conf:
ENABLE_DWC2_PERIPHERAL = "1"
And the Raspberry-Pi can be run in device mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment