您的位置:首页 > 运维架构 > Linux

嵌入式Linux内核启动参数介绍与设置

2017-06-14 21:16 357 查看
软件子系统各组成部分之间的层次与关联,怎样相互识别、配置与加载?

一、系统启动流程

bootloader(uboot) ————> Linux Kernel(uImage) ————> Rootfs(Init) ————> Applications


二、启动环境配置

uboot环境变量: printenv setenv saveenv tftpboot nand read/write …等等

baudrate 115200

bootdelay

bootcmd :在uboot命令行中输入boot或bootd运行bootcmd变量指定的命令进行启动

ipaddr, serverip, ethaddr,gatewayip

bootargs

bootargs内核启动参数:

bootargs '<name>=<value> ...'设置如下:
bootargs=root=/dev/nfs nfsroot=192.168.10.7:/home/hong/nfsroot ip=192.168.10.11 init=/linuxrc console=ttySAC0,115200


root, rootfstype, nfsroot

root=/dev/nfs nfsroot=nfsserver:path

root=/dev/mtdblock2

mtdparts: mtdparts=mtd-id:@(),@()

mtdparts=s5pv210-nand:1M(boot),5M(kernel),80M(rootfs),426M(usrfs)

要想这个参数起作用,内核中的mtd驱动必须要支持,即内核配置时需要选上

`Device Drivers  ---> Memory Technology Device (MTD) support  ---> Command line partition table parsing`


rootfstype=jffs2/yaffs2/squashfs/ubifs/…

ip:使用nfs时必须进行设置

ip=ip addr
ip=ip addr:server ip addr:gateway:netmask::which netcard:off


init, console

mem 限制linux内核的使用内存 mem=128M

三、启动参数设置:在uboot命令行中输入以下内容:

- setenv bootargs  'root=/dev/nfs nfsroot=192.168.10.7:/home/hong/nfsroot ip=192.168.10.11 init=/linuxrc console=ttySAC0,115200'
- setenv bootcmd 'tftpboot 20008000 tiny_uImage;bootm 20008000'


总结:

1. 收集信息:flash类型与分区(nand/nor/spi.etc), 内存大小, 根文件系统类型,网络参数等(参考SDK开发手册)

2. 配置参数:setenv bootargs ‘…’;saveenv;

3. 测试参数:确保内核镜像可以成功加载,必不可少的步骤
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息