-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
What happened?
I added some userpatches to debug an issue, and somehow one particular source file was not recompiled and was stuck at a previous version of my patch.
Debugging the build framework showed that:
- The patch I was working on was applied, which updated the timestamp of the source file to the mtime of the patch, as expected.
- Then another patch (that I added earlier and was finished, but happened to sort after the other patch)was applied, which updated the timestamp of the source file back to an older timestamp.
Effectively this means that when I modify the first patch, the source file contents change, but the timestamp stays the same, so the kernel Makefile does not recompile it.
To fix this, I guess the patching code should keep a dict of files patched and timestamps to apply at the end, so it can take the newest timestamp of all patches modifying a file? Alternatively, it could read the timestamp before applying the patch, and only update the file if the patch timestamp is newer than the original file timestamp.
I was running this on v25.11.1 (since that was running on my test board). Haven't retested this on main, but given patching_utils.py has not been modified since 2024, I'm confident the issue still exists on main.
How to reproduce?
- Add two patches to userpatches (or probably also patch) that touch the same file
- Compile (I used
./compile.sh BOARD=rockpi-s BRANCH=current DEBUG=yes kernel) - Modify the first patch.
- Compile again.
- See that the file is not recompiled.
Here's a snippet of my log output (with some added ls -l calls and log lines to show what happens exactly).
[[ First patch ]]
-> 039/193: debug(:1) (+25/-31)[5M] {gpio-rockchip.c, gpiolib.c, rk3308.dtsi, gpiolib-of.c, core.c}
Patch ->debug(:1) (+25/-31)[5M] {gpio-rockchip.c, gpiolib.c, rk3308.dtsi, gpiolib-of.c, core.c}<- needs rebase: offset/fuzz used during apply.
Patch /armbian/userpatches/kernel/archive/rockchip64-6.12/debug.patch is newer than root Makefile, using patch date
-rw-rw-r-- 1 root root 20609 Dec 5 10:02 /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c
touching /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c / 1764928816.3029776
-rw-rw-r-- 1 root root 20609 Dec 5 10:00 /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c
[[ Second patch ]]
-> 042/193: fix-gpio-config(:1) (+1/-1)[1M] {gpio-rockchip.c}
Patch /armbian/userpatches/kernel/archive/rockchip64-6.12/fix-gpio-config.patch is newer than root Makefile, using patch date
-rw-rw-r-- 1 root root 20643 Dec 5 10:02 /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c
touching /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c / 1764856353.3521569
-rw-rw-r-- 1 root root 20643 Dec 4 13:52 /armbian/cache/sources/linux-kernel-worktree/6.12__rockchip64__arm64/drivers/gpio/gpio-rockchip.c
Branch
other (only relevant in corner cases)
On which host OS are you running the build script and observing this problem?
Other
Are you building on Windows WSL2?
- Yes, my Ubuntu/Debian/OtherOS is running on WSL2
Relevant log URL
No response
Code of Conduct
- I agree to follow this project's Code of Conduct