gpt4 book ai didi

linux - 只读 initramfs Linux 系统

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:07:23 25 4
gpt4 key购买 nike

我有一 block 嵌入式主板,上面运行着 Linux。 Linux 是通过 uboot 启动的。完整的 Linux 镜像构建为 Initramfs。当系统启动时,我发现根 FS 是可读写的。我的理解是 Initramfs 默认情况下应该是只读的。对吧?

我也试过将uboot中的引导参数更改为只读,但没有效果。我想知道如何使 Initramfs 默认只读?

最佳答案

The full Linux image is build as Initramfs.

如果不是不准确的话,这是一个措辞不佳的描述。
initramfs 使用 cpio 存档文件,它不是图像文件。
cpio 存档文件可以链接到 Linux 内核镜像中。

initramfs“镜像”始终是 cpio 存档文件,而不是文件系统镜像。


My understanding is that the Initramfs should be by default read only. Right?

错了。
将 initramfs 挂载为只读文件系统毫无意义。
创建并挂载 initramfs 后,它是一个空文件系统。
如果它以只读方式安装,则 initramfs 无法使用其 cpio 存档填充,并且 initramfs 将保持为空文件系统。

建议使用内核命令行参数,例如 root=/dev/ram ro 表示混淆了(已弃用的)ramdisk 和 ramfs。
请参见 Linux 内核 Documentation/filesystems/ramfs-rootfs-initramfs.txt


I wonder what to do to make the Initramfs read only by default?

您可以将其重新挂载为只读。
参见 http://lkml.iu.edu/hypermail/linux/kernel/0908.1/01693.html

https://serverfault.com/questions/463828/linux-initramfs-read-only

关于linux - 只读 initramfs Linux 系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43891240/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com