gpt4 book ai didi

linux - Buildroot 不以 root 身份运行,也不想以 root 身份运行

转载 作者:太空宇宙 更新时间:2023-11-04 12:35:00 25 4
gpt4 key购买 nike

我有两个问题:

  • 我不确定是否理解(根据 Buildroot 手册中的目录描述):

    target/ which contains almost the complete root filesystem for the target:everything needed is present except the device files in /dev/ (Buildroot doesn’t run as root and doesn’t want to run as root)

为什么buildroot需要root才能创建/dev

  • 我所知道的是 buildroot 使用 target 生成 images/rootfs.tar;它是使用tar 还是...的简单压缩?你能帮我找到生成 images/rootfs.tar 的 make 目标吗?在使用 NFS 的情况下,为什么我们不能直接使用 target 文件夹作为 rootfs 是什么使得“untaring” images/rootfs.tar 不同于 target

引用:http://free-electrons.com/~thomas/buildroot/manual/html/ch03.html

最佳答案

I am not sure to undrestand(from the directories description in Buildroot manual):

Buildroot 是一种用于生成内核和根文件系统的工具,它作为普通用户在您的主机系统上执行,无需 super 用户权限。


Why buildroot need to be root to create the /dev

Buildroot 不使用 super 用户权限。


what i know is that buildroot uses target to generate images/rootfs.tar; is it a simple compression with taror ...?

.tar 是一个没有压缩的普通存档。
您可以使用 make menuconfig 过程配置/指定压缩(和/或选择文件系统镜像)。


could you please help me find the make target that generate images/rootfs.tar?

您不要在 ma​​ke shell 命令中指定它。
您可以使用 make menuconfig 过程配置/指定带有可选压缩(和/或选择文件系统镜像)的 tar 和/或 cpio 存档。


In case of using NFS why can't we use directly the target folder as rootfs

因为它不适合做屋顶。
文件所有者和组不正确(这可能与 NFS 使用无关)。
文件权限可能不正确(例如 busybox 二进制文件的 setuid)。
/dev 目录没有目标内核所需的最小设备节点。

目标目录没有所需的最小设备节点(例如console),而是在dev中有普通的文件:

buildroot-2015.05/output/target$ ls -l dev
total 4
-rw--w--w- 1 me swdev 0 Sep 15 16:34 console
lrwxrwxrwx 1 me swdev 10 Aug 14 2015 log -> ../tmp/log
drwxrwxr-x 2 me swdev 4096 May 31 2015 pts
$

目标内核在需要设备节点时不能使用这些文件。将尝试使用这些文件进行普通文件传输,而不是通过设备节点执行 I/O。

实际的dev目录应该是:

crw--w--w- 1 root root 5, 1 Sep 15 16:34 console
lrwxrwxrwx 1 root root 10 Aug 14 2015 log -> ../tmp/log
drwxr-xr-x 2 root root 4096 May 31 2015 pts

what makes "untaring" images/rootfs.tar different than target

Buildroot 可以巧妙地为设备节点创建条目,并在创建存档(或文件系统镜像)时为每个文件名分配适当的所有者和组。
这只是以适当的格式生成二进制数据,这些数据与写入文件的实际存档条目(或 fs 图像)一起插入。
只有当它未归档(或文件系统镜像已安装)时,“数据”才被正确解释为设备节点。

关于linux - Buildroot 不以 root 身份运行,也不想以 root 身份运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42175387/

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