Embedded: patch buildroot to build Mesa3D with Pi 5 support

This commit is contained in:
Floris Bos 2023-10-16 22:14:16 +02:00
parent af5828e6e2
commit 40a73c3797
6 changed files with 156 additions and 7 deletions

View file

@ -7,6 +7,7 @@ BUILDROOT_TAR=buildroot-20231002.tar.bz2
if [ ! -e $BUILDROOT ]; then if [ ! -e $BUILDROOT ]; then
tar xjf $BUILDROOT_TAR tar xjf $BUILDROOT_TAR
patch -p0 < buildroot-mesa3d-pi5.patch
fi fi
if [ ! -e $BUILDROOT/.config ]; then if [ ! -e $BUILDROOT/.config ]; then

View file

@ -0,0 +1,150 @@
diff -urN buildroot/package/mesa3d.orig/0004-Fix-uClibc-build.patch buildroot/package/mesa3d/0004-Fix-uClibc-build.patch
--- buildroot/package/mesa3d.orig/0004-Fix-uClibc-build.patch 2023-10-01 23:05:28.000000000 +0200
+++ buildroot/package/mesa3d/0004-Fix-uClibc-build.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,69 +0,0 @@
-From 09ce52fe375a6fc1ccf51b6b691aaa2c3f53fbd5 Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd.kuhls@t-online.de>
-Date: Fri, 3 Jun 2022 16:26:03 +0200
-Subject: [PATCH] Fix uClibc build
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Fixes build errors with uClibc and gcc-9.3.0:
-
-../src/gallium/drivers/lima/lima_texture.c:47:15: error: expected
- declaration specifiers or ... before __builtin_offsetof
- 47 | static_assert(offsetof(lima_tex_desc, va) == 24,
- "lima_tex_desc->va offset isn't 24");
-
-../src/egl/main/egldisplay.c: In function _eglGetNativePlatformFromEnv:
- ../src/egl/main/egldisplay.c:101:4: error: implicit declaration of
- function static_assert [-Werror=implicit-function-declaration] 101 |
- static_assert(ARRAY_SIZE(egl_platforms) == _EGL_NUM_PLATFORMS,
-
-../src/util/macros.h:74:4: error: implicit declaration of function
- static_assert [-Werror=implicit-function-declaration]
- 74 | static_assert(cond, #cond); \
- | ^~~~~~~~~~~~~
-
-Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13898
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
----
- src/util/compiler.h | 10 ++++++++++
- src/util/macros.h | 1 +
- 2 files changed, 11 insertions(+)
-
-diff --git a/src/util/compiler.h b/src/util/compiler.h
-index d184ad455af..b5c56807acc 100644
---- a/src/util/compiler.h
-+++ b/src/util/compiler.h
-@@ -36,6 +36,16 @@
-
- #include <assert.h>
-
-+/*
-+ * C11 static_assert() macro
-+ * assert.h only defines that name for C11 and above
-+ */
-+#if !defined(__cplusplus)
-+#ifndef static_assert
-+#define static_assert _Static_assert
-+#endif
-+#endif
-+
- #include "util/macros.h"
-
-
-diff --git a/src/util/macros.h b/src/util/macros.h
-index 22b18303826..8f73ee72693 100644
---- a/src/util/macros.h
-+++ b/src/util/macros.h
-@@ -27,6 +27,7 @@
- #include <stddef.h>
- #include <stdint.h>
- #include <stdio.h>
-+#include "util/compiler.h"
-
- /* Compute the size of an array */
- #ifndef ARRAY_SIZE
---
-2.34.1
-
diff -urN buildroot/package/mesa3d.orig/0006-meson-ensure-i915-Gallium-driver-includes-Intel-sour.patch buildroot/package/mesa3d/0006-meson-ensure-i915-Gallium-driver-includes-Intel-sour.patch
--- buildroot/package/mesa3d.orig/0006-meson-ensure-i915-Gallium-driver-includes-Intel-sour.patch 2023-10-01 23:05:28.000000000 +0200
+++ buildroot/package/mesa3d/0006-meson-ensure-i915-Gallium-driver-includes-Intel-sour.patch 1970-01-01 01:00:00.000000000 +0100
@@ -1,46 +0,0 @@
-From cd861b7f38e448822ce765aee61304d1e0a3a8b5 Mon Sep 17 00:00:00 2001
-From: James Knight <james.d.knight@live.com>
-Date: Thu, 13 Apr 2023 16:38:51 -0400
-Subject: meson: ensure i915 Gallium driver includes Intel sources
-
-Ensure builds flag the use of Intel sources when the i915 Gallium driver
-is configured (`-Dgallium-drivers=i915`). Otherwise, a build may fail if
-other Intel-based configuration options are not enabled:
-
- ./src/gallium/winsys/i915/drm/meson.build:21:0: ERROR: Unknown variable "libintel_common".
-
-Signed-off-by: James Knight <james.d.knight@live.com>
-Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22490>
-
-Upstream: https://gitlab.freedesktop.org/mesa/mesa/-/commit/cd861b7f38e448822ce765aee61304d1e0a3a8b5
-
-Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
----
- meson.build | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-(limited to 'meson.build')
-
-diff --git a/meson.build b/meson.build
-index 23d2d965b37..a3e3c5478a8 100644
---- a/meson.build
-+++ b/meson.build
-@@ -245,7 +245,14 @@ with_microsoft_vk = _vulkan_drivers.contains('microsoft-experimental')
- with_any_vk = _vulkan_drivers.length() != 0
-
- with_any_broadcom = with_gallium_vc4 or with_gallium_v3d or with_broadcom_vk
--with_any_intel = with_intel_vk or with_intel_hasvk or with_gallium_iris or with_gallium_crocus or with_intel_tools
-+with_any_intel = [
-+ with_gallium_crocus,
-+ with_gallium_i915,
-+ with_gallium_iris,
-+ with_intel_hasvk,
-+ with_intel_tools,
-+ with_intel_vk,
-+].contains(true)
-
- if with_swrast_vk and not with_gallium_softpipe
- error('swrast vulkan requires gallium swrast')
---
-cgit v1.2.1
-
diff -urN buildroot/package/mesa3d.orig/mesa3d.hash buildroot/package/mesa3d/mesa3d.hash
--- buildroot/package/mesa3d.orig/mesa3d.hash 2023-10-01 23:05:28.000000000 +0200
+++ buildroot/package/mesa3d/mesa3d.hash 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-# From https://lists.freedesktop.org/archives/mesa-announce/2023-September/000730.html
-sha256 45434ff91a709844130a3174d9c0ef39c6b50725b2bb0c13e736f36134db14ad mesa-23.1.8.tar.xz
-sha512 02dc6f8b10dd3827a2b62fba3035726b1b60ec0c3188817deea2ad14f80f332a37272e9f15c5f653f20cecb14f8ff91697d73c89afc83674c19b686a674b677d mesa-23.1.8.tar.xz
-# License
-sha256 a00275a53178e2645fb65be99a785c110513446a5071ff2c698ed260ad917d75 docs/license.rst
diff -urN buildroot/package/mesa3d.orig/mesa3d.mk buildroot/package/mesa3d/mesa3d.mk
--- buildroot/package/mesa3d.orig/mesa3d.mk 2023-10-01 23:05:28.000000000 +0200
+++ buildroot/package/mesa3d/mesa3d.mk 2023-10-16 22:07:23.863228341 +0200
@@ -4,10 +4,10 @@
#
################################################################################
-# When updating the version, please also update mesa3d-headers
-MESA3D_VERSION = 23.1.8
-MESA3D_SOURCE = mesa-$(MESA3D_VERSION).tar.xz
-MESA3D_SITE = https://archive.mesa3d.org
+# gitid that has Pi 5 support
+MESA3D_VERSION = cba898a53059b12b948fba7c69634a033c6dccad
+MESA3D_SITE = https://gitlab.freedesktop.org/mesa/mesa.git
+MESA3D_SITE_METHOD = git
MESA3D_LICENSE = MIT, SGI, Khronos
MESA3D_LICENSE_FILES = docs/license.rst
MESA3D_CPE_ID_VENDOR = mesa3d

View file

@ -22,7 +22,7 @@ mkdir -p /var/run
dhcpcd -f /etc/dhcpcd.conf --noarp 2>/dev/null & dhcpcd -f /etc/dhcpcd.conf --noarp 2>/dev/null &
if grep -q debugconsole /proc/cmdline; then if grep -q debugconsole /proc/cmdline; then
/sbin/getty -L ttyAMA0 0 vt100 & /sbin/getty -L console 0 vt100 &
fi fi
if grep -q blockingconsole /proc/cmdline; then if grep -q blockingconsole /proc/cmdline; then

View file

@ -2,6 +2,8 @@ BR2_aarch64=y
BR2_cortex_a72=y BR2_cortex_a72=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_SSP_NONE=y
BR2_FORTIFY_SOURCE_NONE=y
BR2_INIT_NONE=y BR2_INIT_NONE=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_ROOTFS_MERGED_USR=y BR2_ROOTFS_MERGED_USR=y
@ -10,7 +12,7 @@ BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_IMAGER_PATH)/board/overlay/"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_IMAGER_PATH)/board/post-build.sh" BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_IMAGER_PATH)/board/post-build.sh"
BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,2ff65ffbdeb0c8764985af19df2a687a126136f4)/linux-2ff65ffbdeb0c8764985af19df2a687a126136f4.tar.gz" BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,2a47ccf97c6a91bc56f8cfb387d47f59cc347dd5)/linux-2a47ccf97c6a91bc56f8cfb387d47f59cc347dd5.tar.gz"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_IMAGER_PATH)/board/bcm2711_defconfig_minus_modules" BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_IMAGER_PATH)/board/bcm2711_defconfig_minus_modules"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_IMAGER_PATH)/board/kernel_config_fragment_imager" BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_IMAGER_PATH)/board/kernel_config_fragment_imager"

View file

@ -1 +1 @@
quiet console=serial0,115200 console=tty1 debugconsole quiet console=tty1 console=serial0,115200 debugconsole

View file

@ -1,7 +1,3 @@
[HDMI:0]
hdmi_pixel_freq_limit=200000000
[HDMI:1]
hdmi_pixel_freq_limit=200000000
[all] [all]
kernel=Image.gz kernel=Image.gz
initramfs rootfs.cpio.zst initramfs rootfs.cpio.zst