在嵌入式Linux系统中,有时需要关闭调试串口,不让调试口输出信息,这也可以保证系统程序的安全。关闭调试串口输出的方法也很简单,可以在uboot阶段通过修改参数来实现,参数设置如下:
setenv bootargs 'mem=756M console=null,115200 initrd=0x82600000,0x700000 , root=/dev/ram0 init=nuxrc mtdparts=hi_sfc:1M(boot),1M(logo),5M(kernel),7M(rootfs),26M(qtlib),12M(app),-(config);hinand:-(nand-user)'
这里面主要是这一句是关闭调试口输出:
console=null
设置完成后记得保存(sav),然后重启设备,通过串口可以看到,内核启动后,调试信息就没有了:
System startup U-Boot 2010.06-dirty (Jun 10 2020 - 10:51:22) Check Flash Memory Controller v100 ... Found SPI Nor(cs 0) ID: 0xc2 0x20 0x1a Block:64KB Chip:64MB Name:"MX25L(512)XX" SPI Nor total size: 64MB SPI Nand(cs 1) ID: 0xc8 0xf4 Name:"5F4GQ4UAYIG" Block:128KB Page:2KB Chip:512MB*1 OOB:64B ECC:4bit/512 ECC provided by Flash Memory Controller SPI Nand total size: 512MB In: serial Out: serial Err: serial 65536 KiB hi_fmc at 0:0 is now current device jpeg decoding ... <<addr=0x82000000, size=0x20000, vobuf=0x9f000000>> mmu_enable <<imgwidth=1024, imgheight=768, linebytes=2048>> decode success!!!! decode jpeg! stMaxRect.u32Width:1024, stMaxRect.u32Height:768. HDMI_INFO:DispFmt2HdmiTiming[402] ,Non CEA video timing:17 HDMI_INFO:Hdmi_PixelFreqSearch[146] ,u32Fmt17. dev 0 opened! graphic layer 0 opened! Hit any key to stop autoboot: 0 65536 KiB hi_fmc at 0:0 is now current device ## Booting kernel from Legacy Image at 82100000 ... Image Name: Linux-3.18.20 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3372785 Bytes = 3.2 MiB Load Address: 80008000 Entry Point: 80008000 Loading Kernel Image ... OK OK Starting kernel ...