I'm building image from sources as described in the manual.
But I am not sure that installed after sysupgrade image also updated the kernel. At least once I've got kernel and modules mismatch ("could not find modules for ... kernel version").
So, the question is, where in the sources the kernel version is written. To compare it with uname -rv output. (And the next question, if it differs what to do.)
When I got tge problem, I had to tftp the factory image from openwrt.org, and then sysupgrade to my built image. At least it works. (Kernel version the same or upgraded? Or not too different in number?)
technically, they newer will, there will always be a mismatch.
as I said, snapshot builds are daily, even for people installing images from openwrt.org, everyone will get a kernel version mismatch error after < 24h.
want to avoid it, use stable, or refresh, recompile and reinstall every 24h.
I do not quite understand what are you recommending.
I do
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make
But then, when I install the successfully built (without errors) sysupgrade image, not everytime everything is actually updated, for example, kernel sometimes stays the same old, but LUCi is updated and modules too. So, I had got a version mismatch problem at least once.
I am not sure this occurs every time, so was the first question: how to compare installed kernel version uname -vr with the version from sources I was compiling.
And, obviously, the second question: how to solve the problem if it occurs?
May be some "dangerous" options during menuconfig step which I should be aware?
Typical mismatches are from trying to use opkg, so I pointed at that. Sorry, if opkg is unrelated.
If you build everything from sources with the full toolchain (from a clean slate after a make clean), you should always get a coherent image, as everything is built at the same time.
As your problem is related to the actual build, I suspect that some build artefacts are from a different build run. You need a "make clean" before the build to ensure a clean build.
(Your commands looked ok otherwise. A "make menuconfig" or "make defconfig" is needed for dependency check after a source update, and you had that.)
I suppose, I could have problem in sysupgrade process itself. The initial installation on that router was not that easy also. Had to use initramfs image in between.
As far as I've found out, kernel version could be checked in a built image if one open it like a tar file.
So, I will watch the situation and do make cleandir sometimes instead of just make clean.