diff --git a/demos/runtime_boot/README.md b/demos/runtime_boot/README.md index 47639e53..cd7dc04d 100644 --- a/demos/runtime_boot/README.md +++ b/demos/runtime_boot/README.md @@ -11,7 +11,7 @@ The later step will use the image content to generate UnionFS image. ### Build and start a [`gen_rootfs`](./gen_rootfs) Occlum instance -This `gen_rootfs` mounts a empty UnionFS, copy the BASH Occlum image content to the mount point, unmount the UnionFS. It generates an encrypted UnionFS image containing the BASH image content. The **key** used in this demo is `"c7-32-b3-ed-44-df-ec-7b-25-2d-9a-32-38-8d-58-61"`. +This `gen_rootfs` mounts a empty **sefs** (uses the lower path as mount target dir), copy the BASH Occlum image content to the mount point, unmount the **sefs**. It generates an encrypted **sefs** image containing the BASH image content. The **key** used in this demo is `"c7-32-b3-ed-44-df-ec-7b-25-2d-9a-32-38-8d-58-61"`. ### Build customized [`init`](./init) @@ -22,7 +22,7 @@ Occlum [`default init`](../../tools/init) calls syscall (363) `MountRootFS` to m The first parameter `key_ptr` is optional. The second parameter `rootfs_config` needs to be set as NULL. -But for runtime booting pre-generated UnionFS image, The first parameter `key_ptr` is must to have, the second parameter `rootfs_config` needs have valid members. +But for runtime booting pre-generated image, The first parameter `key_ptr` is must to have, the second parameter `rootfs_config` needs have valid members. ``` struct user_rootfs_config { // length of the struct diff --git a/demos/runtime_boot/gen_rootfs/src/main.rs b/demos/runtime_boot/gen_rootfs/src/main.rs index 2fed4956..d6f1fe0c 100644 --- a/demos/runtime_boot/gen_rootfs/src/main.rs +++ b/demos/runtime_boot/gen_rootfs/src/main.rs @@ -9,15 +9,14 @@ fn main() { println!("{:?}", args); fs::create_dir("/mount").unwrap(); - let fs_type = "unionfs"; + let fs_type = "sefs"; let mount_path = Path::new("/mount"); - let source = Path::new("unionfs"); + let source = Path::new("sefs"); let flags = MsFlags::empty(); let key = &args[1]; let options = format!( - "lowerdir={},upperdir={},key={}", + "dir={},key={}", "./mnt_unionfs/lower", - "./mnt_unionfs/upper", key ); diff --git a/src/libos/src/config.rs b/src/libos/src/config.rs index d1752348..c609f5b2 100644 --- a/src/libos/src/config.rs +++ b/src/libos/src/config.rs @@ -578,7 +578,7 @@ impl ConfigApp { .find(|m| m.target == Path::new("/") && m.type_ == ConfigMountFsType::TYPE_UNIONFS) .ok_or_else(|| errno!(Errno::ENOENT, "the root UnionFS is not valid"))?; - if upper_layer.is_some() { + if lower_layer.is_some() { let layer_mount_configs = root_mount_config.options.layers.as_mut().unwrap(); // image SEFS in layers let root_image_sefs_mount_config = layer_mount_configs @@ -590,12 +590,12 @@ impl ConfigApp { }) .ok_or_else(|| errno!(Errno::ENOENT, "the image SEFS in layers is not valid"))?; - root_image_sefs_mount_config.source = upper_layer; + root_image_sefs_mount_config.source = lower_layer; root_image_sefs_mount_config.options.mac = None; root_image_sefs_mount_config.options.index = 1; } - if lower_layer.is_some() { + if upper_layer.is_some() { let layer_mount_configs = root_mount_config.options.layers.as_mut().unwrap(); // container SEFS in layers let root_container_sefs_mount_config = layer_mount_configs @@ -610,7 +610,7 @@ impl ConfigApp { errno!(Errno::ENOENT, "the container SEFS in layers is not valid") })?; - root_container_sefs_mount_config.source = lower_layer; + root_container_sefs_mount_config.source = upper_layer; } if entry_point.is_some() {