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 v2 1/5] LoongArch: Add struct loongarch_image_header for kernel image
Date: Wed, 20 Aug 2025 13:56:56 +0800 [thread overview]
Message-ID: <20250820055700.24344-2-youling.tang@linux.dev> (raw)
In-Reply-To: <20250820055700.24344-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-20 5:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 5:56 [PATCH v2 0/5] Add kexec_file support for LoongArch Youling Tang
2025-08-20 5:56 ` Youling Tang [this message]
2025-08-20 5:56 ` [PATCH v2 2/5] LoongArch: Add kexec_file support Youling Tang
2025-08-20 6:50 ` Yao Zi
2025-08-20 9:13 ` Youling Tang
2025-08-20 11:13 ` Yao Zi
2025-08-21 1:19 ` Youling Tang
2025-08-22 4:24 ` Huacai Chen
2025-08-22 2:56 ` Youling Tang
2025-08-22 4:19 ` Yao Zi
2025-08-22 6:40 ` Huacai Chen
2025-08-26 1:55 ` kernel test robot
2025-08-20 5:56 ` [PATCH v2 3/5] LoongArch/kexec_file: Support loading ELF binary file Youling Tang
2025-08-21 7:14 ` Youling Tang
2025-08-20 5:56 ` [PATCH v2 4/5] LoongArch/kexec_file: Add crash dump support Youling Tang
2025-08-20 5:57 ` [PATCH v2 5/5] LoongArch: Enable CONFIG_KEXEC_FILE Youling Tang
2025-08-22 4:13 ` [PATCH v2 0/5] Add kexec_file support for LoongArch Huacai Chen
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=20250820055700.24344-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®