Closed ls-1801 closed 5 months ago
One thing you could do is disabling the assertion checks in the bootloader code, by adding -DNO_ASSERT
to the bootloader compiler flags at https://github.com/nanovms/nanos/blob/8a66481fd4f1d657122fc37998e13ee452b1768b/platform/pc/boot/Makefile#L34.
Alternatively, since the 64KB size limit only applies to non-Nitro AWS instances, if you are not running your workloads on non-Nitro AWS instances you could just remove the binary size check at https://github.com/nanovms/nanos/blob/8a66481fd4f1d657122fc37998e13ee452b1768b/platform/pc/boot/Makefile#L120.
Alright cool, stage2 is down to 44KiB. How likely is it to hit any of the asserts?
Most asserts are there to detect bugs in the code, and most are in code shared between the bootloader and the kernel. Given that the bootloader is relatively simple and executes in a fixed sequence of steps, I would say the likelihood of any of the asserts to be hit is very low.
https://github.com/nanovms/nanos/pull/2012 decreases the bootloader size and allows building with gcc-9.
I am running in issues when building nanos
make run-noaccel
on a different machine.My local machine (Works here): GLIBC 2.36-9+deb12u4 GCC 12.2
On the server (does not work): GLIBC 2.31-0ubuntu9.9 GCC 9.4
Is there anything i can do to reduce the stage2 size? Or have i just picked a bad version of compiler and libc, that does not generate the smaller binary?