温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux内核映像启动怎么配置

发布时间:2021-11-23 15:04:20 来源:亿速云 阅读:541 作者:iii 栏目:互联网科技

本篇内容介绍了“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内核映像启动怎么配置”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI