Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support partition offset and size for linux file device #75

Open
rick-masters opened this issue Jun 9, 2023 · 0 comments · May be fixed by #76
Open

Support partition offset and size for linux file device #75

rick-masters opened this issue Jun 9, 2023 · 0 comments · May be fixed by #76

Comments

@rick-masters
Copy link

The lwext4 API for a linux file device does not support partition offsets. The code assumes the partition starts at the beginning of the file. This means a partitioned disk image with MBR cannot be created entirely with lwext4. lwext4 supports writing an MBR with partitions in a linux file but then does not allow creating file systems in those (offset) partitions, which is a confusing limitation.

Ideally, lwext4 would allow setting the partition offset and size for the file device like this:

https://github.com/rick-masters/live-bootstrap/blob/ebb9b941a781f6fea26deeb12d1f187c2c856315/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L69-L74

This would allow creating an MBR at offset zero and then reconfiguring the file dev at the partition offset to create and use a partition.

Creating an MBR:
https://github.com/rick-masters/live-bootstrap/blob/kernel-bootstrap-fiwix-hd/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L229-L240

Reopening a partition:
https://github.com/rick-masters/live-bootstrap/blob/ebb9b941a781f6fea26deeb12d1f187c2c856315/sysa/lwext4-1.0.0-lb2/files/make_fiwix_initrd.c#L242-L256

The forthcoming PR adds APIs to set the offset and size for the linux file device. Note that these APIs are optional and the library will behave exactly the same without them. They have been designed to be fully backward compatible with the existing API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant