heads icon indicating copy to clipboard operation
heads copied to clipboard

Further optimization for space (-Os -> -Oz): musl-cross-make-> bump to gcc 15.1.0 & related changes

Open tlaurion opened this issue 5 months ago • 0 comments

WiP : bump musl-cross-make to latest commit, bump gcc 9.4.0 -> 15.1.0; rename/bump kexec-tools to latest version + gcc 15.10, switch/patch modules to switch from -Os to -Oz

TLDR: 1.44% space reduction (115kb gain)

Stats from global to specifics:

coreboot final stiching stats diff

"/home/user/heads/build/x86/coreboot-24.12/EOL_x230-hotp-maximized/cbfstool" "/home/user/heads/build/x86/coreboot-24.12/EOL_x230-hotp-maximized/coreboot.rom" print
FMAP REGION: COREBOOT
Name                           Offset     Type           Size   Comp
cbfs_master_header             0x0        cbfs header        32 none
cpu_microcode_blob.bin         0x80       microcode       26624 none
fallback/romstage              0x68c0     stage          107512 none
fallback/ramstage              0x20d40    stage          149993 LZMA (324488 decompressed)
config                         0x45780    raw              3521 LZMA (11135 decompressed)
revision                       0x46580    raw               724 none
build_info                     0x46880    raw               101 none
bootsplash.jpg                 0x46940    bootsplash      43282 none
fallback/dsdt.aml              0x51280    raw             14748 none
vbt.bin                        0x54c80    raw              1433 LZMA (4281 decompressed)
cmos_layout.bin                0x55280    cmos_layout      2012 none
fallback/postcar               0x55ac0    stage           40156 none
fallback/payload               0x5f800    simple elf    7908858 none
(empty)                        0x7ea640   null          4048740 none
bootblock                      0xbc6dc0   bootblock       36864 none

Master:

Jul 28 03:19:40 EOL_x230-hotp-maximized/util/cbfstool/cbfstool EOL_x230-hotp-maximized/coreboot.rom print -r COREBOOT
Jul 28 03:19:40 FMAP REGION: COREBOOT
Jul 28 03:19:40 Name                           Offset     Type           Size   Comp
Jul 28 03:19:40 cbfs_master_header             0x0        cbfs header        32 none
Jul 28 03:19:40 cpu_microcode_blob.bin         0x80       microcode       26624 none
Jul 28 03:19:40 fallback/romstage              0x68c0     stage          107512 none
Jul 28 03:19:40 fallback/ramstage              0x20d40    stage          149982 LZMA (324488 decompressed)
Jul 28 03:19:40 config                         0x45780    raw              3521 LZMA (11135 decompressed)
Jul 28 03:19:40 revision                       0x46580    raw               724 none
Jul 28 03:19:40 build_info                     0x46880    raw               101 none
Jul 28 03:19:40 bootsplash.jpg                 0x46940    bootsplash      43282 none
Jul 28 03:19:40 fallback/dsdt.aml              0x51280    raw             14748 none
Jul 28 03:19:40 vbt.bin                        0x54c80    raw              1433 LZMA (4281 decompressed)
Jul 28 03:19:40 cmos_layout.bin                0x55280    cmos_layout      2012 none
Jul 28 03:19:40 fallback/postcar               0x55ac0    stage           40156 none
Jul 28 03:19:40 fallback/payload               0x5f800    simple elf    8024362 none
Jul 28 03:19:40 (empty)                        0x806980   null          3933220 none
Jul 28 03:19:40 bootblock                      0xbc6dc0   bootblock       36864 none

Analysis:

  • gain (emtpy comparison) = 4048740 - 3933220 = 115520 bytes

sizes.txt comparison (diff -u master pr)

--- /tmp/master_sizes.txt       2025-07-27 23:19:45.000000000 -0400
+++ build/x86/EOL_x230-hotp-maximized/sizes.txt 2025-07-30 12:22:53.607423022 -0400
-2025-07-28 03:11:34+00:00 652eff3d831aaf195825e55903cbc4fab67d4a56 clean
- 2822912:/root/heads/build/x86/EOL_x230-hotp-maximized/bzImage
-  930816:/root/heads/build/x86/EOL_x230-hotp-maximized/modules.cpio
+2025-07-30 16:19:56+00:00 b5a94d5488287500316e4de1072a6fba41d593b9 clean
+ 2798032:/home/user/heads/build/x86/EOL_x230-hotp-maximized/bzImage
+  928256:/home/user/heads/build/x86/EOL_x230-hotp-maximized/modules.cpio
[...]
-13865984:/root/heads/build/x86/EOL_x230-hotp-maximized/tools.cpio
+13262336:/home/user/heads/build/x86/EOL_x230-hotp-maximized/tools.cpio
[...]
-  434176:/root/heads/build/x86/EOL_x230-hotp-maximized/heads.cpio
+  434176:/home/user/heads/build/x86/EOL_x230-hotp-maximized/heads.cpio
[...]
- 2508800:/root/heads/build/x86/EOL_x230-hotp-maximized/data.cpio
+ 2508800:/home/user/heads/build/x86/EOL_x230-hotp-maximized/data.cpio
[...]
- 5212160:build/x86/EOL_x230-hotp-maximized/initrd.cpio.xz
+ 5121536:build/x86/EOL_x230-hotp-maximized/initrd.cpio.xz

Analysis:

  • initrd.cpio.xz (concatenated+compressed cpio) reduced by 90,624 bytes (compression gains maybe suboptimal?)
    • modules.cpio (kernel modules) reduced by 2,560 bytes
    • tools.cpio (compiled libs/bins) reduced by 603,648 bytes
  • bzImage (kernel) reduced by 24,880 bytes

TLDR:

  • Master Heads payload: 8,035,072 bytes (7.66 MB)
  • PR Heads payload: 7,919,568 bytes (7.55 MB) Total Savings: 115,504 bytes (1.44% reduction)

Continues #590

tlaurion avatar Jul 30 '25 17:07 tlaurion