rules.h: Add ENV_RAMSTAGE_LOADER

Define ENV_RAMSTAGE_LOADER in rules.h similar to ENV_PAYLOAD_LOADER
to simplify the current code and avoid code duplication when adding
zstd support.

Change-Id: I8c049c640b11c6f0b51e37dd2c368bb786ca9b0f
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90153
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
Patrick Rudolph 2025-11-22 17:08:13 +01:00 committed by Matt DeVillier
commit 4ca5e9c8c6
2 changed files with 11 additions and 11 deletions

View file

@ -267,6 +267,14 @@
#define ENV_PAYLOAD_LOADER ENV_RAMSTAGE
#endif
#if CONFIG(POSTCAR_STAGE)
#define ENV_RAMSTAGE_LOADER ENV_POSTCAR
#elif CONFIG(SEPARATE_ROMSTAGE)
#define ENV_RAMSTAGE_LOADER ENV_SEPARATE_ROMSTAGE
#else
#define ENV_RAMSTAGE_LOADER ENV_BOOTBLOCK
#endif
#define ENV_ROMSTAGE_OR_BEFORE \
(ENV_DECOMPRESSOR || ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || \
(ENV_SEPARATE_VERSTAGE && !CONFIG(VBOOT_STARTS_IN_ROMSTAGE)))

View file

@ -150,17 +150,9 @@ static inline bool cbfs_lzma_enabled(void)
/* Payload loader (ramstage) always needs LZMA. */
if (ENV_PAYLOAD_LOADER)
return true;
/* Only other use of LZMA is ramstage compression. */
if (!CONFIG(COMPRESS_RAMSTAGE_LZMA))
return false;
/* If there is a postcar, it loads the ramstage. */
if (CONFIG(POSTCAR_STAGE))
return ENV_POSTCAR;
/* If there is no postcar but a separate romstage, it loads the ramstage. */
if (CONFIG(SEPARATE_ROMSTAGE))
return ENV_SEPARATE_ROMSTAGE;
/* Otherwise, the combined bootblock+romstage loads the ramstage. */
return ENV_BOOTBLOCK;
if (ENV_RAMSTAGE_LOADER && CONFIG(COMPRESS_RAMSTAGE_LZMA))
return true;
return false;
}
static bool cbfs_file_hash_mismatch(const void *buffer, size_t size,