开发板:A33,运行linux-3.4.39

主机:Ubuntu 14.04

----------------------------------------------

1. 修改kernel启动参数的几种方式

1)make menuconfig里修改“General Setup”子菜单中的“Default kernel command string” 选项,通过修改这个选项来修改autoconf.h文件中的CONFIG_CMDLINE宏。

2)直接修改arch/arm/kernel/setup.c文件default_command_line,CONFIG_CMDLINE宏的值最终是赋值给这个变量的。

3)一般情况下还可以修改uboot的环境变量中的启动参数bootargs,这个启动参数会由uboot传递给内核。

推荐方式3。

2. 内核配置中有如下选项

make menuconfig-> Boot options -> Kernel command line type (***) (X ) Use bootloader kernel arguments if available ( ) Extend bootloader kernel arguments () Always use the default kernel command string

解释:

第一项:Use bootloader kernel arguments if available

Uses the command-line options passed by the boot loader. If the boot loader doesn't provide any, the default kernel command string provided in CMDLINE will be used.

第二项:Extend bootloader kernel arguments

The command-line arguments provided by the boot loader will be appended to the default kernel command string.

BootLoader环境变量bootargs被追加到kernel command string后面

第三项:Always use the default kernel command string

Always use the default kernel command string, even if the boot loader passes other arguments to the kernel. This is useful if you cannot or don't want to change the command-line options your boot loader passes to the kernel.

如果选择第三项,则内核只使用default kernel command string作为kernel启动参数(也在Boot options下设置)。

A33默认为:earlyprintk=ttyS0,115200 loglevel=9 initcall_debug=1 console=ttyS0,115200 ramfs

3. 测试

将Kernel command line type 配置为第二项:Extend bootloader kernel arguments,编译内核,然后重新打包烧录到A33。

内核启动时可以发现,uboot的环境变量bootargs被添加到kernel command string后面,如下:

Kernel command line: earlyprintk=ttyS0,115200 console=ttyS0,115200 root=/dev/mmcblk0p7 init=/init ......

注:kernel command string已修改为:earlyprintk=ttyS0,115200

建议选择第一项:Use bootloader kernel arguments if available,因为修改uboot环境变量bootargs要比修改内核再重新编译烧录简单高效的多。

4. uboot给kernel传参:bootargs

(1)linux内核启动时可以接收uboot给他传递的启动参数,这些启动参数是uboot和内核约定好的形式、内容,linux内核在这些启动参数的指导下完成启动过程。这样的设计是为了灵活,为了内核在不重新编译的情况下可以用不同的方式启动。

(2)我们要做的事情就是:在uboot的环境变量中设置bootargs,然后bootm命令启动内核时会自动将bootargs传给内核。

(3)bootargs=console=ttySAC2,115200 root=/dev/mmcblk0p2 rw init=/linuxrc rootfstype=ext3

意义解释:

console=ttySAC2,115200 控制台使用串口2,波特率115200.

root=/dev/mmcblk0p2 rw 根文件系统在SD卡端口0设备(iNand)第2分区,根文件系统是可读可写的

init=/linuxrc linux的进程1(init进程)的路径

rootfstype=ext3 根文件系统的类型是ext3

(4)A33开发板bootargs 参数设置如下

setargs_mmc=setenv bootargs console=${console} root=${mmc_root} init=${init} ion_cma_512m=120m ion_cma_1g=176m ion_carveout_512m=96m ion_carveout_1g=150m coherent_pool=4m loglevel=${loglevel} partitions=${partitions}

setargs_nand=setenv bootargs console=${console} root=${nand_root} init=${init} ion_cma_512m=120m ion_cma_1g=176m ion_carveout_512m=96m ion_carveout_1g=150m coherent_pool=4m loglevel=${loglevel} partitions=${partitions}

5. 环境变量

(1)第一个命令:printenv/print

print命令不用带参数,作用是打印出系统中所有的环境变量。

环境变量就好像程序的全局变量一样。程序中任何地方都可以根据需要去调用或者更改环境变量(一般都是调用),环境变量和全局变量不同之处在于:全局变量的生命周期是在程序的一次运行当中,开始运行时诞生程序结束时死亡,下次运行程序时从头开始;但是环境变量被存储在Flash的另一块专门区域(Flash上有一个环境变量分区),一旦我们在程序中保存了该环境变量,那么下次开机时该环境变量的值将维持上一次更改保存后的值。

(2)设置(添加/更改)环境变量:setenv/set

用法:set name value

(3)保存环境变量的更改:saveenv/save

saveenv/save命令不带参数,直接执行,作用是将内存中的环境变量的值同步保存到Flash中环境变量的分区。注意:环境变量的保存是整体的覆盖保存,也就是说内存中所有的环境变量都会整体的将Flash中环境变量分区中原来的内容整体覆盖。

总结:彻底更改一个环境变量的值,需要2步:第一步set命令来更改内存中的环境变量,第二步用save命令将其同步到Flash中环境变量的分区。

有时候我们只是想测试下这个环境变量,不希望影响到下一次开机,那就只set不save,这样set后当前本次运行的uboot已经起效果了,只不过没save下一次开机还是会恢复到原来的状况。

注:A33 uboot环境变量:

boot_fastboot=fastboot

boot_normal=sunxi_flash read 40007800 boot;boota 40007800

boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800

bootcmd=run setargs_mmc boot_normal

bootdelay=0

console=ttyS0,115200

fastboot_key_value_max=0x8

fastboot_key_value_min=0x2

filesize=6B1B6

init=/init

loglevel=7

mmc_root=/dev/mmcblk0p7

nand_root=/dev/nandd

partitions=boot-res@mmcblk0p2:env@mmcblk0p5:boot@mmcblk0p6:rootfs@mmcblk0p7:data@mmcblk0p8:UDISK@mmcblk0p1

recovery_key_value_max=0x13

recovery_key_value_min=0x10

setargs_mmc=setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p7 init=/init ion_cma_512m=120m ion_cma_1g=176m ion_carveout_512m=96m ion_carveout_1g=150m coherent_pool=4m loglevel=7 partitions=boot-res@mmcblk0p2:env@mmcblk0p5:boot@mmcblk0p6:rootfs@mmcblk0p7:data@mmcblk0p8:UDISK@mmcblk0p1

setargs_nand=setenv bootargs console=${console} root=${nand_root} init=${init} ion_cma_512m=120m ion_cma_1g=176m ion_carveout_512m=96m ion_carveout_1g=150m coherent_pool=4m loglevel=${loglevel} partitions=${partitions}

stderr=serial

stdin=serial

stdout=serial

全志A33-修改linux kernel启动参数相关推荐

  1. a33 linux 硬解码_全志A33-修改linux kernel启动参数

    开发板:A33,运行linux-3.4.39 主机:Ubuntu 14.04 ---------------------------------------------- 1. 修改kernel启动参 ...

  2. 修改Linux内核启动图片

    原文: http://www.linuxde.net/2013/06/13936.html 保存一下,去试试. 本文讲的是修改Linux内核启动的图片,而不是uboot,这两者是不一样的哦. uboo ...

  3. 修改linux资源限制参数命令,Linux的资源限制功能cgroups v1和cgroups v2的详细介绍

    cgroups - Linux control groups 早些时候简单了解过cgroup( Linux中cgroup的初级方法 ),当时了解地太浅了,想要做一些或调查一些和cgroup有关的问题时 ...

  4. linux查询内核参数命令,Linux内核启动参数详解

    1.环境: Ubuntu 16.04 Linux linuxidc 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_ ...

  5. linux系统内核参数命令,Linux内核启动参数解析及添加

    1.环境: Linux linuxidc 4.4.0-89-generic #112-Ubuntu SMP Mon Jul 31 19:38:41 UTC 2017 x86_64 x86_64 x86 ...

  6. Linux kernel启动过程

    0. 声明 kernel版本号3.10.53 1. 链接脚本 arch/arm/kernel/vmlinux.lds.S ==>vmlinux.lds 生成的链接脚本(vmlinux.lds)中 ...

  7. linux kernel.sem参数,kernel.sem参数的设置

    可以理解为semaphore为每个进程通讯需要的信号灯或者IPC标志,每个连接的process都要分配一个semaphore,那么 semaphore的设置跟process的数量有关系. semaph ...

  8. linux改开机图片,修改linux开机启动图像

    Linux字符界面切换到图形界面 由字符界面切换到图形界面可用两种简单方法实现: 1.在字符界面 LINUX 启动logo 总结 最近在imx6上需要调试linux下启动logo.其实linux启动l ...

  9. Arm linux kernel 启动之start_kernel (一)

    了解完kernel启动以前的汇编之后我们来看看正式的c语言启动代码,也就是我们的start_kernel函数了.start_kernel相当大,里面每一个调用到的函数都足够我们伤脑筋了,我这里只是浅尝 ...

最新文章

  1. 如何用Asp判断你的网站的虚拟物理路径
  2. Python3开发过程常见的异常(最近更新:2019-04-26)
  3. Ubuntu 16.04 LTS下编译GPU版tensorflow
  4. 驾照考试:六百公里考试流程与注意事项
  5. 自由自在公司进口食品呈现高端消费的趋势
  6. VTK修炼之道35:边缘检测_Laplace算子
  7. pdf python 位置_如何使用PDFMiner获取PDF中文本的位置?
  8. python没有tkinter_Python升级提示Tkinter模块找不到的解决方法
  9. SpringMVC项目中中文字符乱码问题及解决办法总结(非专业最优解决办法) -- ajax传值乱码; request.getParameter()乱码;
  10. format函数使用matlab,Matlab基本函数-format函数 | 学步园
  11. 如何为你的CSDN博客加入百度统计
  12. UnityHub破解Unity破解
  13. 高斯消元法解线性方程组
  14. 第二章 AIR202_Lua_串口控制
  15. MPS模块式柔性自动化生产线
  16. c语言循环卖n西瓜 几天卖完,C++循环结构23道题含答案.docx
  17. 直播连麦实现的三种方法
  18. 2018-2019 ACM-ICPC沈阳(C,J)
  19. nginx的access.log文件详解,main的具体意思
  20. 看2022年卡塔尔世界杯有感

热门文章

  1. 1067: [SCOI2007]降雨量
  2. Ubuntu   root密码
  3. 解决链接模型的可见性问题
  4. 第 8 章:管理模式对象
  5. php与mysql基础教程第二版_PHP 和 MySQL 基础教程(二)
  6. udp多线程 java_UDP实现多线程通信
  7. 企鹅java游戏下载安装_企鹅企鹅生活安卓版游戏下载|企鹅企鹅生活手游下载v1.6.1-乐游网安卓下载...
  8. python加载图片并显示_python OpenCV 读取并显示图像
  9. .post与 .ajax,关于post与ajax post的数据类型
  10. mysql 不能用dbcontext_EntityFramework中的DbContext使用疑点说明