1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootblock_common.h>
4 #include <commonlib/bsd/compression.h>
6 #include <metadata_hash.h>
7 #include <program_loading.h>
11 extern u8 compressed_bootblock
[];
13 ".pushsection .data.compressed_bootblock,\"a\",@progbits\n\t"
14 ".type compressed_bootblock, %object\n\t"
16 "compressed_bootblock:\n\t"
17 ".incbin \"" __BUILD_DIR__
"/cbfs/" CONFIG_CBFS_PREFIX
"/bootblock.lz4\"\n\t"
18 ".size compressed_bootblock, . - compressed_bootblock\n\t"
22 struct bootblock_arg arg
= {
26 { .entry_id
= TS_ULZ4F_START
},
27 { .entry_id
= TS_ULZ4F_END
},
31 struct prog prog_bootblock
= {
32 .type
= PROG_BOOTBLOCK
,
33 .entry
= (void *)_bootblock
,
37 __weak
void decompressor_soc_init(void) { /* no-op */ }
43 if (CONFIG(COLLECT_TIMESTAMPS
))
44 arg
.base_timestamp
= timestamp_get();
46 if (CONFIG(CBFS_VERIFICATION
))
47 arg
.metadata_hash_anchor
= metadata_hash_export_anchor();
49 decompressor_soc_init();
51 if (CONFIG(COLLECT_TIMESTAMPS
))
52 arg
.timestamps
[0].entry_stamp
= timestamp_get();
54 size_t out_size
= ulz4f(compressed_bootblock
, _bootblock
);
55 prog_segment_loaded((uintptr_t)_bootblock
, out_size
, SEG_FINAL
);
57 if (CONFIG(COLLECT_TIMESTAMPS
))
58 arg
.timestamps
[1].entry_stamp
= timestamp_get();
60 prog_run(&prog_bootblock
);