在运行 Linux 的单板计算机上,有没有办法读取控制硬件的设备配置寄存器的内容?我认为这将是inw()
.
我正在寻找与 U-boot memory dump ( md
) 命令等效的东西,以便在驱动程序调试的上下文中使用。
通过回答我之前的问题(谢谢!)而将其定向到 initramfs ,我一直在努力使 initramfs 工作。我现在可以启动内核并进入 shell 提示符,在那里我可以执行 busybox 命令,这很棒。
这就是我卡住的地方——(至少)有两种生成 initramfs 图像的方法:
第二种方法看起来更简洁,所以我一直在使用它。
仅供参考,这是我目前的文件列表:
dir /dev 755 0 0
nod /dev/console 644 0 0 c 5 1
nod /dev/loop0 644 0 0 b 7 0
dir /bin 755 1000 1000
slink /bin/sh busybox 777 0 0
file /bin/busybox /home/brandon/rascal-initramfs/bin/busybox 755 0 0
dir /proc 755 0 0
dir /sys 755 0 0
dir /mnt 755 0 0
file /init /home/brandon/rascal-initramfs/init.sh 755 0 0
Run Code Online (Sandbox Code Playgroud)
不幸的是,我了解到busybox 需要一长串链接作为其所有不同命令的别名。有没有办法生成所有这些命令的列表,以便我可以将其添加到我的文件列表中?
或者,我可以使用预构建的目录层次结构切换到方法 …
我正在研究使用 initramfs 启动的嵌入式 ARM Linux 系统。(这里有一些早期 问题的背景知识,如果你感兴趣的话。)到目前为止,部分感谢在这里收到的帮助,我可以通过带有嵌入式 initramfs 的 TFTP 引导内核。MMC 驱动程序检测到包含新根文件系统的 SD 卡,然后我可以挂载它。但是,我无法完成最后一步,即使用 busybox switch_root 切换到 SD 卡上的文件系统来工作。
在 initramfs shell 提示符下,我认为这应该使内核切换到新的文件系统:
switch_root -c /dev/console /mnt/root /sbin/init.sysvinit
Run Code Online (Sandbox Code Playgroud)
然而,它只是让busybox( switch_root 别名)打印其手册页,如下所示:
/ # switch_root -c /dev/console /mnt/root /sbin/init.sysvinit
BusyBox v1.17.4 (2010-12-08 17:01:07 EST) multi-call binary.
Usage: switch_root [-c /dev/console] NEW_ROOT NEW_INIT [ARGS]
Free initramfs and switch to another root fs:
chroot to NEW_ROOT, delete all in /, move NEW_ROOT to /,
execute NEW_INIT. PID must be 1. NEW_ROOT …
Run Code Online (Sandbox Code Playgroud)