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

utils.py: raise error if rootfs file size is not multiple of 4KiB. #236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eatradish
Copy link

@eatradish eatradish commented Nov 10, 2023

See: AOSC-Dev/aosc-asahi-installer@c5c8633, if rootfs image size can not multipie of 16MiB, asahi-installer will raise EINVAL, users don't know whats happen ...

The point of this commit is to look for illegitimate rootfs image sizes in advance, so that the raise error becomes clear.

@eatradish eatradish force-pushed the raise-err-if-rootfs-image-not-multipie-16 branch 3 times, most recently from 14f2433 to db8f947 Compare November 10, 2023 12:45
@eatradish eatradish changed the title utils.py: raise error if rootfs file size is not multiple of 16. utils.py: raise error if rootfs file size is not multiple of 16MiB. Nov 10, 2023
@marcan
Copy link
Member

marcan commented Nov 10, 2023

This doesn't look right. 16MiB is just the copy block size.

The rootfs has to be a multiple of the physical sector size which is 4KiB. If your image creation is producing FS images that are not a multiple of the sector size, then yeah, you have a problem ;)

@eatradish
Copy link
Author

eatradish commented Nov 10, 2023

This doesn't look right. 16MiB is just the copy block size.

The rootfs has to be a multiple of the physical sector size which is 4KiB. If your image creation is producing FS images that are not a multiple of the sector size, then yeah, you have a problem ;)

Thanks for the answer! do you think I should go ahead and change my PR to 4KiB or is there no need to go ahead and do anything?

@Cyanoxygen
Copy link

The rootfs has to be a multiple of the physical sector size which is 4KiB. If your image creation is producing FS images that are not a multiple of the sector size, then yeah, you have a problem ;)

Thanks for pointing that out! Yes, due to the flaw in the calculation algorithm, our image creation process just always creates images which are not a multiple of 16MiB, 4KiB or 512B. I thought that each write in the dd process should always equal to bs.

@eatradish eatradish force-pushed the raise-err-if-rootfs-image-not-multipie-16 branch from db8f947 to d9abd7d Compare November 11, 2023 03:27
See: AOSC-Dev/aosc-asahi-installer@f46e12d,
if rootfs image size can not multipie of 4KiB, asahi-installer will raise `EINVAL`, users don't know whats happen ...

The point of this commit is to look for illegitimate rootfs image sizes in advance, so that the raise error becomes clear.

Signed-off-by: eatradish <[email protected]>
@eatradish eatradish force-pushed the raise-err-if-rootfs-image-not-multipie-16 branch from d9abd7d to fe92e2e Compare November 11, 2023 03:28
Cyanoxygen added a commit to AOSC-Dev/aosc-asahi-installer that referenced this pull request Nov 11, 2023
- According to [1], image size does not necessaily comply to the
  multiple of 16MiB rule, but 4KiB is the hard limit.

- Also make sure bc does not emit any decimals.

[1]: AsahiLinux/asahi-installer#236 (comment)
@eatradish eatradish changed the title utils.py: raise error if rootfs file size is not multiple of 16MiB. utils.py: raise error if rootfs file size is not multiple of 4KiB. Nov 11, 2023
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 this pull request may close these issues.

3 participants