网站首页 > 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.conf
timeout 10
menu title select kernel
label 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=ext4
label 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=ext4
label 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'): 0
Device 0: unknown device
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:4...
Found /extlinux/extlinux.conf
pxefile_addr_str = 0x00500000
bootfile = /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
reading /extlinux/extlinux.conf
797 bytes read in 6 ms (128.9 KiB/s)
select kernel
1: kernel-4.4.154-90-rockchip-ga14f6502e045
2: kernel-4.4.154-88-rockchip-00030-g90239a6
3: kernel-debug
Enter choice: 3
Retrieving file: /hw_intfc.conf
reading /hw_intfc.conf
1720 bytes read in 4 ms (419.9 KiB/s)
...(省略部分log)
Retrieving file: /debug/Image
reading /debug/Image
20371464 bytes read in 885 ms (22 MiB/s)
append: earlyprintk console=ttyFIQ0,1500000n8 init=/sbin/init root=PARTUUID=b921b045-1d rw rootwait rootfstype=ext4
Retrieving file: /debug/rk3399-rock-pi-4a.dtb
reading /debug/rk3399-rock-pi-4a.dtb
94381 bytes read in 13 ms (6.9 MiB/s)
fdt addr 0000000008300000
fdt magic number edfe0dd0
fdt size 1048576
此时,u-boot会引导/boot/extlinux/extlinux.conf文件中kernle-debug标签对应的Linux内核和dtb映像。
此方法有个缺点:如果要更新kernle-debug标签对应的Linux内核和dtb映像,需要先进入第1个或第2个标签对应的系统,然后下载调试映像,重启系统,再选择对应的调试标签。
Tags:linux系统镜像下载
- 上一篇:EVE-NG如何导入镜像
- 下一篇:虚拟机如何安装Linux系统
猜你喜欢
- 2024-11-26 微软商店中的WSL预览版现已可用!Windows 11用户狂喜
- 2024-11-26 KaliLinux 2021.2发布,增加大量新工具和功能
- 2024-11-26 Linux环境中搭建Docker私有镜像仓库
- 2024-11-26 把Kali Linux操作系统装进U盘
- 2024-11-26 Linux学习-VMware虚拟机安装Linux系统
- 2024-11-26 嵌入式linux新手入门手记-制作UBI文件镜像
- 2024-11-26 KaliLinux在USB,树莓派和VMware的安装以及VMware tools的安装
- 2024-11-26 linux上安装Docker(超简单的安装方法)
- 2024-11-26 世界上最好用的Linux发行版之一,OpenSUSE安装及简单体验
- 2024-11-26 虚拟机如何安装Linux系统