moby: optimize kernels for size

this is REQUIRED for future kernel changes i plan: u-boot has limitations on the kernel size it can load
This commit is contained in:
2024-09-26 01:42:35 +00:00
parent 3de9465de9
commit 20265a899b

View File

@@ -7,9 +7,16 @@
}:
linux_latest.override {
DTB = true; #< XXX: not sure if actually needed
# compressed images:
# - `target = ...` doesn't have effect here.
# - one _can_ manually gzip the result, and it's about 20% the size, and u-boot boots it *much* faster.
# - unsure if u-boot cares about the name of the image (`Image` v.s. `Image.gz`)
# - u-boot decompression does not fix size constraints (e.g. >64 MiB decompressed image may still be a problem)
# target = "Image.gz"; #< this doesn't have effect, have to use manual-config for it
# DTB = true; #< this doesn't have effect, but is default
autoModules = true;
preferBuiltin = true;
preferBuiltin = true; #< TODO: disable this for faster boots and fewer size limitations
enableCommonConfig = true; #< enable nixpkgs config options
kernelPatches = [
@@ -65,6 +72,14 @@ linux_latest.override {
# DRM_PANEL_SIMPLE = module;
# };
# }
# {
# # necessary only if `preferBuiltin = false`
# name = "fix-module-only";
# patch = null;
# extraStructuredConfig = with lib.kernel; {
# SUN8I_DE2_CCU = lib.mkForce module;
# };
# }
{
name = "fix-no-display";
patch = null;
@@ -123,6 +138,20 @@ linux_latest.override {
MEDIA_PCI_SUPPORT = lib.mkForce no;
};
}
{
# i suspect that u-boot can only load a (decompressed) image up to 64 MiB in size for this platform.
# i say that because `CONFIG_DEBUG_INFO=y` seems to break the boot
# and the difference in size is 62843392 v.s. 71297536
# see this u-boot patch, which places OPTREE 72 MiB after the relocated u-boot stack... <https://lore.kernel.org/all/20240217005817.2150377-3-jonas@kwiboo.se/#Z31configs:pinephone-pro-rk3399_defconfig>
# largest observed bootable image: 63300096B
# smallest observed non-bootable image: 71297536B
name = "optimize-for-size";
patch = null;
extraStructuredConfig = with lib.kernel; {
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE = no;
CONFIG_CC_OPTIMIZE_FOR_SIZE = yes;
};
}
{
name = "reset-automodules-overrides";
patch = null;