Skip to content

Better support kernel patches, out-of-tree defconfig, and defconfig fragments - #173

Open
ts-kris wants to merge 4 commits into
mainfrom
kernel-fixes
Open

Better support kernel patches, out-of-tree defconfig, and defconfig fragments#173
ts-kris wants to merge 4 commits into
mainfrom
kernel-fixes

Conversation

@ts-kris

@ts-kris ts-kris commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Implement support for kernel patches applied from a single folder in lexical order, an out-of-tree defconfig which overrides the in-tree name, and support for defconfig fragments from space separated files.

Most of these were inspired by and take the same form of Buildroot's operations for the same functions.

These features will make customer use of distro-seed a lot more bearable; they can maintain their own defconfig, fragments for a defconfig, or even kernel patches outside of existing trees. Allowing for better kernel customization without needing a whole maintained fork of linux-lts or distro-seed. Simply tracking their changes outside of this tree and maintaining a simple repository of configs and patches.

This will also make the upstreaming process easier long-term. For example, we can better support upstream kernels, and then maintain patches as part of distro-seed (or some other repo) that allow us or customers to build from upstream kernels while also being able to apply patches for better hardware support that would normally be maintained as part of our linux-lts tree.

Testing:

Fragments:

Built stock ts4100_debian_13_headless_defconfig saving the generated kernel .config, then added DS_KERNEL_CONFIG_FRAGMENT_FILES=MAX.fragment ADIS.fragment with the contents

$ cat MAX.fragment 
CONFIG_GPIO_MAX732X=m
$ cat ADIS.fragment 
CONFIG_ADIS16209=y
CONFIG_MMA8452=n

Saved that, and compared the two after building both:

$ diff -u original fragment 
--- original    2026-08-20 21:29:38.854666539 +0000
+++ fragment    2026-08-20 21:41:48.945882305 +0000
@@ -2678,7 +2678,7 @@
 # CONFIG_GPIO_ADNP is not set
 # CONFIG_GPIO_GW_PLD is not set
 # CONFIG_GPIO_MAX7300 is not set
-# CONFIG_GPIO_MAX732X is not set
+CONFIG_GPIO_MAX732X=m
 CONFIG_GPIO_PCA953X=m
 # CONFIG_GPIO_PCA953X_IRQ is not set
 # CONFIG_GPIO_PCA9570 is not set
@@ -4181,7 +4181,7 @@
 # Accelerometers
 #
 # CONFIG_ADIS16201 is not set
-# CONFIG_ADIS16209 is not set
+CONFIG_ADIS16209=y
 # CONFIG_ADXL345_I2C is not set
 # CONFIG_ADXL345_SPI is not set
 # CONFIG_ADXL372_SPI is not set
@@ -4202,7 +4202,7 @@
 # CONFIG_MMA7455_I2C is not set
 # CONFIG_MMA7455_SPI is not set
 # CONFIG_MMA7660 is not set
-CONFIG_MMA8452=y
+# CONFIG_MMA8452 is not set
 # CONFIG_MMA9551 is not set
 # CONFIG_MMA9553 is not set
 # CONFIG_MXC4005 is not set
@@ -4451,6 +4451,9 @@
 CONFIG_IIO_ST_LSM6DSX_SPI=m
 # end of Inertial measurement units
 
+CONFIG_IIO_ADIS_LIB=y
+CONFIG_IIO_ADIS_LIB_BUFFER=y
+

Modules were correctly enabled and disabled as expected.

Out-of-tree defconfig

From the current config, tsimx6ul_minimal_defconfig from the linux-lts tree was copied in as tsimx6ul_min_defconfig to prevent naming confusion, and DS_KERNEL_DEFCONFIG_FILE=tsimx6ul_min_defconfig was set and the image was built. The output .config was compared to a similar .config building the real tsimx6ul_minimal_defconfig. The diff was similar and still had the fragments applied in the correct order.

Kernel patches

The full defconfig from linux-lts was copied in as tsimx6ul_full_defconfig, DS_KERNEL_DEFCONFIG_FILE=tsimx6ul_full_defconfig was set, and DS_KERNEL_PATCH_DIR=kernel_patches was set. In it was a custom patch series of 4 patches generated from git. The patches include a separate devicetree file patched in, and the distro-seed config was updated to also copy this devicetree file to the final output image.

The build succeeded. The live .config was compared to the original and showed valid and expected changes. And the output tarball was extracted and the presence of the proper devicetree was verified.

Fixes #164

Assisted-by: gpt-5.6-terra
Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
Fixes #164

Assisted-by: gpt-5.6-terra
Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
Fixes #172

Assisted-by: gpt-5.6-terra
Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
The rest of the script assumes this is updates/ which on newer
kernels it is, however, the older version of the driver uses extras/
which breaks the build script.

Fixes: 1df160e ("build: install task overlays as local packages")
Signed-off-by: Kris Bahnsen <kris@embeddedTS.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants