Open quinnwencn opened 2 months ago
对于EXT4格式的分区,测试失败,原因是:
#if CONFIG_IS_ENABLED(FS_EXT4)
{
.fstype = FS_TYPE_EXT,
.name = "ext4",
.null_dev_desc_ok = false,
.probe = ext4fs_probe,
.close = ext4fs_close,
.ls = ext4fs_ls,
.exists = ext4fs_exists,
.size = ext4fs_size,
.read = ext4_read_file,
#ifdef CONFIG_CMD_EXT4_WRITE
.write = ext4_write_file,
.ln = ext4fs_create_link,
#else
.write = fs_write_unsupported,
.ln = fs_ln_unsupported,
#endif
.uuid = ext4fs_uuid,
.opendir = fs_opendir_unsupported,
.unlink = fs_unlink_unsupported,
.mkdir = fs_mkdir_unsupported,
},
ext4不支持fs_opendir。 TODO
背景
前一个话题todo讨论了如果在板子上启用secure boot,基于OSTree的升级方案会因为无法设置环境变量而无法启动,也给出了一个新增分区用于记录环境变量的方案。但是,从更合理的角度,我们不应该引入任何的分区和文件记录启动信息。由于U-BOOT具有基本的目录检索能力,我们可以基于U-BOOT的这个能力,制作一个U-BOOT命令,用以实现获取rootfs启动的参数。
基本思路
基于ostree的rootfs的启动目录如下:
启动相关的目录是:
/sysroot/ostree/boot.0/7998bb342a92ae7def2a55e6c40fbc5dbbbde41b7421a5258f61a4ccbeb0b4d6/0
,其中在启动时,变化的只有boot.0中的0, 哈希值以及最后的0或者1。因此,我们可以在uboot中遍历查找当前的值,并存储起来添加到bootargs环境变量的末尾即可。实现
在uboot/common中新建文件
ostree_env.c
,并在同目录的Makefile下添加:obj-y += ostree_env.o
,编译后即可测试。