rust-osdev / bootloader

An experimental pure-Rust x86 bootloader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image builder sporadically throws ENOSPC on macOS even with 72GB of host space available

kennystrawnmusic opened this issue · comments

After having suddenly added 1,464 lines of code to my kernel the UEFI version of this will no longer compile:

Screenshot 2023-10-22 at 7 53 38 AM

This has happened before, but figured it was just a transient issue — ah, not anymore. The instant a large change is made, the bootloader suddenly fails to copy the kernel binary onto the disk image. Why is this? And is there a way to potentially specify in the BootConfig how big you want the disk image to be?

AFAICT the out of space error is not related to your hard drive but to the bootable disk image we create. We try to calculate the smallest size we need to fit all the files on the disk image and apparently those calculations are not correct.
Can you try to add a by more padding but increasing the value calculated in this line?

let fat_size_padded_and_rounded = ((needed_size + 1024 * 64 - 1) / MB + 1) * MB;

AFAICT the out of space error is not related to your hard drive but to the bootable disk image we create. We try to calculate the smallest size we need to fit all the files on the disk image and apparently those calculations are not correct.

Can you try to add a bit more padding but increasing the value calculated in this line?

let fat_size_padded_and_rounded = ((needed_size + 1024 * 64 - 1) / MB + 1) * MB;

Will do that when I get home, thanks.

Alright, just submitted PR #397 to fix this

I also noticed that this only happens when compiling with debug assertions enabled; file size doesn't overflow at all and compilation still occurs without any patches if I pass --release to Cargo. So using that in my VS Code configuration files as a workaround.

I also noticed that this only happens when compiling with debug assertions enabled; file size doesn't overflow at all and compilation still occurs without any patches if I pass --release to Cargo. So using that in my VS Code configuration files as a workaround.

Does the --release flag also affect your kernel? If so, the generated binary will have a different size, which might explain why no error occurs.

I also noticed that this only happens when compiling with debug assertions enabled; file size doesn't overflow at all and compilation still occurs without any patches if I pass --release to Cargo. So using that in my VS Code configuration files as a workaround.

Does the --release flag also affect your kernel? If so, the generated binary will have a different size, which might explain why no error occurs.

It actually improves performance, so I prefer it anyway for that reason.