-
-
Notifications
You must be signed in to change notification settings - Fork 205
Further optimization for space (-Os -> -Oz): musl-cross-make-> bump to gcc 15.1.0 & related changes #1991
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
base: master
Are you sure you want to change the base?
Conversation
69ab1d1 to
c19ab15
Compare
|
This PR will be needed soon, since xx20 (t420/x220) are near space exhaustion (less than 100kb free left) as can be seen at #2041 (comment) : the t420-hotp-maximized rom has 67kb free left in CBFS region. |
Introduce validation to ensure coreboot CBFS size matches IFD BIOS region: - Add bin/validate_cbfs_ifd_fit.sh: New script to validate CBFS size against Intel Flash Descriptor (IFD) BIOS region and provide space usage statistics - Add Makefile targets: validate_cbfs_ifd and fix_cbfs_ifd for manual validation and automatic fixes - Integrate validation into coreboot module build process to catch misconfigs at compile time - Add validation to final ROM image generation step - Add informational hint to Makefile when V=1 verbose flag is not set This prevents shipping firmware with CBFS sizes that exceed the available BIOS region, catching configuration errors early in the build process. Signed-off-by: Thierry Laurion <[email protected]>
For the t420-hotp-maximized in this pr, CBFS free space is 209 KiB :) |
Local build:
Builds are reproducible if built clean ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR upgrades the Heads build toolchain from GCC 9.4.0 to GCC 15.1.0 and systematically switches compiler optimization flags from -Os (optimize for size) to -Oz (optimize aggressively for size) across 30+ modules. The changes deliver a 1.44% space reduction (115 KB) in the final firmware payload through improved compiler optimization and enhanced binary stripping.
Key changes include:
- GCC toolchain upgrade via musl-cross-make bump to latest commit with GCC 15.1.0
- C23 compatibility patches for multiple modules (tpmtotp, powerpc-utils, bash, e2fsprogs, gpg2, cairo, linux kernel)
- Systematic
-Osto-Ozoptimization flag conversion across all modules - New CBFS/IFD validation script with automatic size fixing capability
- Module version bumps: kexec-tools (2.0.26→2.0.31), dropbear (2016.74→2025.88)
- Enhanced Makefile with GPG injection caching and improved stripping flags
- Disabled features in OpenSSL and LVM2 for additional space savings
Reviewed changes
Copilot reviewed 59 out of 60 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/musl-cross-make | Bumps commit hash and GCC version from 9.4.0 to 15.1.0 with upgrade notes |
| patches/musl-cross-make-3635262e4524c991552789af6f36211a335a77b3/0001-use-gcc-15_1_0.patch | Updates musl-cross-make Makefile to use GCC 15.1.0 |
| patches/tpmtotp-4d63d21c8b7db2e92ddb393057f168aead147f47/*.patch | Three patches fixing GCC 15.1.0 compatibility issues (function signatures, printf formats, AES macro) |
| patches/powerpc-utils-1.3.5/0001-fix-rtas-function-pointer-signatures-gcc15.patch | Fixes function pointer declarations for C23 compatibility |
| patches/kexec-tools-2.0.31/*.patch | Six patches for kexec-tools 2.0.31: disables unused modules, improves framebuffer support, adds EBDA workaround, fixes purgatory build, uses build compiler for utils, adds x86-64 baseline flags |
| patches/lvm2-2.03.23.patch | Adds libgen.h include for basename() function required by GCC 15.1.0 |
| patches/linux-6.6.16-openpower/0008-powerpc-boot-Fix-C23-bool-compatibility-for-GCC-15.patch | Adds -std=gnu11 to PowerPC boot Makefile for C23 bool keyword conflicts |
| patches/dropbear-2025.88/0001-disable-fatal-user-group-change-errors-for-heads-environment.patch | Updates patch paths for dropbear 2025.88 source tree restructuring |
| patches/coreboot-talos_2/0003-ugly_skiboot-patch_fix_for_newer_gcc_from_musl_125.patch | Adds additional GCC 15.1.0 warning suppressions for skiboot (-Wno-error=unterminated-string-initialization, -Wno-error=misleading-indentation) |
| patches/bash-5.1.16.patch | Adds unistd.h include to lib/termcap/tparam.c for write() declaration |
| modules/kexec | Deleted - replaced by modules/kexec-tools |
| modules/kexec-tools | New module file for kexec-tools 2.0.31 with -Oz optimization |
| modules/dropbear | Updates to version 2025.88 with additional configure options for space savings |
| modules/openssl | Switches to -Oz and disables additional protocols/algorithms (dtls, ec2m, engine, gost, md2, srp, ssl3, tls1, tls1_1) |
| modules/lvm2 | Switches to -Oz and disables advanced features (thin, cache, VDO, writecache, integrity, snapshots, mirrors) |
| modules/linux | Adds -std=gnu11 flag and PowerPC-specific GCC 15.1.0 compatibility flags |
| modules/bash | Changes to -Oz with -std=gnu11 for C23 compatibility |
| modules/cairo | Changes to -Oz with -std=gnu11, -Wno-inline, -Wno-incompatible-pointer-types |
| modules/coreboot | Adds validation script calls and extensive GCC 15.1.0 compatibility documentation |
| modules/e2fsprogs | Changes to -Oz with -std=gnu11 for C23 bool keyword conflicts |
| modules/gpg2 | Changes to -Oz with -std=gnu11 and adds -DDISABLE_PHOTO_VIEWER |
| modules/libgcrypt | Changes to -Oz and disables jent-support |
| modules/zstd, modules/util-linux, modules/tpmtotp, modules/qrencode, modules/powerpc-utils, modules/pixman, modules/pinentry, modules/newt, modules/ncurses, modules/mbedtls, modules/libusb-compat, modules/libusb, modules/libpng, modules/libnitrokey, modules/libksba, modules/libhidapi-libusb, modules/libgpg-error, modules/libassuan, modules/kbd, modules/ioport, modules/io386, modules/gpg, modules/flashtools, modules/flashrom, modules/flashprog, modules/fbwhiptail, modules/exfatprogs, modules/cryptsetup2, modules/cryptsetup | All changed from -Os to -Oz optimization |
| bin/validate_cbfs_ifd_fit.sh | New validation script that checks CONFIG_CBFS_SIZE against IFD BIOS region with auto-fix capability |
| Makefile | Adds validation targets, enhances strip flags (--strip-all), implements GPG injection caching, adds verbose build hints, fixes kexec module reference, adds coreboot cbmem GCC 15.1.0 compatibility flag |
Comments suppressed due to low confidence (2)
patches/dropbear-2025.88/0001-disable-fatal-user-group-change-errors-for-heads-environment.patch:1
- The patch header line references the old path "dropbear-2016.74" but this module is being updated to "dropbear-2025.88". The patch should use paths that match the new version to avoid confusion during patch application.
patches/dropbear-2025.88/0001-disable-fatal-user-group-change-errors-for-heads-environment.patch:12 - Commenting out the
dropbear_exitcalls whensetgid/initgroupsorsetuidfail means the server will continue executing the user session even if it could not drop privileges toses.authstate.pw_uid/pw_gid, so a user who authenticated as an unprivileged account could end up with a shell running under the original (likely root) UID/GID. This silently bypasses the operating system’s privilege separation mechanisms and can turn any failure in the privilege-dropping path (for example due to security policy or environment issues) into a remote privilege escalation to the Dropbear daemon’s UID. The fix is to keep these failures fatal (e.g., by retainingdropbear_exitor otherwise aborting the session) so that no user commands are executed when user/group changes fail.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| echo ""; \ | ||
| echo "Validating CONFIG_CBFS_SIZE vs IFD BIOS region..."; \ | ||
| $(pwd)/bin/validate_cbfs_ifd_fit.sh \ | ||
| --coreboot-dir "$(build)/$(coreboot_dir)" \ | ||
| --board-dir "$(build)/$(BOARD)" \ | ||
| --config "$(pwd)/$(CONFIG_COREBOOT_CONFIG)" \ | ||
| || exit 1; \ | ||
| echo "" |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation script is called twice during the build: once at configuration time (lines 193-199) and once after the build (lines 273-278). Both calls use || exit 1 which will cause the build to fail if validation fails. However, the first call (at configuration time) checks before coreboot is built, when cbfstool and ifdtool don't exist yet. The script handles this by returning exit code 0 when tools are missing, but this makes the || exit 1 pattern misleading. Consider documenting why the validation is called twice, or restructuring to only validate when tools are definitely available.
| From 14f48ea80e510e5af79ca6c46fa28e99a3695d1c Mon Sep 17 00:00:00 2001 | ||
| From: Ross Lagerwall <[email protected]> | ||
| Date: Thu, 17 Apr 2025 09:31:40 +0100 | ||
| Subject: [PATCH] x86_64: Use the x86-64 level for purgatory | ||
|
|
||
| The compiler may be configured by default to use a newer | ||
| microarchitecture level such as x86-64-v3. Set purgatory to compile | ||
| using the baseline x86-64 level since the environment isn't set up | ||
| correctly to use SSE and AVX instructions. At the same time, be a bit | ||
| paranoid and add some additional flags to ensure that the compiler | ||
| doesn't use any such instructions. | ||
|
|
||
| Signed-off-by: Ross Lagerwall <[email protected]> | ||
| Signed-off-by: Simon Horman <[email protected]> | ||
| --- | ||
| --- a/purgatory/arch/x86_64/Makefile 2025-08-11 16:40:00.000000000 +0000 | ||
| +++ b/purgatory/arch/x86_64/Makefile 2025-08-11 16:40:00.000000000 +0000 | ||
| @@ -24,5 +24,5 @@ x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c | ||
| x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c | ||
|
|
||
| ifneq ($(SUBARCH),x32) | ||
| -x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large | ||
| +x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large -march=x86-64 -mno-mmx -mno-sse -mno-sse2 -mno-avx | ||
| endif |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch comment mentions "GCC 15.10" but the PR description and other patches consistently reference GCC 15.1.0. This appears to be a typo where "15.10" should be "15.1.0".
| @@ -0,0 +1,27 @@ | |||
| modules-$(CONFIG_KEXEC) += kexec-tools | |||
|
|
|||
| kexec-tools_version := 2.0.31 | |||
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions "rename/bump kexec-tools to latest version + gcc 15.10" but kexec-tools is being set to version 2.0.31 (released in 2024). According to the kernel.org repository, version 2.0.31 is not the latest version - version 2.0.32 was released in December 2024. Consider bumping to 2.0.32 if compatible, or clarify in the PR description that 2.0.31 was chosen intentionally.
| dropbear_version := 2025.88 | ||
| dropbear_dir := dropbear-$(dropbear_version) | ||
| dropbear_tar := dropbear-$(dropbear_version).tar.bz2 | ||
| dropbear_url := https://mirror.dropbear.nl/mirror/releases/$(dropbear_tar) | ||
| dropbear_hash := 2720ea54ed009af812701bcc290a2a601d5c107d12993e5d92c0f5f81f718891 | ||
| dropbear_url := https://matt.ucc.asn.au/dropbear/releases/$(dropbear_tar) | ||
| dropbear_hash := 783f50ea27b17c16da89578fafdb6decfa44bb8f6590e5698a4e4d3672dc53d4 |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropbear is being updated from version 2016.74 (released in July 2016) to version 2025.88 (released in April 2025), which is a major version jump spanning 9 years. This is a significant upgrade that likely includes many changes. While the space optimization goals are met, ensure that:
- The patch for disabling user/group change errors still applies correctly to the new source code structure
- All Heads-specific configurations remain compatible with the new version
- Testing has been performed to verify SSH/SCP functionality still works as expected
The patch shows the file path changed from dropbear-2016.74/svr-chansession.c to src/svr-chansession.c, indicating a source tree restructuring. Verify the patch applies cleanly.
modules/powerpc-utils
Outdated
| # - Converts void (*)() to properly typed function pointers: | ||
| # * int (*)(int, int, ...) for variadic RTAS calls | ||
| # * int (*)(int, int, int, int *, int *, int *) for specific RTAS calls |
Copilot
AI
Jan 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment describes function pointer types but contains inaccuracies. The actual patch (lines 17-19 in the patch file) shows the function pointers are converted to:
void *(*parse_rtas_event)(char *, int)void (*rtas_print_event)(FILE *, void *, int)void (*cleanup_rtas_event)(void *)
However, the comment in lines 8-10 claims they are converted to types with "int" return values and different signatures. The comment should accurately reflect what the patch actually does.
Upgrade from 5.1.16 (Jan 2022) to 5.3 (Jul 2025). The newer version doesn't require patches - it already includes proper C header handling and the -std=gnu11 workaround is no longer needed thanks to upstream fixes. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991)
…for 6.1.8 only Remove duplication of EXTRA_FLAGS definition across kernel versions. Define base flags once (-fdebug-prefix-map, -gno-record-gcc-switches), then conditionally add -std=gnu11 only for kernel 6.1.8 which requires GCC 15.1 C23 compatibility workaround. Other kernel versions (4.14.62, 4.19.139, 5.4.69, 5.10.214, 6.6.16-openpower) compile without workaround flags. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 2.03.23 (Nov 2023) to 2.03.25 (Jul 2024). The newer version removes the libgen.h issue that required a GCC 15.1.0 workaround patch. However, GCC 15.1.0's C23 mode enforces const qualifiers on stdin/stdout/stderr, which breaks lvm2's reopen_standard_stream() calls. Port the working patch from lvm2-2.03.23 in osresearch/heads master branch (commit 63290d6) to 2.03.25. The patch wraps problematic memory allocation and log10() calls in #if 0 blocks to disable them at compile-time, maintaining compatibility with musl-libc and C23 standard enforcement. Changes: - Bump lvm2 from 2.03.23 to 2.03.25 - Update hash to 4bea6fd2e5af9cdb3e27b48b4efa8d89210d9bfa13df900e092e404720a59b1d - Replace -Os with -Oz for space optimization - Port lvm2-2.03.23.patch to lvm2-2.03.25.patch for C23 compatibility - Remove obsolete lvm2-gcc-15.1-libgen.patch Tested: EOL_x220-hotp-maximized board builds successfully with 182 KiB free CBFS Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 5.1.16 (Jan 2022) to 5.3 (Jul 2025). The newer version doesn't require patches - it already includes proper C header handling and the -std=gnu11 workaround is no longer needed thanks to upstream fixes. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
…for 6.1.8 only Remove duplication of EXTRA_FLAGS definition across kernel versions. Define base flags once (-fdebug-prefix-map, -gno-record-gcc-switches), then conditionally add -std=gnu11 only for kernel 6.1.8 which requires GCC 15.1 C23 compatibility workaround. Other kernel versions (4.14.62, 4.19.139, 5.4.69, 5.10.214, 6.6.16-openpower) compile without workaround flags. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 2.03.23 (Nov 2023) to 2.03.25 (Jul 2024). The newer version removes the libgen.h issue that required a GCC 15.1.0 workaround patch. However, GCC 15.1.0's C23 mode enforces const qualifiers on stdin/stdout/stderr, which breaks lvm2's reopen_standard_stream() calls. Port the working patch from lvm2-2.03.23 in osresearch/heads master branch (commit 63290d6) to 2.03.25. The patch wraps problematic memory allocation and log10() calls in #if 0 blocks to disable them at compile-time, maintaining compatibility with musl-libc and C23 standard enforcement. Changes: - Bump lvm2 from 2.03.23 to 2.03.25 - Update hash to 4bea6fd2e5af9cdb3e27b48b4efa8d89210d9bfa13df900e092e404720a59b1d - Replace -Os with -Oz for space optimization - Port lvm2-2.03.23.patch to lvm2-2.03.25.patch for C23 compatibility - Remove obsolete lvm2-gcc-15.1-libgen.patch Tested: EOL_x220-hotp-maximized board builds successfully with 182 KiB free CBFS Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
a6f1917 to
f547ef2
Compare
For KVM/QEMU boards, cache source/key hashes in a .meta file to skip repeated injections when inputs are unchanged. Default SRC_SHA256/KEY_SHA256 to empty if the meta file lacks them (or sourcing fails) before comparing hashes to avoid false negatives. Signed-off-by: Thierry Laurion <[email protected]>
….1.0 (in the goal of using gcc 12+ -Oz instead of -Os for more agressive optimization for space) Signed-off-by: Thierry Laurion <[email protected]>
… (purgatory cannot be built with i386; do 2.0.31(latest) + missing patch) Signed-off-by: Thierry Laurion <[email protected]>
…ility fixes This commit upgrades the cross-compilation toolchain from GCC 9.4.0 to GCC 15.1.0 and implements systematic compatibility fixes across the codebase. **Core Changes:** - modules/musl-cross-make: Update to commit 3635262e (GCC 15.1.0 toolchain) - Systematic conversion from -Os to -Oz optimization across 33+ modules - Added comprehensive C23 compatibility fixes for affected modules **C23 Standard Compatibility Fixes:** - modules/linux: Added -std=gnu11 to resolve bool/false keyword conflicts - modules/gpg2: Added -std=gnu11 to resolve true keyword conflicts - modules/bash: Added -std=gnu11 + patched tparam.c for unistd.h include - modules/e2fsprogs: Added -std=gnu11 to resolve bool typedef conflicts **Header Include Fixes:** - patches/lvm2-2.03.23.patch: Added libgen.h include for basename() function - patches/bash-5.1.16.patch: Added unistd.h include for write() function **Compiler Flag Adjustments:** - modules/cairo: Added -Wno-inline and -Wno-incompatible-pointer-types for -Oz - Makefile: Added -Wno-unterminated-string-initialization for cbmem utility **Optimization Improvements:** - Converted CFLAGS from -Os to -Oz in 33+ modules for better size optimization - All modules: cryptsetup, flashrom, gpg, libgcrypt, ncurses, util-linux, etc. **Documentation & Future Maintenance:** - Added unified TODO_GCC_15_* comments across all modified modules - Created doc/GCC_15_UPGRADE_SUMMARY.md for tracking changes - Created doc/GCC_15_COMPATIBILITY_TEMPLATE.md for future upgrades - All compatibility fixes documented with removal conditions **Build Validation:** - Full build testing completed successfully - All modules compile cleanly with GCC 15.1.0 - Cross-compiler toolchain verified functional - Systematic C23 compatibility approach established This upgrade enables modern GCC optimizations while maintaining compatibility with current module versions. All changes include TODO comments for easy removal when modules are updated to support C23 natively. Co-authored-by: GitHub Copilot <[email protected]> Signed-off-by: Thierry Laurion <[email protected]>
…being added to cpio then initrd.cpio.xz Signed-off-by: Thierry Laurion <[email protected]>
…e fixes to comply with gcc 15.1+ Signed-off-by: Thierry Laurion <[email protected]>
….patch individual patch files Signed-off-by: Thierry Laurion <[email protected]>
…to be built with -O0 Signed-off-by: Thierry Laurion <[email protected]>
• Upgrade from 2016.74 to 2025.88 for GCC 15.1.0 compatibility • Apply extensive configure optimizations to minimize feature set: --disable-lastlog, --disable-syslog, --disable-utmp, --disable-utmpx, --disable-wtmp, --disable-wtmpx, --disable-loginfunc, --disable-pututline, --disable-pututxline, --disable-openpty, --disable-shadow • Restore critical security patch for Heads embedded environment: Comment out fatal user/group change errors that legitimately fail in firmware • Organize patches under patches/dropbear-2025.88/ directory structure • Size impact: +89KB (185KB→274KB dropbear, 23KB→27KB scp) Trade-off necessary for security updates and compiler compatibility Signed-off-by: Thierry Laurion <[email protected]>
…c algorithms Reduce OpenSSL libcrypto.so.3 size by 103KB (3.1%) through aggressive algorithm disabling via configure flags. Removed unused cryptographic algorithms while maintaining compatibility with TPM2-TSS requirements. Disabled algorithms: - Legacy ciphers: DES, RC2/RC4, IDEA, Blowfish, CAST - Hash functions: MD2/MD4/MD5, RIPEMD160, Whirlpool - Modern algorithms: ChaCha20, Poly1305, ARIA, Camellia - Elliptic curves: EC2M curves, SM2/SM4 Chinese algorithms - Key exchange: DH, DSA, SRP, GOST - Protocol versions: SSL 3.0, TLS 1.0/1.1 - Advanced features: OCB, SIV, CMAC, BLAKE2, engines Size impact: - libcrypto.so.3: 3,280,536 → 3,177,880 bytes (-103KB, -3.1%) - tools.cpio total: ~621KB cumulative savings vs master Maintains required algorithms for TPM2 operations (SHA, AES, SM3). Signed-off-by: Thierry Laurion <[email protected]>
…tion Further optimize LVM2 by disabling unused features: - --with-snapshots=none: Disable snapshot support - --with-mirrors=none: Disable mirror support - --disable-udev_rules: Disable udev integration - --disable-pkgconfig: Disable pkgconfig support - --disable-nls: Disable internationalization Results (stripped binary sizes): - lvm: 2,140,888 → 2,132,376 bytes (-8,512 bytes) - dmsetup: 110,936 bytes (unchanged) - Total LVM2 optimization: 51,976 bytes saved These flags safely remove functionality not needed by Heads while maintaining essential device-mapper capabilities required by cryptsetup for disk encryption support. Signed-off-by: Thierry Laurion <[email protected]>
…tion Algorithm-specific optimization targeting only required cryptographic functions: - Ciphers: aes des chacha20 (for GPG2 and factory reset) - Public key: rsa ecc (RSA keys and ECDSA/ECDH nistp256) - Digests: sha1 sha256 sha512 blake2 (essential hash functions) Space reduction: - Baseline (stripped): 814,928 bytes - Optimized (stripped): 497,504 bytes - Space saved: 317,424 bytes (310KB) - Reduction: 38.9% Excluded unused algorithms: - Symmetric: arcfour blowfish cast5 twofish serpent rfc2268 seed camellia idea salsa20 gost28147 sm4 - Digests: crc gostr3411-94 md4 md5 rmd160 sha3 tiger whirlpool stribog sm3 - Public key: dsa elgamal Hardware acceleration preserved for optimal performance. Maintains full functionality for GPG2 operations and factory reset key generation. Signed-off-by: GitHub Copilot <[email protected]> Signed-off-by: Thierry Laurion <[email protected]>
Optimized libgcrypt with -Oz optimization: - Stripped size: 564,192 bytes (551KB) - Significant improvement over master baseline - All algorithms enabled for full compatibility Baseline measurements: - Master baseline: 1,198,224 bytes (1.17MB) - Current (-Oz): 564,192 bytes (551KB) - Space saved: 634,032 bytes (619KB) - 53% reduction! - Previous attempt: 497,504 bytes (restricted algorithms, GPG broken) This provides a solid optimized baseline for further systematic algorithm optimization while maintaining full functionality for GPG2, factory reset, and cryptsetup2. The -Oz flag alone provides massive space savings. Signed-off-by: GitHub Copilot <[email protected]> Signed-off-by: Thierry Laurion <[email protected]>
Signed-off-by: Thierry Laurion <[email protected]>
…-gcc15.patch: function pointers need proper signatures to match their actual usage modules/powerpc-utils contains docs traces in regard of gcc15 requirements Signed-off-by: Thierry Laurion <[email protected]>
…atch_fix_for_newer_gcc_from_musl_125.patch: add patches needed for skiboot to be compiled in little-endian by heads boostrapped gcc15.1 compiler Signed-off-by: Thierry Laurion <[email protected]>
Introduce validation to ensure coreboot CBFS size matches IFD BIOS region: - Add bin/validate_cbfs_ifd_fit.sh: New script to validate CBFS size against Intel Flash Descriptor (IFD) BIOS region and provide space usage statistics - Add Makefile targets: validate_cbfs_ifd and fix_cbfs_ifd for manual validation and automatic fixes - Integrate validation into coreboot module build process to catch misconfigs at compile time - Add validation to final ROM image generation step - Add informational hint to Makefile when V=1 verbose flag is not set This prevents shipping firmware with CBFS sizes that exceed the available BIOS region, catching configuration errors early in the build process. Signed-off-by: Thierry Laurion <[email protected]>
- Cairo version bump will require Meson buildstack support since version 1.16.0. At time of writing, Cairo is 1.18.4 Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 5.1.16 (Jan 2022) to 5.3 (Jul 2025). The newer version doesn't require patches - it already includes proper C header handling and the -std=gnu11 workaround is no longer needed thanks to upstream fixes. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
…for 6.1.8 only Remove duplication of EXTRA_FLAGS definition across kernel versions. Define base flags once (-fdebug-prefix-map, -gno-record-gcc-switches), then conditionally add -std=gnu11 only for kernel 6.1.8 which requires GCC 15.1 C23 compatibility workaround. Other kernel versions (4.14.62, 4.19.139, 5.4.69, 5.10.214, 6.6.16-openpower) compile without workaround flags. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 2.03.23 (Nov 2023) to 2.03.25 (Jul 2024). The newer version removes the libgen.h issue that required a GCC 15.1.0 workaround patch. However, GCC 15.1.0's C23 mode enforces const qualifiers on stdin/stdout/stderr, which breaks lvm2's reopen_standard_stream() calls. Port the working patch from lvm2-2.03.23 in osresearch/heads master branch (commit 63290d6) to 2.03.25. The patch wraps problematic memory allocation and log10() calls in #if 0 blocks to disable them at compile-time, maintaining compatibility with musl-libc and C23 standard enforcement. Changes: - Bump lvm2 from 2.03.23 to 2.03.25 - Update hash to 4bea6fd2e5af9cdb3e27b48b4efa8d89210d9bfa13df900e092e404720a59b1d - Replace -Os with -Oz for space optimization - Port lvm2-2.03.23.patch to lvm2-2.03.25.patch for C23 compatibility - Remove obsolete lvm2-gcc-15.1-libgen.patch Tested: EOL_x220-hotp-maximized board builds successfully with 182 KiB free CBFS Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
f547ef2 to
90edf07
Compare
- Update e2fsprogs from 1.47.0 to 1.47.2 (released January 2025) - Remove GCC 15.1 workaround flag (-std=gnu11) as newer version improves C23 compatibility - Disable debugging, backup tools, and optional features: - debugfs, imager, resizer, defrag (not needed for initrd) - uuidd, mmp, tdb (reduces dependencies) - backtrace, bmap-stats (debugging features) - nls, rpath, fuse2fs (unnecessary for minimal build) Reduces build time and binary size while maintaining core mke2fs functionality Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 5.1.16 (Jan 2022) to 5.3 (Jul 2025). The newer version doesn't require patches - it already includes proper C header handling and the -std=gnu11 workaround is no longer needed thanks to upstream fixes. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
…for 6.1.8 only Remove duplication of EXTRA_FLAGS definition across kernel versions. Define base flags once (-fdebug-prefix-map, -gno-record-gcc-switches), then conditionally add -std=gnu11 only for kernel 6.1.8 which requires GCC 15.1 C23 compatibility workaround. Other kernel versions (4.14.62, 4.19.139, 5.4.69, 5.10.214, 6.6.16-openpower) compile without workaround flags. Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
Upgrade from 2.03.23 (Nov 2023) to 2.03.25 (Jul 2024). The newer version removes the libgen.h issue that required a GCC 15.1.0 workaround patch. However, GCC 15.1.0's C23 mode enforces const qualifiers on stdin/stdout/stderr, which breaks lvm2's reopen_standard_stream() calls. Port the working patch from lvm2-2.03.23 in osresearch/heads master branch (commit 63290d6) to 2.03.25. The patch wraps problematic memory allocation and log10() calls in #if 0 blocks to disable them at compile-time, maintaining compatibility with musl-libc and C23 standard enforcement. Changes: - Bump lvm2 from 2.03.23 to 2.03.25 - Update hash to 4bea6fd2e5af9cdb3e27b48b4efa8d89210d9bfa13df900e092e404720a59b1d - Replace -Os with -Oz for space optimization - Port lvm2-2.03.23.patch to lvm2-2.03.25.patch for C23 compatibility - Remove obsolete lvm2-gcc-15.1-libgen.patch Tested: EOL_x220-hotp-maximized board builds successfully with 182 KiB free CBFS Ref: GCC 15.1.0 upgrade (PR linuxboot#1991) Signed-off-by: Thierry Laurion <[email protected]>
…ba, libassuan Replaces version-specific patches with build system sed commands to simplify version upgrades. Verified identical binary output with baseline. Changes: - libgcrypt-1.10.1: Remove patch, use sed for hardcode_into_libs - libksba-1.6.3: Remove patch, use sed for hardcode_into_libs - libassuan-2.5.5: Remove patch, use sed for hardcode_into_libs - gpg2-2.4.0: Refactor patch to only contain functional code change (ttyfp behavior) Move cross_compiling=yes to sed in module for future version bumps - All modules: Add TODO comments for version bump considerations Sed patterns follow tpm2-tss convention (simple string matching without anchors). Build verification: EOL_x220-hotp-maximized compiles successfully with 175 KiB free CBFS space. All GPG2 toolstack libraries built correctly with -Oz optimization. Signed-off-by: Thierry Laurion <[email protected]>
Prior PR marked the ROM target phony to force rebuilds. The new CBFS/IFD validation already runs after the coreboot build and downstream post-processing is guarded by up-to-date checks, so letting make track the actual output avoids unnecessary rebuilds while keeping validation intact. Signed-off-by: Thierry Laurion <[email protected]>
90edf07 to
f6a4e38
Compare
TODO:
TLDR: 1.44% space reduction (115kb gain)
Stats from global to specifics:
coreboot final stiching stats diff
Master:
Analysis:
sizes.txt comparison (diff -u master pr)
Analysis:
TLDR:
Total Savings: 115,504 bytes (1.44% reduction)
Continues #590