📄 silent_booting.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><div class="toc"><div class="tocheader toctoggle" id="toc__header">Table of Contents</div><div id="toc__inside"><ul class="toc"><li class="level1"><div class="li"><span class="li"><a href="#silencing_the_boot_process" class="toc">Silencing the boot process</a></span></div><ul class="toc"><li class="clear"><ul class="toc"><li class="level3"><div class="li"><span class="li"><a href="#u-boot" class="toc">U-Boot</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#linux_kernel" class="toc">Linux Kernel</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#busybox_shells" class="toc">Busybox shells</a></span></div></li><li class="level3"><div class="li"><span class="li"><a href="#disabling_the_console" class="toc">Disabling the console</a></span></div></li></ul></li></ul></li></ul></div></div><h1><a name="silencing_the_boot_process" id="silencing_the_boot_process">Silencing the boot process</a></h1><div class="level1"><p> All the output sent to the console is useful when developing your application, but when deploying the final product, this may be quite undesirable. Since the software running on the board is actually a set of distinct code bases, we have to tweak a few different places for a truly silent boot.</p></div><!-- SECTION [1-339] --><h3><a name="u-boot" id="u-boot">U-Boot</a></h3><div class="level3"><p> The u-boot code already supports the notion of booting up silently. The document README.silent covers most of the details: </p><p>Some things to note:</p><ul><li class="level1"><div class="li"> define CONFIG_SILENT_CONSOLE to enable support for silent mode</div></li><li class="level1"><div class="li"> set the u-boot envvar <code>silent</code> to disable u-boot output</div></li><li class="level1"><div class="li"> you should probably tweak the bootdelay to 1 second (or turn it off)</div></li><li class="level1"><div class="li"> you can still interrupt u-boot by pressing the specified key</div></li></ul></div><!-- SECTION [340-825] --><h3><a name="linux_kernel" id="linux_kernel">Linux Kernel</a></h3><div class="level3"><p> The linux kernel too supports quieting the console output. The kernel-parameters.txt covers this briefly: </p><p>So you can simply add <code>loglevel=0</code> to the u-boot <code>bootargs</code> envvar and the kernel will do the rest.</p><p>If, at runtime, you wish to change the console log level, you can do this a few ways:</p><ul><li class="level1"><div class="li"> from the shell, run <code>dmesg -n #</code> to set the log level to #</div></li><li class="level1"><div class="li"> from your code, call the syslog kernel function</div></li></ul><p> The syslog kernel function is pretty easy to utilize: </p><pre class="code c"><span class="co2">#include <unistd.h></span><span class="co2">#include <linux/unistd.h></span><span class="co2">#include <errno.h></span> _syscall3<span class="br0">(</span><span class="kw4">int</span>, syslog, <span class="kw4">int</span>, type, <span class="kw4">char</span> *, bufp, <span class="kw4">int</span>, len<span class="br0">)</span> <span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span><span class="br0">{</span> <span class="coMULTI">/* Set the console loglevel to 3 */</span> syslog<span class="br0">(</span><span class="nu0">8</span>, <span class="nu0">0</span>, <span class="nu0">3</span><span class="br0">)</span>;<span class="br0">}</span></pre><p>See the syslog(2) man page for more in-depth details of the syslog() system call.</p></div><!-- SECTION [826-1716] --><h3><a name="busybox_shells" id="busybox_shells">Busybox shells</a></h3><div class="level3"><p> The busybox shell will display some helpful text at startup. This message can be disabled via the uClinux Vendor menuconfig: </p><pre class="code">uClinux-dist$ make config_menuconfig</pre><p>Then navigate the menus: </p><pre class="code">BusyBox ---> [*] sh: Hide message on interactive shell startup</pre></div><!-- SECTION [1717-2026] --><h3><a name="disabling_the_console" id="disabling_the_console">Disabling the console</a></h3><div class="level3"><p> If you wish to disable the console altogether, then just add <code>console=</code> to the kernel command line option. If you enable the <code>CONFIG_SILENT_LINUX</code> build option in u-boot, then u-boot will automatically add this for you to the <code>bootargs</code> variable. </p></div><!-- SECTION [2027-] --></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -