Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to apply my own kernel patch

Featured Replies

Hello,

 

I try build kernel for NanopiNeo board with user kernel patch, but I don't understand with path needed put my patch. In previous version armbian's builds I just put files to userpatches/kernel/sunxi-current how it described in docs. But now with current version Armbian build system it's not working.

I put my custom linux-sunxi-current.config to userpatches folder, my patch to userpatches/kernel/sunxi-current and try build kernel with command:

./compile.sh BOARD=nanopineo BRANCH=current kernel

I see that linux-sunxi-current.config found and applied but not patch isn't.

  • Author

Is this option used to create a patch and apply it at the same time? I've only used it for making patches, not for building the kernel.
That is, to build the kernel with my patch, I have to use this command:

./compile.sh BOARD=nanopineo BRANCH=current kernel-patch,kernel

?

11 hours ago, nikkov said:

Is this option used to create a patch and apply it at the same time?

 

No it creates your patch, then you have to manually apply.

[🌱] You will find your patch here: [ /home/alistair/build/output/patch/kernel-sunxi64-edge.patch ]
[✨] Now you can manually move the produced patch to your userpatches or core patches to have it included in the next build [ /home/alistair/build/output/patch/kernel-sunxi64-edge.patch ]
[💖] Stopping after creating kernel patch
[🌱] Runtime [ 2:27 min ]

 

I do it this way for sunxi kernels as an example:

 

git -C cache/sources/linux-kernel-worktree/6.2__sunxi64__arm64 format-patch -1 -o ~/build/patch/kernel/archive/sunxi-6.2/patches.armbian/
/home/alistair/build/patch/kernel/archive/sunxi-6.2/patches.armbian/0001-Patching-kernel-sunxi64-files-arch-arm64-boot-dts-al.patch

 

 cd into the directory:

 

mv 0001-Patching-kernel-sunxi64-files-arch-arm64-boot-dts-al.patch <name of your new patch>.patch

 

 

In order to apply the patch during the build you have to change the series files to include your patch.

 

You include(commit) or discard your changes to git as you chose.

 

I don't have a use for userpatches (can't comment whether or not it works 'as expected' in main) as I'm normally doing a specific task that will lead to a commit.

 

I found inconsistencies (1st weeks of main) where patches (output/patch) were included in build even though not implicitly stated with cmd.

 

Hope this somewhat helps!

  • Author

Thank you for your time!

 

6 hours ago, ALIGMSTEN said:

In order to apply the patch during the build you have to change the series files to include your patch.

If I understand correctly, I have to include my patch in one of this files: /build/patch/kernel/archive/sunxi-6.1/series.* or just put it to folder /build/patch/kernel/archive/sunxi-6.1/.

Not a very clear approach, the previous one was more understandable, especially since the userpatches folder is still used.

Edited by nikkov

Yes that's right you must include the file in the directory /sunxi-6.1/patches.armbian and then manually edit the file at patch/kernel/archive/sunxi-6.1/series.conf   series.armbian  to include your new patch.

 

I've not tried userpatches and don't know if it functions or not - perhaps raise an issue if you are sure it not currently working.

 

ADD: I think its correct that placing the file in the top directory series.conf picks it up (was smth like that master)

 

 

For anyone else looking to patch their kernel through userpatches - it seems that (at least with the updated build system that uses the quite complex lib/tools/patching.py to apply patches) you can just drop a patch in `userpatches/kernel/archive/<platform>-<version>/` and it will be picked up (in my case, it was `userpatches/kernel/archive/sunxi-6.7`). No series file needed. I used a patch generated with `git format-patch`, but it seems that the script supports different formats, even mbox with multiple patches inside.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.