- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我的系统 (ARM32) 正在通过 U-Boot 启动 Linux。内核从 u-boot 获取 console=ttymxc1,115200
作为参数。然后它在 initramfs 中使用带有 switch_root
(由 busybox
解释)的 shell 脚本来初始化根文件系统。此外,此 initramfs 脚本解析内核命令行以获取正确的 console
。
问题是 switch_root
正在打印到 tty1
。尽管如此,内核还是使用了在其参数中指定的正确控制台。如果我没有将 -c
参数传递给 switch_root
,它也会使用 /dev/tty1
,这就是我的显示。
你们有没有人知道我如何让 init
(sysvinit) 使用内核参数中指定的控制台?
这是 initramfs 脚本源:
#!/bin/sh
echo "init: rootfs setup"
# mount temporary filesystems
mount -n -t devtmpfs devtmpfs /dev
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -t tmpfs tmpfs /run
read -r cmdline < /proc/cmdline
# define filesystems
ROOT_DEV="/dev/mydev"
ROOT="/newroot"
# mount rootfs
mkdir -p ${ROOT}
mount ${ROOT_DEV} ${ROOT}
# get & create console
CONSOLE=$(echo $cmdline) | sed 's/.*console=\(.*\),.*/\1/'
mknod -m 644 ${ROOT}/dev/${CONSOLE} c 5 1
# switch to new rootfs and exec init
echo "init: rootfs successful mounted (${ROOT})"
cd ${ROOT}
exec switch_root -c /dev/${CONSOLE} . "/sbin/init" "$@"
这是 initramfs config.cfg
dir /bin 755 1000 1000
dir /dev 755 0 0
dir /mnt 755 0 0
dir /proc 755 0 0
dir /run 755 0 0
dir /sys 755 0 0
file /bin/busybox initramfs/busybox 755 0 0
file /init initramfs/init 755 0 0
nod /dev/console 644 0 0 c 5 1
nod /dev/ttymxc1 644 0 0 c 5 1
slink /bin/chroot busybox 777 0 0
slink /bin/find busybox 777 0 0
slink /bin/grep busybox 777 0 0
slink /bin/mkdir busybox 777 0 0
slink /bin/mknod busybox 777 0 0
slink /bin/mount busybox 777 0 0
slink /bin/sed busybox 777 0 0
slink /bin/sh busybox 777 0 0
最佳答案
终于我找到了解决方案(以及我犯的错误)!
控制台设备是用错误的主要/次要编号创建的。使用与内核分配给 ttymxc* 相同的方式创建它,它可以工作:
mknod -m 644 ${ROOT}/dev/${CONSOLE} c 207 17
关于Linux initramfs switch_root 无法找到内核使用的控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39014689/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
运行 Ubuntu 18.04 LTS。我已将脚本放在以下位置: /usr/share/initramfs-tools/scripts/init-bottom/dothis dothis 设置为 +x
有些硬件设备需要用户空间支持,例如守护进程运行和处理不适合(太复杂或与策略相关)内核空间的交互部分。 一旦到达用户空间,运行此类守护进程就很容易了——您可以在热插拔事件后运行它们,不用太担心。 一旦
我的系统 (ARM32) 正在通过 U-Boot 启动 Linux。内核从 u-boot 获取 console=ttymxc1,115200 作为参数。然后它在 initramfs 中使用带有 swi
我在 SmartFusion2 上运行 uClinux,作为构建小型立方体卫星的大学团队的一部分。但是,我在 Linux 内核方面不是很有经验,这个问题让我难过了几天。我试图让 SmartFusion
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为
我正在coldfire板M5272C3上进行uclinux移植。现在我有从 RAM 运行的内核,并使用 romfs 作为我的根文件系统。我不清楚一些术语的含义以及何时使用它们...... 请用最简单的
我带来了一个RPi。现在使用 Raspbian 或其他哪个发行版? Raspbian 和其他发行版之间到底有什么区别。 http://elinux.org/RPi_Distributions 这些 z
我正在从 minimfs 编译 initramfs,但它在启动过程中无法检测到 init。我有 2 个 simlink,一个位于/init,另一个位于 sbin/init,均指向/sbin/init.
在运行 Linux 2.6.36 的嵌入式平台上,我偶尔会遇到一个问题,即根文件系统中的文件没有出现在我们的 initramfs cpio 文件中。 我正在从 cpio 列表文件构建 initramf
不知谁有过这样的经历。我们正在使用无盘 linux 服务器。在我们使用ramdisk之前,最近我们正在尝试用ramfs制作一个无盘服务器,我们成功地创建了rootfs镜像并启动了服务器。 那么这里的问
我有一 block 嵌入式主板,上面运行着 Linux。 Linux 是通过 uboot 启动的。完整的 Linux 镜像构建为 Initramfs。当系统启动时,我发现根 FS 是可读写的。我的理解
我想修改根设备节点作为 initramfs 脚本的一部分。我不想自己执行 switch_root(除非我必须这样做)。我想添加一个脚本,如果满足某些条件,它可以更改根设备。 我尝试了各种选项,例如读取
我在浏览 Linux 源代码时,在 initramfs 的第 400 行遇到了一段不熟悉的代码。 .我知道括号中的名称是 188 枚举中的状态。在我看来,这是一个默认数组设置函数指针(我可能是错的)。
据我所知,initrd 充当 block 设备,因此需要文件系统驱动程序(例如 ext2)。内核必须至少有一个内置模块用于检测 initrd 的文件系统。在这篇文章中,Introducing init
Linux 内核使用一种 ram 磁盘在早期引导阶段访问模块。出于好奇,我想了解我有一个问题:内核在此阶段必须可以访问包含 initramfs/initrd 的文件。这意味着内核必须支持适当的文件系统
我正在尝试使用 initramfs 作为 linux 内核引导的文件系统。我希望我的文件系统是最小的,所以我只使用没有 rootfs 的 initramfs。现在,一旦内核启动,它就会从 initra
使用gentoo规范为Thinkpad T430编译了内核 挂载空的 ext4 硬盘并在其上创建 boot/目录,将 bzImage 和 System.map 移入其中 使用“extlinux --i
我有这个与 initramfs 一起运行的 perl 脚本。我遇到了很多我不明白的小问题,这些问题肯定与 shell 有关。我要问的具体问题是: system("/sbin/e2fsck -f $de
我想通过编辑现有脚本或在已安装 CentO 的引导文件夹中的 initramfs 中添加新脚本来添加新的 ext3 分区。然后通过将新的 initramfs 镜像替换为其他已安装的 centos,只需
我是一名优秀的程序员,十分优秀!