It's always bothered me that for some time (perhaps as long as I have been using LFS?) that I could not get the kernel symbols properly loaded by sysklogd, producing a message sequence like this:

Nov 15 15:45:38 www kernel: klogd 1.5.1, log source = /proc/kmsg started.
Nov 15 15:45:38 www kernel: Inspecting /boot/System.map-5.9.8
Nov 15 15:45:38 www kernel: Cannot find map file.

It's a very minor nuisance, but I didn't like it.

It turns out that sysklogd inspects the System.map file but cannot find a particular symbol, one named Version_XXXXXX, where XXXXXX is the encoded Linux version number that corresponds to this map file.

It further turns out that init/version.c is not producing this symbol if CONFIG_KALLSYMS is define. Since it usually IS defined (and kind of should be, at this point), then this doesn't work.

I am certainly not a kernel expert, but as far as I can see, there's no downside to producing this symbol anyway - even if CONFIG_KALLSYMS is defined.

So I removed the check for CONFIG_KALLSYMS not being defined, with this patch included at the end of this email.

When I boot this kernel, I get the following result:

Nov 16 06:28:51 www kernel: Inspecting /boot/System.map-5.9.8
Nov 16 06:28:51 www kernel: Loaded 116685 symbols from /boot/System.map-5.9.8.
Nov 16 06:28:51 www kernel: Symbols match kernel version 5.9.8.

Again, I don't know if I am creating unintended side-effects by allowing this symbol to be defined. I mean, there must have been SOME reason to remove the generation of the "Version_" symbol if KALLSYMS is defined - but I couldn't find it.

Thoughts?

-Joel

diff -Naur linux-5.9.8.orig/init/version.c linux-5.9.8/init/version.c
--- linux-5.9.8.orig/init/version.c 2020-11-10 12:16:17.000000000 -0800
+++ linux-5.9.8/init/version.c  2020-11-16 06:15:48.559481272 -0800
@@ -16,13 +16,11 @@
 #include <linux/version.h>
 #include <linux/proc_ns.h>

-#ifndef CONFIG_KALLSYMS
 #define version(a) Version_ ## a
 #define version_string(a) version(a)

 extern int version_string(LINUX_VERSION_CODE);
 int version_string(LINUX_VERSION_CODE);
-#endif

 struct uts_namespace init_uts_ns = {
        .kref = KREF_INIT(2),

--
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to