资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

Linux内核映像启动怎么配置

本篇内容介绍了“Linux内核映像启动怎么配置”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、小程序定制开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了漳州免费建站欢迎大家使用!

Debian系统中,通过修改启动配置文件/boot/extlinux/extlinux.conf,可以增加u-boot引导时的Linux内核映像选项,方便Linux内核调试。

注:本文基于RockPI 4A单板Debian系统。

一、extlinux.conf配置文件

Debian系统启动后,使用cat命令查看/boot/extlinux/extlinux.conf文件内容。

root@linaro-alip:~# cat /boot/extlinux/extlinux.conftimeout 10menu title select kernellabel kernel-4.4.154-90-rockchip-ga14f6502e045    kernel /vmlinuz-4.4.154-90-rockchip-ga14f6502e045    devicetreedir /dtbs/4.4.154-90-rockchip-ga14f6502e045    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4label kernel-4.4.154-88-rockchip-00030-g90239a6    kernel /vmlinuz-4.4.154-88-rockchip-00030-g90239a6    devicetreedir /dtbs/4.4.154-88-rockchip-00030-g90239a6    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4label kernel-debug    kernel /debug/Image    fdt /debug/rk3399-rock-pi-4a.dtb    append earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4

注:最后一个label kernel-debug用于Linux内核调试映像,在u-boot启动时可以选择该标签。

关键字kernel后面跟Linux内核映像;关键字fdt后面跟dtb映像。其中:debug/boot目录下的新建文件夹,保存调试用的Linux内核和dtb映像。如下:

root@linaro-alip:~# ls /boot/debug/Image  rk3399-rock-pi-4a.dtb

extlinux.conf中的关键字可以参考u-boot代码中的cmd/pxe.c文件。

/* * Keywords recognized. */static const struct token keywords[] = {        {"menu", T_MENU},        {"title", T_TITLE},        {"timeout", T_TIMEOUT},        {"default", T_DEFAULT},        {"prompt", T_PROMPT},        {"label", T_LABEL},        {"kernel", T_KERNEL},        {"linux", T_LINUX},        {"localboot", T_LOCALBOOT},        {"append", T_APPEND},        {"initrd", T_INITRD},        {"include", T_INCLUDE},        {"devicetree", T_FDT},        {"fdt", T_FDT},        {"devicetreedir", T_FDTDIR},        {"fdtdir", T_FDTDIR},        {"ontimeout", T_ONTIMEOUT,},        {"ipappend", T_IPAPPEND,},        {NULL, T_INVALID}};

二、Linux内核加载

完成extlinux.conf文件修改后,将Linux内核和dtb映像拷贝到/boot/debug/目录下,重启系统。在u-boot启动到Hit key to stop autoboot('CTRL+C'): 0时,按回车,在Enter choice:后输入“3”,选择需要调试的Linux内核映像3: kernel-debug,如下:

Hit key to stop autoboot('CTRL+C'):  0Device 0: unknown deviceswitch to partitions #0, OKmmc1 is current deviceScanning mmc 1:4...Found /extlinux/extlinux.confpxefile_addr_str = 0x00500000bootfile = /extlinux/extlinux.confRetrieving file: /extlinux/extlinux.confreading /extlinux/extlinux.conf797 bytes read in 6 ms (128.9 KiB/s)select kernel1:      kernel-4.4.154-90-rockchip-ga14f6502e0452:      kernel-4.4.154-88-rockchip-00030-g90239a63:      kernel-debugEnter choice: 3Retrieving file: /hw_intfc.confreading /hw_intfc.conf1720 bytes read in 4 ms (419.9 KiB/s)...(省略部分log)Retrieving file: /debug/Imagereading /debug/Image20371464 bytes read in 885 ms (22 MiB/s)append: earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4Retrieving file: /debug/rk3399-rock-pi-4a.dtbreading /debug/rk3399-rock-pi-4a.dtb94381 bytes read in 13 ms (6.9 MiB/s)fdt addr 0000000008300000fdt magic number edfe0dd0fdt size 1048576

此时,u-boot会引导/boot/extlinux/extlinux.conf文件中kernle-debug标签对应的Linux内核和dtb映像。

此方法有个缺点:如果要更新kernle-debug标签对应的Linux内核和dtb映像,需要先进入第1个或第2个标签对应的系统,然后下载调试映像,重启系统,再选择对应的调试标签

“Linux内核映像启动怎么配置”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!


文章标题:Linux内核映像启动怎么配置
文章来源:http://cdkjz.cn/article/jjsggi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220