From: Youling Tang <youling.tang@linux.dev>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>, Baoquan He <bhe@redhat.com>,
Yao Zi <ziyao@disroot.org>,
kexec@lists.infradead.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, youling.tang@linux.dev,
Youling Tang <tangyouling@kylinos.cn>
Subject: [PATCH v3 1/6] LoongArch: Add struct loongarch_image_header for kernel image
Date: Tue, 26 Aug 2025 09:17:17 +0800 [thread overview]
Message-ID: <20250826011722.82391-2-youling.tang@linux.dev> (raw)
In-Reply-To: <20250826011722.82391-1-youling.tang@linux.dev>
From: Youling Tang <tangyouling@kylinos.cn>
Define a dedicated image header structure for LoongArch architecture to
standardize kernel loading in bootloaders (primarily for kexec_file).
This header includes critical metadata such as PE signature, entry points,
image size and load address offset, etc.
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
arch/loongarch/include/asm/image.h | 40 ++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 arch/loongarch/include/asm/image.h
diff --git a/arch/loongarch/include/asm/image.h b/arch/loongarch/include/asm/image.h
new file mode 100644
index 000000000000..1f090736e71d
--- /dev/null
+++ b/arch/loongarch/include/asm/image.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * LoongArch binary image header.
+ *
+ * Author: Youling Tang <tangyouling@kylinos.cn>
+ * Copyright (C) 2025 KylinSoft Corporation.
+ *
+ * Most code is derived from LoongArch port of kexec-tools
+ */
+
+#ifndef __ASM_IMAGE_H
+#define __ASM_IMAGE_H
+#ifndef __ASSEMBLY__
+
+/**
+ * struct loongarch_image_header
+ *
+ * @pe_sig: Optional PE format 'MZ' signature.
+ * @reserved_1: Reserved.
+ * @kernel_entry: Kernel image entry pointer.
+ * @image_size: An estimated size of the memory image size in LSB byte order.
+ * @text_offset: The image load offset in LSB byte order.
+ * @reserved_2: Reserved.
+ * @reserved_3: Reserved.
+ * @pe_header: Optional offset to a PE format header.
+ **/
+
+struct loongarch_image_header {
+ uint8_t pe_sig[2];
+ uint16_t reserved_1[3];
+ uint64_t kernel_entry;
+ uint64_t image_size;
+ uint64_t text_offset;
+ uint64_t reserved_2[3];
+ uint32_t reserved_3;
+ uint32_t pe_header;
+};
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ASM_IMAGE_H */
--
2.43.0
next prev parent reply other threads:[~2025-08-26 1:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-26 1:17 [PATCH v3 0/6] Add kexec_file support for LoongArch Youling Tang
2025-08-26 1:17 ` Youling Tang [this message]
2025-08-27 7:37 ` [PATCH v3 1/6] LoongArch: Add struct loongarch_image_header for kernel image Huacai Chen
2025-08-26 1:17 ` [PATCH v3 2/6] LoongArch: Add preparatory infrastructure for kexec_file Youling Tang
2025-08-26 1:17 ` [PATCH v3 3/6] LoongArch/kexec_file: Support loading EFI binary file Youling Tang
2025-08-26 1:17 ` [PATCH v3 4/6] LoongArch/kexec_file: Support loading ELF " Youling Tang
2025-08-26 1:17 ` [PATCH v3 5/6] LoongArch/kexec_file: Add crash dump support Youling Tang
2025-08-26 1:17 ` [PATCH v3 6/6] LoongArch: Enable CONFIG_KEXEC_FILE Youling Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250826011722.82391-2-youling.tang@linux.dev \
--to=youling.tang@linux.dev \
--cc=bhe@redhat.com \
--cc=chenhuacai@kernel.org \
--cc=kernel@xen0n.name \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=tangyouling@kylinos.cn \
--cc=ziyao@disroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®