eclipse-score / eclipse-score/rules_imagefs

Create a raw ext4 filesystem image from input files

Open
#18 0 comments 0 reactions 1 assignee Claimed by @nradakovic View on GitHub
Dominant language
Starlark
Stars
0
Forks
2
Avg merge
7d 6h
Merged PRs (30d)
2

Description

## Description

Implement generation of a raw Linux `ext4` filesystem image from a set of input files and directories.

The resulting image should be easy to consume and should preserve the paths provided through `srcs`.

## Requirements

### Filesystem

- The filesystem must be **ext4**.
- Use standard/default ext4 filesystem configuration where possible.
- Journaling should remain **enabled**.
- The filesystem should have the label `s-core-data`.
- The filesystem should be writable by default.
- There is no requirement to make the filesystem read-only at this point.

### Image size

The image size should be **automatically calculated based on the input files**.
The implementation should avoid relying on an arbitrary safety margin as the current shell-script implementation does.
The resulting image should be large enough to contain all input files while minimizing unnecessary unused space.

### Input content

The image must support any file or directory that is supported by Linux/ext4.
The primary use case is storing test data, so the implementation should not be restricted to the limitations of filesystems such as FAT.

### Path preservation

The paths provided through `srcs` must be preserved in the generated filesystem.
For example, if the inputs are:
```bash
srcs/
|── testdata/foo.txt
└── testdata/config/config.json
```

the resulting image should contain:
```bash
/testdata/foo.txt
/testdata/config/config.json
```
In other words, all paths should be placed relative to `/` inside the image.

### Output

- The output must be a **raw ext4 filesystem image**.
- The output should be exposed through the existing interface/output mechanism, so that the generated image is straightforward to consume.

### Architecture

The ext4 filesystem format itself should be architecture-independent.

The implementation should therefore not make the filesystem format dependent on the architecture of the files stored in the image. Any architecture-specific considerations should be handled by the toolchain/cross-compiler rather than by the filesystem image generation.

## Open considerations

The following are intentionally not requirements at this point:

- Read-only filesystem support.
- A flag to force the generated image to be read-only.
- Custom filesystem parameters beyond the label and standard ext4 defaults.

If read-only support is added later, the implementation should also clarify whether the consumer is expected to mount the image with `ro` or whether the image itself should be generated with properties enforcing read-only usage.

## Acceptance criteria

- [ ] A raw `.ext4` image is generated from `srcs`.
- [ ] The generated filesystem is valid ext4.
- [ ] Image size is calculated from the actual input content rather than using a fixed safety margin.
- [ ] All supported Linux files/directories can be included.
- [ ] Input paths are preserved relative to `/`.
- [ ] The filesystem is writable by default.
- [ ] Journaling is enabled.
- [ ] Filesystem label is `s-core-data`.
- [ ] The generated image can be mounted using the standard Linux `mount` mechanism.
- [ ] The solution works independently of the architecture of the files contained in the image.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.