Yocto - Create and populate a separate /home partition

微笑、不失礼 提交于 2020-12-06 04:02:23

问题


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 "

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.

So, I'm adding a line

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

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:

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.

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.

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

Appreciate someone's kind help.


回答1:


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

...

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



来源:https://stackoverflow.com/questions/56187209/yocto-create-and-populate-a-separate-home-partition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!