diff --git a/src/include/rules.h b/src/include/rules.h index 673138bfe6..053cd6bc09 100644 --- a/src/include/rules.h +++ b/src/include/rules.h @@ -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))) diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c index 0c47359260..4ec65a864c 100644 --- a/src/lib/cbfs.c +++ b/src/lib/cbfs.c @@ -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,