Yocto - 创建并填充一个单独的/home 分区 [英] Yocto - Create and populate a separate /home partition

查看:27
本文介绍了Yocto - 创建并填充一个单独的/home 分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个基于 x86 的非常简单的 Yocto 图像.

I'm creating quite a simple Yocto image based on x86.

我希望/文件系统是只读的,所以我设置了

I want the / file system to be readonly, so I set the

IMAGE_FEATURES_append = " read-only-rootfs "

在原始core-image-minimal.bb 的自定义副本中.不过,我确实希望 /home 可写并且位于一个单独的分区上.

in a custom copy of the original core-image-minimal.bb. I do want to have the /home writable and on a separate partition, though.

所以,我要添加一行

part /home --ondisk sda --fstype=ext4 --label home --align 1024 --size 600

在 genericx86.wks 中.这会在最终 wic 映像中创建实际的 /home 分区,但它自然不保存任何数据,因为没有相应的 rootfs 用于它.这会导致启动后出现以下非常预期的消息:No directory, login with HOME=/.

in genericx86.wks. This creates the actual /home partition in the final wic image, but it naturally does not hold any data, as there's no corresponding rootfs for it. This leads to the following quite expected message after boot: No directory, logging in with HOME=/.

令人惊讶的是,互联网上关于此的信息很少.有这个解释:

There's surprisingly little info about this on the internet. There's this explanation:

创建或修改构建要简单得多为每个分区准备一个 rootfs 目录的方法.

It's much more simpler to create or modify build recipes to prepare one rootfs directory per partition.

我只是希望文档或示例中有任何关于如何实现这一目标的参考.

I just wish there was any reference in the documentation or example on how to achieve that.

我可以看到分区是由像 rootfs.py 这样的 python 脚本(插件)填充的,并且在提到的图像配方中指定了像 IMAGE_ROOTFS_SIZE 这样的图像参数像 genericx86.wks 这样的文件,但这不足以让我将这些部分连接在一起.

I can see that the partitions are being populated by python scripts (plugins) like rootfs.py, and that the image parameters like IMAGE_ROOTFS_SIZE are specified in mentioned image recipe files like the genericx86.wks, but this is just not enough for me to connect these pieces together.

我已阅读 creating-partitioned-images-using-wic 和链接的 openembedded kickstart 手册,那里没有任何线索.

I've read the creating-partitioned-images-using-wic and the linked openembedded kickstart manuals, there are no clues there.

感谢某人的善意帮助.

推荐答案

使用 WIC,您可以执行以下操作:

With WIC you can do something like this:

custom.wks.in:

...

part / --source rootfs --ondisk sda --fstype=ext4 --label system --exclude-path=home/    
part /home --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/home --ondisk sda --fstype=ext4 --label home

...

请注意,如果您想在 WKS 文件中使用 ${IMAGE_ROOTFS}.in 后缀命名它,这一点很重要.

Note it is important if you want to use ${IMAGE_ROOTFS} in WKS file to name it with .in suffix.

这篇关于Yocto - 创建并填充一个单独的/home 分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆