Unfortunately, it is a necessity due to source diversity. Packaging script from kernel 3.4.y is very different from the one from 4.17.y. Then there are small changes in between. If someone would dig into and clean up this mess, we could end up probably with 4 different patches + a patch that differentiate our DEV and NEXT kernel branch naming. Since all this mess works, upstream changes in this sections are extremely rare ... we don't touch it.
I use this procedure to reproduce the issue:
systemctl stop ntp
dats -s "2017-07-25T12:34:27+00:00"
cd /usr/src/linux-headers-4.14.52-sunxi/
make scripts
This result into make doing an infinite loop while complaining about files that has modification time in the future.
Then I tried to use this command to fix the issue:
find scripts/ -type f -exec touch {} \;
This reduce the number of complains but still cause an infinite loop. I also tried to touch only make related files, without more success. Actually the generic way to solve the issue is this command:
find -type f -exec touch {} \;
This fix the infinite loop, even if a few complains remains about some files outside of the actual directory. But this is very slow, especially on my low power Orange Pi Zero that is purposely running at the fixed very low 240 MHz processor frequency (USB powered with a lot of sensors).
But I have found that the following command both solve the issue and is very fast:
find -type f -exec touch {} +
The execution time go from 311 seconds to only 4.5 seconds, about 70 time faster !
So I suggest to add this command into the linux-headers package postinst script, just before calling the 'make -s scripts'.