[Buildroot] [PATCH v2 1/7] linux: Add support for custom license files

Kory Maincent kory.maincent at bootlin.com
Wed Oct 1 14:58:23 UTC 2025


The Linux package was not providing any license file when a custom
Linux version was selected.

Fix this by adding a Kconfig option to specify the license file,
with a default value set to the commonly used license paths.

Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
---

Change in v2:
- Do not show license option if it is not a custom repo
---
 linux/Config.in | 16 ++++++++++++++++
 linux/linux.mk  |  8 ++------
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/linux/Config.in b/linux/Config.in
index 1f1c014ba21fe8ca5f06993f08c6707f6501d9af..6352260cd7d90520964d5ea6fb2714fbf827557d 100644
--- a/linux/Config.in
+++ b/linux/Config.in
@@ -150,6 +150,22 @@ config BR2_LINUX_KERNEL_VERSION
 	default BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION \
 		if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG || BR2_LINUX_KERNEL_CUSTOM_SVN
 
+config BR2_LINUX_KERNEL_CUSTOM_LICENSE_FILES
+	string "Kernel license files"
+	default "COPYING LICENSES/preferred/GPL-2.0 LICENSES/exceptions/Linux-syscall-note"
+	depends on BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG || \
+		   BR2_LINUX_KERNEL_CUSTOM_SVN || BR2_LINUX_KERNEL_CUSTOM_TARBALL
+	help
+	  A space-separated list of license files related to the Linux
+	  kernel package.
+
+config BR2_LINUX_KERNEL_LICENSE_FILES
+	string
+	default BR2_LINUX_KERNEL_CUSTOM_LICENSE_FILES \
+		if BR2_LINUX_KERNEL_CUSTOM_GIT || BR2_LINUX_KERNEL_CUSTOM_HG || \
+		   BR2_LINUX_KERNEL_CUSTOM_SVN || BR2_LINUX_KERNEL_CUSTOM_TARBALL
+	default "COPYING LICENSES/preferred/GPL-2.0 LICENSES/exceptions/Linux-syscall-note"
+
 #
 # Patch selection
 #
diff --git a/linux/linux.mk b/linux/linux.mk
index 0520394931ce7950a750d4f57dab451377886612..c61089bfe040ba9dee9efc00c0ec3cf4f9ef0167 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -6,12 +6,8 @@
 
 LINUX_VERSION = $(call qstrip,$(BR2_LINUX_KERNEL_VERSION))
 LINUX_LICENSE = GPL-2.0
-ifeq ($(BR2_LINUX_KERNEL_LATEST_VERSION),y)
-LINUX_LICENSE_FILES = \
-	COPYING \
-	LICENSES/preferred/GPL-2.0 \
-	LICENSES/exceptions/Linux-syscall-note
-endif
+LINUX_LICENSE_FILES = $(call qstrip,$(BR2_LINUX_KERNEL_LICENSE_FILES))
+
 LINUX_CPE_ID_VENDOR = linux
 LINUX_CPE_ID_PRODUCT = linux_kernel
 LINUX_CPE_ID_PREFIX = cpe:2.3:o

-- 
2.43.0



More information about the buildroot mailing list