Yocto 2.4

Move OpenBMC to Yocto 2.4(rocko)

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I12057b18610d6fb0e6903c60213690301e9b0c67
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/import-layers/meta-raspberrypi/README.md b/import-layers/meta-raspberrypi/README.md
index c2ea048..fe1c2f3 100644
--- a/import-layers/meta-raspberrypi/README.md
+++ b/import-layers/meta-raspberrypi/README.md
@@ -33,12 +33,12 @@
 This layer depends on:
 
 * URI: git://git.yoctoproject.org/poky
-  * branch: pyro
+  * branch: rocko
   * revision: HEAD
 
 * URI: git://git.openembedded.org/meta-openembedded
   * layers: meta-oe, meta-multimedia, meta-networking, meta-python
-  * branch: pyro
+  * branch: rocko
   * revision: HEAD
 
 ## Quick Start
diff --git a/import-layers/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass b/import-layers/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass
deleted file mode 100644
index e925d4e..0000000
--- a/import-layers/meta-raspberrypi/classes/linux-raspberrypi-base.bbclass
+++ /dev/null
@@ -1,29 +0,0 @@
-inherit linux-kernel-base
-
-def get_dts(d, ver=None):
-    import re
-
-    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR")
-    dts = d.getVar("KERNEL_DEVICETREE")
-
-    # d.getVar() might return 'None' as a normal string
-    # leading to 'is None' check isn't enough.
-    # TODO: Investigate if this is a bug in bitbake
-    if ver is None or ver == "None":
-        ''' if 'ver' isn't set try to grab the kernel version
-        from the kernel staging '''
-        ver = get_kernelversion_file(staging_dir)
-
-    return dts
-
-
-def split_overlays(d, out, ver=None):
-    dts = get_dts(d, ver)
-    if out:
-        overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
-        overlays = oe.utils.str_filter_out('\S+\.dtbo$', overlays, d)
-    else:
-        overlays = oe.utils.str_filter('\S+\-overlay\.dtb$', dts, d) + \
-                   " " + oe.utils.str_filter('\S+\.dtbo$', dts, d)
-
-    return overlays
diff --git a/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass b/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
index 56a854e..2dd9326 100644
--- a/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
+++ b/import-layers/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
@@ -1,5 +1,4 @@
 inherit image_types
-inherit linux-raspberrypi-base
 
 #
 # Create an image that can by written onto a SD card using dd.
@@ -48,15 +47,15 @@
 
 # Use an uncompressed ext3 by default as rootfs
 SDIMG_ROOTFS_TYPE ?= "ext3"
-SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.${SDIMG_ROOTFS_TYPE}"
+SDIMG_ROOTFS = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${SDIMG_ROOTFS_TYPE}"
 
-IMAGE_DEPENDS_rpi-sdimg = " \
-			parted-native \
-			mtools-native \
-			dosfstools-native \
+do_image_rpi_sdimg[depends] = " \
+			parted-native:do_populate_sysroot \
+			mtools-native:do_populate_sysroot \
+			dosfstools-native:do_populate_sysroot \
 			virtual/kernel:do_deploy \
-			${IMAGE_BOOTLOADER} \
-			${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', 'u-boot', '',d)} \
+			${IMAGE_BOOTLOADER}:do_deploy \
+			${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
 			"
 
 # SD card image name
@@ -76,6 +75,17 @@
 SDIMG_VFAT = "${IMAGE_NAME}.vfat"
 SDIMG_LINK_VFAT = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vfat"
 
+def split_overlays(d, out, ver=None):
+    dts = d.getVar("KERNEL_DEVICETREE")
+    if out:
+        overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
+        overlays = oe.utils.str_filter_out('\S+\.dtbo$', overlays, d)
+    else:
+        overlays = oe.utils.str_filter('\S+\-overlay\.dtb$', dts, d) + \
+                   " " + oe.utils.str_filter('\S+\.dtbo$', dts, d)
+
+    return overlays
+
 IMAGE_CMD_rpi-sdimg () {
 
 	# Align partitions
@@ -86,7 +96,7 @@
 	echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
 
 	# Check if we are building with device tree support
-	DTS="${@get_dts(d)}"
+	DTS="${KERNEL_DEVICETREE}"
 
 	# Initialize sdcard image file
 	dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -126,16 +136,13 @@
 			mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.${DTB_EXT} ::overlays/${DTB_BASE_NAME}.${DTB_EXT}
 		done
 	fi
-	case "${KERNEL_IMAGETYPE}" in
-	"uImage")
+        if [ "${RPI_USE_U_BOOT}" = "1" ]; then
 		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE}
-		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage
+		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${KERNEL_IMAGETYPE}
 		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr
-		;;
-	*)
+	else
 		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE}
-		;;
-	esac
+	fi
 
 	if [ -n ${FATPAYLOAD} ] ; then
 		echo "Copying payload into VFAT"
@@ -150,23 +157,19 @@
 	mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info ::
 
         # Deploy vfat partition (for u-boot case only)
-        case "${KERNEL_IMAGETYPE}" in
-        "uImage")
+        if [ "${RPI_USE_U_BOOT}" = "1" ]; then
                 cp ${WORKDIR}/boot.img ${IMGDEPLOYDIR}/${SDIMG_VFAT}
                 ln -sf ${SDIMG_VFAT} ${SDIMG_LINK_VFAT}
-                ;;
-        *)
-                ;;
-        esac
+        fi
 
 	# Burn Partitions
-	dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+	dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
 	# If SDIMG_ROOTFS_TYPE is a .xz file use xzcat
 	if echo "${SDIMG_ROOTFS_TYPE}" | egrep -q "*\.xz"
 	then
-		xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+		xzcat ${SDIMG_ROOTFS} | dd of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
 	else
-		dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync
+		dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024)
 	fi
 
 	# Optionally apply compression
diff --git a/import-layers/meta-raspberrypi/conf/layer.conf b/import-layers/meta-raspberrypi/conf/layer.conf
index bea5a65..bbdce14 100644
--- a/import-layers/meta-raspberrypi/conf/layer.conf
+++ b/import-layers/meta-raspberrypi/conf/layer.conf
@@ -12,3 +12,12 @@
 # Additional license directories.
 LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
 
+# The dynamic-layers directory hosts the extensions and layer specific
+# modifications.
+#
+# The .bbappend and .bb files are included if the respective layer
+# collection is available.
+BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bbappend' % layer \
+               for layer in BBFILE_COLLECTIONS.split())}"
+BBFILES += "${@' '.join('${LAYERDIR}/dynamic-layers/%s/recipes*/*/*.bb' % layer \
+               for layer in BBFILE_COLLECTIONS.split())}"
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 7ed1088..688227c 100644
--- a/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc
+++ b/import-layers/meta-raspberrypi/conf/machine/include/rpi-base.inc
@@ -41,7 +41,17 @@
     overlays/pi3-miniuart-bt.dtbo \
     overlays/vc4-kms-v3d.dtbo \
     "
-KERNEL_IMAGETYPE ?= "Image"
+
+# By default:
+#
+# * When u-boot is disabled use the "Image" format which can be directly loaded
+#   by the rpi firmware.
+#
+# * When u-boot is enabled use the "uImage" format and the "bootm" command
+#   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)}"
 
 MACHINE_FEATURES += "apm usbhost keyboard vfat ext2 screen touchscreen alsa bluetooth wifi sdio"
 
@@ -83,7 +93,7 @@
 
 IMAGE_BOOT_FILES ?= "bcm2835-bootfiles/* \
                  ${@make_dtb_boot_files(d)} \
-                 ${@bb.utils.contains('KERNEL_IMAGETYPE', 'uImage', \
+                 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', \
                     '${KERNEL_IMAGETYPE} u-boot.bin;${SDIMG_KERNELIMAGE} boot.scr', \
                     '${KERNEL_IMAGETYPE};${SDIMG_KERNELIMAGE}', d)} \
                  "
diff --git a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
index e3d11f2..ebc9f38 100644
--- a/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
+++ b/import-layers/meta-raspberrypi/conf/machine/raspberrypi3-64.conf
@@ -31,6 +31,7 @@
     overlays/pi3-disable-bt.dtbo \
     overlays/pi3-miniuart-bt.dtbo \
     overlays/vc4-kms-v3d.dtbo \
+    overlays/vc4-fkms-v3d.dtbo \
     "
 
 SERIAL_CONSOLE ?= "115200 ttyS0"
@@ -38,3 +39,8 @@
 
 UBOOT_MACHINE = "rpi_3_config"
 MACHINE_FEATURES_append = " vc4graphics"
+
+# When u-boot is enabled we need to use the "Image" format and the "booti"
+# command to load the kernel
+KERNEL_IMAGETYPE_UBOOT ?= "Image"
+KERNEL_BOOTCMD ?= "booti"
diff --git a/import-layers/meta-raspberrypi/docs/conf.py b/import-layers/meta-raspberrypi/docs/conf.py
index ce0bb0a..eb98c49 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 = 'pyro'
+version = 'rocko'
 # The full version, including alpha/beta/rc tags.
-release = 'pyro'
+release = 'rocko'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/import-layers/meta-raspberrypi/docs/extra-build-config.md b/import-layers/meta-raspberrypi/docs/extra-build-config.md
index 365c490..380d969 100644
--- a/import-layers/meta-raspberrypi/docs/extra-build-config.md
+++ b/import-layers/meta-raspberrypi/docs/extra-build-config.md
@@ -95,14 +95,22 @@
 
     ENABLE_KGDB = "1"
 
+## Disable rpi boot logo
+
+To disable rpi boot logo, set this variable in local.conf:
+
+    DISABLE_RPI_BOOT_LOGO = "1"
+
 ## Boot to U-Boot
 
 To have u-boot load kernel image, set in your local.conf:
 
-    KERNEL_IMAGETYPE = "uImage"
+    RPI_USE_U_BOOT = "1"
 
-This will make kernel.img be u-boot image which will load uImage. By default,
-kernel.img is the actual kernel image (ex. Image).
+This will select the appropriate image format for use with u-boot automatically.
+For further customisation the KERNEL_IMAGETYPE and KERNEL_BOOTCMD variables can
+be overridden to select the exact kernel image type (eg. zImage) and u-boot
+command (eg. bootz) to be used.
 
 ## Image with Initramfs
 
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 b279e15..a115037 100644
--- a/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
+++ b/import-layers/meta-raspberrypi/recipes-bsp/bootfiles/bcm2835-bootfiles.bb
@@ -9,7 +9,7 @@
 
 RDEPENDS_${PN} = "rpi-config"
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 S = "${RPIFW_S}/boot"
 
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 b3c5084..ca4160b 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
@@ -5,7 +5,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 SRCREV = "648ffc470824c43eb0d16c485f4c24816b32cd6f"
 SRC_URI = "git://github.com/Evilpaul/RPi-config.git;protocol=git;branch=master \
@@ -21,7 +21,8 @@
 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 ?= "vc4-kms-v3d"
 inherit deploy
 
 do_deploy() {
@@ -114,7 +115,7 @@
     # VC4 Graphics support
     if [ "${VC4GRAPHICS}" = "1" ]; then
         echo "# Enable VC4 Graphics" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
-        echo "dtoverlay=vc4-kms-v3d,${VC4_CMA_SIZE}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+        echo "dtoverlay=${VC4DTBO},${VC4_CMA_SIZE}" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
     fi
 
     # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm)
@@ -129,6 +130,12 @@
 }
 
 do_deploy_append_raspberrypi3-64() {
+    echo "# have a properly sized image" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+    echo "disable_overscan=1" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt
+
+    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
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd b/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
deleted file mode 100644
index 2e8452e..0000000
--- a/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd
+++ /dev/null
@@ -1,3 +0,0 @@
-fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
-fatload mmc 0:1 ${kernel_addr_r} uImage
-bootm ${kernel_addr_r} - ${fdt_addr}
diff --git a/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in b/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
new file mode 100644
index 0000000..ad54cd0
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-bsp/rpi-u-boot-scr/files/boot.cmd.in
@@ -0,0 +1,3 @@
+fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
+fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
+@@KERNEL_BOOTCMD@@ ${kernel_addr_r} - ${fdt_addr}
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 4936dcf..3457300 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
@@ -1,13 +1,16 @@
 SUMMARY = "U-boot boot scripts for Raspberry Pi"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
-COMPATIBLE_MACHINE = "rpi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 DEPENDS = "u-boot-mkimage-native"
 
-SRC_URI = "file://boot.cmd"
+SRC_URI = "file://boot.cmd.in"
 
 do_compile() {
+    sed -e 's/@@KERNEL_IMAGETYPE@@/${KERNEL_IMAGETYPE}/' \
+        -e 's/@@KERNEL_BOOTCMD@@/${KERNEL_BOOTCMD}/' \
+        "${WORKDIR}/boot.cmd.in" > "${WORKDIR}/boot.cmd"
     mkimage -A arm -T script -C none -n "Boot script" -d "${WORKDIR}/boot.cmd" boot.scr
 }
 
diff --git a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
index 956d776..03efd5c 100644
--- a/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-connectivity/bluez5/bluez5_%.bbappend
@@ -1,6 +1,6 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
 
-SRC_URI_append_raspberrypi3 = " \
+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 \
@@ -9,7 +9,7 @@
     file://brcm43438.service \
     "
 
-do_install_append_raspberrypi3() {
+enable_bcm_bluetooth() {
     install -d ${D}/lib/firmware/brcm/
     install -m 0644 ${WORKDIR}/BCM43430A1.hcd ${D}/lib/firmware/brcm/BCM43430A1.hcd
 
@@ -19,8 +19,30 @@
     fi
 }
 
-FILES_${PN}_append_raspberrypi3 = " \
+BCM_BT_FIRMWARE =  " \
     /lib/firmware/brcm/BCM43430A1.hcd \
     "
 
-SYSTEMD_SERVICE_${PN}_append_raspberrypi3 = " brcm43438.service"
+BCM_BT_SERVICE =  " brcm43438.service"
+
+# for raspberrypi3
+SRC_URI_append_raspberrypi3 = " ${BCM_BT_SOURCES}"
+
+do_install_append_raspberrypi3() {
+    enable_bcm_bluetooth
+}
+
+FILES_${PN}_append_raspberrypi3 = " ${BCM_BT_FIRMWARE}"
+
+SYSTEMD_SERVICE_${PN}_append_raspberrypi3 = " ${BCM_BT_SERVICE}"
+
+# for raspberrypi0-wifi
+SRC_URI_append_raspberrypi0-wifi = " ${BCM_BT_SOURCES}"
+
+do_install_append_raspberrypi0-wifi() {
+    enable_bcm_bluetooth
+}
+
+FILES_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_FIRMWARE}"
+
+SYSTEMD_SERVICE_${PN}_append_raspberrypi0-wifi = " ${BCM_BT_SERVICE}"
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 b5602a6..c8dc436 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,4 +1,6 @@
 # Base this image on rpi-basic-image
 include rpi-basic-image.bb
 
+COMPATIBLE_MACHINE = "^rpi$"
+
 IMAGE_INSTALL_append = " packagegroup-rpi-test"
diff --git a/import-layers/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb b/import-layers/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
index 29e995e..029c18c 100644
--- a/import-layers/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
+++ b/import-layers/meta-raspberrypi/recipes-core/packagegroups/packagegroup-rpi-test.bb
@@ -4,8 +4,13 @@
 
 inherit packagegroup
 
+COMPATIBLE_MACHINE = "^rpi$"
+
+OMXPLAYER_rpi = "omxplayer"
+OMXPLAYER_rpi_aarch64 = ""
+
 RDEPENDS_${PN} = "\
-    omxplayer \
+    ${OMXPLAYER} \
     bcm2835-tests \
     wiringpi \
     rpio \
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/bcm2835/bcm2835_1.52.bb b/import-layers/meta-raspberrypi/recipes-devtools/bcm2835/bcm2835_1.52.bb
index 8e41c61..eef6afd 100644
--- a/import-layers/meta-raspberrypi/recipes-devtools/bcm2835/bcm2835_1.52.bb
+++ b/import-layers/meta-raspberrypi/recipes-devtools/bcm2835/bcm2835_1.52.bb
@@ -8,7 +8,7 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 SRC_URI = "http://www.airspayce.com/mikem/bcm2835/bcm2835-${PV}.tar.gz"
 
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
index a548957..3cb79cc 100644
--- a/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster.inc
+++ b/import-layers/meta-raspberrypi/recipes-devtools/pi-blaster/pi-blaster.inc
@@ -2,7 +2,7 @@
 HOMEPAGE = "https://github.com/sarfata/pi-blaster/"
 SECTION = "devel/libs"
 LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://README.md;beginline=212;endline=239;md5=a012868ef5f83b9f257af253d7cb07a3"
+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 \
@@ -16,6 +16,6 @@
 INITSCRIPT_NAME_${PN} = "${PN}.boot.sh"
 INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
 
-COMPATIBLE_MACHINE = "raspberrypi"
+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 ac812ab..730f9d3 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,3 @@
 require pi-blaster.inc
 
-SRCREV = "9f45eb23a8a3b2d1c08d08a6d68f206fe91ecf4c"
+SRCREV = "1035ad7dffb270c40eec1bb3a654171a755fba98"
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.1.0.bb b/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.1.0.bb
deleted file mode 100644
index e990a28..0000000
--- a/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.1.0.bb
+++ /dev/null
@@ -1,28 +0,0 @@
-SUMMARY = "Python module to control the Raspberry Pi Sense HAT used in the Astro Pi mission"
-HOMEPAGE = "https://github.com/RPi-Distro/python-sense-hat"
-SECTION = "devel/python"
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=d80fe312e1ff5fbd97369b093bf21cda"
-
-SRCNAME = "sense-hat"
-
-SRC_URI = "https://pypi.python.org/packages/source/s/${SRCNAME}/${SRCNAME}-${PV}.tar.gz"
-
-SRC_URI[md5sum] = "71217f15ea963040f06e2f50722186ca"
-SRC_URI[sha256sum] = "c6c76707c0ea514e4b0f1f96f1b5b79755875891aae037df7434b6aad7b9dbca"
-
-S = "${WORKDIR}/${SRCNAME}-${PV}"
-
-inherit setuptools
-
-DEPENDS += " \
-    jpeg \
-    zlib \
-    freetype \
-    "
-
-RDEPENDS_${PN} += " \
-    python-numpy \
-    python-rtimu \
-    python-imaging \
-    "
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.2.0.bb b/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.2.0.bb
new file mode 100644
index 0000000..f7c4e34
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-devtools/python/python-sense-hat_2.2.0.bb
@@ -0,0 +1,24 @@
+SUMMARY = "Python module to control the Raspberry Pi Sense HAT used in the Astro Pi mission"
+HOMEPAGE = "https://github.com/RPi-Distro/python-sense-hat"
+SECTION = "devel/python"
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=d80fe312e1ff5fbd97369b093bf21cda"
+
+inherit setuptools pypi
+
+PYPI_PACKAGE = "sense-hat"
+
+SRC_URI[md5sum] = "69929250cb72349a8a82edf2584b1d83"
+SRC_URI[sha256sum] = "f000998d042d96ed722d459312e1bebd0107f9f3015cd34b3e4fabcab9c800af"
+
+DEPENDS += " \
+    jpeg \
+    zlib \
+    freetype \
+    "
+
+RDEPENDS_${PN} += " \
+    python-numpy \
+    python-rtimu \
+    python-imaging \
+    "
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.2.bb b/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.2.bb
deleted file mode 100644
index a08ea98..0000000
--- a/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.2.bb
+++ /dev/null
@@ -1,21 +0,0 @@
-DESCRIPTION = "A module to control Raspberry Pi GPIO channels"
-HOMEPAGE = "http://code.google.com/p/raspberry-gpio-python/"
-SECTION = "devel/python"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=9b95630a648966b142f1a0dcea001cb7"
-
-SRCNAME = "RPi.GPIO"
-
-SRC_URI = "\
-          http://pypi.python.org/packages/source/R/RPi.GPIO/${SRCNAME}-${PV}.tar.gz \
-          file://0001-Remove-nested-functions.patch \
-          "
-SRC_URI[md5sum] = "9db86fd5f3bae872de9dbb068ee0b096"
-SRC_URI[sha256sum] = "82acff0ef6bbe3cdf6f4dbdd73d96add5294bb94baf7f51c1d901861af3c2392"
-
-S = "${WORKDIR}/${SRCNAME}-${PV}"
-
-inherit distutils
-
-COMPATIBLE_MACHINE = "raspberrypi"
-
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.3.bb b/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.3.bb
new file mode 100644
index 0000000..d0ff00a
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-devtools/python/rpi-gpio_0.6.3.bb
@@ -0,0 +1,14 @@
+DESCRIPTION = "A module to control Raspberry Pi GPIO channels"
+HOMEPAGE = "http://code.google.com/p/raspberry-gpio-python/"
+SECTION = "devel/python"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENCE.txt;md5=9b95630a648966b142f1a0dcea001cb7"
+
+PYPI_PACKAGE = "RPi.GPIO"
+inherit pypi distutils
+
+SRC_URI += "file://0001-Remove-nested-functions.patch"
+SRC_URI[md5sum] = "e4abe1cfb5eacebe53078032256eb837"
+SRC_URI[sha256sum] = "a5fc0eb5e401963b6c0a03650da6b42c4005f02d962b81241d96c98d0a578516"
+
+COMPATIBLE_MACHINE = "^rpi$"
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/python/rpio_0.10.0.bb b/import-layers/meta-raspberrypi/recipes-devtools/python/rpio_0.10.0.bb
index 1a6cee7..998fdb3 100644
--- a/import-layers/meta-raspberrypi/recipes-devtools/python/rpio_0.10.0.bb
+++ b/import-layers/meta-raspberrypi/recipes-devtools/python/rpio_0.10.0.bb
@@ -14,7 +14,7 @@
 
 inherit setuptools
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 RDEPENDS_${PN} = "\
     python-logging \
diff --git a/import-layers/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb b/import-layers/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
index 7953a55..f1b01db 100644
--- a/import-layers/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-devtools/wiringPi/wiringpi_git.bb
@@ -13,7 +13,7 @@
            file://0001-Add-initial-cross-compile-support.patch \
            "
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 CFLAGS_prepend = "-I${S}/wiringPi -I${S}/devLib "
 
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 579aace..d38b02d 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-graphics/userland/userland_git.bb
@@ -12,7 +12,7 @@
 
 RPROVIDES_${PN} += "libgles2 egl libegl"
 
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 SRCBRANCH = "master"
 SRCFORK = "raspberrypi"
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 a1c8d29..668c5ce 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
@@ -4,7 +4,7 @@
 LIC_FILES_CHKSUM = "file://LICENCE;md5=86e53f5f5909ee66900418028de11780"
 
 PROVIDES = "virtual/libgles2 virtual/egl"
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 include recipes-bsp/common/firmware.inc
 
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/wayland/weston_%.bbappend b/import-layers/meta-raspberrypi/recipes-graphics/wayland/weston_%.bbappend
index f2cb7aa..55cf700 100644
--- a/import-layers/meta-raspberrypi/recipes-graphics/wayland/weston_%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-graphics/wayland/weston_%.bbappend
@@ -1,12 +1,10 @@
-EXTRA_OECONF_append_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' --enable-rpi-compositor WESTON_NATIVE_BACKEND=rpi-backend.so', d)}"
-
 PACKAGECONFIG_remove_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'fbdev', '', d)}"
 
-EXTRA_OECONF += "--disable-xwayland-test \
-                 --disable-simple-egl-clients \
+EXTRA_OECONF_append_rpi = " \
+    --disable-xwayland-test \
+    --disable-simple-egl-clients \
+    ${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', ' \
+        --disable-resize-optimization \
+        --disable-setuid-install \
+    ', d)} \
 "
-
-EXTRA_OECONF += "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', '--enable-rpi-compositor', d)}"
-EXTRA_OECONF += "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', '--disable-resize-optimization', d)}"
-EXTRA_OECONF += "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', '--disable-setuid-install', d)}"
-EXTRA_OECONF += "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', '', 'WESTON_NATIVE_BACKEND=rpi-backend.so', d)}"
diff --git a/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf
new file mode 100644
index 0000000..1a562ea
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-graphics/xorg-xserver/xserver-xf86-config/rpi/xorg.conf.d/10-noglamor.conf
@@ -0,0 +1,6 @@
+# 
+Section "Device"
+	Identifier "modeset"
+	Driver "modesetting"
+	Option "AccelMethod" "None"
+EndSection
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 b361eef..7902f20 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
@@ -4,7 +4,9 @@
     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)}"
     if [ "${PITFT}" = "1" ]; then
@@ -13,5 +15,8 @@
         install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
     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/linux-raspberrypi-dev.bb b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi-dev.bb
index 0879bcb..b947659 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,8 +7,8 @@
 
 FILESEXTRAPATHS_prepend := "${THISDIR}/linux-raspberrypi:"
 
-LINUX_VERSION ?= "4.11"
-LINUX_RPI_DEV_BRANCH ?= "rpi-4.11.y"
+LINUX_VERSION ?= "4.13"
+LINUX_RPI_DEV_BRANCH ?= "rpi-4.13.y"
 
 SRCREV = "${AUTOREV}"
 SRC_URI = "git://github.com/raspberrypi/linux.git;protocol=git;branch=${LINUX_RPI_DEV_BRANCH} \
@@ -16,11 +16,6 @@
 "
 require linux-raspberrypi.inc
 
-# A LOADADDR is needed when building a uImage format kernel. This value is not
-# set by default in rpi-4.8.y and later branches so we need to provide it
-# manually. This value unused if KERNEL_IMAGETYPE is not uImage.
-KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000"
-
 # Disable version check so that we don't have to edit this recipe every time
 # upstream bumps the version
 KERNEL_VERSION_SANITY_SKIP = "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 9265d55..da36ca7 100644
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
+++ b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc
@@ -1,24 +1,22 @@
-require linux-rpi.inc
-inherit linux-raspberrypi-base
-
 DESCRIPTION = "Linux Kernel for Raspberry Pi"
 SECTION = "kernel"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
 
-SRC_URI += " \
-        file://defconfig \
-        "
-
-COMPATIBLE_MACHINE = "raspberrypi"
+COMPATIBLE_MACHINE = "^rpi$"
 
 PE = "1"
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
-# NOTE: For now we pull in the default config from the RPi kernel GIT tree.
-KERNEL_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig"
-KERNEL_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"
-KERNEL_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig"
+inherit kernel siteinfo
+require recipes-kernel/linux/linux-yocto.inc
+
+KCONFIG_MODE = "--alldefconfig"
+KBUILD_DEFCONFIG_raspberrypi0-wifi ?= "bcmrpi_defconfig"
+KBUILD_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig"
+KBUILD_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"
+KBUILD_DEFCONFIG_raspberrypi3 ?= "bcm2709_defconfig"
+KBUILD_DEFCONFIG_raspberrypi3-64 ?= "bcmrpi3_defconfig"
 
 # CMDLINE for raspberrypi
 CMDLINE ?= "dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
@@ -26,20 +24,141 @@
 # Add the kernel debugger over console kernel command line option if enabled
 CMDLINE_append = ' ${@base_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)}'
+
+# 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_MODULE_AUTOLOAD += "${@bb.utils.contains("MACHINE_FEATURES", "pitft28r", "stmpe-ts", "", d)}"
 
-# Set programmatically some variables during recipe parsing
-# See http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#anonymous-python-functions
-python __anonymous () {
-    kerneltype = d.getVar('KERNEL_IMAGETYPE')
-    kerneldt = get_dts(d, d.getVar('LINUX_VERSION'))
-    d.setVar("KERNEL_DEVICETREE", kerneldt)
+# A LOADADDR is needed when building a uImage format kernel. This value is not
+# set by default in rpi-4.8.y and later branches so we need to provide it
+# manually. This value unused if KERNEL_IMAGETYPE is not uImage.
+KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000"
+
+# Set a variable in .configure
+# $1 - Configure variable to be set
+# $2 - value [n/y/value]
+kernel_configure_variable() {
+    # Remove the config
+    CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
+    if test "$2" = "n"
+    then
+        echo "# CONFIG_$1 is not set" >> ${B}/.config
+    else
+        echo "CONFIG_$1=$2" >> ${B}/.config
+    fi
 }
 
-do_kernel_configme_prepend() {
-    install -m 0644 ${S}/arch/${ARCH}/configs/${KERNEL_DEFCONFIG} ${WORKDIR}/defconfig || die "No default configuration for ${MACHINE} / ${KERNEL_DEFCONFIG} available."
+do_configure_prepend() {
+    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)}"
+    if [ ${VC4GRAPHICS} = "1" ]; then
+        kernel_configure_variable I2C_BCM2835 y
+        kernel_configure_variable DRM y
+        kernel_configure_variable DRM_FBDEV_EMULATION y
+        kernel_configure_variable DRM_VC4 y
+    fi
+
+    # Keep this the last line
+    # 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() {
+    cc_extra=$(get_cc_option)
+    oe_runmake dtbs CC="${KERNEL_CC} $cc_extra " LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS}
 }
 
 do_install_prepend() {
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/defconfig b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/defconfig
deleted file mode 100644
index ecbf32c..0000000
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/defconfig
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file to get through do_kernel_configme.
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 df28fda..061e893 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
@@ -6,8 +6,3 @@
 SRC_URI = "git://github.com/raspberrypi/linux.git;branch=rpi-4.9.y"
 
 require linux-raspberrypi.inc
-
-# A LOADADDR is needed when building a uImage format kernel. This value is not
-# set by default in rpi-4.8.y and later branches so we need to provide it
-# manually. This value unused if KERNEL_IMAGETYPE is not uImage.
-KERNEL_EXTRA_ARGS += "LOADADDR=0x00008000"
diff --git a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-rpi.inc b/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-rpi.inc
deleted file mode 100644
index 53383b0..0000000
--- a/import-layers/meta-raspberrypi/recipes-kernel/linux/linux-rpi.inc
+++ /dev/null
@@ -1,148 +0,0 @@
-DESCRIPTION = "Linux Kernel"
-SECTION = "kernel"
-LICENSE = "GPLv2"
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
-
-inherit kernel siteinfo
-require recipes-kernel/linux/linux-yocto.inc
-
-# Enable OABI compat for people stuck with obsolete userspace
-ARM_KEEP_OABI ?= "1"
-
-# Quirk for udev greater or equal 141
-UDEV_GE_141 ?= "1"
-
-# You can define CMDLINE_DEBUG as "debug" in your local.conf or distro.conf
-# to enable kernel debugging.
-CMDLINE_DEBUG ?= ""
-CMDLINE_append = " ${CMDLINE_DEBUG}"
-
-KERNEL_INITRAMFS ?= '${@base_conditional("INITRAMFS_IMAGE_BUNDLE", "1", "1", "", d)}'
-
-# Set a variable in .configure
-# $1 - Configure variable to be set
-# $2 - value [n/y/value]
-kernel_configure_variable() {
-    # Remove the config
-    CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
-    if test "$2" = "n"
-    then
-        echo "# CONFIG_$1 is not set" >> ${B}/.config
-    else
-        echo "CONFIG_$1=$2" >> ${B}/.config
-    fi
-}
-
-do_configure_prepend() {
-    # Clean .config
-    echo "" > ${B}/.config
-    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
-
-    # Activate the configuration options for VC4
-    VC4GRAPHICS="${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}"
-    if [ ${VC4GRAPHICS} = "1" ]; then
-        kernel_configure_variable I2C_BCM2835 y
-        kernel_configure_variable DRM y
-        kernel_configure_variable DRM_FBDEV_EMULATION y
-        kernel_configure_variable DRM_VC4 y
-        kernel_configure_variable FB_BCM2708 n
-    fi
-
-    # Keep this the last line
-    # Remove all modified configs and add the rest to .config
-    sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config'
-
-    yes '' | oe_runmake oldconfig
-}
-
-# Automatically depend on lzop-native if CONFIG_KERNEL_LZO is enabled
-python () {
-    try:
-        defconfig = bb.fetch2.localpath('file://defconfig', d)
-    except bb.fetch2.FetchError:
-        return
-
-    try:
-        configfile = open(defconfig)
-    except IOError:
-        return
-
-    if 'CONFIG_KERNEL_LZO=y\n' in configfile.readlines():
-        depends = d.getVar('DEPENDS', False)
-        d.setVar('DEPENDS', depends + ' lzop-native')
-
-    configfile.close()
-}
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/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
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0001-Don-t-try-to-acquire-buffer-when-src-pad-isn-t-activ.patch
rename to 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
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0001-config-files-path.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0001-config-files-path.patch
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0001-config-files-path.patch
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0002-fix-decoder-flushing.patch b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0002-fix-decoder-flushing.patch
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0002-fix-decoder-flushing.patch
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/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
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0003-no-timeout-on-get-state.patch
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0003-no-timeout-on-get-state.patch
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/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
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0004-Properly-handle-drain-requests-while-flushing.patch
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.12/0004-Properly-handle-drain-requests-while-flushing.patch
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/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
similarity index 100%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx-1.10/0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch
rename to 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
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10%.bbappend b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend
similarity index 88%
rename from import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10%.bbappend
rename to import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend
index d419867..93381a4 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.10%.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.12%.bbappend
@@ -10,4 +10,4 @@
              file://0005-Don-t-abort-gst_omx_video_dec_set_format-if-there-s-.patch \
 "
 
-FILESEXTRAPATHS_prepend := "${THISDIR}/gstreamer1.0-omx-1.10:"
+FILESEXTRAPATHS_prepend := "${THISDIR}/gstreamer1.0-omx-1.12:"
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch
new file mode 100644
index 0000000..4f56ad2
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0005-Don-t-require-internet-connection-during-build.patch
@@ -0,0 +1,56 @@
+From 97cb9405f281f54d4083f3126d441c8b44eafb89 Mon Sep 17 00:00:00 2001
+From: Paul Barker <pbarker@toganlabs.com>
+Date: Thu, 7 Sep 2017 19:14:20 +0000
+Subject: [PATCH] Don't require internet connection during build
+
+The following issues break offline builds:
+
+* Building the man page uses a web service hosted on heroku.
+
+* Makefile.ffmpeg explicitly does a "git clone" from the internet.
+
+Signed-off-by: Paul Barker <pbarker@toganlabs.com>
+Upstream-status: Inappropriate
+---
+ Makefile        | 6 ++----
+ Makefile.ffmpeg | 2 +-
+ 2 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 60501b1..6471f0f 100644
+--- a/Makefile
++++ b/Makefile
+@@ -79,14 +79,12 @@ ffmpeg:
+ 	make -f Makefile.ffmpeg
+ 	make -f Makefile.ffmpeg install
+ 
+-dist: omxplayer.bin omxplayer.1
++dist: omxplayer.bin
+ 	mkdir -p $(DIST)/usr/lib/omxplayer
+ 	mkdir -p $(DIST)/usr/bin
+ 	mkdir -p $(DIST)/usr/share/doc/omxplayer
+-	mkdir -p $(DIST)/usr/share/man/man1
+ 	cp omxplayer omxplayer.bin $(DIST)/usr/bin
+ 	cp COPYING $(DIST)/usr/share/doc/omxplayer
+ 	cp README.md $(DIST)/usr/share/doc/omxplayer/README
+-	cp omxplayer.1 $(DIST)/usr/share/man/man1
+ 	cp -P ffmpeg_compiled/usr/lib/*.so* $(DIST)/usr/lib/omxplayer/
+-	tar -czf omxplayer-dist.tar.gz $(DIST)
+\ No newline at end of file
++	tar -czf omxplayer-dist.tar.gz $(DIST)
+diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
+index 22d495c..8651724 100644
+--- a/Makefile.ffmpeg
++++ b/Makefile.ffmpeg
+@@ -6,7 +6,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstru
+ WORK=$(PWD)
+ 
+ .PHONY : all
+-all: checkout configure compile
++all: configure compile
+ 
+ .PHONY : copy
+ copy:
+-- 
+2.7.4
+
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch
new file mode 100644
index 0000000..3fac2d1
--- /dev/null
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer/0006-Prevent-ffmpeg-configure-compile-race-condition.patch
@@ -0,0 +1,39 @@
+From 4a13419e3805b541fc58e57f1f27c4a388609ef5 Mon Sep 17 00:00:00 2001
+From: Paul Barker <pbarker@toganlabs.com>
+Date: Thu, 7 Sep 2017 20:02:15 +0000
+Subject: [PATCH] Prevent ffmpeg configure/compile race condition
+
+Additional dependency information is needed in Makefile.ffmpeg to ensure that
+the configure stage is finished before the compile stage starts.
+
+Signed-off-by: Paul Barker <pbarker@toganlabs.com>
+Upstream-status: Pending
+---
+ Makefile.ffmpeg | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg
+index 8651724..619c49a 100644
+--- a/Makefile.ffmpeg
++++ b/Makefile.ffmpeg
+@@ -6,7 +6,7 @@ FFMPEG_EXTRA_CFLAGS?=-mfpu=vfp -mfloat-abi=$(FLOAT) -mno-apcs-stack-check -mstru
+ WORK=$(PWD)
+ 
+ .PHONY : all
+-all: configure compile
++all: compile
+ 
+ .PHONY : copy
+ copy:
+@@ -14,7 +14,7 @@ copy:
+ 	$(HOST)-strip *.so*
+ 
+ .PHONY : compile
+-compile: 
++compile: configure
+ 	+$(MAKE) -C ffmpeg
+ 
+ .PHONY : configure
+-- 
+2.7.4
+
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 0e0f9ba..db01d74 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/omxplayer/omxplayer_git.bb
@@ -10,14 +10,27 @@
 DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl samba libssh libomxil coreutils-native curl-native"
 PR = "r4"
 
-SRCREV = "061425a5eabf6e9ee43229911c073a863d144038"
+SRCREV_default = "b8ff59dccd9307f10dad71bec2525a95bd6c603b"
+
+# omxplayer builds its own copy of ffmpeg from source instead of using the
+# system's ffmpeg library. This isn't ideal but it's ok for now. We do however
+# want to keep control of the exact version of ffmpeg used instead of just
+# fetching the latest commit on a release branch (which is what the checkout job
+# in Makefile.ffmpeg in the omxplayer source tree does).
+#
+# This SRCREV corresponds to the v3.1.10 release of ffmpeg.
+SRCREV_ffmpeg = "afa34cb36edca0ff809b7e58474bbce12271ecba"
+
 SRC_URI = "git://github.com/popcornmix/omxplayer.git;protocol=git;branch=master \
+           git://source.ffmpeg.org/ffmpeg;branch=release/3.1;protocol=git;depth=1;name=ffmpeg;destsuffix=git/ffmpeg \
            file://0001-Remove-Makefile.include-which-includes-hardcoded.patch \
            file://0002-Libraries-and-headers-from-ffmpeg-are-installed-in-u.patch \
            file://0003-Remove-strip-step-in-Makefile.patch \
            file://0004-Add-FFMPEG_EXTRA_CFLAGS-and-FFMPEG_EXTRA_LDFLAGS.patch \
            file://fix-tar-command-with-DIST.patch \
            file://use-native-pkg-config.patch \
+           file://0005-Don-t-require-internet-connection-during-build.patch \
+           file://0006-Prevent-ffmpeg-configure-compile-race-condition.patch \
            "
 S = "${WORKDIR}/git"
 
@@ -53,7 +66,8 @@
     # Needed for compiler test in ffmpeg's configure
     mkdir -p tmp
 
-    oe_runmake ffmpeg
+    oe_runmake -f Makefile.ffmpeg
+    oe_runmake -f Makefile.ffmpeg install
     oe_runmake
 }
 
diff --git a/import-layers/meta-raspberrypi/recipes-multimedia/x264/x264_git.bbappend b/import-layers/meta-raspberrypi/recipes-multimedia/x264/x264_git.bbappend
index c1cb3bc..505719e 100644
--- a/import-layers/meta-raspberrypi/recipes-multimedia/x264/x264_git.bbappend
+++ b/import-layers/meta-raspberrypi/recipes-multimedia/x264/x264_git.bbappend
@@ -1 +1,2 @@
 EXTRA_OECONF_append_raspberrypi = " --disable-asm"
+EXTRA_OECONF_append_raspberrypi0-wifi = " --disable-asm"