第三种形式:log_info("starting version " VERSION);
[ 2.755560] systemd-udevd[96]: starting version 204
cheng@chpc:~/download/systemd-218$ grep -r "starting version" ./*
./src/udev/udevd.c: log_info("starting version " VERSION);
/usr/src/linux-3.18.4/include/linux/syslog.h中有do_syslog()函数的声明
int do_syslog(int type, char __user *buf, int count, bool from_file);
/usr/src/linux-3.18.4/kernel/printk/printk.c文件中有do_syslog()函数的定义
[ 1.496584] Trying to unpack rootfs image as initramfs...
initrd.img.version里面init脚本会调用
usr/share/initramfs-tools/scripts/init-top/udev脚本
udev脚本有对systemd-udevd的调用
/lib/systemd/systemd-udevd --daemon --resolve-names=never
[ 2.755560] systemd-udevd[96]: starting version 204
第一种形式: pr_notice("%s", linux_banner);
init/main.c 中有
pr_notice("%s", linux_banner);
setup_arch(&command_line);
mm_init_cpumask(&init_mm);
setup_command_line(command_line);
setup_nr_cpu_ids();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
build_all_zonelists(NULL, NULL);
page_alloc_init();
pr_notice("Kernel command line: %s\n", boot_command_line);
version.c 中有linux_banner[]定义
const char linux_banner[] =
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
dmesg中的信息显示:
[ 0.000000] Linux version 3.18.4 (root@chpc) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #1 SMP Wed Feb 4 08:53:13 CST 2015
...
...
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.18.4 root=UUID=588558ea-103e-4a08-9e09-1b23f25c9ee7 ro quiet splash vt.handoff=7
[ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
第二种形式:printk(KERN_INFO "virtual kernel memory layout:\n"
cheng@chpc:/usr/src/linux-3.18.4$ grep -rn "virtual kernel memory layout" ./*
./arch/xtensa/mm/init.c:330: pr_info("virtual kernel memory layout:\n"
./arch/x86/mm/init_32.c:762
printk(KERN_INFO "virtual kernel memory layout:\n"
" fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
#ifdef CONFIG_HIGHMEM
" pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
#endif
" vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
" lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
" .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
" .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
" .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
FIXADDR_START, FIXADDR_TOP,
(FIXADDR_TOP - FIXADDR_START) >> 10,
#ifdef CONFIG_HIGHMEM
PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
(LAST_PKMAP*PAGE_SIZE) >> 10,
#endif
VMALLOC_START, VMALLOC_END,
(VMALLOC_END - VMALLOC_START) >> 20,
(unsigned long)__va(0), (unsigned long)high_memory,
((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
(unsigned long)&__init_begin, (unsigned long)&__init_end,
((unsigned long)&__init_end -
(unsigned long)&__init_begin) >> 10,
(unsigned long)&_etext, (unsigned long)&_edata,
((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
(unsigned long)&_text, (unsigned long)&_etext,
((unsigned long)&_etext - (unsigned long)&_text) >> 10);
[ 0.000000] .text : 0xc1000000 - 0xc149861e (4705 kB)
第四种形式: pr_warn("%s: Unknown symbol %s (err %li)\n",
pr_warn("%s: Unknown symbol %s (err %li)\n",
mod->name, name, PTR_ERR(ksym));
grep -rn "Unknown symbol" ./*
./arch/arm/kernel/unwind.c:160: pr_warn("unwind: Unknown symbol address %08lx\n", addr);
./arch/mips/kernel/module.c:221: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/mips/kernel/module-rela.c:132: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/parisc/kernel/module.c:572: printk(KERN_WARNING "%s: Unknown symbol %s\n",
./arch/parisc/kernel/module.c:708: printk(KERN_WARNING "%s: Unknown symbol %s\n",
匹配到二进制文件 ./arch/x86/boot/compressed/vmlinux.bin
./kernel/module.c:1981: pr_warn("%s: Unknown symbol %s (err %li)\n",
匹配到二进制文件 ./kernel/module.o
匹配到二进制文件 ./kernel/built-in.o
./scripts/kconfig/symbol.c:868: * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
匹配到二进制文件 ./vmlinux
匹配到二进制文件 ./vmlinux.o
[ 21.511318] radeon: Unknown symbol cfb_copyarea (err 0)
[ 21.522742] radeon: Unknown symbol cfb_imageblit (err 0)
[ 21.522941] radeon: Unknown symbol cfb_fillrect (err 0)