diff options
author | Elliott Hughes <enh@google.com> | 2024-04-12 17:49:01 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2024-04-12 17:49:01 +0000 |
commit | ecbd6b01413e775ff614b1363aa72416c04a90e4 (patch) | |
tree | 4c5695103e86da93a4f43fffa520f9a464b560c1 | |
parent | 6a00fe9b1d256e648b469771abd2ca68ae7a0503 (diff) | |
download | update_engine-ecbd6b01413e775ff614b1363aa72416c04a90e4.tar.gz |
update_engine: never enable BCJ.
This was only enabled for 32-bit, has been demonstrated not to
reduce OTA sizes, and we have a build in dogfood that can't decode
BCJ output.
Bug: http://b/333826436
Change-Id: I3cd81b65f943d4ab6c5d981dbe6e9d5bf336e612
-rw-r--r-- | payload_generator/xz_android.cc | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/payload_generator/xz_android.cc b/payload_generator/xz_android.cc index 9d157c41..97e2c32a 100644 --- a/payload_generator/xz_android.cc +++ b/payload_generator/xz_android.cc @@ -16,9 +16,6 @@ #include "update_engine/payload_generator/xz.h" -#include <elf.h> -#include <endian.h> - #include <algorithm> #include <7zCrc.h> @@ -68,37 +65,6 @@ struct BlobWriterStream : public ISeqOutStream { brillo::Blob* data_; }; -// Returns the filter id to be used to compress |data|. -// Only BCJ filter for x86 and ARM ELF file are supported, returns 0 otherwise. -int GetFilterID(const brillo::Blob& data) { - if (data.size() < sizeof(Elf32_Ehdr) || - memcmp(data.data(), ELFMAG, SELFMAG) != 0) - return 0; - - const Elf32_Ehdr* header = reinterpret_cast<const Elf32_Ehdr*>(data.data()); - - // Only little-endian is supported. - if (header->e_ident[EI_DATA] != ELFDATA2LSB) - return 0; - - switch (le16toh(header->e_machine)) { - case EM_386: - case EM_X86_64: - return XZ_ID_X86; - case EM_ARM: - // Both ARM and ARM Thumb instructions could be found in the same ARM ELF - // file. We choose to use the ARM Thumb filter here because testing shows - // that it usually works better than the ARM filter. - return XZ_ID_ARMT; -#ifdef EM_AARCH64 - case EM_AARCH64: - // Neither the ARM nor the ARM Thumb filter works well with AArch64. - return 0; -#endif - } - return 0; -} - } // namespace namespace chromeos_update_engine { @@ -139,7 +105,8 @@ bool XzCompress(const brillo::Blob& in, brillo::Blob* out) { Lzma2EncProps_Normalize(&lzma2Props); props.lzma2Props = lzma2Props; - props.filterProps.id = GetFilterID(in); + // We do not use xz's BCJ filters (http://b/329112384). + props.filterProps.id = 0; BlobWriterStream out_writer(out); BlobReaderStream in_reader(in); |