Yocto 2.5

Move OpenBMC to Yocto 2.5(sumo)

Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I5c5ad6904a16e14c1c397f0baf10c9d465594a78
diff --git a/import-layers/meta-raspberrypi/README.md b/import-layers/meta-raspberrypi/README.md
index fe1c2f3..b49405b 100644
--- a/import-layers/meta-raspberrypi/README.md
+++ b/import-layers/meta-raspberrypi/README.md
@@ -10,10 +10,11 @@
 ## Quick links
 
 * Git repository web frontend:
-  <http://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/>
+  <https://github.com/agherzan/meta-raspberrypi>
 * Mailing list (yocto mailing list): <yocto@yoctoproject.org>
 * Issues management (Github Issues):
   <https://github.com/agherzan/meta-raspberrypi/issues>
+* Documentation: <http://meta-raspberrypi.readthedocs.io/en/latest/>
 
 ## Description
 
@@ -33,12 +34,12 @@
 This layer depends on:
 
 * URI: git://git.yoctoproject.org/poky
-  * branch: rocko
+  * branch: master
   * revision: HEAD
 
 * URI: git://git.openembedded.org/meta-openembedded
   * layers: meta-oe, meta-multimedia, meta-networking, meta-python
-  * branch: rocko
+  * branch: master
   * revision: HEAD
 
 ## Quick Start
@@ -46,7 +47,7 @@
 1. source poky/oe-init-build-env rpi-build
 2. Add this layer to bblayers.conf and the dependencies above
 3. Set MACHINE in local.conf to one of the supported boards
-4. bitbake rpi-hwup-image
+4. bitbake core-image-base
 5. dd to a SD card the generated sdimg file (use xzcat if rpi-sdimg.xz is used)
 6. Boot your RPI.
 
diff --git a/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass b/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
index 2dd9326..f03595c 100644
--- a/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
+++ b/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
@@ -1,7 +1,7 @@
 inherit image_types
 
 #
-# Create an image that can by written onto a SD card using dd.
+# Create an image that can be written onto a SD card using dd.
 #
 # The disk layout used is:
 #
@@ -58,6 +58,8 @@
 			${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
 			"
 
+do_image_rpi_sdimg[recrdeps] = "do_build"
+
 # SD card image name
 SDIMG = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 
diff --git a/import-layers/meta-raspberrypi/conf/layer.conf b/import-layers/meta-raspberrypi/conf/layer.conf
index bbdce14..cfc2234 100644
--- a/import-layers/meta-raspberrypi/conf/layer.conf
+++ b/import-layers/meta-raspberrypi/conf/layer.conf
@@ -9,6 +9,8 @@
 BBFILE_PATTERN_raspberrypi := "^${LAYERDIR}/"
 BBFILE_PRIORITY_raspberrypi = "9"
 
+LAYERSERIES_COMPAT_raspberrypi = "sumo"
+
 # Additional license directories.
 LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
 
diff --git a/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc b/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc
index 688227c..d76495a 100644
--- a/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc
+++ b/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc
@@ -6,6 +6,7 @@
 include conf/machine/include/soc-family.inc
 
 IMAGE_FSTYPES ?= "tar.bz2 ext3 rpi-sdimg"
+WKS_FILE ?= "sdimage-raspberrypi.wks"
 
 XSERVER = " \
     xserver-xorg \
@@ -19,9 +20,11 @@
     bcm2708-rpi-b-plus.dtb \
     bcm2709-rpi-2-b.dtb \
     bcm2710-rpi-3-b.dtb \
+    bcm2710-rpi-3-b-plus.dtb \
     bcm2708-rpi-cm.dtb \
     bcm2710-rpi-cm3.dtb \
     \
+    overlays/dwc2.dtbo \
     overlays/hifiberry-amp.dtbo \
     overlays/hifiberry-dac.dtbo \
     overlays/hifiberry-dacplus.dtbo \
@@ -51,14 +54,16 @@
 #   within u-boot to load the kernel.
 KERNEL_BOOTCMD ??= "bootm"
 KERNEL_IMAGETYPE_UBOOT ??= "uImage"
-KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', '${KERNEL_IMAGETYPE_UBOOT}', 'Image', d)}"
+KERNEL_IMAGETYPE_DIRECT ??= "zImage"
+KERNEL_IMAGETYPE ?= "${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
+        '${KERNEL_IMAGETYPE_UBOOT}', '${KERNEL_IMAGETYPE_DIRECT}', d)}"
 
 MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio"
 
 # Raspberry Pi has no hardware clock
 MACHINE_FEATURES_BACKFILL_CONSIDERED = "rtc"
 
-MACHINE_EXTRA_RRECOMMENDS += " kernel-modules"
+MACHINE_EXTRA_RRECOMMENDS += " kernel-modules udev-rules-rpi"
 
 # Set Raspberrypi splash image
 SPLASH = "psplash-raspberrypi"
@@ -102,6 +107,8 @@
     ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
     "
 
+do_image_wic[recrdeps] = "do_build"
+
 # The kernel image is installed into the FAT32 boot partition and does not need
 # to also be installed into the rootfs.
-RDEPENDS_kernel-base = ""
+RDEPENDS_${KERNEL_PACKAGE_NAME}-base = ""
diff --git a/import-layers/meta-raspberrypi/conf/machine/include/rpi-default-versions.inc b/import-layers/meta-raspberrypi/conf/machine/include/rpi-default-versions.inc
index faa6b41..a5fe6d7 100644
--- a/import-layers/meta-raspberrypi/conf/machine/include/rpi-default-versions.inc
+++ b/import-layers/meta-raspberrypi/conf/machine/include/rpi-default-versions.inc
@@ -1,3 +1,3 @@
 # RaspberryPi BSP default versions
 
-PREFERRED_VERSION_linux-raspberrypi ??= "4.9.%"
+PREFERRED_VERSION_linux-raspberrypi ??= "4.14.%"
diff --git a/import-layers/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf b/import-layers/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
index adb2238..accdf3c 100644
--- a/import-layers/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
+++ b/import-layers/meta-raspberrypi/conf/machine/raspberrypi0-wifi.conf
@@ -6,10 +6,12 @@
 require conf/machine/include/tune-arm1176jzf-s.inc
 include conf/machine/include/rpi-base.inc
 
-MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"
+MACHINE_EXTRA_RRECOMMENDS += "\
+    linux-firmware-bcm43430 \
+    linux-firmware-bcm43430a1-hcd \
+"
 
 SDIMG_KERNELIMAGE ?= "kernel.img"
-KERNEL_DEFCONFIG ?= "bcmrpi_defconfig"
-UBOOT_MACHINE ?= "rpi_config"
+UBOOT_MACHINE ?= "rpi_0_w_defconfig"
 SERIAL_CONSOLE ?= "115200 ttyS0"
 VC4_CMA_SIZE ?= "cma-128"
diff --git a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
index ebc9f38..5163320 100644
--- a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
+++ b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
@@ -4,13 +4,19 @@
 
 MACHINEOVERRIDES = "raspberrypi3:${MACHINE}"
 
-MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"
+MACHINE_EXTRA_RRECOMMENDS += "\
+    linux-firmware-bcm43430 \
+    linux-firmware-bcm43455 \
+    linux-firmware-bcm43430a1-hcd \
+    linux-firmware-bcm4345c0-hcd \
+"
 
 require conf/machine/include/arm/arch-armv8.inc
 include conf/machine/include/rpi-base.inc
 
 KERNEL_DEVICETREE = " \
     broadcom/bcm2710-rpi-3-b.dtb \
+    broadcom/bcm2710-rpi-3-b-plus.dtb \
     broadcom/bcm2837-rpi-3-b.dtb \
     \
     overlays/hifiberry-amp.dtbo \
@@ -43,4 +49,6 @@
 # When u-boot is enabled we need to use the "Image" format and the "booti"
 # command to load the kernel
 KERNEL_IMAGETYPE_UBOOT ?= "Image"
+# "zImage" not supported on arm64 and ".gz" images not supported by bootloader yet
+KERNEL_IMAGETYPE_DIRECT ?= "Image"
 KERNEL_BOOTCMD ?= "booti"
diff --git a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3.conf b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3.conf
index b511bec..8b5cce5 100644
--- a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3.conf
+++ b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3.conf
@@ -6,10 +6,14 @@
 require conf/machine/include/tune-cortexa7.inc
 include conf/machine/include/rpi-base.inc
 
-MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-bcm43430"
+MACHINE_EXTRA_RRECOMMENDS += "\
+    linux-firmware-bcm43430 \
+    linux-firmware-bcm43455 \
+    linux-firmware-bcm43430a1-hcd \
+    linux-firmware-bcm4345c0-hcd \
+"
 
 SDIMG_KERNELIMAGE ?= "kernel7.img"
-KERNEL_DEFCONFIG ?= "bcm2709_defconfig"
 UBOOT_MACHINE = "rpi_3_32b_config"
 SERIAL_CONSOLE ?= "115200 ttyS0"
 VC4_CMA_SIZE ?= "cma-256"
diff --git a/import-layers/meta-raspberrypi/docs/conf.py b/import-layers/meta-raspberrypi/docs/conf.py
index eb98c49..fcebbf1 100644
--- a/import-layers/meta-raspberrypi/docs/conf.py
+++ b/import-layers/meta-raspberrypi/docs/conf.py
@@ -58,9 +58,9 @@
 # built documents.
 #
 # The short X.Y version.
-version = 'rocko'
+version = 'master'
 # The full version, including alpha/beta/rc tags.
-release = 'rocko'
+release = 'master'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -120,7 +120,7 @@
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-html_theme = 'alabaster'
+# html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
diff --git a/import-layers/meta-raspberrypi/docs/extra-build-config.md b/import-layers/meta-raspberrypi/docs/extra-build-config.md
index 380d969..806c238 100644
--- a/import-layers/meta-raspberrypi/docs/extra-build-config.md
+++ b/import-layers/meta-raspberrypi/docs/extra-build-config.md
@@ -32,6 +32,8 @@
 * `GPU_MEM_1024`: GPU memory in megabyte for the 1024MB Raspberry Pi. Ignored by
   the 256MB/512MB RP. Overrides gpu_mem. Max 944. Default not set.
 
+See: <https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md>
+
 ## Add purchased license codecs
 
 To add you own licenses use variables `KEY_DECODE_MPG2` and `KEY_DECODE_WVC1` in
@@ -44,6 +46,7 @@
 
     KEY_DECODE_WVC1 = "0x12345678,0xabcdabcd,0x87654321"
 
+See: <https://www.raspberrypi.org/documentation/configuration/config-txt/codeclicence.md>
 
 ## Disable overscan
 
@@ -53,18 +56,57 @@
 
     DISABLE_OVERSCAN = "1"
 
+## Disable splash screen
+
+By default a rainbow splash screen is shown after the GPU firmware is loaded.
+To disable this set this variable in local.conf:
+
+    DISABLE_SPLASH = "1"
+
+## Boot delay
+
+The Raspberry Pi waits a number of seconds after loading the GPU firmware and
+before loading the kernel. By default it is one second. This is useful if your
+SD card needs a while to get ready before Linux is able to boot from it.
+To remove (or adjust) this delay set these variables in local.conf:
+
+    BOOT_DELAY = "0"
+    BOOT_DELAY_MS = "0"
+
 ## Set overclocking options
 
-The Raspberry PI can be overclocked. As of now overclocking up to the "Turbo
+The Raspberry Pi can be overclocked. As of now overclocking up to the "Turbo
 Mode" is officially supported by the raspbery and does not void warranty. Check
-the config.txt for a detailed description of options and modes. Example turbo
-mode:
+the config.txt for a detailed description of options and modes. The following
+variables are supported in local.conf: `ARM_FREQ`, `GPU_FREQ`, `CORE_FREQ`,
+`SDRAM_FREQ` and `OVER_VOLTAGE`.
+
+Example official settings for Turbo Mode in Raspberry Pi 2:
 
     ARM_FREQ = "1000"
     CORE_FREQ = "500"
     SDRAM_FREQ = "500"
     OVER_VOLTAGE = "6"
 
+See: <https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md>
+
+## HDMI and composite video options
+
+The Raspberry Pi can output video over HDMI or SDTV composite (the RCA connector).
+By default the video mode for these is autodetected on boot: the HDMI mode is
+selected according to the connected monitor's EDID information and the composite
+mode is defaulted to NTSC using a 4:3 aspect ratio. Check the config.txt for a
+detailed description of options and modes. The following variables are supported in
+local.conf: `HDMI_FORCE_HOTPLUG`, `HDMI_DRIVE`, `HDMI_GROUP`, `HDMI_MODE`,
+`CONFIG_HDMI_BOOST`, `SDTV_MODE`, `SDTV_ASPECT` and `DISPLAY_ROTATE`.
+
+Example to force HDMI output to 720p in CEA mode:
+
+    HDMI_GROUP = "1"
+    HDMI_MODE = "4"
+
+See: <https://www.raspberrypi.org/documentation/configuration/config-txt/video.md>
+
 ## Video camera support with V4L2 drivers
 
 Set this variable to enable support for the video camera (Linux 3.12.4+
@@ -179,10 +221,34 @@
 operations - 60fps h264 decode, high quality deinterlace - which aren't
 performed on the ARM may be affected, and we wouldn't want to do that to users
 who don't want to use the serial port. Users who want serial console support on
-RaspberryPi3 will have to explicitely set in local.conf:
+RaspberryPi3 will have to explicitly set in local.conf:
 
     ENABLE_UART = "1"
 
 Ref.:
 * <https://github.com/raspberrypi/firmware/issues/553>
 * <https://github.com/RPi-Distro/repo/issues/22>
+
+## Enable USB Peripheral (Gadget) support
+
+The standard USB driver only supports host mode operations.  Users who
+want to use gadget modules like g_ether should set the following in
+local.conf:
+
+    ENABLE_DWC2_PERIPHERAL = "1"
+
+## Manual additions to config.txt
+
+The `RPI_EXTRA_CONFIG` variable can be used to manually add additional lines to
+the `config.txt` file if there is not a specific option above for the
+configuration you need. To add multiple lines you must include `\n` separators.
+If double-quotes are needed in the lines you are adding you can use single
+quotes around the whole string.
+
+For example, to add a comment containing a double-quote and a configuration
+option:
+
+    RPI_EXTRA_CONFIG = ' \n \
+        # Raspberry Pi 7\" display/touch screen \n \
+        lcd_rotate=2 \n \
+        '
diff --git a/import-layers/meta-raspberrypi/docs/layer-contents.md b/import-layers/meta-raspberrypi/docs/layer-contents.md
index 29cfa35..f71d396 100644
--- a/import-layers/meta-raspberrypi/docs/layer-contents.md
+++ b/import-layers/meta-raspberrypi/docs/layer-contents.md
@@ -11,14 +11,24 @@
 * raspberrypi-cm (dummy alias for raspberrypi)
 * raspberrypi-cm3 (dummy alias for raspberrypi2)
 
+Note: The raspberrypi3 machines include support for Raspberry Pi 3B+.
+
 ## Images
 
-* rpi-hwup-image
-  * Hardware up image
-
-* rpi-basic-image
-  * Based on rpi-hwup-image with some added features (ex: splash)
-
 * rpi-test-image
-  * Image based on rpi-basic-image which includes most of the packages in this
+  * Image based on core-image-base which includes most of the packages in this
     layer and some media samples.
+
+For other uses it's recommended to base images on `core-image-minimal` or
+`core-image-base` as appropriate. The old image names (`rpi-hwup-image` and
+`rpi-basic-image`) are deprecated.
+
+## WiFi and Bluetooth Firmware
+
+Be aware that the WiFi and Bluetooth firmware for the supported boards
+is not available in the base version of `linux-firmware` from OE-Core
+(poky). The files are added from Raspbian repositories in this layer's
+bbappends to that recipe. All machines define
+`MACHINE_EXTRA_RRECOMMENDS` to include the required wireless firmware;
+raspberrypi3 supports 3, 3B, and 3B+ and so include multiple firmware
+packages.
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb b/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
index a115037..466f443 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
+++ b/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
@@ -3,11 +3,13 @@
 
 LIC_FILES_CHKSUM = "file://LICENCE.broadcom;md5=4a4d169737c0786fb9482bb6d30401d1"
 
-inherit deploy
+inherit deploy nopackages
 
 include recipes-bsp/common/firmware.inc
 
-RDEPENDS_${PN} = "rpi-config"
+INHIBIT_DEFAULT_DEPS = "1"
+
+DEPENDS = "rpi-config"
 
 COMPATIBLE_MACHINE = "^rpi$"
 
@@ -32,7 +34,7 @@
     touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp
 }
 
-addtask deploy before do_package after do_install
+addtask deploy before do_build after do_install
 do_deploy[dirs] += "${DEPLOYDIR}/${PN}"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb b/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
index ca4160b..e0b2b58 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bb
@@ -15,15 +15,18 @@
 
 PR = "r5"
 
+INHIBIT_DEFAULT_DEPS = "1"
+
 PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
 PITFT22="${@bb.utils.contains("MACHINE_FEATURES", "pitft22", "1", "0", d)}"
 PITFT28r="${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "1", "0", d)}"
 PITFT35r="${@bb.utils.contains("MACHINE_FEATURES", "pitft35r", "1", "0", d)}"
 
 VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
-VC4DTBO_raspberrypi3-64 = "vc4-fkms-v3d"
+VC4DTBO_raspberrypi3-64 ?= "vc4-fkms-v3d"
 VC4DTBO ?= "vc4-kms-v3d"
-inherit deploy
+
+inherit deploy nopackages
 
 do_deploy() {
     install -d ${DEPLOYDIR}/bcm2835-bootfiles
@@ -31,25 +34,33 @@
     cp ${S}/config.txt ${DEPLOYDIR}/bcm2835-bootfiles/
 
     if [ -n "${KEY_DECODE_MPG2}" ]; then
-        sed -i '/#decode_MPG2/ c\decode_MPG2=${KEY_DECODE_MPG2}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#decode_MPG2=/ c\decode_MPG2=${KEY_DECODE_MPG2}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${KEY_DECODE_WVC1}" ]; then
-        sed -i '/#decode_WVC1/ c\decode_WVC1=${KEY_DECODE_WVC1}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#decode_WVC1=/ c\decode_WVC1=${KEY_DECODE_WVC1}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${DISABLE_OVERSCAN}" ]; then
-        sed -i '/#disable_overscan/ c\disable_overscan=${DISABLE_OVERSCAN}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#disable_overscan=/ c\disable_overscan=${DISABLE_OVERSCAN}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
+    if [ -n "${DISABLE_SPLASH}" ]; then
+        sed -i '/#disable_splash=/ c\disable_splash=${DISABLE_SPLASH}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+
+    # Set overclocking options
     if [ -n "${ARM_FREQ}" ]; then
-        sed -i '/#arm_freq/ c\arm_freq=${ARM_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#arm_freq=/ c\arm_freq=${ARM_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${GPU_FREQ}" ]; then
+        sed -i '/#gpu_freq=/ c\gpu_freq=${GPU_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${CORE_FREQ}" ]; then
-        sed -i '/#core_freq/ c\core_freq=${CORE_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#core_freq=/ c\core_freq=${CORE_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${SDRAM_FREQ}" ]; then
-        sed -i '/#sdram_freq/ c\sdram_freq=${SDRAM_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#sdram_freq=/ c\sdram_freq=${SDRAM_FREQ}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${OVER_VOLTAGE}" ]; then
-        sed -i '/#over_voltage/ c\over_voltage=${OVER_VOLTAGE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#over_voltage=/ c\over_voltage=${OVER_VOLTAGE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
 
     # GPU memory
@@ -57,13 +68,47 @@
         sed -i '/#gpu_mem=/ c\gpu_mem=${GPU_MEM}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${GPU_MEM_256}" ]; then
-        sed -i '/#gpu_mem_256/ c\gpu_mem_256=${GPU_MEM_256}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#gpu_mem_256=/ c\gpu_mem_256=${GPU_MEM_256}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${GPU_MEM_512}" ]; then
-        sed -i '/#gpu_mem_512/ c\gpu_mem_512=${GPU_MEM_512}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#gpu_mem_512=/ c\gpu_mem_512=${GPU_MEM_512}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
     if [ -n "${GPU_MEM_1024}" ]; then
-        sed -i '/#gpu_mem_1024/ c\gpu_mem_1024=${GPU_MEM_1024}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        sed -i '/#gpu_mem_1024=/ c\gpu_mem_1024=${GPU_MEM_1024}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+
+    # Set boot delay
+    if [ -n "${BOOT_DELAY}" ]; then
+        sed -i '/#boot_delay=/ c\boot_delay=${BOOT_DELAY}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${BOOT_DELAY_MS}" ]; then
+        sed -i '/#boot_delay_ms=/ c\boot_delay_ms=${BOOT_DELAY_MS}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+
+    # Set HDMI and composite video options
+    if [ -n "${HDMI_FORCE_HOTPLUG}" ]; then
+        sed -i '/#hdmi_force_hotplug=/ c\hdmi_force_hotplug=${HDMI_FORCE_HOTPLUG}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${HDMI_DRIVE}" ]; then
+        sed -i '/#hdmi_drive=/ c\hdmi_drive=${HDMI_DRIVE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${HDMI_GROUP}" ]; then
+        sed -i '/#hdmi_group=/ c\hdmi_group=${HDMI_GROUP}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${HDMI_MODE}" ]; then
+        sed -i '/#hdmi_mode=/ c\hdmi_mode=${HDMI_MODE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${CONFIG_HDMI_BOOST}" ]; then
+        sed -i '/#config_hdmi_boost=/ c\config_hdmi_boost=${CONFIG_HDMI_BOOST}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${SDTV_MODE}" ]; then
+        sed -i '/#sdtv_mode=/ c\sdtv_mode=${SDTV_MODE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${SDTV_ASPECT}" ]; then
+        sed -i '/#sdtv_aspect=/ c\sdtv_aspect=${SDTV_ASPECT}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    if [ -n "${DISPLAY_ROTATE}" ]; then
+        sed -i '/#display_rotate=/ c\display_rotate=${DISPLAY_ROTATE}' ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
 
     # Video camera support
@@ -84,6 +129,7 @@
         echo "dtparam=spi=on" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
 
+    # I2C support
     if [ -n "${ENABLE_I2C}" ] || [ "${PITFT}" = "1" ]; then
         echo "# Enable I2C" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "dtparam=i2c1=on" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
@@ -95,12 +141,10 @@
         echo "# Enable PITFT22 display" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "dtoverlay=pitft22,rotate=270,speed=32000000,txbuflen=32768" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
-
     if [ "${PITFT28r}" = "1" ]; then
         echo "# Enable PITFT28r display" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "dtoverlay=pitft28-resistive,rotate=90,speed=32000000,txbuflen=32768" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
-
     if [ "${PITFT35r}" = "1" ]; then
         echo "# Enable PITFT35r display" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "dtoverlay=pitft35-resistive,rotate=90,speed=42000000,fps=20" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
@@ -127,6 +171,15 @@
         echo "hdmi_cvt 1024 600 60 6 0 0 0" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
         echo "hdmi_drive=1" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
+
+    # DWC2 USB peripheral support
+    if [ "${ENABLE_DWC2_PERIPHERAL}" = "1" ]; then
+        echo "# Enable USB peripheral mode" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        echo "dtoverlay=dwc2,dr_mode=peripheral" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    fi
+    
+    # Append extra config if the user has provided any
+    echo "${RPI_EXTRA_CONFIG}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
 }
 
 do_deploy_append_raspberrypi3-64() {
@@ -135,13 +188,9 @@
 
     echo "# Enable audio (loads snd_bcm2835)" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     echo "dtparam=audio=on" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
-
-    # Device Tree support
-    echo "# Load correct Device Tree for Aarch64" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
-    echo "device_tree=bcm2710-rpi-3-b.dtb" >>${DEPLOYDIR}/bcm2835-bootfiles/config.txt
 }
 
-addtask deploy before do_package after do_install
+addtask deploy before do_build after do_install
 do_deploy[dirs] += "${DEPLOYDIR}/bcm2835-bootfiles"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/common/firmware.inc b/import-layers/meta-raspberrypi/recipes-bsp/common/firmware.inc
index 67078c1..d564a49 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/common/firmware.inc
+++ b/import-layers/meta-raspberrypi/recipes-bsp/common/firmware.inc
@@ -1,9 +1,10 @@
-RPIFW_DATE ?= "20171029"
-RPIFW_SRC_URI ?= "https://github.com/raspberrypi/firmware/archive/1.${RPIFW_DATE}.tar.gz"
-RPIFW_S ?= "${WORKDIR}/firmware-1.${RPIFW_DATE}"
+RPIFW_DATE ?= "20180417"
+SRCREV ?= "5db8e4e1c63178e200d6fbea23ed4a9bf4656658"
+RPIFW_SRC_URI ?= "https://github.com/raspberrypi/firmware/archive/${SRCREV}.tar.gz"
+RPIFW_S ?= "${WORKDIR}/firmware-${SRCREV}"
 
 SRC_URI = "${RPIFW_SRC_URI}"
-SRC_URI[md5sum] = "4d27c1888a7bab3097471906e7b4a319"
-SRC_URI[sha256sum] = "46ce28c8d87ef22bdcc57ac1836ca3f04d1ec6f46580ff5a30bf76b3c0822117"
-PV = "${RPIFW_DATE}"
+SRC_URI[md5sum] = "6bce52f22a7a005a9bcdb9912b132590"
+SRC_URI[sha256sum] = "84568c4e7f5b0deee4cd76e7c0b48315885f983d6131d8148ef8af8438328a36"
 
+PV = "${RPIFW_DATE}"
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb b/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
index 3457300..0106ac3 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
+++ b/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/rpi-u-boot-scr.bb
@@ -5,6 +5,8 @@
 
 DEPENDS = "u-boot-mkimage-native"
 
+INHIBIT_DEFAULT_DEPS = "1"
+
 SRC_URI = "file://boot.cmd.in"
 
 do_compile() {
@@ -14,7 +16,7 @@
     mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
 }
 
-inherit deploy
+inherit deploy nopackages
 
 do_deploy() {
     install -d ${DEPLOYDIR}
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch b/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch
new file mode 100644
index 0000000..e98fd85
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot/0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch
@@ -0,0 +1,41 @@
+From 5d113dc0130ea2ea9faaa000fba9c737266b9747 Mon Sep 17 00:00:00 2001
+From: Drew Moseley <drew.moseley@northern.tech>
+Date: Fri, 9 Feb 2018 18:10:09 -0500
+Subject: [PATCH] rpi_0_w: Add configs consistent with RpI3
+
+Upstream-Status: Accepted [https://patchwork.ozlabs.org/patch/856572/]
+
+Signed-off-by: Drew Moseley <drew.moseley@northern.tech>
+---
+ configs/rpi_0_w_defconfig | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig
+index 9a6d24b..1248294 100644
+--- a/configs/rpi_0_w_defconfig
++++ b/configs/rpi_0_w_defconfig
+@@ -12,14 +12,21 @@ CONFIG_SYS_PROMPT="U-Boot> "
+ CONFIG_CMD_GPIO=y
+ CONFIG_CMD_MMC=y
+ CONFIG_CMD_USB=y
++CONFIG_OF_EMBED=y
++CONFIG_ENV_FAT_INTERFACE="mmc"
++CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
++CONFIG_DM_KEYBOARD=y
+ CONFIG_DM_MMC=y
+ CONFIG_MMC_SDHCI=y
+ CONFIG_MMC_SDHCI_BCM2835=y
+ CONFIG_DM_ETH=y
+ CONFIG_USB=y
+ CONFIG_DM_USB=y
++CONFIG_USB_DWC2=y
+ CONFIG_USB_STORAGE=y
+ CONFIG_USB_KEYBOARD=y
++CONFIG_USB_HOST_ETHER=y
++CONFIG_USB_ETHER_SMSC95XX=y
+ CONFIG_DM_VIDEO=y
+ CONFIG_SYS_WHITE_ON_BLACK=y
+ CONFIG_CONSOLE_SCROLL_LINES=10
+-- 
+2.7.4
+
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend b/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
index 3781666..7d4a49e 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -1 +1,7 @@
-RDEPENDS_${PN}_append_rpi = " rpi-u-boot-scr"
+FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot:"
+
+SRC_URI_append_rpi = " \
+    file://0002-rpi_0_w-Add-configs-consistent-with-RpI3.patch \
+"
+
+DEPENDS_append_rpi = " rpi-u-boot-scr"
diff --git a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd
deleted file mode 100644
index 162275a..0000000
--- a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/BCM43430A1.hcd
+++ /dev/null
Binary files differ
diff --git a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service
index d57125c..a51f6bc 100644
--- a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service
+++ b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5/brcm43438.service
@@ -2,11 +2,13 @@
 Description=Broadcom BCM43438 bluetooth HCI
 ConditionPathIsDirectory=/proc/device-tree/soc/gpio@7e200000/bt_pins
 Before=bluetooth.service
-After=dev-ttyAMA0.device
+BindsTo=dev-serial1.device
+After=dev-serial1.device
 
 [Service]
-Type=simple
-ExecStart=/usr/bin/hciattach -n /dev/ttyAMA0 bcm43xx 921600 noflow -
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/btuart
 
 [Install]
 WantedBy=multi-user.target
diff --git a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
index 03efd5c..d1b84df 100644
--- a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
@@ -1,7 +1,6 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
 BCM_BT_SOURCES =  " \
-    file://BCM43430A1.hcd \
     file://0001-bcm43xx-Add-bcm43xx-3wire-variant.patch \
     file://0002-bcm43xx-The-UART-speed-must-be-reset-after-the-firmw.patch \
     file://0003-Increase-firmware-load-timeout-to-30s.patch \
@@ -9,21 +8,19 @@
     file://brcm43438.service \
     "
 
-enable_bcm_bluetooth() {
-    install -d ${D}/lib/firmware/brcm/
-    install -m 0644 ${WORKDIR}/BCM43430A1.hcd ${D}/lib/firmware/brcm/BCM43430A1.hcd
+BCM_BT_SERVICE = "brcm43438.service"
 
+enable_bcm_bluetooth() {
     if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_unitdir}/system
-        install -m 0644 ${WORKDIR}/brcm43438.service ${D}${systemd_unitdir}/system
+        install -m 0644 ${WORKDIR}/${BCM_BT_SERVICE} ${D}${systemd_unitdir}/system
     fi
 }
 
-BCM_BT_FIRMWARE =  " \
-    /lib/firmware/brcm/BCM43430A1.hcd \
-    "
-
-BCM_BT_SERVICE =  " brcm43438.service"
+BCM_BT_RDEPENDS = "\
+    udev-rules-rpi \
+    pi-bluetooth \
+"
 
 # for raspberrypi3
 SRC_URI_append_raspberrypi3 = " ${BCM_BT_SOURCES}"
@@ -32,10 +29,10 @@
     enable_bcm_bluetooth
 }
 
-FILES_${PN}_append_raspberrypi3 = " ${BCM_BT_FIRMWARE}"
-
 SYSTEMD_SERVICE_${PN}_append_raspberrypi3 = " ${BCM_BT_SERVICE}"
 
+RDEPENDS_${PN}_append_raspberrypi3 = " ${BCM_BT_RDEPENDS}"
+
 # for raspberrypi0-wifi
 SRC_URI_append_raspberrypi0-wifi = " ${BCM_BT_SOURCES}"
 
@@ -43,6 +40,6 @@
     enable_bcm_bluetooth
 }
 
-FILES_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_FIRMWARE}"
-
 SYSTEMD_SERVICE_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_SERVICE}"
+
+RDEPENDS_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_RDEPENDS}"
diff --git a/import-layers/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth.bb b/import-layers/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth.bb
new file mode 100644
index 0000000..e185f25
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-connectivity/pi-bluetooth/pi-bluetooth.bb
@@ -0,0 +1,22 @@
+SUMMARY = "Script to properly configure BT-HCI on Raspberry Pi"
+HOMEPAGE = "https://github.com/RPi-Distro/pi-bluetooth"
+SECTION = "kernel"
+LICENSE = "BSD-3-Clause"
+LIC_FILES_CHKSUM = "\
+    file://debian/copyright;md5=6af8de3c8ee71f8e91e9b22f84ff2022 \
+"
+
+SRC_URI = "git://github.com/RPi-Distro/pi-bluetooth"
+SRCREV = "2a7477966bb3c69838b224f3ea92cb49a88124d5"
+UPSTREAM_VERSION_UNKNOWN = "1"
+
+S = "${WORKDIR}/git"
+
+inherit allarch
+
+do_install() {
+    install -d ${D}${bindir}
+    install -m 0755 ${S}/usr/bin/btuart ${D}${bindir}
+}
+
+FILES_${PN} = "${bindir}"
diff --git a/import-layers/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb b/import-layers/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb
index 623a5a7..77a3d7b 100644
--- a/import-layers/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb
+++ b/import-layers/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb
@@ -1,6 +1,15 @@
-# Base this image on rpi-hwup-image
-include rpi-hwup-image.bb
+# Base this image on core-image-minimal
+include recipes-core/images/core-image-minimal.bb
+
+# Include modules in rootfs
+IMAGE_INSTALL += " \
+	kernel-modules \
+	"
 
 SPLASH = "psplash-raspberrypi"
 
 IMAGE_FEATURES += "ssh-server-dropbear splash"
+
+do_image_prepend() {
+    bb.warn("The image 'rpi-basic-image' is deprecated, please use 'core-image-base' instead")
+}
diff --git a/import-layers/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb b/import-layers/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
index 486ea59..d2371ad 100644
--- a/import-layers/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
+++ b/import-layers/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
@@ -5,3 +5,7 @@
 IMAGE_INSTALL += " \
 	kernel-modules \
 	"
+
+do_image_prepend() {
+    bb.warn("The image 'rpi-hwup-image' is deprecated, please use 'core-image-minimal' instead")
+}
diff --git a/import-layers/meta-raspberrypi/recipes-core/images/rpi-test-image.bb b/import-layers/meta-raspberrypi/recipes-core/images/rpi-test-image.bb
index c8dc436..c2f5f73 100644
--- a/import-layers/meta-raspberrypi/recipes-core/images/rpi-test-image.bb
+++ b/import-layers/meta-raspberrypi/recipes-core/images/rpi-test-image.bb
@@ -1,5 +1,5 @@
-# Base this image on rpi-basic-image
-include rpi-basic-image.bb
+# Base this image on core-image-base
+include recipes-core/images/core-image-base.bb
 
 COMPATIBLE_MACHINE = "^rpi$"
 
diff --git a/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb
index 20443d3..b249d97 100644
--- a/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb
+++ b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-rpi.bb
@@ -6,6 +6,8 @@
 
 S = "${WORKDIR}"
 
+INHIBIT_DEFAULT_DEPS = "1"
+
 do_install () {
     install -d ${D}${sysconfdir}/udev/rules.d
     install -m 0644 ${WORKDIR}/99-com.rules ${D}${sysconfdir}/udev/rules.d/
diff --git a/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi/80-udisks-rpi.rules b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi/80-udisks-rpi.rules
new file mode 100644
index 0000000..3eff66d
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi/80-udisks-rpi.rules
@@ -0,0 +1,10 @@
+##############################################################################################################
+
+# Partitions which desktops should not display
+#
+
+# boot partition
+ENV{ID_FS_TYPE}=="vfat", ENV{ID_FS_LABEL}=="raspberrypi", \
+  ENV{UDISKS_PRESENTATION_HIDE}="1", ENV{UDISKS_IGNORE}="1"
+
+##############################################################################################################
diff --git a/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi_1.0.bb b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi_1.0.bb
new file mode 100644
index 0000000..ae35521
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-core/udev/udev-rules-udisks-rpi_1.0.bb
@@ -0,0 +1,13 @@
+DESCRIPTION = "add udisk/udev rule to hide boot partition from udev"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+SRC_URI = "file://80-udisks-rpi.rules"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+do_install () {
+	install -d ${D}${base_libdir}/udev/rules.d
+	install -m 644 ${WORKDIR}/80-udisks-rpi.rules ${D}${base_libdir}/udev/rules.d
+}
+
+FILES_${PN} = "${base_libdir}/udev/rules.d"
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster.inc b/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster.inc
deleted file mode 100644
index 3cb79cc..0000000
--- a/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-DESCRIPTION = "This project enables PWM on the GPIO pins you request of a Raspberry Pi."
-HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
-SECTION = "devel/libs"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://README.md;beginline=225;endline=252;md5=a012868ef5f83b9f257af253d7cb07a3"
-
-SRC_URI = "git://github.com/sarfata/pi-blaster \
-           file://remove-initscript-lsb-dependency.patch \
-"
-
-S = "${WORKDIR}/git"
-
-inherit update-rc.d autotools
-
-INITSCRIPT_PACKAGES = "${PN}"
-INITSCRIPT_NAME_${PN} = "${PN}.boot.sh"
-INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
-
-COMPATIBLE_MACHINE = "^rpi$"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb b/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
index 730f9d3..2748459 100644
--- a/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster_git.bb
@@ -1,3 +1,23 @@
-require pi-blaster.inc
+DESCRIPTION = "This project enables PWM on the GPIO pins you request of a Raspberry Pi."
+HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
+SECTION = "devel/libs"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://README.md;beginline=225;endline=252;md5=a012868ef5f83b9f257af253d7cb07a3"
+
+SRC_URI = "git://github.com/sarfata/pi-blaster \
+           file://remove-initscript-lsb-dependency.patch \
+"
+
+S = "${WORKDIR}/git"
 
 SRCREV = "1035ad7dffb270c40eec1bb3a654171a755fba98"
+
+inherit update-rc.d autotools
+
+INITSCRIPT_PACKAGES = "${PN}"
+INITSCRIPT_NAME_${PN} = "${PN}.boot.sh"
+INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
+
+COMPATIBLE_MACHINE = "^rpi$"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
index e789022..52fe757 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend
@@ -1,3 +1,7 @@
-PACKAGECONFIG_append_rpi = " gallium"
+# DRI3 note:
+# With oe-core commit 8509e2e1a87578882b71948ccef3b50ccf1228b3 dri3 is set
+# as default. To state out clearly that Raspi needs dri3 and to avoid surprises
+# in case oe-core changes this default, we set dri3 explicitly.
+PACKAGECONFIG_append_rpi = " gallium ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)}"
 GALLIUMDRIVERS_rpi = "vc4"
 DRIDRIVERS_rpi = ""
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
index 5861c4e..933f279 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0001-Allow-applications-to-set-next-resource-handle.patch
@@ -1,7 +1,7 @@
-From e45bc677368d0f8d42720aad242f33f6e2687fb1 Mon Sep 17 00:00:00 2001
+From 0a64dc61d3d7db69389157ae757203b4b3afdbfa Mon Sep 17 00:00:00 2001
 From: Dom Cobley <dc4@broadcom.com>
 Date: Tue, 9 Jul 2013 09:26:26 -0400
-Subject: [PATCH 01/15] Allow applications to set next resource handle
+Subject: [PATCH 01/16] Allow applications to set next resource handle
 
 This patch adds provisions in userland to
 let apps callers set the next rendereing dispmanx resource.
@@ -204,5 +204,5 @@
  
  FN(void, eglIntGetColorData_impl, (EGL_SURFACE_ID_T s, KHRN_IMAGE_FORMAT_T format, uint32_t width, uint32_t height, int32_t stride, uint32_t y_offset, void *data))
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
index d6e6476..4613504 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0002-wayland-Add-support-for-the-Wayland-winsys.patch
@@ -1,7 +1,7 @@
-From 15fb270f438f4ef1413192b5ce1e0dc784b45d9e Mon Sep 17 00:00:00 2001
+From 5608ec8002be8370e78c9dbb1e07cee4cfb18b58 Mon Sep 17 00:00:00 2001
 From: Tomeu Vizoso <tomeu.vizoso@collabora.com>
 Date: Tue, 1 Oct 2013 13:19:20 +0200
-Subject: [PATCH 02/15] wayland: Add support for the Wayland winsys
+Subject: [PATCH 02/16] wayland: Add support for the Wayland winsys
 
 * Adds EGL_WL_bind_wayland_display extension
 * Adds wayland-egl library
@@ -57,20 +57,20 @@
  create mode 100644 interface/wayland/dispmanx.xml
  create mode 100644 makefiles/cmake/Wayland.cmake
 
-diff --git a/.gitignore b/.gitignore
-index 63570f1..1459436 100644
---- a/.gitignore
-+++ b/.gitignore
+Index: git/.gitignore
+===================================================================
+--- git.orig/.gitignore
++++ git/.gitignore
 @@ -30,3 +30,4 @@ build/
  *.pts
  *.ppm
  *.mkv
 +*~
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index cfc8ae5..673a5ad 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.cmake)
+Index: git/CMakeLists.txt
+===================================================================
+--- git.orig/CMakeLists.txt
++++ git/CMakeLists.txt
+@@ -24,6 +24,17 @@ include(makefiles/cmake/global_settings.
  include(makefiles/cmake/arm-linux.cmake)
  include(makefiles/cmake/vmcs.cmake)
  
@@ -88,22 +88,22 @@
  enable_language(ASM)
  
  # Global include paths
-diff --git a/README.md b/README.md
-index 358d2b4..4da4448 100644
---- a/README.md
-+++ b/README.md
-@@ -4,3 +4,7 @@ EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG.
- 
- Use buildme to build. It requires cmake to be installed and an arm cross compiler. It is set up to use this one:
+Index: git/README.md
+===================================================================
+--- git.orig/README.md
++++ git/README.md
+@@ -6,3 +6,7 @@ Use buildme to build. It requires cmake
  https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian
+ 
+ Note that this repository does not contain the source for the edid_parser and vcdbg binaries due to licensing restrictions.
 +
 +To build support for the Wayland winsys in EGL, execute the buildme script like this:
 +
 +$ BUILD_WAYLAND=1 ./buildme.
-diff --git a/buildme b/buildme
-index b8fd440..a780bb6 100755
---- a/buildme
-+++ b/buildme
+Index: git/buildme
+===================================================================
+--- git.orig/buildme
++++ git/buildme
 @@ -8,6 +8,10 @@ fi
  
  BUILDSUBDIR=`echo $BUILDTYPE | tr '[A-Z]' '[a-z]'`;
@@ -130,11 +130,11 @@
  	make -j `nproc`
  
  	if [ "$1" != "" ]; then
-diff --git a/host_applications/linux/apps/raspicam/CMakeLists.txt b/host_applications/linux/apps/raspicam/CMakeLists.txt
-index e6aa6b8..69059cb 100644
---- a/host_applications/linux/apps/raspicam/CMakeLists.txt
-+++ b/host_applications/linux/apps/raspicam/CMakeLists.txt
-@@ -28,7 +28,7 @@ add_executable(raspividyuv  ${COMMON_SOURCES} RaspiVidYUV.c)
+Index: git/host_applications/linux/apps/raspicam/CMakeLists.txt
+===================================================================
+--- git.orig/host_applications/linux/apps/raspicam/CMakeLists.txt
++++ git/host_applications/linux/apps/raspicam/CMakeLists.txt
+@@ -28,7 +28,7 @@ add_executable(raspividyuv  ${COMMON_SOU
  
  set (MMAL_LIBS mmal_core mmal_util mmal_vc_client)
  
@@ -143,10 +143,10 @@
  target_link_libraries(raspiyuv   ${MMAL_LIBS} vcos bcm_host)
  target_link_libraries(raspivid   ${MMAL_LIBS} vcos bcm_host)
  target_link_libraries(raspividyuv   ${MMAL_LIBS} vcos bcm_host)
-diff --git a/interface/khronos/CMakeLists.txt b/interface/khronos/CMakeLists.txt
-index 9ad615b..3d3571a 100644
---- a/interface/khronos/CMakeLists.txt
-+++ b/interface/khronos/CMakeLists.txt
+Index: git/interface/khronos/CMakeLists.txt
+===================================================================
+--- git.orig/interface/khronos/CMakeLists.txt
++++ git/interface/khronos/CMakeLists.txt
 @@ -6,6 +6,12 @@
  # have quite a few circular dependencies, and so the only way
  # to make it work seems to be to have everything static.
@@ -160,7 +160,7 @@
  set(EGL_SOURCE
     egl/egl_client_config.c
     egl/egl_client_context.c
-@@ -55,12 +61,56 @@ set(CLIENT_SOURCE
+@@ -55,12 +61,55 @@ set(CLIENT_SOURCE
     common/khrn_int_hash_asm.s
     common/khrn_client_cache.c)
  
@@ -168,8 +168,7 @@
 +   khrn_client
 +   vchiq_arm
 +   vcos
-+   bcm_host
-+   -lm)
++   bcm_host)
 +
 +if (BUILD_WAYLAND)
 +   set(EGL_SOURCE
@@ -217,21 +216,30 @@
  # TODO do we need EGL_static and GLESv2_static now that khrn_static exists?
  add_library(EGL_static STATIC ${EGL_SOURCE})
  add_library(GLESv2_static STATIC ${GLES_SOURCE})
-@@ -72,8 +122,7 @@ include_directories (../../host_applications/linux/libs/sm )
+@@ -72,8 +121,7 @@ include_directories (../../host_applicat
  set(VCSM_LIBS vcsm)
  add_definitions(-DKHRONOS_HAVE_VCSM)
  endif()
 -
 -target_link_libraries(EGL khrn_client vchiq_arm vcos bcm_host ${VCSM_LIBS} -lm)
-+target_link_libraries(EGL ${EGL_LIBS} ${VCSM_LIBS})
++target_link_libraries(EGL ${EGL_LIBS} ${VCSM_LIBS} -lm)
  target_link_libraries(GLESv2 EGL khrn_client vcos)
  target_link_libraries(WFC EGL)
  target_link_libraries(OpenVG EGL)
-diff --git a/interface/khronos/common/khrn_client.c b/interface/khronos/common/khrn_client.c
-index ef4babd..d7e798e 100644
---- a/interface/khronos/common/khrn_client.c
-+++ b/interface/khronos/common/khrn_client.c
-@@ -54,6 +54,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+@@ -87,7 +135,7 @@ add_library(brcmGLESv2 ${SHARED} ${GLES_
+ add_library(brcmOpenVG ${SHARED} ${VG_SOURCE})
+ add_library(brcmWFC ${SHARED} ${WFC_SOURCE})
+ 
+-target_link_libraries(brcmEGL khrn_client vchiq_arm vcos bcm_host ${VCSM_LIBS} -lm)
++target_link_libraries(brcmEGL ${EGL_LIBS} ${VCSM_LIBS} -lm)
+ target_link_libraries(brcmGLESv2 brcmEGL khrn_client vcos)
+ target_link_libraries(brcmWFC brcmEGL)
+ target_link_libraries(brcmOpenVG brcmEGL)
+Index: git/interface/khronos/common/khrn_client.c
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client.c
++++ git/interface/khronos/common/khrn_client.c
+@@ -54,6 +54,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "applications/vmcs/khronos/khronos_server.h"
  #endif
  
@@ -242,7 +250,7 @@
  VCOS_LOG_CAT_T khrn_client_log = VCOS_LOG_INIT("khrn_client", VCOS_LOG_WARN);
  
  /*
-@@ -142,6 +146,10 @@ void client_try_unload_server(CLIENT_PROCESS_STATE_T *process)
+@@ -142,6 +146,10 @@ void client_try_unload_server(CLIENT_PRO
  bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
  {
     if (!process->inited) {
@@ -253,7 +261,7 @@
        if (!khrn_pointer_map_init(&process->contexts, 64))
           return false;
  
-@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
+@@ -194,6 +202,13 @@ bool client_process_state_init(CLIENT_PR
        }
  #endif
  
@@ -267,10 +275,10 @@
        process->inited = true;
     }
  
-diff --git a/interface/khronos/common/khrn_client.h b/interface/khronos/common/khrn_client.h
-index 804039b..615f7b4 100644
---- a/interface/khronos/common/khrn_client.h
-+++ b/interface/khronos/common/khrn_client.h
+Index: git/interface/khronos/common/khrn_client.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client.h
++++ git/interface/khronos/common/khrn_client.h
 @@ -310,6 +310,16 @@ struct CLIENT_PROCESS_STATE {
  #ifdef RPC_LIBRARY
     KHRONOS_SERVER_CONNECTION_T khrn_connection;
@@ -288,11 +296,11 @@
  };
  
  extern bool client_process_state_init(CLIENT_PROCESS_STATE_T *process);
-diff --git a/interface/khronos/common/khrn_client_mangle.h b/interface/khronos/common/khrn_client_mangle.h
-index b3c04f4..b7b21c5 100644
---- a/interface/khronos/common/khrn_client_mangle.h
-+++ b/interface/khronos/common/khrn_client_mangle.h
-@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_mangle.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_mangle.h
++++ git/interface/khronos/common/khrn_client_mangle.h
+@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #define eglReleaseGlobalImageBRCM mangled_eglReleaseGlobalImageBRCM
  #define eglInitGlobalImageBRCM mangled_eglInitGlobalImageBRCM
  #define eglTermGlobalImageBRCM mangled_eglTermGlobalImageBRCM
@@ -302,11 +310,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-diff --git a/interface/khronos/common/khrn_client_platform.h b/interface/khronos/common/khrn_client_platform.h
-index 1c9da3a..715c67e 100644
---- a/interface/khronos/common/khrn_client_platform.h
-+++ b/interface/khronos/common/khrn_client_platform.h
-@@ -48,6 +48,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_platform.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_platform.h
++++ git/interface/khronos/common/khrn_client_platform.h
+@@ -48,6 +48,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "interface/khronos/common/vcos/khrn_client_platform_filler_vcos.h"
  #endif
  
@@ -326,11 +334,11 @@
 +#endif
 +
  #endif // KHRN_CLIENT_PLATFORM_H
-diff --git a/interface/khronos/common/khrn_client_unmangle.h b/interface/khronos/common/khrn_client_unmangle.h
-index 4f3ce49..84f6ec0 100644
---- a/interface/khronos/common/khrn_client_unmangle.h
-+++ b/interface/khronos/common/khrn_client_unmangle.h
-@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/khrn_client_unmangle.h
+===================================================================
+--- git.orig/interface/khronos/common/khrn_client_unmangle.h
++++ git/interface/khronos/common/khrn_client_unmangle.h
+@@ -83,6 +83,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #undef eglReleaseGlobalImageBRCM
  #undef eglInitGlobalImageBRCM
  #undef eglTermGlobalImageBRCM
@@ -340,11 +348,11 @@
  
  /* OpenGL ES 1.1 and 2.0 functions */
  
-diff --git a/interface/khronos/common/linux/khrn_client_platform_linux.c b/interface/khronos/common/linux/khrn_client_platform_linux.c
-index 710d20f..50d60a6 100644
---- a/interface/khronos/common/linux/khrn_client_platform_linux.c
-+++ b/interface/khronos/common/linux/khrn_client_platform_linux.c
-@@ -37,6 +37,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/common/linux/khrn_client_platform_linux.c
+===================================================================
+--- git.orig/interface/khronos/common/linux/khrn_client_platform_linux.c
++++ git/interface/khronos/common/linux/khrn_client_platform_linux.c
+@@ -37,6 +37,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "X11/Xlib.h"
  #endif
  
@@ -356,7 +364,7 @@
  extern VCOS_LOG_CAT_T khrn_client_log;
  
  extern void vc_vchi_khronos_init();
-@@ -464,13 +469,36 @@ EGLDisplay khrn_platform_set_display_id(EGLNativeDisplayType display_id)
+@@ -464,14 +469,37 @@ EGLDisplay khrn_platform_set_display_id(
  	   return EGL_NO_DISPLAY;
  }
  #else
@@ -384,18 +392,19 @@
 +#endif
 +         return EGL_NO_DISPLAY;
 +   }
- }
++}
 +
 +#ifdef BUILD_WAYLAND
 +struct wl_display *khrn_platform_get_wl_display()
 +{
 +   return hacky_display;
-+}
-+#endif
+ }
  #endif
++#endif
  
  #ifdef WANT_X
-@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_default(EGLNativeWindowType win)
+ static void dump_hierarchy(Window w, Window thisw, Window look, int level)
+@@ -805,22 +833,81 @@ static EGL_DISPMANX_WINDOW_T *check_defa
  void platform_get_dimensions(EGLDisplay dpy, EGLNativeWindowType win,
        uint32_t *width, uint32_t *height, uint32_t *swapchain_count)
  {
@@ -426,8 +435,8 @@
 +#ifdef BUILD_WAYLAND
 +   }
 +#endif
- }
- 
++}
++
 +#ifdef BUILD_WAYLAND
 +static DISPMANX_ELEMENT_HANDLE_T create_dummy_element()
 +{
@@ -458,9 +467,9 @@
 +   vc_dispmanx_display_close(display);
 +
 +   return element;
-+}
+ }
 +#endif
-+
+ 
  uint32_t platform_get_handle(EGLDisplay dpy, EGLNativeWindowType win)
  {
 -   EGL_DISPMANX_WINDOW_T *dwin = check_default(win);
@@ -489,11 +498,10 @@
  }
  
  #endif
-diff --git a/interface/khronos/common/linux/khrn_wayland.c b/interface/khronos/common/linux/khrn_wayland.c
-new file mode 100644
-index 0000000..0e1b9e7
+Index: git/interface/khronos/common/linux/khrn_wayland.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/common/linux/khrn_wayland.c
++++ git/interface/khronos/common/linux/khrn_wayland.c
 @@ -0,0 +1,215 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -710,74 +718,72 @@
 +
 +   return wl_dispmanx_client_buffer;
 +}
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.h b/interface/khronos/common/linux/khrn_wayland.h
-similarity index 56%
-copy from interface/vmcs_host/vc_vchi_dispmanx.h
-copy to interface/khronos/common/linux/khrn_wayland.h
-index b723b76..b9bf08c 100644
---- a/interface/vmcs_host/vc_vchi_dispmanx.h
-+++ b/interface/khronos/common/linux/khrn_wayland.h
-@@ -1,5 +1,5 @@
- /*
--Copyright (c) 2012, Broadcom Europe Ltd
+Index: git/interface/vmcs_host/vc_vchi_dispmanx.h
+===================================================================
+--- git.orig/interface/vmcs_host/vc_vchi_dispmanx.h
++++ git/interface/vmcs_host/vc_vchi_dispmanx.h
+@@ -66,4 +66,19 @@ typedef struct {
+ #define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
+ #define ELEMENT_CHANGE_TRANSFORM      (1<<5)
+ 
++#ifdef BUILD_WAYLAND
++/* XXX: This should be in a private header that can be included from EGL and vc_* */
++#include <wayland-server.h>
++#include "interface/vmcs_host/wayland-dispmanx-server-protocol.h"
++struct wl_dispmanx_server_buffer {
++	struct wl_resource *resource;
++	struct wl_dispmanx *dispmanx;
++	enum wl_dispmanx_format format;
++	DISPMANX_RESOURCE_HANDLE_T handle;
++	int32_t width;
++	int32_t height;
++	int in_use;
++};
++#endif
++
+ #endif
+Index: git/interface/khronos/common/linux/khrn_wayland.h
+===================================================================
+--- /dev/null
++++ git/interface/khronos/common/linux/khrn_wayland.h
+@@ -0,0 +1,33 @@
++/*
 +Copyright (c) 2013, Raspberry Pi Foundation
- All rights reserved.
- 
- Redistribution and use in source and binary forms, with or without
-@@ -25,45 +25,9 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- 
--#ifndef VC_VCHI_DISPMANX_H
--#define VC_VCHI_DISPMANX_H
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++    * Redistributions of source code must retain the above copyright
++      notice, this list of conditions and the following disclaimer.
++    * Redistributions in binary form must reproduce the above copyright
++      notice, this list of conditions and the following disclaimer in the
++      documentation and/or other materials provided with the distribution.
++    * Neither the name of the copyright holder nor the
++      names of its contributors may be used to endorse or promote products
++      derived from this software without specific prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++*/
++
 +#include "interface/khronos/common/khrn_client.h"
- 
--#include "interface/peer/vc_vchi_dispmanx_common.h"
++
 +int init_process_wayland(CLIENT_PROCESS_STATE_T *process);
 +int do_wl_roundtrip();
- 
--#define VC_NUM_HOST_RESOURCES 64
--#define DISPMANX_MSGFIFO_SIZE 1024
--#define DISPMANX_CLIENT_NAME MAKE_FOURCC("DISP")
--#define DISPMANX_NOTIFY_NAME MAKE_FOURCC("UPDH")
--
--//Or with command to indicate we don't need a response
--#define DISPMANX_NO_REPLY_MASK (1<<31)
--
--typedef struct {
--   char     description[32];
--   uint32_t width;
--   uint32_t height;
--   uint32_t aspect_pixwidth;
--   uint32_t aspect_pixheight;
--   uint32_t fieldrate_num;
--   uint32_t fieldrate_denom;
--   uint32_t fields_per_frame;
--   uint32_t transform;        
--} GET_MODES_DATA_T;
--
--typedef struct {
--   int32_t  response;
--   uint32_t width;
--   uint32_t height;
--   uint32_t transform;
--   uint32_t input_format;
--} GET_INFO_DATA_T;
--
--//Attributes changes flag mask
--#define ELEMENT_CHANGE_LAYER          (1<<0)
--#define ELEMENT_CHANGE_OPACITY        (1<<1)
--#define ELEMENT_CHANGE_DEST_RECT      (1<<2)
--#define ELEMENT_CHANGE_SRC_RECT       (1<<3)
--#define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
--#define ELEMENT_CHANGE_TRANSFORM      (1<<5)
--
--#endif
++
 +struct wl_dispmanx_client_buffer *allocate_wl_buffer(struct wl_egl_window *window, KHRN_IMAGE_FORMAT_T color);
-diff --git a/interface/khronos/egl/egl_client.c b/interface/khronos/egl/egl_client.c
-index b8bb374..03fe67b 100644
---- a/interface/khronos/egl/egl_client.c
-+++ b/interface/khronos/egl/egl_client.c
+Index: git/interface/khronos/egl/egl_client.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client.c
++++ git/interface/khronos/egl/egl_client.c
 @@ -153,6 +153,10 @@ by an attribute value"
  #include <stdlib.h>
  #include <string.h>
@@ -789,7 +795,7 @@
  
  #include "interface/khronos/egl/egl_client_cr.c"
  
-@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_PROCESS_STATE_T *process, EGL_CURRENT_T *
+@@ -162,17 +166,6 @@ static void egl_current_release(CLIENT_P
  void egl_gl_flush_callback(bool wait);
  void egl_vg_flush_callback(bool wait);
  
@@ -807,17 +813,17 @@
  /*
  TODO: do an RPC call to make sure the Khronos vll is loaded (and that it stays loaded until eglTerminate)
  Also affects global image (and possibly others?)
-@@ -450,6 +443,9 @@ EGLAPI const char EGLAPIENTRY * eglQueryString(EGLDisplay dpy, EGLint name)
- #ifdef EGL_KHR_fence_sync
+@@ -451,6 +444,9 @@ EGLAPI const char EGLAPIENTRY * eglQuery
              "EGL_KHR_fence_sync "
  #endif
-+#endif
+ #endif
 +#if EGL_WL_bind_wayland_display
 +            "EGL_WL_bind_wayland_display "
- #endif
++#endif
              ;
           break;
-@@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig c
+       case EGL_VENDOR:
+@@ -655,8 +651,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateW
                                  false,
                                  EGL_NO_TEXTURE,
                                  EGL_NO_TEXTURE,
@@ -827,7 +833,7 @@
  
                 if (surface) {
                    if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig
+@@ -901,7 +896,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
                               mipmap_texture,
                               texture_format,
                               texture_target,
@@ -836,7 +842,7 @@
  
              if (surface) {
                 if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig c
+@@ -1043,7 +1038,7 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreateP
                                     false,
                                     EGL_NO_TEXTURE,
                                     EGL_NO_TEXTURE,
@@ -845,7 +851,7 @@
  
                       if (surface) {
                          if (khrn_pointer_map_insert(&process->surfaces, process->next_surface, surface)) {
-@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
+@@ -2245,6 +2240,9 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
     CLIENT_THREAD_STATE_T *thread;
     CLIENT_PROCESS_STATE_T *process;
     EGLBoolean result;
@@ -855,7 +861,7 @@
  
     vcos_log_trace("eglSwapBuffers start. dpy=%d. surf=%d.", (int)dpy, (int)surf);
  
-@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surf)
+@@ -2315,18 +2313,58 @@ EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuf
  
                 vcos_log_trace("eglSwapBuffers server call");
  
@@ -926,11 +932,11 @@
                 RPC_CALL6(eglIntSwapBuffers_impl,
                       thread,
                       EGLINTSWAPBUFFERS_ID,
-diff --git a/interface/khronos/egl/egl_client_get_proc.c b/interface/khronos/egl/egl_client_get_proc.c
-index 4cfa9ff..6a715af 100644
---- a/interface/khronos/egl/egl_client_get_proc.c
-+++ b/interface/khronos/egl/egl_client_get_proc.c
-@@ -254,6 +254,17 @@ EGLAPI void EGLAPIENTRY (* eglGetProcAddress(const char *procname))(void)
+Index: git/interface/khronos/egl/egl_client_get_proc.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_get_proc.c
++++ git/interface/khronos/egl/egl_client_get_proc.c
+@@ -254,6 +254,17 @@ EGLAPI void EGLAPIENTRY (* eglGetProcAdd
        return (void(*)(void))eglQueryGlobalImageBRCM;
  #endif
  
@@ -948,11 +954,11 @@
     return (void(*)(void)) NULL;
  }
  
-diff --git a/interface/khronos/egl/egl_client_surface.c b/interface/khronos/egl/egl_client_surface.c
-index 128325e..42350bf 100644
---- a/interface/khronos/egl/egl_client_surface.c
-+++ b/interface/khronos/egl/egl_client_surface.c
-@@ -46,6 +46,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/khronos/egl/egl_client_surface.c
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_surface.c
++++ git/interface/khronos/egl/egl_client_surface.c
+@@ -46,6 +46,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #include "interface/khronos/egl/egl_int_impl.h"
  #endif
  
@@ -1026,7 +1032,7 @@
           RPC_CALL15_OUT_CTRL(eglIntCreateSurface_impl,
                               thread,
                               EGLINTCREATESURFACE_ID,
-@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *surface)
+@@ -663,6 +685,18 @@ void egl_surface_free(EGL_SURFACE_T *sur
     if( surface->type == WINDOW ) {
        vcos_log_trace("egl_surface_free: calling platform_destroy_winhandle...");
        platform_destroy_winhandle( surface->win, surface->internal_handle );
@@ -1045,10 +1051,10 @@
     }
     /* return value ignored -- read performed to ensure blocking. we want this to
      * block so clients can safely destroy the surface's window as soon as the
-diff --git a/interface/khronos/egl/egl_client_surface.h b/interface/khronos/egl/egl_client_surface.h
-index b5bf70a..e328b77 100644
---- a/interface/khronos/egl/egl_client_surface.h
-+++ b/interface/khronos/egl/egl_client_surface.h
+Index: git/interface/khronos/egl/egl_client_surface.h
+===================================================================
+--- git.orig/interface/khronos/egl/egl_client_surface.h
++++ git/interface/khronos/egl/egl_client_surface.h
 @@ -288,6 +288,41 @@ typedef struct {
        type == PIXMAP
     */
@@ -1091,7 +1097,7 @@
  } EGL_SURFACE_T;
  
  extern bool egl_surface_check_attribs(
-@@ -322,8 +357,7 @@ extern EGL_SURFACE_T *egl_surface_create(
+@@ -322,8 +357,7 @@ extern EGL_SURFACE_T *egl_surface_create
     EGLenum texture_format,
     EGLenum texture_target,
     EGLNativePixmapType pixmap,
@@ -1101,10 +1107,10 @@
  extern EGL_SURFACE_T *egl_surface_from_vg_image(
     VGImage vg_handle,
     EGLSurface name,
-diff --git a/interface/khronos/egl/egl_int_impl.h b/interface/khronos/egl/egl_int_impl.h
-index 51b3580..6863a3b 100644
---- a/interface/khronos/egl/egl_int_impl.h
-+++ b/interface/khronos/egl/egl_int_impl.h
+Index: git/interface/khronos/egl/egl_int_impl.h
+===================================================================
+--- git.orig/interface/khronos/egl/egl_int_impl.h
++++ git/interface/khronos/egl/egl_int_impl.h
 @@ -57,7 +57,7 @@ FN(int, eglIntCreateSurface_impl, (
     uint32_t sem,
     uint32_t type,
@@ -1114,11 +1120,10 @@
  
  FN(int, eglIntCreatePbufferFromVGImage_impl, (
     VGImage vg_handle,
-diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
-new file mode 100644
-index 0000000..5730743
+Index: git/interface/khronos/ext/egl_wayland.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/ext/egl_wayland.c
++++ git/interface/khronos/ext/egl_wayland.c
 @@ -0,0 +1,246 @@
 +/*
 +Copyright (c) 2013, Raspberry Pi Foundation
@@ -1366,11 +1371,11 @@
 +
 +   return EGL_FALSE;
 +}
-diff --git a/interface/khronos/include/EGL/eglext.h b/interface/khronos/include/EGL/eglext.h
-index 89a3369..d7e5ba7 100755
---- a/interface/khronos/include/EGL/eglext.h
-+++ b/interface/khronos/include/EGL/eglext.h
-@@ -191,6 +191,29 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EG
+Index: git/interface/khronos/include/EGL/eglext.h
+===================================================================
+--- git.orig/interface/khronos/include/EGL/eglext.h
++++ git/interface/khronos/include/EGL/eglext.h
+@@ -191,6 +191,29 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLG
  #endif
  
  
@@ -1400,11 +1405,10 @@
  #ifdef __cplusplus
  }
  #endif
-diff --git a/interface/khronos/wayland-egl/wayland-egl-priv.h b/interface/khronos/wayland-egl/wayland-egl-priv.h
-new file mode 100644
-index 0000000..8e38d36
+Index: git/interface/khronos/wayland-egl/wayland-egl-priv.h
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl-priv.h
++++ git/interface/khronos/wayland-egl/wayland-egl-priv.h
 @@ -0,0 +1,53 @@
 +/* Copied from Mesa */
 +
@@ -1459,11 +1463,10 @@
 +#endif
 +
 +#endif
-diff --git a/interface/khronos/wayland-egl/wayland-egl.c b/interface/khronos/wayland-egl/wayland-egl.c
-new file mode 100644
-index 0000000..b8f050b
+Index: git/interface/khronos/wayland-egl/wayland-egl.c
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl.c
++++ git/interface/khronos/wayland-egl/wayland-egl.c
 @@ -0,0 +1,59 @@
 +/* Copied from Mesa */
 +
@@ -1524,11 +1527,10 @@
 +	if (height)
 +		*height = egl_window->attached_height;
 +}
-diff --git a/interface/khronos/wayland-egl/wayland-egl.pc.in b/interface/khronos/wayland-egl/wayland-egl.pc.in
-new file mode 100644
-index 0000000..8bafc15
+Index: git/interface/khronos/wayland-egl/wayland-egl.pc.in
+===================================================================
 --- /dev/null
-+++ b/interface/khronos/wayland-egl/wayland-egl.pc.in
++++ git/interface/khronos/wayland-egl/wayland-egl.pc.in
 @@ -0,0 +1,10 @@
 +prefix=@CMAKE_INSTALL_PREFIX@
 +exec_prefix=${prefix}
@@ -1540,10 +1542,10 @@
 +Version: @PROJECT_APIVER@
 +Libs: -L${libdir} -lwayland-egl
 +Cflags: -I${includedir}
-diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt
-index fde18da..6718215 100755
---- a/interface/vmcs_host/CMakeLists.txt
-+++ b/interface/vmcs_host/CMakeLists.txt
+Index: git/interface/vmcs_host/CMakeLists.txt
+===================================================================
+--- git.orig/interface/vmcs_host/CMakeLists.txt
++++ git/interface/vmcs_host/CMakeLists.txt
 @@ -9,13 +9,24 @@ add_definitions(-fno-strict-aliasing)
  
  include_directories(${VMCS_TARGET}/vcfiled)
@@ -1574,11 +1576,11 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
  # OpenMAX/IL component service
-diff --git a/interface/vmcs_host/vc_dispmanx.h b/interface/vmcs_host/vc_dispmanx.h
-index 37fdae1..fe3619a 100755
---- a/interface/vmcs_host/vc_dispmanx.h
-+++ b/interface/vmcs_host/vc_dispmanx.h
-@@ -39,6 +39,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Index: git/interface/vmcs_host/vc_dispmanx.h
+===================================================================
+--- git.orig/interface/vmcs_host/vc_dispmanx.h
++++ git/interface/vmcs_host/vc_dispmanx.h
+@@ -39,6 +39,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
  #ifdef __cplusplus
  extern "C" {
  #endif
@@ -1590,7 +1592,7 @@
  // Same function as above, to aid migration of code.
  VCHPRE_ int VCHPOST_ vc_dispman_init( void );
  // Stop the service from being used
-@@ -135,6 +140,11 @@ VCHPRE_ int VCHPOST_ vc_dispmanx_resource_set_palette( DISPMANX_RESOURCE_HANDLE_
+@@ -135,6 +140,11 @@ VCHPRE_ int VCHPOST_ vc_dispmanx_resourc
  // Start triggering callbacks synced to vsync
  VCHPRE_ int VCHPOST_ vc_dispmanx_vsync_callback( DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_CALLBACK_FUNC_T cb_func, void *cb_arg );
  
@@ -1602,11 +1604,11 @@
  #ifdef __cplusplus
  }
  #endif
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.c b/interface/vmcs_host/vc_vchi_dispmanx.c
-index 7a6cdcd..eab146e 100755
---- a/interface/vmcs_host/vc_vchi_dispmanx.c
-+++ b/interface/vmcs_host/vc_vchi_dispmanx.c
-@@ -1319,3 +1319,45 @@ static void *dispmanx_notify_func( void *arg ) {
+Index: git/interface/vmcs_host/vc_vchi_dispmanx.c
+===================================================================
+--- git.orig/interface/vmcs_host/vc_vchi_dispmanx.c
++++ git/interface/vmcs_host/vc_vchi_dispmanx.c
+@@ -1319,3 +1319,45 @@ static void *dispmanx_notify_func( void
     }
     return 0;
  }
@@ -1652,35 +1654,10 @@
 +	buffer->in_use = in_use;
 +}
 +#endif
-diff --git a/interface/vmcs_host/vc_vchi_dispmanx.h b/interface/vmcs_host/vc_vchi_dispmanx.h
-index b723b76..f0bae30 100644
---- a/interface/vmcs_host/vc_vchi_dispmanx.h
-+++ b/interface/vmcs_host/vc_vchi_dispmanx.h
-@@ -66,4 +66,19 @@ typedef struct {
- #define ELEMENT_CHANGE_MASK_RESOURCE  (1<<4)
- #define ELEMENT_CHANGE_TRANSFORM      (1<<5)
- 
-+#ifdef BUILD_WAYLAND
-+/* XXX: This should be in a private header that can be included from EGL and vc_* */
-+#include <wayland-server.h>
-+#include "interface/vmcs_host/wayland-dispmanx-server-protocol.h"
-+struct wl_dispmanx_server_buffer {
-+	struct wl_resource *resource;
-+	struct wl_dispmanx *dispmanx;
-+	enum wl_dispmanx_format format;
-+	DISPMANX_RESOURCE_HANDLE_T handle;
-+	int32_t width;
-+	int32_t height;
-+	int in_use;
-+};
-+#endif
-+
- #endif
-diff --git a/interface/wayland/dispmanx.xml b/interface/wayland/dispmanx.xml
-new file mode 100644
-index 0000000..c18626d
+Index: git/interface/wayland/dispmanx.xml
+===================================================================
 --- /dev/null
-+++ b/interface/wayland/dispmanx.xml
++++ git/interface/wayland/dispmanx.xml
 @@ -0,0 +1,123 @@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<protocol name="dispmanx">
@@ -1805,11 +1782,10 @@
 +  </interface>
 +
 +</protocol>
-diff --git a/makefiles/cmake/Wayland.cmake b/makefiles/cmake/Wayland.cmake
-new file mode 100644
-index 0000000..ad90d30
+Index: git/makefiles/cmake/Wayland.cmake
+===================================================================
 --- /dev/null
-+++ b/makefiles/cmake/Wayland.cmake
++++ git/makefiles/cmake/Wayland.cmake
 @@ -0,0 +1,72 @@
 +#=============================================================================
 +# Copyright (C) 2012-2013 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
@@ -1883,6 +1859,3 @@
 +    list(APPEND ${_sources} "${_server_header}")
 +    set(${_sources} ${${_sources}} PARENT_SCOPE)
 +endfunction()
--- 
-2.15.0
-
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
index 1d78755..e3a0cf2 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0003-wayland-Add-Wayland-example.patch
Binary files differ
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
index d60c432..713fc3e 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0004-wayland-egl-Add-bcm_host-to-dependencies.patch
@@ -1,7 +1,7 @@
-From cae4ff834eef23c8f23126ba4d630db395f13aee Mon Sep 17 00:00:00 2001
+From f17879b691984b5c4950e4b94ebf102c78797ede Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 10 Aug 2015 02:38:27 -0700
-Subject: [PATCH 04/15] wayland-egl: Add bcm_host to dependencies
+Subject: [PATCH 04/16] wayland-egl: Add bcm_host to dependencies
 
 It uses headers like vcos_platform_types.h but does not
 depend on module which should add the required include paths
@@ -24,5 +24,5 @@
  Libs: -L${libdir} -lwayland-egl
  Cflags: -I${includedir}
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
index 676f34c..8d78333 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0005-interface-remove-faulty-assert-to-make-weston-happy-.patch
@@ -1,7 +1,7 @@
-From 8ee4f6eedb81e9bfe0e603a21606c52f9501e609 Mon Sep 17 00:00:00 2001
+From 0273b7b9d7a27d8fe7d3ad8680b799f997e75dca Mon Sep 17 00:00:00 2001
 From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 Date: Sat, 24 Jan 2015 22:07:19 +0100
-Subject: [PATCH 05/15] interface: remove faulty assert() to make weston happy
+Subject: [PATCH 05/16] interface: remove faulty assert() to make weston happy
  at runtime
 
 This was removed after a discussion on IRC with the weston guys
@@ -25,5 +25,5 @@
              }
           } else {
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
index a8f1f24..43eb7f0 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0006-zero-out-wl-buffers-in-egl_surface_free.patch
@@ -1,7 +1,7 @@
-From 789b0b0c04b741c21dd573b78eded970721d14c2 Mon Sep 17 00:00:00 2001
+From 0d678cd2042551cc4e26ec42fa3aba7c72d033b4 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:10:47 -0800
-Subject: [PATCH 06/15] zero-out wl buffers in egl_surface_free
+Subject: [PATCH 06/16] zero-out wl buffers in egl_surface_free
 
 origins from buildroot
 
@@ -29,5 +29,5 @@
  #endif
     }
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
index ad2636a..987740b 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0007-initialize-front-back-wayland-buffers.patch
@@ -1,7 +1,7 @@
-From 762dd3156775f167ff0dfd44322dbb19a85822a7 Mon Sep 17 00:00:00 2001
+From ec2e00989bf614b259bc9a47b5035f8586e8a214 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:11:41 -0800
-Subject: [PATCH 07/15] initialize front back wayland buffers
+Subject: [PATCH 07/16] initialize front back wayland buffers
 
 origins from metrological wayland support
 
@@ -30,5 +30,5 @@
     }
  #endif
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
index 1e66813..4bf05c1 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0008-Remove-RPC_FLUSH.patch
@@ -1,7 +1,7 @@
-From f8929adbf95ad3d44491cf6fc8a84a686b71193e Mon Sep 17 00:00:00 2001
+From 59ba66c2ea17f7a57124b9fd6c9bdff4325ff5c9 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 11:09:18 -0800
-Subject: [PATCH 08/15] Remove RPC_FLUSH
+Subject: [PATCH 08/16] Remove RPC_FLUSH
 
 Origins from buildroot
 
@@ -23,5 +23,5 @@
        }
  #endif
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
index 214d5e2..a2c1df5 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0009-fix-cmake-dependency-race.patch
@@ -1,7 +1,7 @@
-From f53e028f33f261f85883c9168977dd5486e9b47c Mon Sep 17 00:00:00 2001
+From 264d82387ea1e607b2e5c899ff6bd46807c7b185 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 6 Feb 2016 13:12:47 -0800
-Subject: [PATCH 09/15] fix cmake dependency race
+Subject: [PATCH 09/16] fix cmake dependency race
 
 Fixes errors like
 
@@ -74,5 +74,5 @@
  	struct wl_resource *resource;
  	struct wl_dispmanx *dispmanx;
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
index 9f77920..a6c9a59 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0010-Fix-for-framerate-with-nested-composition.patch
@@ -1,7 +1,7 @@
-From 6559a57c66c5f55571a1aa29cf14d9130a9ef2c9 Mon Sep 17 00:00:00 2001
+From 7c51c2d37bfadaabbbf205237d932b685b09d34f Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Tue, 29 Mar 2016 20:38:30 -0700
-Subject: [PATCH 10/15] Fix for framerate with nested composition
+Subject: [PATCH 10/16] Fix for framerate with nested composition
 
 frame rate appears irregular and lower than expected when using nested composition.
 
@@ -56,5 +56,5 @@
  #ifdef ANDROID
                 CLIENT_UNLOCK();
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
index 5ee5cbd..55a5be8 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0011-build-shared-library-for-vchostif.patch
@@ -1,7 +1,7 @@
-From 3e396f0b514f3acf90c02f5d55b3816028367a55 Mon Sep 17 00:00:00 2001
+From fb3002f77a175633af31019c513754d2ef5f3ac0 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 2 Apr 2016 10:37:24 -0700
-Subject: [PATCH 11/15] build shared library for vchostif
+Subject: [PATCH 11/16] build shared library for vchostif
 
 Fixes #149
 
@@ -24,5 +24,5 @@
  #add_library(bufman            vc_vchi_bufman.c            )
  
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
index 48af588..28a5fc6 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0012-implement-buffer-wrapping-interface-for-dispmanx.patch
@@ -1,7 +1,7 @@
-From f5b2263c8d65e307cb085414e08118cbbe00a94c Mon Sep 17 00:00:00 2001
+From df8b9633a45069bdd1bf256d974636ef11aa39cb Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Sat, 2 Apr 2016 10:54:59 -0700
-Subject: [PATCH 12/15] implement buffer wrapping interface for dispmanx
+Subject: [PATCH 12/16] implement buffer wrapping interface for dispmanx
 
 Courtesy: Zan Dobersek
 
@@ -88,5 +88,5 @@
  
  </protocol>
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
index d3a9840..ebff314 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0013-Implement-triple-buffering-for-wayland.patch
@@ -1,7 +1,7 @@
-From 10ba55489002c2ccdf96d221301ec059c4574811 Mon Sep 17 00:00:00 2001
+From 2e0e331da8556fecd841349cfae294baf0f14485 Mon Sep 17 00:00:00 2001
 From: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
 Date: Thu, 19 Jan 2017 18:56:07 +0000
-Subject: [PATCH 13/15] Implement triple buffering for wayland
+Subject: [PATCH 13/16] Implement triple buffering for wayland
 
 Change from double to triple buffering for wayland.
 This enables higher frame rates without tearing artifacts
@@ -86,5 +86,5 @@
        back_wl_buffer
  
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
index b596056..025b6bc 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch
@@ -1,7 +1,7 @@
-From d750c738b5c23bba24531cb713292e4ab3f2ec56 Mon Sep 17 00:00:00 2001
+From 8d9299d219a2a4f76f8278973584e1a9f7116c78 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Wed, 10 May 2017 06:39:34 +0000
-Subject: [PATCH 14/15] GLES2/gl2ext.h: Define GL_R8_EXT and GL_RG8_EXT
+Subject: [PATCH 14/16] GLES2/gl2ext.h: Define GL_R8_EXT and GL_RG8_EXT
 
 weston code uses these defines
 Upstream-Status: Pending
@@ -26,5 +26,5 @@
  #ifndef GL_EXT_texture_type_2_10_10_10_REV
  #define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
index f10740b..605d0c0 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0015-EGL-glplatform.h-define-EGL_CAST.patch
@@ -1,7 +1,7 @@
-From 827907f2223df93918e680101a1ac6228ba0f07e Mon Sep 17 00:00:00 2001
+From a2182e5437a6664cdb0f3330f6cbee873b6f975a Mon Sep 17 00:00:00 2001
 From: Andrea Galbusera <gizero@gmail.com>
 Date: Fri, 14 Jul 2017 09:52:54 +0200
-Subject: [PATCH 15/15] EGL/glplatform.h: define EGL_CAST
+Subject: [PATCH 15/16] EGL/glplatform.h: define EGL_CAST
 
 C++ / C typecast macros for special EGL handle values: used by libepoxy code
 The definition comes from the updated version of this header in mesa.
@@ -28,5 +28,5 @@
 +
  #endif /* __eglplatform_h */
 -- 
-2.15.0
+2.16.1
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
new file mode 100644
index 0000000..d20ec82
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland/0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch
@@ -0,0 +1,145 @@
+From 6b4c4d469d435bfcfb464356b6ccc9421c6b8fd5 Mon Sep 17 00:00:00 2001
+From: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Date: Sat, 27 Jan 2018 12:28:31 -0500
+Subject: [PATCH 16/16] Allow multiple wayland compositor state data per
+ process
+
+When eglBindWaylandDisplayWL is called store the wl_global
+created in a list associated with the wayland display.
+This allows multiple wayland compositor instances to be
+created and used per process. This scenario is common for
+applications integrating externl process UI elements
+via embedded composition e.g. westeros
+
+Signed-off-by: Jeff Wannamaker <jeff_wannamaker@cable.comcast.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ interface/khronos/common/khrn_client.c |  2 +-
+ interface/khronos/common/khrn_client.h | 11 +++++++-
+ interface/khronos/ext/egl_wayland.c    | 50 ++++++++++++++++++++++++++++++----
+ 3 files changed, 55 insertions(+), 8 deletions(-)
+
+diff --git a/interface/khronos/common/khrn_client.c b/interface/khronos/common/khrn_client.c
+index d7e798e..60bdb63 100644
+--- a/interface/khronos/common/khrn_client.c
++++ b/interface/khronos/common/khrn_client.c
+@@ -147,7 +147,7 @@ bool client_process_state_init(CLIENT_PROCESS_STATE_T *process)
+ {
+    if (!process->inited) {
+ #ifdef BUILD_WAYLAND
+-      process->wl_global = NULL;
++      process->wlStateMap = NULL;
+ #endif
+ 
+       if (!khrn_pointer_map_init(&process->contexts, 64))
+diff --git a/interface/khronos/common/khrn_client.h b/interface/khronos/common/khrn_client.h
+index 615f7b4..4fa86f7 100644
+--- a/interface/khronos/common/khrn_client.h
++++ b/interface/khronos/common/khrn_client.h
+@@ -170,6 +170,15 @@ static INLINE CLIENT_THREAD_STATE_T *CLIENT_GET_CHECK_THREAD_STATE(void)
+    return (CLIENT_THREAD_STATE_T *)platform_tls_get_check(client_tls);
+ }
+ 
++#ifdef BUILD_WAYLAND
++typedef struct WAYLAND_STATE
++{
++   struct WAYLAND_STATE *next;
++   struct wl_display *display;
++   struct wl_global *wl_global;
++} WAYLAND_STATE_T;
++#endif
++
+ /*
+    per-process state
+ 
+@@ -318,7 +327,7 @@ struct CLIENT_PROCESS_STATE {
+    struct wl_event_queue *wl_queue;
+ 
+    /* Compositor-side Wayland state */
+-   struct wl_global *wl_global;
++   WAYLAND_STATE_T *wlStateMap;
+ #endif
+ };
+ 
+diff --git a/interface/khronos/ext/egl_wayland.c b/interface/khronos/ext/egl_wayland.c
+index 9ef89cd..abd5ab3 100644
+--- a/interface/khronos/ext/egl_wayland.c
++++ b/interface/khronos/ext/egl_wayland.c
+@@ -208,17 +208,38 @@ eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+ {
+    CLIENT_THREAD_STATE_T *thread;
+    CLIENT_PROCESS_STATE_T *process;
++   WAYLAND_STATE_T *stateIter;
++   WAYLAND_STATE_T *stateNew;
++   struct wl_global *wl_global;
+ 
+    if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
+       return EGL_FALSE;
+ 
+-   if (process->wl_global != NULL)
++   stateIter= process->wlStateMap;
++   while( stateIter )
++   {
++      if ( stateIter->display == display )
++         goto error;
++      stateIter= stateIter->next;
++   }
++
++   wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
++                                NULL, bind_dispmanx);
++   if (wl_global == NULL)
+       goto error;
+ 
+-   process->wl_global = wl_global_create(display, &wl_dispmanx_interface, 1,
+-                                         NULL, bind_dispmanx);
+-   if (process->wl_global == NULL)
++   stateNew= (WAYLAND_STATE_T*)calloc( 1, sizeof(WAYLAND_STATE_T));
++   if (stateNew == NULL )
++   {
++      wl_global_destroy(wl_global);
+       goto error;
++   }
++
++   stateNew->next= process->wlStateMap;
++   stateNew->display= display;
++   stateNew->wl_global= wl_global;
++   process->wlStateMap= stateNew;
++   CLIENT_UNLOCK();
+ 
+    return EGL_TRUE;
+ 
+@@ -232,12 +253,29 @@ eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+ {
+    CLIENT_THREAD_STATE_T *thread;
+    CLIENT_PROCESS_STATE_T *process;
++   WAYLAND_STATE_T *stateIter;
++   WAYLAND_STATE_T *statePrev;
+ 
+    if (!CLIENT_LOCK_AND_GET_STATES(dpy, &thread, &process))
+       return EGL_FALSE;
+ 
+-   wl_global_destroy(process->wl_global);
+-   process->wl_global = NULL;
++   statePrev= NULL;
++   stateIter= process->wlStateMap;
++   while( stateIter )
++   {
++      if ( stateIter->display == display )
++      {
++         wl_global_destroy(stateIter->wl_global);
++         if ( statePrev )
++            statePrev->next= stateIter->next;
++         else
++            process->wlStateMap= stateIter->next;
++         free( stateIter );
++         break;
++      }
++      statePrev= stateIter;
++      stateIter= stateIter->next;
++   }
+ 
+    CLIENT_UNLOCK();
+ 
+-- 
+2.16.1
+
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
index d38b02d..7f2dca6 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
@@ -5,8 +5,6 @@
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENCE;md5=0448d6488ef8cc380632b1569ee6d196"
 
-PR = "r5"
-
 PROVIDES = "virtual/libgles2 \
             virtual/egl"
 
@@ -16,7 +14,11 @@
 
 SRCBRANCH = "master"
 SRCFORK = "raspberrypi"
-SRCREV = "bc3c52a51315399a9f31ed24049eb4bc81fd1c60"
+SRCREV = "11389772c79685442e0ab8aa9be8ad0e32703f68"
+
+# Use the date of the above commit as the package version. Update this when
+# SRCREV is changed.
+PV = "20180219"
 
 SRC_URI = "\
     git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
@@ -35,6 +37,7 @@
     file://0013-Implement-triple-buffering-for-wayland.patch \
     file://0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch \
     file://0015-EGL-glplatform.h-define-EGL_CAST.patch \
+    file://0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch \
 "
 S = "${WORKDIR}/git"
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc b/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
index 668c5ce..cd0d57b 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
+++ b/import-layers/meta-raspberrypi/recipes-graphics/vc-graphics/vc-graphics.inc
@@ -6,6 +6,8 @@
 PROVIDES = "virtual/libgles2 virtual/egl"
 COMPATIBLE_MACHINE = "^rpi$"
 
+INHIBIT_DEFAULT_DEPS = "1"
+
 include recipes-bsp/common/firmware.inc
 
 SRC_URI += " \
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
index 7902f20..919e95e 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
@@ -3,20 +3,19 @@
 SRC_URI_append_rpi = " \
     file://xorg.conf.d/98-pitft.conf \
     file://xorg.conf.d/99-calibration.conf \
-"
-SRC_URI_append_libc-musl_raspberrypi3-64 = " \
     file://xorg.conf.d/10-noglamor.conf \
 "
 do_install_append_rpi () {
     PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
+    VC4="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
     if [ "${PITFT}" = "1" ]; then
         install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
         install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
         install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
     fi
+    if [ "${VC4}" = "1" ]; then
+        install -Dm 0644 ${WORKDIR}/xorg.conf.d/10-noglamor.conf ${D}/${sysconfdir}/X11/xorg.conf.d/10-noglamor.conf
+    fi
 }
-do_install_append_libc-musl_raspberrypi3-64 () {
-    install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
-    install -m 0644 ${WORKDIR}/xorg.conf.d/10-noglamor.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
-}
+
 FILES_${PN}_rpi += "${sysconfdir}/X11/xorg.conf ${sysconfdir}/X11/xorg.conf.d/*"
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.bin b/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.bin
deleted file mode 100644
index 6b955da..0000000
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.bin
+++ /dev/null
Binary files differ
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.txt b/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.txt
deleted file mode 100644
index 3d917a7..0000000
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/files/brcmfmac43430-sdio.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# NVRAM file for BCM943430WLSELG
-# 2.4 GHz, 20 MHz BW mode
-
-# The following parameter values are just placeholders, need to be updated.
-manfid=0x2d0
-prodid=0x0726
-vendid=0x14e4
-devid=0x43e2
-boardtype=0x0726
-boardrev=0x1202
-boardnum=22
-macaddr=00:90:4c:c5:12:38
-sromrev=11
-boardflags=0x00404201
-boardflags3=0x08000000
-xtalfreq=37400
-#xtalfreq=19200
-nocrc=1
-ag0=255
-aa2g=1
-ccode=ALL
-
-pa0itssit=0x20
-extpagain2g=0
-
-#PA parameters for 2.4GHz, measured at CHIP OUTPUT
-pa2ga0=-168,7161,-820
-AvVmid_c0=0x0,0xc8
-cckpwroffset0=5
-
-# PPR params
-maxp2ga0=84
-txpwrbckof=6
-cckbw202gpo=0
-legofdmbw202gpo=0x66111111
-mcsbw202gpo=0x77711111
-propbw202gpo=0xdd
-
-# OFDM IIR :
-ofdmdigfilttype=18
-ofdmdigfilttypebe=18
-# PAPD mode:
-papdmode=1
-papdvalidtest=1
-pacalidx2g=32
-papdepsoffset=-36
-papdendidx=61
-
-il0macaddr=00:90:4c:c5:12:38
-wl0id=0x431b
-
-deadman_to=0xffffffff
-# muxenab: 0x1 for UART enable, 0x2 for GPIOs, 0x8 for JTAG
-muxenab=0x1
-# CLDO PWM voltage settings - 0x4 - 1.1 volt
-#cldo_pwm=0x4
-
-#VCO freq 326.4MHz
-spurconfig=0x3 
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
index 565b735..34d2b67 100644
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux-firmware/linux-firmware_%.bbappend
@@ -1,26 +1,77 @@
-FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+# Augments upstream linux-firmware with additional and updated images
+# from Raspbian:
+# https://github.com/RPi-Distro/firmware-nonfree
+# https://github.com/RPi-Distro/bluez-firmware
 
-SRC_URI += " \
-	file://brcmfmac43430-sdio.bin \
-	file://brcmfmac43430-sdio.txt \
-	"
+LICENSE_append_rpi = "\
+    & Firmware-cypress \
+"
 
-do_install_append() {
-	# Overwrite v7.45.41.26 by the one we currently provide in this layer
-	# (v7.45.41.46)
-	local _firmware="brcmfmac43430-sdio.bin"
-	local _oldmd5=9258986488eca9fe5343b0d6fe040f8e
-	if [ "$(md5sum ${D}/lib/firmware/brcm/$_firmware | awk '{print $1}')" != "$_oldmd5" ]; then
-		_firmware=""
-		bbwarn "linux-firmware stopped providing brcmfmac43430 v7.45.41.26."
-	else
-		_firmware="${WORKDIR}/$_firmware"
-	fi
+LIC_FILES_CHKSUM_append_rpi = "\
+    file://LICENCE.cypress;md5=cbc5f665d04f741f1e006d2096236ba7 \
+"
+NO_GENERIC_LICENSE[Firmware-cypress] = "LICENCE.cypress"
 
-	mkdir -p ${D}/lib/firmware/brcm
-	install -m 0644 $_firmware ${WORKDIR}/brcmfmac43430-sdio.txt ${D}/lib/firmware/brcm
+SRC_URI_append_rpi = " \
+    git://github.com/RPi-Distro/firmware-nonfree;destsuffix=raspbian-nf;name=raspbian-nf \
+    git://github.com/RPi-Distro/bluez-firmware;destsuffix=raspbian-bluez;name=raspbian-bluez \
+"
+
+SRCREV_raspbian-nf = "86e88fbf0345da49555d0ec34c80b4fbae7d0cd3"
+SRCREV_raspbian-bluez = "e28cd7ee8615de33aa7ec2b41d556af61a4a2707"
+SRCREV_FORMAT_rpi = "default+raspbian-nf+raspbian-bluez"
+
+do_install_append_rpi() {
+    install -d ${D}${nonarch_base_libdir}/firmware/brcm/
+
+    # Replace outdated linux-firmware files with updated ones from
+    # raspbian firmware-nonfree. Raspbian adds blobs and nvram
+    # definitions that are also necessary so copy those too.
+    for fw in brcmfmac43430-sdio brcmfmac43455-sdio ; do
+        install -m 0644 ${WORKDIR}/raspbian-nf/brcm/${fw}.* ${D}${nonarch_base_libdir}/firmware/brcm/
+    done
+
+    # Add missing Cypress Bluetooth files from raspbian bluez-firmware
+    for fw in BCM43430A1.hcd BCM4345C0.hcd ; do
+        install -m 0644 ${WORKDIR}/raspbian-bluez/broadcom/${fw} ${D}${nonarch_base_libdir}/firmware/brcm/
+    done
 }
 
-FILES_${PN}-bcm43430 += " \
-	/lib/firmware/brcm/brcmfmac43430-sdio.txt \
+# NB: Must prepend, else these become empty and their content is left in
+# the roll-up package which precedes them.
+PACKAGES_prepend_rpi = "\
+    ${PN}-bcm43455 \
+    ${PN}-cypress-license \
+    ${PN}-bcm43430a1-hcd \
+    ${PN}-bcm4345c0-hcd \
 "
+
+# For additional Broadcom
+LICENSE_${PN}-bcm43455 = "Firmware-broadcom_bcm43xx"
+
+FILES_${PN}-bcm43430_append_rpi = " \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt \
+"
+FILES_${PN}-bcm43455 = " \
+  ${nonarch_base_libdir}/firmware/brcm/brcmfmac43455-sdio.* \
+"
+
+RDEPENDS_${PN}-bcm43455 += "${PN}-broadcom-license"
+
+# For additional Cypress
+FILES_${PN}-cypress-license = "\
+  ${nonarch_base_libdir}/firmware/LICENCE.cypress \
+"
+
+LICENSE_${PN}-bcm43430a1-hcd = "Firmware-cypress"
+LICENSE_${PN}-bcm4345c0-hcd = "Firmware-cypress"
+
+FILES_${PN}-bcm43430a1-hcd = " \
+  ${nonarch_base_libdir}/firmware/brcm/BCM43430A1.hcd \
+"
+FILES_${PN}-bcm4345c0-hcd = " \
+  ${nonarch_base_libdir}/firmware/brcm/BCM4345C0.hcd \
+"
+
+RDEPENDS_${PN}-bcm43430a1-hcd += "${PN}-cypress-license"
+RDEPENDS_${PN}-bcm4345c0-hcd += "${PN}-cypress-license"
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/files/0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch b/import-layers/meta-raspberrypi/recipes-kernel/linux/files/0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch
new file mode 100644
index 0000000..a9e9213
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/files/0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch
@@ -0,0 +1,62 @@
+From e6ebc8e654bba53f28af5229a1069fc74fa58b7b Mon Sep 17 00:00:00 2001
+From: Jason Wessel <jason.wessel@windriver.com>
+Date: Thu, 25 Sep 2014 11:26:49 -0700
+Subject: [PATCH] menuconfig,check-lxdiaglog.sh: Allow specification of ncurses
+ location
+
+In some cross build environments such as the Yocto Project build
+environment it provides an ncurses library that is compiled
+differently than the host's version.  This causes display corruption
+problems when the host's curses includes are used instead of the
+includes from the provided compiler are overridden.  There is a second
+case where there is no curses libraries at all on the host system and
+menuconfig will just fail entirely.
+
+The solution is simply to allow an override variable in
+check-lxdialog.sh for environments such as the Yocto Project.  Adding
+a CROSS_CURSES_LIB and CROSS_CURSES_INC solves the issue and allowing
+compiling and linking against the right headers and libraries.
+
+Upstream-Status: submitted [https://lkml.org/lkml/2013/3/3/103]
+
+Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
+cc: Michal Marek <mmarek@suse.cz>
+cc: linux-kbuild@vger.kernel.org
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
+---
+ scripts/kconfig/lxdialog/check-lxdialog.sh | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+ mode change 100755 => 100644 scripts/kconfig/lxdialog/check-lxdialog.sh
+
+diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
+old mode 100755
+new mode 100644
+index 5075ebf2d3b9..ba9242101190
+--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
++++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
+@@ -4,6 +4,10 @@
+ # What library to link
+ ldflags()
+ {
++	if [ "$CROSS_CURSES_LIB" != "" ]; then
++		echo "$CROSS_CURSES_LIB"
++		exit
++	fi
+ 	pkg-config --libs ncursesw 2>/dev/null && exit
+ 	pkg-config --libs ncurses 2>/dev/null && exit
+ 	for ext in so a dll.a dylib ; do
+@@ -21,6 +25,10 @@ ldflags()
+ # Where is ncurses.h?
+ ccflags()
+ {
++	if [ x"$CROSS_CURSES_INC" != x ]; then
++		echo "$CROSS_CURSES_INC"
++		exit
++	fi
+ 	if pkg-config --cflags ncursesw 2>/dev/null; then
+ 		echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
+ 	elif pkg-config --cflags ncurses 2>/dev/null; then
+-- 
+2.14.3
+
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb
index b947659..4a7db1a 100644
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb
@@ -7,13 +7,14 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"
 
-LINUX_VERSION ?= "4.13"
-LINUX_RPI_DEV_BRANCH ?= "rpi-4.13.y"
+LINUX_VERSION ?= "4.16"
+LINUX_RPI_DEV_BRANCH ?= "rpi-4.16.y"
 
 SRCREV = "${AUTOREV}"
-SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=${LINUX_RPI_DEV_BRANCH} \
-           file://0001-build-arm64-Add-rules-for-.dtbo-files-for-dts-overla.patch \
-"
+SRC_URI = " \
+    git://github.com/raspberrypi/linux.git;protocol=git;branch=${LINUX_RPI_DEV_BRANCH} \
+    file://0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch \
+    "
 require linux-raspberrypi.inc
 
 # Disable version check so that we don't have to edit this recipe every time
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev/0001-build-arm64-Add-rules-for-.dtbo-files-for-dts-overla.patch b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev/0001-build-arm64-Add-rules-for-.dtbo-files-for-dts-overla.patch
deleted file mode 100644
index e8bc52e..0000000
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev/0001-build-arm64-Add-rules-for-.dtbo-files-for-dts-overla.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 922ce1fd0eb810b713f6ffa9a7ab97c11b6e38cf Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Fri, 10 Feb 2017 17:57:08 -0800
-Subject: [PATCH] build/arm64: Add rules for .dtbo files for dts overlays
-
-We now create overlays as .dtbo files.
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- arch/arm64/Makefile | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
-index 3635b8662724..822fefeb1cd0 100644
---- a/arch/arm64/Makefile
-+++ b/arch/arm64/Makefile
-@@ -113,6 +113,9 @@ zinstall install:
- %.dtb: scripts
- 	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
- 
-+%.dtbo: | scripts
-+	$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
-+
- PHONY += dtbs dtbs_install
- 
- dtbs: prepare scripts
--- 
-2.11.1
-
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
index da36ca7..65c2ab7 100644
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
@@ -19,26 +19,21 @@
 KBUILD_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig"
 
 # CMDLINE for raspberrypi
-CMDLINE ?= "dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
+SERIAL = "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}"
+CMDLINE ?= "dwc_otg.lpm_enable=0 ${SERIAL} root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
 
 # Add the kernel debugger over console kernel command line option if enabled
-CMDLINE_append = ' ${@base_conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}'
+CMDLINE_append = ' ${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}'
 
 # Disable rpi logo on boot
-CMDLINE_append += ' ${@base_conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}'
+CMDLINE_append += ' ${@oe.utils.conditional("DISABLE_RPI_BOOT_LOGO", "1", "logo.nologo", "", d)}'
 
 # You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf
 # to enable kernel debugging.
 CMDLINE_DEBUG ?= ""
 CMDLINE_append = " ${CMDLINE_DEBUG}"
 
-# Quirk for udev greater or equal 141
-UDEV_GE_141 ?= "1"
-
-# Enable OABI compat for people stuck with obsolete userspace
-ARM_KEEP_OABI ?= "1"
-
-KERNEL_INITRAMFS ?= '${@base_conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}'
+KERNEL_INITRAMFS ?= '${@oe.utils.conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}'
 
 KERNEL_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}"
 
@@ -61,83 +56,54 @@
     fi
 }
 
+config_setup() {
+    # From kernel.bbclass. Unfortunately, this is needed to support builds that
+    # use devtool. The reason is as follows:
+    #
+    # - In devtool builds, externalsrc.bbclass gets inherited and sets a list of
+    # SRCTREECOVEREDTASKS, which don't get run because they affect the source
+    # tree and, when using devtool, we want the developer's changes to be the
+    # single source of truth. kernel-yocto.bbclass adds do_kernel_configme to
+    # SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal
+    # non-devtool build, do_kernel_configme creates ${B}.config.
+    #
+    # - Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme
+    # doesn't run, because the first few lines of do_configure in kernel.bbclass
+    # populate ${B}.config from either ${S}.config (if it exists) for custom
+    # developer changes, or otherwise from ${WORDIR}/defconfig.
+    #
+    # - In linux-raspberrypi, we add do_configure_prepend, which tweaks
+    # ${B}.config. Since this runs *before* the kernel.bbclass do_configure,
+    # ${B}.config doesn't yet exist and we hit an error. Thus we need to move
+    # the logic from do_configure up to before our do_configure_prepend. Because
+    # we are copying only a portion of do_configure and not the whole thing,
+    # there is no clean way to do it using OE functionality, so we just
+    # copy-and-paste.
+    if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
+        mv "${S}/.config" "${B}/.config"
+    fi
+
+    # Copy defconfig to .config if .config does not exist. This allows
+    # recipes to manage the .config themselves in do_configure_prepend().
+    if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
+        cp "${WORKDIR}/defconfig" "${B}/.config"
+    fi
+}
+
 do_configure_prepend() {
+    config_setup
+
     mv -f ${B}/.config ${B}/.config.patched
     CONF_SED_SCRIPT=""
 
-    # oabi / eabi support
-    kernel_configure_variable AEABI y
-    if [ "${ARM_KEEP_OABI}" = "1" ] ; then
-        kernel_configure_variable OABI_COMPAT y
-    else
-        kernel_configure_variable OABI_COMPAT n
-    fi
-
-    # Set cmdline
-    kernel_configure_variable CMDLINE "\"${CMDLINE}\""
-
     # Localversion
     kernel_configure_variable LOCALVERSION "\"\""
-    kernel_configure_variable LOCALVERSION_AUTO n
 
-    # Udev quirks
-    # Newer versions of udev mandate that sysfs doesn't have deprecated entries
-    if [ "${UDEV_GE_141}" = "1" ] ; then
-        kernel_configure_variable SYSFS_DEPRECATED n
-        kernel_configure_variable SYSFS_DEPRECATED_V2 n
-        kernel_configure_variable HOTPLUG y
-        kernel_configure_variable UEVENT_HELPER_PATH "\"\""
-        kernel_configure_variable UNIX y
-        kernel_configure_variable SYSFS y
-        kernel_configure_variable PROC_FS y
-        kernel_configure_variable TMPFS y
-        kernel_configure_variable INOTIFY_USER y
-        kernel_configure_variable SIGNALFD y
-        kernel_configure_variable TMPFS_POSIX_ACL y
-        kernel_configure_variable BLK_DEV_BSG y
-        kernel_configure_variable DEVTMPFS y
-        kernel_configure_variable DEVTMPFS_MOUNT y
-    fi
-
-    # Newer inits like systemd need cgroup support
-    if [ "${KERNEL_ENABLE_CGROUPS}" = "1" ] ; then
-        kernel_configure_variable CGROUP_SCHED y
-        kernel_configure_variable CGROUPS y
-        kernel_configure_variable CGROUP_NS y
-        kernel_configure_variable CGROUP_FREEZER y
-        kernel_configure_variable CGROUP_DEVICE y
-        kernel_configure_variable CPUSETS y
-        kernel_configure_variable PROC_PID_CPUSET y
-        kernel_configure_variable CGROUP_CPUACCT y
-        kernel_configure_variable RESOURCE_COUNTERS y
-    fi
-
-    # root-over-nfs-over-usb-eth support. Limited, but should cover some cases
-    # Enable this by setting a proper CMDLINE_NFSROOT_USB.
-    if [ ! -z "${CMDLINE_NFSROOT_USB}" ]; then
-        oenote "Configuring the kernel for root-over-nfs-over-usb-eth with CMDLINE ${CMDLINE_NFSROOT_USB}"
-        kernel_configure_variable INET y
-        kernel_configure_variable IP_PNP y
-        kernel_configure_variable USB_GADGET y
-        kernel_configure_variable USB_GADGET_SELECTED y
-        kernel_configure_variable USB_ETH y
-        kernel_configure_variable NFS_FS y
-        kernel_configure_variable ROOT_NFS y
-        kernel_configure_variable ROOT_NFS y
-        kernel_configure_variable CMDLINE "\"${CMDLINE_NFSROOT_USB}\""
-    fi
     if [ ! -z "${KERNEL_INITRAMFS}" ]; then
-        kernel_configure_variable BLK_DEV_INITRD y
-        kernel_configure_variable INITRAMFS_SOURCE ""
-        kernel_configure_variable RD_GZIP y
         kernel_configure_variable OVERLAY_FS y
         kernel_configure_variable SQUASHFS y
         kernel_configure_variable UBIFS_FS y
     fi
-    # Activate CONFIG_LEGACY_PTYS
-    kernel_configure_variable LEGACY_PTYS y
-    # this module is built externally via drbd-utils
-    kernel_configure_variable BLK_DEV_DRBD n
 
     # Activate the configuration options for VC4
     VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
@@ -152,8 +118,6 @@
     # Remove all modified configs and add the rest to .config
     sed -e "${CONF_SED_SCRIPT}" < '${B}/.config.patched' >> '${B}/.config'
     rm -f ${B}/.config.patched
-
-    yes '' | oe_runmake oldconfig
 }
 
 do_compile_append_raspberrypi3-64() {
@@ -161,10 +125,6 @@
     oe_runmake dtbs CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
 }
 
-do_install_prepend() {
-    install -d ${D}/lib/firmware
-}
-
 do_deploy_append() {
     # Deploy cmdline.txt
     install -d ${DEPLOYDIR}/bcm2835-bootfiles
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
new file mode 100644
index 0000000..0478576
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.14.bb
@@ -0,0 +1,9 @@
+LINUX_VERSION ?= "4.14.39"
+
+SRCREV = "865ddc1393f558198e7e7ce70928ff2e49c4f7f6"
+SRC_URI = " \
+    git://github.com/raspberrypi/linux.git;branch=rpi-4.14.y \
+    file://0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch \
+    "
+
+require linux-raspberrypi.inc
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb
index 061e893..21fcfef 100644
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.9.bb
@@ -1,8 +1,11 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
 
-LINUX_VERSION ?= "4.9.59"
+LINUX_VERSION ?= "4.9.80"
 
-SRCREV = "e7976b2affa8c05bd299ead0ad9c36ddaf135b9d"
-SRC_URI = "git://github.com/raspberrypi/linux.git;branch=rpi-4.9.y"
+SRCREV = "ffd7bf4085b09447e5db96edd74e524f118ca3fe"
+SRC_URI = " \
+    git://github.com/raspberrypi/linux.git;branch=rpi-4.9.y \
+    file://0001-menuconfig-check-lxdiaglog.sh-Allow-specification-of.patch \
+    "
 
 require linux-raspberrypi.inc
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
index 815a7c2..85fea67 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
@@ -1,4 +1,4 @@
-From 2e111e52f96f0b942abda120c30a876629bd73fc Mon Sep 17 00:00:00 2001
+From cfb432fcd8868c7a4f32010c61e47e2bf0ff80c6 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
 Date: Mon, 25 May 2015 14:53:35 +0200
 Subject: [PATCH] Don't try to acquire buffer when src pad isn't active
@@ -23,15 +23,16 @@
   gst_omx_video_dec_loop()
   gst_omx_port_acquire_buffer()
   gst_omx_component_wait_message()
+
 ---
  omx/gstomxvideodec.c | 5 +++++
  1 file changed, 5 insertions(+)
 
 diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index cd24944..57a61dd 100644
+index d12ee8f..fb0100a 100644
 --- a/omx/gstomxvideodec.c
 +++ b/omx/gstomxvideodec.c
-@@ -1247,6 +1247,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
+@@ -1250,6 +1250,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
    GstClockTimeDiff deadline;
    OMX_ERRORTYPE err;
  
@@ -43,6 +44,3 @@
  #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
    port = self->eglimage ? self->egl_out_port : self->dec_out_port;
  #else
--- 
-1.8.3.2
-
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
index a7da922..6903c17 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
@@ -1,3 +1,14 @@
+From 0dc88ed881eb8420dad4cf0934a900d85b6ef313 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 11 Feb 2016 12:53:20 -0800
+
+---
+ config/bellagio/gstomx.conf |  8 ++++----
+ config/rpi/gstomx.conf      | 22 +++++++++++-----------
+ 2 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/config/bellagio/gstomx.conf b/config/bellagio/gstomx.conf
+index 5ca8ba6..8931255 100644
 --- a/config/bellagio/gstomx.conf
 +++ b/config/bellagio/gstomx.conf
 @@ -1,6 +1,6 @@
@@ -6,18 +17,18 @@
 -core-name=/usr/local/lib/libomxil-bellagio.so.0
 +core-name=/usr/lib/libomxil-bellagio.so.0
  component-name=OMX.st.video_decoder.mpeg4
- rank=256
+ rank=257
  in-port-index=0
-@@ -9,7 +9,7 @@
+@@ -9,7 +9,7 @@ hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-chang
  
  [omxh264dec]
  type-name=GstOMXH264Dec
 -core-name=/usr/local/lib/libomxil-bellagio.so.0
 +core-name=/usr/lib/libomxil-bellagio.so.0
  component-name=OMX.st.video_decoder.avc
- rank=256
+ rank=257
  in-port-index=0
-@@ -18,7 +18,7 @@
+@@ -18,7 +18,7 @@ hacks=event-port-settings-changed-ndata-parameter-swap;event-port-settings-chang
  
  [omxmpeg4videoenc]
  type-name=GstOMXMPEG4VideoEnc
@@ -26,7 +37,7 @@
  component-name=OMX.st.video_encoder.mpeg4
  rank=0
  in-port-index=0
-@@ -27,7 +27,7 @@
+@@ -27,7 +27,7 @@ hacks=event-port-settings-changed-ndata-parameter-swap;video-framerate-integer;s
  
  [omxaacenc]
  type-name=GstOMXAACEnc
@@ -35,6 +46,8 @@
  component-name=OMX.st.audio_encoder.aac
  rank=0
  in-port-index=0
+diff --git a/config/rpi/gstomx.conf b/config/rpi/gstomx.conf
+index d3ea56a..2508dae 100644
 --- a/config/rpi/gstomx.conf
 +++ b/config/rpi/gstomx.conf
 @@ -1,6 +1,6 @@
@@ -45,7 +58,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -9,7 +9,7 @@
+@@ -9,7 +9,7 @@ hacks=no-component-role
  
  [omxmpeg4videodec]
  type-name=GstOMXMPEG4VideoDec
@@ -54,7 +67,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -18,7 +18,7 @@
+@@ -18,7 +18,7 @@ hacks=no-component-role
  
  [omxh263dec]
  type-name=GstOMXH263Dec
@@ -63,7 +76,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -27,7 +27,7 @@
+@@ -27,7 +27,7 @@ hacks=no-component-role
  
  [omxh264dec]
  type-name=GstOMXH264Dec
@@ -72,7 +85,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -36,7 +36,7 @@
+@@ -36,7 +36,7 @@ hacks=no-component-role;signals-premature-eos
  
  [omxtheoradec]
  type-name=GstOMXTheoraDec
@@ -81,7 +94,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -45,7 +45,7 @@
+@@ -45,7 +45,7 @@ hacks=no-component-role
  
  [omxvp8dec]
  type-name=GstOMXVP8Dec
@@ -90,7 +103,7 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -54,7 +54,7 @@
+@@ -54,7 +54,7 @@ hacks=no-component-role
  
  [omxmjpegdec]
  type-name=GstOMXMJPEGDec
@@ -99,16 +112,16 @@
  component-name=OMX.broadcom.video_decode
  rank=257
  in-port-index=130
-@@ -63,7 +63,7 @@
+@@ -63,7 +63,7 @@ hacks=no-component-role
  
  [omxvc1dec]
  type-name=GstOMXWMVDec
 -core-name=/opt/vc/lib/libopenmaxil.so
 +core-name=/usr/lib/libopenmaxil.so
  component-name=OMX.broadcom.video_decode
- rank=256
+ rank=257
  in-port-index=130
-@@ -73,7 +73,7 @@
+@@ -73,7 +73,7 @@ sink-template-caps=video/x-wmv,wmvversion=(int)3,format=(string){WMV3,WVC1},widt
  
  [omxh264enc]
  type-name=GstOMXH264Enc
@@ -117,21 +130,21 @@
  component-name=OMX.broadcom.video_encode
  rank=257
  in-port-index=200
-@@ -82,7 +82,7 @@
+@@ -82,7 +82,7 @@ hacks=no-component-role;no-component-reconfigure
  
  [omxanalogaudiosink]
  type-name=GstOMXAnalogAudioSink
 -core-name=/opt/vc/lib/libopenmaxil.so
 +core-name=/usr/lib/libopenmaxil.so
  component-name=OMX.broadcom.audio_render
- rank=256
+ rank=257
  in-port-index=100
-@@ -92,7 +92,7 @@
+@@ -92,7 +92,7 @@ sink-template-caps=audio/x-raw,format=(string){S16LE,S32LE},layout=(string)inter
  
  [omxhdmiaudiosink]
  type-name=GstOMXHdmiAudioSink
 -core-name=/opt/vc/lib/libopenmaxil.so
 +core-name=/usr/lib/libopenmaxil.so
  component-name=OMX.broadcom.audio_render
- rank=257
+ rank=258
  in-port-index=100
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
index d4c7c81..122ddb3 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
@@ -1,8 +1,16 @@
+From fc4773f36aa31b4ae0fc97d3aa3f94db0c88f194 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 11 Feb 2016 12:53:20 -0800
+
+---
+ omx/gstomx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
 diff --git a/omx/gstomx.c b/omx/gstomx.c
-index 69696c4..c382019 100644
+index 0237f3c..45732c3 100644
 --- a/omx/gstomx.c
 +++ b/omx/gstomx.c
-@@ -1508,8 +1508,8 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
+@@ -1538,8 +1538,8 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
      last_error = OMX_ErrorNone;
      gst_omx_component_handle_messages (comp);
      while (signalled && last_error == OMX_ErrorNone && !port->flushed
@@ -13,4 +21,3 @@
        signalled = gst_omx_component_wait_message (comp, timeout);
        if (signalled)
          gst_omx_component_handle_messages (comp);
-
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch
index 0a0050d..4124bcc 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch
@@ -1,8 +1,16 @@
+From 02e49cba402a783fa1b30e445b83a5c280949c1e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 13 Feb 2016 11:42:29 -0800
+
+---
+ omx/gstomxvideodec.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
 diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index 0d4e7a1..a0d9c74 100644
+index fb0100a..bad6335 100644
 --- a/omx/gstomxvideodec.c
 +++ b/omx/gstomxvideodec.c
-@@ -1697,9 +1697,9 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
+@@ -1713,9 +1713,9 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
    g_cond_broadcast (&self->drain_cond);
    g_mutex_unlock (&self->drain_lock);
  
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
index 4d10f24..b02072a 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
@@ -1,20 +1,20 @@
-From 80dddfd13aaf2fe7272765f8cf291215fe375e28 Mon Sep 17 00:00:00 2001
+From f00912f0628aff15e882bdc1619f5de1ddf5c720 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
 Date: Tue, 17 Nov 2015 16:51:27 +0000
 Subject: [PATCH] Properly handle drain requests while flushing
 
 Without this commit the decoder streaming thread stops without ever attending
 the drain request, leaving the decoder input thread waiting forever.
----
- omx/gstomx.c         |  7 +++++++
- omx/gstomxvideodec.c | 13 +++++++++++++
- 2 files changed, 20 insertions(+)
 
-Index: gst-omx-1.10.2/omx/gstomx.c
-===================================================================
---- gst-omx-1.10.2.orig/omx/gstomx.c
-+++ gst-omx-1.10.2/omx/gstomx.c
-@@ -737,6 +737,13 @@ gst_omx_component_new (GstObject * paren
+---
+ omx/gstomx.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/omx/gstomx.c b/omx/gstomx.c
+index 45732c3..784a5d7 100644
+--- a/omx/gstomx.c
++++ b/omx/gstomx.c
+@@ -737,6 +737,13 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
  
    g_mutex_lock (&comp->lock);
    gst_omx_component_handle_messages (comp);
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
index b7a8753..fdfdd1b 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
@@ -1,4 +1,4 @@
-From 12103842d5f347cf245e71071d0c44297bcdb1f9 Mon Sep 17 00:00:00 2001
+From 0d2ad639e6158c8023c157e206ef3ff7abdc089c Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
 Date: Fri, 4 Dec 2015 18:39:59 +0100
 Subject: [PATCH] Don't abort gst_omx_video_dec_set_format() if there's a
@@ -9,10 +9,10 @@
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index 2368f34..da35e0d 100644
+index bad6335..c63b972 100644
 --- a/omx/gstomxvideodec.c
 +++ b/omx/gstomxvideodec.c
-@@ -1905,8 +1905,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
+@@ -1911,8 +1911,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
                5 * GST_SECOND) != OMX_ErrorNone)
          return FALSE;
        if (gst_omx_port_wait_buffers_released (out_port,
@@ -25,6 +25,3 @@
        if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
          return FALSE;
        if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
--- 
-2.1.4
-
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-config-files-path.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-config-files-path.patch
deleted file mode 100644
index a7da922..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0001-config-files-path.patch
+++ /dev/null
@@ -1,137 +0,0 @@
---- a/config/bellagio/gstomx.conf
-+++ b/config/bellagio/gstomx.conf
-@@ -1,6 +1,6 @@
- [omxmpeg4videodec]
- type-name=GstOMXMPEG4VideoDec
--core-name=/usr/local/lib/libomxil-bellagio.so.0
-+core-name=/usr/lib/libomxil-bellagio.so.0
- component-name=OMX.st.video_decoder.mpeg4
- rank=256
- in-port-index=0
-@@ -9,7 +9,7 @@
- 
- [omxh264dec]
- type-name=GstOMXH264Dec
--core-name=/usr/local/lib/libomxil-bellagio.so.0
-+core-name=/usr/lib/libomxil-bellagio.so.0
- component-name=OMX.st.video_decoder.avc
- rank=256
- in-port-index=0
-@@ -18,7 +18,7 @@
- 
- [omxmpeg4videoenc]
- type-name=GstOMXMPEG4VideoEnc
--core-name=/usr/local/lib/libomxil-bellagio.so.0
-+core-name=/usr/lib/libomxil-bellagio.so.0
- component-name=OMX.st.video_encoder.mpeg4
- rank=0
- in-port-index=0
-@@ -27,7 +27,7 @@
- 
- [omxaacenc]
- type-name=GstOMXAACEnc
--core-name=/usr/local/lib/libomxil-bellagio.so.0
-+core-name=/usr/lib/libomxil-bellagio.so.0
- component-name=OMX.st.audio_encoder.aac
- rank=0
- in-port-index=0
---- a/config/rpi/gstomx.conf
-+++ b/config/rpi/gstomx.conf
-@@ -1,6 +1,6 @@
- [omxmpeg2videodec]
- type-name=GstOMXMPEG2VideoDec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -9,7 +9,7 @@
- 
- [omxmpeg4videodec]
- type-name=GstOMXMPEG4VideoDec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -18,7 +18,7 @@
- 
- [omxh263dec]
- type-name=GstOMXH263Dec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -27,7 +27,7 @@
- 
- [omxh264dec]
- type-name=GstOMXH264Dec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -36,7 +36,7 @@
- 
- [omxtheoradec]
- type-name=GstOMXTheoraDec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -45,7 +45,7 @@
- 
- [omxvp8dec]
- type-name=GstOMXVP8Dec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -54,7 +54,7 @@
- 
- [omxmjpegdec]
- type-name=GstOMXMJPEGDec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=257
- in-port-index=130
-@@ -63,7 +63,7 @@
- 
- [omxvc1dec]
- type-name=GstOMXWMVDec
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_decode
- rank=256
- in-port-index=130
-@@ -73,7 +73,7 @@
- 
- [omxh264enc]
- type-name=GstOMXH264Enc
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.video_encode
- rank=257
- in-port-index=200
-@@ -82,7 +82,7 @@
- 
- [omxanalogaudiosink]
- type-name=GstOMXAnalogAudioSink
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.audio_render
- rank=256
- in-port-index=100
-@@ -92,7 +92,7 @@
- 
- [omxhdmiaudiosink]
- type-name=GstOMXHdmiAudioSink
--core-name=/opt/vc/lib/libopenmaxil.so
-+core-name=/usr/lib/libopenmaxil.so
- component-name=OMX.broadcom.audio_render
- rank=257
- in-port-index=100
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
deleted file mode 100644
index aef21a5..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0002-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 2e111e52f96f0b942abda120c30a876629bd73fc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
-Date: Mon, 25 May 2015 14:53:35 +0200
-Subject: [PATCH] Don't try to acquire buffer when src pad isn't active
-
-This solves a race condition when setting the pipeline from PAUSE to
-NULL while the decoder loop is still running. Without this patch, the
-thread which interacts with the decode sink pad gets blocked here:
-
-  gst_element_change_state()
-  gst_element_change_state_func()
-  gst_element_pads_activate() --> Deactivating pads
-  activate_pads()
-  gst_pad_set_active()
-  gst_pad_activate_mode()
-  post_activate()
-  GST_PAD_STREAM_LOCK()
-
-while gst_omx_port_acquire_buffer() gets stalled forever in
-gst_omx_component_wait_message() waiting for a message that will never
-arrive:
-
-  gst_omx_video_dec_loop()
-  gst_omx_port_acquire_buffer()
-  gst_omx_component_wait_message()
----
- omx/gstomxvideodec.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index cd24944..57a61dd 100644
---- a/omx/gstomxvideodec.c
-+++ b/omx/gstomxvideodec.c
-@@ -1247,6 +1247,11 @@ gst_omx_video_dec_loop (GstOMXVideoDec * self)
-   GstClockTimeDiff deadline;
-   OMX_ERRORTYPE err;
- 
-+  if (!gst_pad_is_active(GST_VIDEO_DECODER_SRC_PAD (self))) {
-+    GST_DEBUG_OBJECT (self, "Src pad not active, not acquiring buffer and flushing instead");
-+      goto flushing;
-+  }
-+
- #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
-   port = self->eglimage ? self->egl_out_port : self->dec_out_port;
- #else
--- 
-1.8.3.2
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-fix-decoder-flushing.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-fix-decoder-flushing.patch
deleted file mode 100644
index a244b09..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-fix-decoder-flushing.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/omx/gstomx.c b/omx/gstomx.c
-index 69696c4..c382019 100644
---- a/omx/gstomx.c
-+++ b/omx/gstomx.c
-@@ -1508,8 +1508,8 @@ gst_omx_port_set_flushing (GstOMXPort * port, GstClockTime timeout,
-     last_error = OMX_ErrorNone;
-     gst_omx_component_handle_messages (comp);
-     while (signalled && last_error == OMX_ErrorNone && !port->flushed
--        && port->buffers
--        && port->buffers->len > g_queue_get_length (&port->pending_buffers)) {
-+     /* && port->buffers
-+        && port->buffers->len > g_queue_get_length (&port->pending_buffers) */) {
-       signalled = gst_omx_component_wait_message (comp, timeout);
-       if (signalled)
-         gst_omx_component_handle_messages (comp);
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-no-timeout-on-get-state.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-no-timeout-on-get-state.patch
deleted file mode 100644
index 0a0050d..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0003-no-timeout-on-get-state.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index 0d4e7a1..a0d9c74 100644
---- a/omx/gstomxvideodec.c
-+++ b/omx/gstomxvideodec.c
-@@ -1697,9 +1697,9 @@ gst_omx_video_dec_stop (GstVideoDecoder * decoder)
-   g_cond_broadcast (&self->drain_cond);
-   g_mutex_unlock (&self->drain_lock);
- 
--  gst_omx_component_get_state (self->dec, 5 * GST_SECOND);
-+  gst_omx_component_get_state (self->dec, 0);
- #if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
--  gst_omx_component_get_state (self->egl_render, 1 * GST_SECOND);
-+  gst_omx_component_get_state (self->egl_render, 0);
- #endif
- 
-   gst_buffer_replace (&self->codec_data, NULL);
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Properly-handle-drain-requests-while-flushing.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Properly-handle-drain-requests-while-flushing.patch
deleted file mode 100644
index 98689f3..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0004-Properly-handle-drain-requests-while-flushing.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 80dddfd13aaf2fe7272765f8cf291215fe375e28 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
-Date: Tue, 17 Nov 2015 16:51:27 +0000
-Subject: [PATCH] Properly handle drain requests while flushing
-
-Without this commit the decoder streaming thread stops without ever attending
-the drain request, leaving the decoder input thread waiting forever.
----
- omx/gstomx.c         |  7 +++++++
- omx/gstomxvideodec.c | 13 +++++++++++++
- 2 files changed, 20 insertions(+)
-
-diff --git a/omx/gstomx.c b/omx/gstomx.c
-index 69696c4..f0cd890 100644
---- a/omx/gstomx.c
-+++ b/omx/gstomx.c
-@@ -830,6 +830,13 @@ gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state)
- done:
- 
-   gst_omx_component_handle_messages (comp);
-+
-+  if (err != OMX_ErrorNone && comp->last_error == OMX_ErrorNone) {
-+    GST_ERROR_OBJECT (comp->parent,
-+        "Last operation returned an error. Setting last_error manually.");
-+    comp->last_error = err;
-+  }
-+
-   g_mutex_unlock (&comp->lock);
- 
-   if (err != OMX_ErrorNone) {
-diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index d531f75..a26c4a6 100644
---- a/omx/gstomxvideodec.c
-+++ b/omx/gstomxvideodec.c
-@@ -1539,9 +1539,16 @@ component_error:
- flushing:
-   {
-     GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
-+
-+    g_mutex_lock (&self->drain_lock);
-+    if (self->draining) {
-+      self->draining = FALSE;
-+      g_cond_broadcast (&self->drain_cond);
-+    }
-     gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
-     self->downstream_flow_ret = GST_FLOW_FLUSHING;
-     self->started = FALSE;
-+    g_mutex_unlock (&self->drain_lock);
-     return;
-   }
- 
-@@ -1599,8 +1606,14 @@ flow_error:
-       self->started = FALSE;
-     } else if (flow_ret == GST_FLOW_FLUSHING) {
-       GST_DEBUG_OBJECT (self, "Flushing -- stopping task");
-+      g_mutex_lock (&self->drain_lock);
-+      if (self->draining) {
-+        self->draining = FALSE;
-+        g_cond_broadcast (&self->drain_cond);
-+      }
-       gst_pad_pause_task (GST_VIDEO_DECODER_SRC_PAD (self));
-       self->started = FALSE;
-+      g_mutex_unlock (&self->drain_lock);
-     }
-     GST_VIDEO_DECODER_STREAM_UNLOCK (self);
-     return;
--- 
-1.8.3.2
-
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
deleted file mode 100644
index b7a8753..0000000
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 12103842d5f347cf245e71071d0c44297bcdb1f9 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Enrique=20Oca=C3=B1a=20Gonz=C3=A1lez?= <eocanha@igalia.com>
-Date: Fri, 4 Dec 2015 18:39:59 +0100
-Subject: [PATCH] Don't abort gst_omx_video_dec_set_format() if there's a
- timeout releasing the buffers taken by the egl_render out port
-
----
- omx/gstomxvideodec.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c
-index 2368f34..da35e0d 100644
---- a/omx/gstomxvideodec.c
-+++ b/omx/gstomxvideodec.c
-@@ -1905,8 +1905,11 @@ gst_omx_video_dec_set_format (GstVideoDecoder * decoder,
-               5 * GST_SECOND) != OMX_ErrorNone)
-         return FALSE;
-       if (gst_omx_port_wait_buffers_released (out_port,
--              1 * GST_SECOND) != OMX_ErrorNone)
-+              1 * GST_SECOND) != OMX_ErrorNone) {
-+#if !(defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL))
-         return FALSE;
-+#endif
-+      }
-       if (gst_omx_port_deallocate_buffers (self->dec_in_port) != OMX_ErrorNone)
-         return FALSE;
-       if (gst_omx_video_dec_deallocate_output_buffers (self) != OMX_ErrorNone)
--- 
-2.1.4
-
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx%.bbappend b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx%.bbappend
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_%.bbappend
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
index db01d74..1df41a5 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
@@ -7,7 +7,7 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
-DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl samba libssh libomxil coreutils-native curl-native"
+DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl libssh libomxil coreutils-native curl-native"
 PR = "r4"
 
 SRCREV_default = "b8ff59dccd9307f10dad71bec2525a95bd6c603b"
@@ -40,6 +40,11 @@
 
 inherit autotools-brokensep pkgconfig
 
+# This isn't used directly by omxplayer, but applied to Makefile.ffmpeg which
+# runs the ffmpeg configuration
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[samba] = "--enable-libsmbclient,--disable-libsmbclient,samba"
+
 # Needed in ffmpeg configure
 export TEMPDIR = "${S}/tmp"
 
@@ -66,6 +71,8 @@
     # Needed for compiler test in ffmpeg's configure
     mkdir -p tmp
 
+    sed -i 's/--enable-libsmbclient/${@bb.utils.contains("PACKAGECONFIG", "samba", "--enable-libsmbclient", "--disable-libsmbclient", d)}/g' Makefile.ffmpeg
+
     oe_runmake -f Makefile.ffmpeg
     oe_runmake -f Makefile.ffmpeg install
     oe_runmake
diff --git a/import-layers/meta-raspberrypi/recipes-sato/webkitgtk/webkitgtk_%.bbappend b/import-layers/meta-raspberrypi/recipes-sato/webkitgtk/webkitgtk_%.bbappend
new file mode 100644
index 0000000..a4cc96e
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-sato/webkitgtk/webkitgtk_%.bbappend
@@ -0,0 +1 @@
+EXTRA_OECMAKE_append_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', ' -DUSE_GSTREAMER_GL=OFF ', '', d)}"
diff --git a/import-layers/meta-raspberrypi/wic/sdimage-raspberrypi.wks b/import-layers/meta-raspberrypi/wic/sdimage-raspberrypi.wks
index 353daac..01fbaea 100644
--- a/import-layers/meta-raspberrypi/wic/sdimage-raspberrypi.wks
+++ b/import-layers/meta-raspberrypi/wic/sdimage-raspberrypi.wks
@@ -2,5 +2,5 @@
 # long-description: Creates a partitioned SD card image for use with
 # Raspberry Pi. Boot files are located in the first vfat partition.
 
-part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 20
-part / --source rootfs --ondisk mmcblk --fstype=ext4 --label root --align 4096
+part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 20
+part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096