【问题标题】:Yocto - How do I change the rootfs file system typeYocto - 如何更改 rootfs 文件系统类型
【发布时间】:2021-10-19 14:27:40
【问题描述】:

我正在尝试使用 squashfs rootfs 构建 vdi 映像,但找不到将当前 ext4 fs 更改为 squash 的位置。我找到的最接近的解决方案在这里:How do I change the rootfs file system type used for the sdcard image in yocto? 但我不觉得这回答了我的问题。我能够构建 .rootfs.squashfs 和 .rootfs.wic.vdi。是否可以使用 bitbake 使用 squashfs root 构建 .rootfs.wic.vdi?

【问题讨论】:

    标签: embedded-linux bitbake rootfs squashfs yocto-wic


    【解决方案1】:

    查找wic命令的配置文件:如果你在yocto树中搜索或者查看日志(使用bitbake -D ...可以获得更多日志),你可能会找到一个以.wks为后缀的文件名.这是传递给wic 的指令文件。

    在yocto环境下,wic可以在命令行使用。例如,要获得手册概览:

    $ wic help overview
    
    
    NAME
        wic overview - General overview of wic
    
    DESCRIPTION
        The 'wic' command generates partitioned images from existing
        OpenEmbedded build artifacts.  Image generation is driven by
        partitioning commands contained in an 'Openembedded kickstart'
    [...]
    

    --source 选项触发插件。该手册可能不是最新的,您可能需要进入插件的源代码(wic 是用 python 编写的),它位于以下位置:...poky/scripts/lib/wic 。您将在此处看到管理 partition.py 中“rootfs”插件的代码。您将看到仅支持一组减少的文件系统类型。希望 squashfs 是其中的一部分。这是管理它的代码 sn-p:

        def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir,
                                    native_sysroot, pseudo):
            """
            Prepare content for a squashfs rootfs partition.
            """
            extraopts = self.mkfs_extraopts or '-noappend'
            squashfs_cmd = "mksquashfs %s %s %s" % \
                           (rootfs_dir, rootfs, extraopts)
            exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
    
    

    以上说明wic调用mksquashfs工具构建文件系统。

    howto 的示例。

    【讨论】:

    • 我在 /meta-yocto-bsp/wic 中找到了这个目录,并对 beaglebone-yocto.wks 文件进行了一些更改,当前代码如下:part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4 --fixed-size 32 --sourceparams="loader=u-boot" --use-uuid part / --source rootfs --ondisk sda --fstype=squashfs --label root --align 1024 --use-uuid bootloader --append="rootfstype=squashfs console=ttyS0,115200" 我也更改了 fstab,但是在 bitbake 之后我的root 仍然是 ext4。我错过了什么吗?
    • bitbake 后图像没有变化,不需要重新运行任务。
    • 我更新了答案以提供更多信息。您可以直接在命令行上运行 wic,将正确的参数和配置文件传递给它。
    • 这一切都是真实的,非常有帮助,尤其是您分享的演示文稿。谢谢你。我发现我没有更改正确的文件,我相信它应该是位于 poky/scripts/lib/wic/canned-wks/ 的 common.wks.inc 和 qemux86-directdisk.wks。清理图像bitbake -c clean <IMAGE> 并构建bitbake <IMAGE> 后,我在common.wks.inc 遇到错误:SquashFS 不支持标签。我设法找到了这个mail-archive.com/openembedded-core@lists.openembedded.org/…的实际补丁partition.py中的代码与您上面描述的相同。
    • 我能够在没有 --label 参数的情况下构建我的项目,到目前为止它可以正常工作。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-05
    • 2021-10-31
    • 2019-07-03
    • 1970-01-01
    • 2020-12-08
    • 2020-04-18
    • 2018-05-30
    相关资源
    最近更新 更多