From 3acb532fd1c18c18272cc9c5c1d6530aecead700 Mon Sep 17 00:00:00 2001 From: Leon Anavi Date: Thu, 22 Sep 2016 15:00:46 +0300 Subject: meta-raspberrypi: AGL support for Raspberry Pi Yocto/OE layer that extends the recipes for mesa and the supported Linux kernel for Raspberry Pi for successful build of AGL with Wayland, Weston and Qt. It is based on the existing ports of Tizen and GENIVI Development Platform for Raspberry Pi. Change-Id: Icfed9e888c2abaf26c14ab402d0a90215862afbd Signed-off-by: Leon Anavi --- meta-agl-bsp/classes/sdcard_image-rpi-gdp.bbclass | 96 ++++++++++++++++++++++ .../recipes-bsp/bootfiles/rpi-config_git.bbappend | 11 +++ .../recipes-graphics/mesa/mesa_%.bbappend | 9 ++ .../linux-raspberrypi/0001-rpi-defconfig.patch | 42 ++++++++++ .../linux-raspberrypi/0002-faytech-fix-rpi.patch | 33 ++++++++ .../linux/linux-raspberrypi_4.4.bbappend | 18 ++++ 6 files changed, 209 insertions(+) create mode 100644 meta-agl-bsp/classes/sdcard_image-rpi-gdp.bbclass create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-rpi-defconfig.patch create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-faytech-fix-rpi.patch create mode 100644 meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend diff --git a/meta-agl-bsp/classes/sdcard_image-rpi-gdp.bbclass b/meta-agl-bsp/classes/sdcard_image-rpi-gdp.bbclass new file mode 100644 index 000000000..2956dd075 --- /dev/null +++ b/meta-agl-bsp/classes/sdcard_image-rpi-gdp.bbclass @@ -0,0 +1,96 @@ +inherit sdcard_image-rpi + +IMAGE_CMD_rpi-sdimg () { + + # Align partitions + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} + ${IMAGE_ROOTFS_ALIGNMENT} - 1) + BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} - ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) + SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE) + + 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, None)}" + + # Initialize sdcard image file + dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE} + + # Create partition table + parted -s ${SDIMG} mklabel msdos + # Create boot partition and mark it as bootable + parted -s ${SDIMG} unit KiB mkpart primary fat32 ${IMAGE_ROOTFS_ALIGNMENT} $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) + parted -s ${SDIMG} set 1 boot on + # Create rootfs partition to the end of disk + parted -s ${SDIMG} -- unit KiB mkpart primary ext2 $(expr ${BOOT_SPACE_ALIGNED} \+ ${IMAGE_ROOTFS_ALIGNMENT}) -1s + parted ${SDIMG} print + + # Create a vfat image with boot files + BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') + rm -f ${WORKDIR}/boot.img + mkfs.vfat -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ + case "${KERNEL_IMAGETYPE}" in + "uImage") + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.img ::${SDIMG_KERNELIMAGE} + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage + ;; + *) + if test -n "${DTS}"; then + # Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' string and will be put in a dedicated folder + DT_OVERLAYS="${@split_overlays(d, 0)}" + DT_ROOT="${@split_overlays(d, 1)}" + + # Copy board device trees to root folder + for DTB in ${DT_ROOT}; do + DTB_BASE_NAME=`basename ${DTB} .dtb` + + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::${DTB_BASE_NAME}.dtb + done + + # Copy device tree overlays to dedicated folder + mmd -i ${WORKDIR}/boot.img overlays + for DTB in ${DT_OVERLAYS}; do + DTB_BASE_NAME=`basename ${DTB} .dtb` + + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTB_BASE_NAME}.dtb ::overlays/${DTB_BASE_NAME}.dtbo + done + fi + mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::${SDIMG_KERNELIMAGE} + ;; + esac + + if [ -n ${FATPAYLOAD} ] ; then + echo "Copying payload into VFAT" + for entry in ${FATPAYLOAD} ; do + # add the || true to stop aborting on vfat issues like not supporting .~lock files + mcopy -i ${WORKDIR}/boot.img -s -v ${IMAGE_ROOTFS}$entry :: || true + done + fi + + # Add stamp file + echo "${IMAGE_NAME}-${IMAGEDATESTAMP}" > ${WORKDIR}/image-version-info + mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}//image-version-info :: + + # Burn Partitions + dd if=${WORKDIR}/boot.img of=${SDIMG} conv=notrunc seek=1 bs=$(expr ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync + # 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 + else + dd if=${SDIMG_ROOTFS} of=${SDIMG} conv=notrunc seek=1 bs=$(expr 1024 \* ${BOOT_SPACE_ALIGNED} + ${IMAGE_ROOTFS_ALIGNMENT} \* 1024) && sync && sync + fi + + # Optionally apply compression + case "${SDIMG_COMPRESSION}" in + "gzip") + gzip -k9 "${SDIMG}" + ;; + "bzip2") + bzip2 -k9 "${SDIMG}" + ;; + "xz") + xz -k "${SDIMG}" + ;; + esac +} diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend new file mode 100644 index 000000000..871901838 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-bsp/bootfiles/rpi-config_git.bbappend @@ -0,0 +1,11 @@ +DISABLE_OVERSCAN = "1" + +do_deploy_append() { + echo "avoid_warnings=2" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "mask_gpu_interrupt0=0x400" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtoverlay=vc4-kms-v3d-overlay,cma-256" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtoverlay=rpi-ft5406-overlay" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt + echo "dtparam=audio=on" >> ${DEPLOYDIR}/bcm2835-bootfiles/config.txt +} + +ENABLE_UART_raspberrypi3 = "1" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend new file mode 100644 index 000000000..78250550f --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-graphics/mesa/mesa_%.bbappend @@ -0,0 +1,9 @@ +DEPENDS += "python-mako-native libomxil" + +PACKAGECONFIG_append = " gallium gallium-llvm" + +GALLIUMDRIVERS_append = ",vc4" + +PACKAGES =+ "mesa-megadriver-dbg" + +FILES_mesa-megadriver-dbg = "${libdir}/dri/.debug/*" diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-rpi-defconfig.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-rpi-defconfig.patch new file mode 100644 index 000000000..ab6863b9f --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0001-rpi-defconfig.patch @@ -0,0 +1,42 @@ +From 34f9f2a5b83869a8620d6bc212dc7110a75202ac Mon Sep 17 00:00:00 2001 +From: Changhyeok Bae +Date: Thu, 11 Aug 2016 00:44:08 +0900 +Subject: [PATCH] rpi defconfig + +--- + arch/arm/configs/bcm2709_defconfig | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 3eff0fc..5859b1d 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -607,6 +607,7 @@ CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m + CONFIG_I2C_MUX_PCA954x=m + CONFIG_I2C_BCM2708=m ++CONFIG_I2C_BCM2835=y + CONFIG_I2C_GPIO=m + CONFIG_SPI=y + CONFIG_SPI_BCM2835=m +@@ -818,14 +819,14 @@ CONFIG_VIDEO_TW9903=m + CONFIG_VIDEO_TW9906=m + CONFIG_VIDEO_OV7640=m + CONFIG_VIDEO_MT9V011=m +-CONFIG_DRM=m ++CONFIG_DRM=y + CONFIG_DRM_LOAD_EDID_FIRMWARE=y + CONFIG_DRM_UDL=m + CONFIG_DRM_PANEL_SIMPLE=m +-CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=m +-CONFIG_DRM_VC4=m ++CONFIG_DRM_PANEL_RASPBERRYPI_TOUCHSCREEN=y ++CONFIG_DRM_VC4=y + CONFIG_FB=y +-CONFIG_FB_BCM2708=y ++# CONFIG_FB_BCM2708 is not set + CONFIG_FB_UDL=m + CONFIG_FB_SSD1307=m + CONFIG_FB_RPISENSE=m +-- +2.9.0 diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-faytech-fix-rpi.patch b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-faytech-fix-rpi.patch new file mode 100644 index 000000000..00e369205 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0002-faytech-fix-rpi.patch @@ -0,0 +1,33 @@ +From f9fefc63456dd50eeec727ae2fbc13b0d84eb44e Mon Sep 17 00:00:00 2001 +From: Tom Pollard +Date: Wed, 6 Apr 2016 07:47:25 +0000 +Subject: [PATCH 1/1] Fix lack of touch up for Faytech 10" Touchscreen MonitorV2 + +NOTE: This is a very temporary hack that is not in a state to be upstreamed yet. +--- +Index: a/drivers/hid/hid-multitouch.c +=================================================================== +--- a/drivers/hid/hid-multitouch.c 2016-07-05 08:45:06.006466000 +0000 ++++ b/drivers/hid/hid-multitouch.c 2016-07-05 08:48:44.574466000 +0000 +@@ -205,7 +205,6 @@ + { .name = MT_CLS_WIN_8, + .quirks = MT_QUIRK_ALWAYS_VALID | + MT_QUIRK_IGNORE_DUPLICATES | +- MT_QUIRK_HOVERING | + MT_QUIRK_CONTACT_CNT_ACCURATE }, + { .name = MT_CLS_EXPORT_ALL_INPUTS, + .quirks = MT_QUIRK_ALWAYS_VALID | +@@ -396,11 +395,6 @@ + td->is_buttonpad = true; + + break; +- case 0xff0000c5: +- /* Retrieve the Win8 blob once to enable some devices */ +- if (usage->usage_index == 0) +- mt_get_feature(hdev, field->report); +- break; + } + } + +-- +1.9.1 diff --git a/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend new file mode 100644 index 000000000..8c0073538 --- /dev/null +++ b/meta-agl-bsp/meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi_4.4.bbappend @@ -0,0 +1,18 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" + +LINUX_VERSION = "4.4.16" + +SRCREV = "26550dcfb86b0308a99f726abbfb55abb1b0f78c" + +SRC_URI_append = "\ + file://0001-rpi-defconfig.patch \ + ${@base_conditional('USE_FAYTECH_MONITOR', '1', 'file://0002-faytech-fix-rpi.patch', '', d)} \ +" + +CMDLINE_append = " usbhid.mousepoll=0" + +KERNEL_MODULE_AUTOLOAD += "snd-bcm2835" +KERNEL_MODULE_AUTOLOAD += "hid-multitouch" + +RDEPENDS_${PN} += "kernel-module-snd-bcm2835" +PACKAGES += "kernel-module-snd-bcm2835" -- cgit 1.2.3-korg