From c1ecb1777ac584e76a78ca41be1dcbf6d5fd9aa5 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Wed, 13 May 2026 15:36:26 +0800 Subject: feat: add compressed kernel header and implementation for RISC-V architecture --- na/include/lume/compressed.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 na/include/lume/compressed.h (limited to 'na/include') 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 + +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); -- cgit v1.2.3