- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
通常 printk
不会在 start_kernel
中出现的 console_init
之前打印任何消息。但是启用 early_printk
后,printk
会在控制台初始化之前开始打印消息。现在 printk
的这种行为如何改变,因为我仍在使用 printk
函数来打印调试消息,而不是 early_printk
函数。这个映射是如何完成的?
最佳答案
这不是真正的映射。当启用 early_printk
时,使用与以前相同的 printk()
,在这种情况下只注册新的引导控制台,并且 printk()
在早期启动阶段使用它。
看arch/arm/kernel/early_printk.c .你可以看到:
register_console()
函数注册新控制台CON_BOOT
标志,因此一旦注册了真正的控制台,它就会自动注销early_write()
函数进行,该函数又使用 printch()
函数,该函数分别为每个平台实现Where in kernel source the
early_console
is disabled after kernel console initialization?
在 register_console() 中完成功能:
if (bcon &&
((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV) &&
!keep_bootcon) {
/* We need to iterate through all boot consoles, to make
* sure we print everything out, before we unregister them.
*/
for_each_console(bcon)
if (bcon->flags & CON_BOOT)
unregister_console(bcon);
}
上面代码中的 unregister_console()
函数禁用所有启动控制台(当注册真实控制台时)。
And where is the real console getting registered?
真实控制台使用相同的方法进行注册 -- register_console()
函数。例如:
CONFIG_SERIAL_8250
作为真正的控制台register_console()
的位置;它在 univ8250_console_init() 中完成功能Is there any way to keep boot consoles up after console initialization and disable real console?
仅当注册了真实控制台时,引导控制台才会自动取消注册。按照这个逻辑,您只需要禁用真正的控制台,以保持启动控制台的完整性。
因此,您需要做的是找出在您的情况下哪个驱动程序用于真正的控制台。您可以查看您的 .config
文件或您的开发板的 *_defconfig
文件。一旦找到它,只需在配置中禁用该驱动程序并重建内核。
如果在这样做之后你一直观察到一些真实控制台的注册,你需要在 register_console()
中添加一些调试打印,以找出正在注册的驱动程序,然后在你的配置。
关于linux - 启用 early_printk 后 Printk 行为发生变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41632166/
据我了解系统控制变量,kernel.printk 中的第一个值是内核消息必须小于的数字才能写入控制台。因此,如果它是 4,那么由此生成的消息将只能通过 dmesg 可见: printk(KERN_IN
我正在尝试从 mm/filemap.c 中打印 __generic_file_write_iter() 中的一些信息. 我修改了函数如下: struct file *file = iocb->ki_f
我有一个关于在 3.10 内核中实现 printk() 的问题。我看到了calls local_irq_save一开始。然后我看到了 calls raw_spin_lock(&logbuf_lock)
我正在为 Linux 内核编写一个系统调用,但到目前为止它并没有像我预期的那样工作(这并不奇怪)。我正在尝试使用 printk 消息在一个函数中对其进行调试,但它们不起作用。然而,单独功能中的功能确实
有没有办法记录/打印内核中的 float 值。它是否取决于运行内核的 FPU? 编译 printk(KERN_DEBUG "error = %f ",floatvalue) 时,出现错误: 对 __a
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
我使用 printk 在内核级别输出中断时间戳,这意味着每个中断一个 printk(在 irg_handler_ 方法中)。在使用那个新内核时,我注意到我的设备运行速度变慢了。 所以我的问题是每个 p
我正在尝试实现我自己的新 schedule()。我想调试我的代码。 我可以在 sched.c 中使用 printk 函数吗? 我使用了 printk 但它不起作用。我错过了什么? 最佳答案 你知道 s
在 Linux 应用程序级别,所有 printf 消息都转到 stdout,所有 err 消息都转到 stderr。在哪里 stderr 通常是无缓冲的, 标准输出是行缓冲的 所以在 kernel s
假设我想使用 printk()在 arch/x86/boot/string.c 内在编译内核之前。我必须包含哪个头文件,以便链接器知道在哪里可以找到 printk() ?我试过 #include 和
只是一个关于内核级别 printk() 函数的快速问题,如果我调用它,消息将打印到哪里?(我在 i386 架构上使用 Ubuntu 并下载最新的内核) 到处都找不到, 如果有人也可以为我指出正确的方向
我在内核代码中放了一些调试信息。 已经检查了/var/log/messages、dmesg 并且那里没有这样的转储。 syslogd 正在机器上运行 我还将/proc/sys/kernel/print
当我 printk(KERN_INFO, ...) 时,我得到这样的结果: [116584.000183] ... 方括号之间的数字到底是多少? 最佳答案 启动后的秒数。您可以控制是否使用内核配置中的
我正在做一些内核修改,并试图让 printk 将信息输出回控制台。我用它传递了任何内核日志级别,即使是最高日志级别,也没有在控制台上正确地返回任何响应。 我检查过,printk 的当前日志配置是 4
我在我的内核可加载模块中使用 printk 来记录系统调用的参数。对于每个系统调用,使用几个 printk 来打印变量,它们以“\t”作为分隔符出现。要将内核日志缓冲区中的数据重定向到系统/var/l
从原子上下文调用 printk 是否安全,例如IRQ? 最佳答案 是的,明确允许在原子上下文中使用它;该函数实际上非常强大,因为它也可能在紧急情况下被调用。 printk 只会尝试锁定控制台来打印消息
systemd 的 journald 支持内核风格的日志记录。因此,该服务可以在 stderr 上写入以“”开头的消息,它们将像信息一样被解析,“”- 警告。 但是在开发服务时,它是在 systemd
我试图让我的模块显示一个printk。我是新手,所以我可能会遇到一些编程错误。这是我的模块 C 文件: #include #include #include asmlinkage long sy
我是 Linux 内核开发的新手,当我尝试通过在 timekeep.c 文件中添加一个 printk 函数来修改系统调用函数时,比如 printk("BEGIN!$$$$$\n"); dmesg 实
printk()打印的信息只有在Alt+Ctrl+F1 ~ F7 控制台。这些控制台非常不方便调试,因为它们无法回滚。我正在使用 KDE 桌面环境和控制台终端,如何将 printk() 消息重定向到控
我是一名优秀的程序员,十分优秀!