[v3,8/8] linux-starfive: Update to 6.6 upstream queue

Message ID e59d47ded4325f0db3b7b26a79457dacfe9fdee8.1705490373.git.jan.kiszka@siemens.com
State Accepted, archived
Headers show
Series Fix and update VisionFive 2 | expand

Commit Message

Jan Kiszka Jan. 17, 2024, 11:19 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

This is compatible with Debian sid, maintains all enabled board
features, and fixes the out-of-tree module build.

We currently need one extra patch (that is also pending upstream) to fix
breakages in the EFI stub with latest binutils coming via sid.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 .../conf/machine/starfive-visionfive2.conf    |  2 +-
 ...sure-GP-relative-addressing-is-not-u.patch | 32 +++++++++++++++++++
 .../linux/files/starfive2_extra.cfg           |  6 ++--
 .../linux/linux-starfive_5.15-visionfive2.bb  | 19 -----------
 .../linux/linux-starfive_6.6-visionfive2.bb   | 21 ++++++++++++
 5 files changed, 58 insertions(+), 22 deletions(-)
 create mode 100644 meta-isar/recipes-kernel/linux/files/0001-riscv-efistub-Ensure-GP-relative-addressing-is-not-u.patch
 delete mode 100644 meta-isar/recipes-kernel/linux/linux-starfive_5.15-visionfive2.bb
 create mode 100644 meta-isar/recipes-kernel/linux/linux-starfive_6.6-visionfive2.bb

Patch

diff --git a/meta-isar/conf/machine/starfive-visionfive2.conf b/meta-isar/conf/machine/starfive-visionfive2.conf
index c7f72bb3..ed2828f1 100644
--- a/meta-isar/conf/machine/starfive-visionfive2.conf
+++ b/meta-isar/conf/machine/starfive-visionfive2.conf
@@ -15,5 +15,5 @@  IMAGER_INSTALL:wic += " \
 IMAGER_BUILD_DEPS += "u-boot-starfive-visionfive2"
 
 # DTB file for booting
-DTB_VISIONFIVE2 = "jh7110-visionfive-v2.dtb"
+DTB_VISIONFIVE2 = "jh7110-starfive-visionfive-2-v1.3b.dtb"
 DTB_FILES = "starfive/${DTB_VISIONFIVE2}"
diff --git a/meta-isar/recipes-kernel/linux/files/0001-riscv-efistub-Ensure-GP-relative-addressing-is-not-u.patch b/meta-isar/recipes-kernel/linux/files/0001-riscv-efistub-Ensure-GP-relative-addressing-is-not-u.patch
new file mode 100644
index 00000000..7db1c70f
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/files/0001-riscv-efistub-Ensure-GP-relative-addressing-is-not-u.patch
@@ -0,0 +1,32 @@ 
+From 80a71d31e35ac5f90e85b0b52cd080a974b91e8d Mon Sep 17 00:00:00 2001
+From: Jan Kiszka <jan.kiszka@siemens.com>
+Date: Fri, 12 Jan 2024 17:17:27 +0100
+Subject: [PATCH] riscv/efistub: Ensure GP-relative addressing is not used
+
+The cflags for the RISC-V efistub were missing -mno-relax, thus were
+under the risk that the compiler could use GP-relative addressing. That
+happened for _edata with binutils-2.41 and kernel 6.1, causing the
+relocation to fail due to an invalid kernel_size in handle_kernel_image.
+It was not yet observed with newer versions, but that may just be luck.
+
+Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
+---
+ drivers/firmware/efi/libstub/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
+index a1157c2a7170..f54715672d52 100644
+--- a/drivers/firmware/efi/libstub/Makefile
++++ b/drivers/firmware/efi/libstub/Makefile
+@@ -28,7 +28,7 @@ cflags-$(CONFIG_ARM)		+= -DEFI_HAVE_STRLEN -DEFI_HAVE_STRNLEN \
+ 				   -DEFI_HAVE_MEMCHR -DEFI_HAVE_STRRCHR \
+ 				   -DEFI_HAVE_STRCMP -fno-builtin -fpic \
+ 				   $(call cc-option,-mno-single-pic-base)
+-cflags-$(CONFIG_RISCV)		+= -fpic
++cflags-$(CONFIG_RISCV)		+= -fpic -mno-relax
+ cflags-$(CONFIG_LOONGARCH)	+= -fpie
+ 
+ cflags-$(CONFIG_EFI_PARAMS_FROM_FDT)	+= -I$(srctree)/scripts/dtc/libfdt
+-- 
+2.35.3
+
diff --git a/meta-isar/recipes-kernel/linux/files/starfive2_extra.cfg b/meta-isar/recipes-kernel/linux/files/starfive2_extra.cfg
index d11c28de..9649ec87 100644
--- a/meta-isar/recipes-kernel/linux/files/starfive2_extra.cfg
+++ b/meta-isar/recipes-kernel/linux/files/starfive2_extra.cfg
@@ -1,3 +1,5 @@ 
 # additional configuration to support stock debian userlands
-CONFIG_BINFMT_MISC=y
-CONFIG_SQUASHFS=m
+CONFIG_NLS_ISO8859_1=m
+
+# only complicates the build
+# CONFIG_MODULE_COMPRESS_ZSTD is not set
diff --git a/meta-isar/recipes-kernel/linux/linux-starfive_5.15-visionfive2.bb b/meta-isar/recipes-kernel/linux/linux-starfive_5.15-visionfive2.bb
deleted file mode 100644
index e9e0bf4a..00000000
--- a/meta-isar/recipes-kernel/linux/linux-starfive_5.15-visionfive2.bb
+++ /dev/null
@@ -1,19 +0,0 @@ 
-#
-# Copyright (c) Siemens AG, 2023
-#
-# SPDX-License-Identifier: MIT
-
-require recipes-kernel/linux/linux-custom.inc
-
-SRC_URI += " \
-    git://github.com/starfive-tech/linux.git;protocol=https;branch=JH7110_VisionFive2_devel;destsuffix=linux-visionfive-${PV} \
-    file://starfive2_extra.cfg"
-SRCREV = "a87c6861c6d96621026ee53b94f081a1a00a4cc7"
-
-S = "${WORKDIR}/linux-visionfive-${PV}"
-
-KERNEL_DEFCONFIG = "starfive_visionfive2_defconfig"
-
-LINUX_VERSION_EXTENSION = "-isar"
-
-COMPATIBLE_MACHINE = "starfive-visionfive2"
diff --git a/meta-isar/recipes-kernel/linux/linux-starfive_6.6-visionfive2.bb b/meta-isar/recipes-kernel/linux/linux-starfive_6.6-visionfive2.bb
new file mode 100644
index 00000000..f4dd5c9a
--- /dev/null
+++ b/meta-isar/recipes-kernel/linux/linux-starfive_6.6-visionfive2.bb
@@ -0,0 +1,21 @@ 
+#
+# Copyright (c) Siemens AG, 2023-2024
+#
+# SPDX-License-Identifier: MIT
+
+require recipes-kernel/linux/linux-custom.inc
+
+SRC_URI += " \
+    https://github.com/starfive-tech/linux/archive/${SRCREV}.tar.gz;downloadfilename=linux-starfive-${SRCREV}.tar.gz \
+    file://0001-riscv-efistub-Ensure-GP-relative-addressing-is-not-u.patch \
+    file://starfive2_extra.cfg"
+SRCREV = "9fe004eaf1aa5b23bd5d03b4cfe9c3858bd884c4"
+SRC_URI[sha256sum] = "9eaf7659aa57e2c5b399b7b33076f1376ec43ef343680e0a57e0a2a9bef6c0ae"
+
+S = "${WORKDIR}/linux-${SRCREV}"
+
+KERNEL_DEFCONFIG = "starfive_visionfive2_defconfig"
+
+LINUX_VERSION_EXTENSION = "-isar"
+
+COMPATIBLE_MACHINE = "starfive-visionfive2"