diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-05-13 15:36:26 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-05-13 15:36:26 +0800 |
| commit | c1ecb1777ac584e76a78ca41be1dcbf6d5fd9aa5 (patch) | |
| tree | bb396a1c46e12454a7ec04e0cf1f898fc9d03e2f /na/include | |
| parent | 5285755373830eee34300b487d3c0e817a05f043 (diff) | |
| download | lume-c1ecb1777ac584e76a78ca41be1dcbf6d5fd9aa5.tar.gz lume-c1ecb1777ac584e76a78ca41be1dcbf6d5fd9aa5.tar.xz | |
feat: add compressed kernel header and implementation for RISC-V architecture
Diffstat (limited to 'na/include')
| -rw-r--r-- | na/include/lume/compressed.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/na/include/lume/compressed.h b/na/include/lume/compressed.h new file mode 100644 index 0000000..8ca775d --- /dev/null +++ b/na/include/lume/compressed.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Copyright (C) 2026 Richard Qin */ + +#pragma once + +#include <lume/types.h> + +inline constexpr uint64 kCompressedKernelMagic = 0x4C554D45434F4D50ULL; /* LUMECOMP */ +inline constexpr uint32 kCompressedKernelVersion = 1; + +enum KernelCompressionType : uint32 { + KERNEL_COMP_NONE = 0, + KERNEL_COMP_LZ4 = 1, +}; + +enum CompressedHeaderFlags : uint16 { + LUME_HDR_FLAG_STAGE3_DONE = 1u << 0, +}; + +struct CompressedKernelHeader { + uint64 magic; + uint32 version; + uint16 header_size; + uint16 flags; + uint32 compression; + uint32 reserved0; + uint64 uncompressed_size; + uint64 compressed_size; + uint64 load_phys_base; + uint64 reloc_offset; + uint64 reloc_size; + uint64 payload_offset; + uint32 header_crc32; + uint32 payload_crc32; +}; + +static_assert(sizeof(CompressedKernelHeader) == 80); |
