From: Youling Tang <youling.tang@linux.dev>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>, Baoquan He <bhe@redhat.com>,
kexec@lists.infradead.org, loongarch@lists.linux.dev,
linux-kernel@vger.kernel.org, youling.tang@linux.dev,
Youling Tang <tangyouling@kylinos.cn>
Subject: [PATCH 1/6] LoongArch: Add struct loongarch_image_header for kernel image
Date: Mon, 11 Aug 2025 17:26:54 +0800 [thread overview]
Message-ID: <20250811092659.14903-2-youling.tang@linux.dev> (raw)
In-Reply-To: <20250811092659.14903-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.34.1
next prev parent reply other threads:[~2025-08-11 9:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 9:26 [PATCH 0/6] Add kexec_file support for LoongArch Youling Tang
2025-08-11 9:26 ` Youling Tang [this message]
2025-08-11 9:26 ` [PATCH 2/6] LoongArch: Add kexec_file support Youling Tang
2025-08-11 14:07 ` Huacai Chen
2025-08-12 1:21 ` Youling Tang
2025-08-12 1:53 ` Yanteng Si
2025-08-12 9:32 ` Youling Tang
2025-08-13 1:15 ` Yanteng Si
2025-08-12 2:53 ` Huacai Chen
2025-08-11 17:06 ` Yao Zi
2025-08-12 2:39 ` Huacai Chen
2025-08-12 7:56 ` Yao Zi
2025-08-12 6:15 ` Youling Tang
2025-08-12 7:06 ` Youling Tang
2025-08-12 9:43 ` Yao Zi
2025-08-13 2:18 ` Youling Tang
2025-08-13 3:24 ` Yao Zi
2025-08-16 5:37 ` kernel test robot
2025-08-11 9:26 ` [PATCH 3/6] LoongArch/kexec_file: Add initrd loading Youling Tang
2025-08-11 14:12 ` Huacai Chen
2025-08-12 2:38 ` Youling Tang
2025-08-12 3:03 ` Huacai Chen
2025-08-11 17:58 ` Yao Zi
2025-08-12 4:05 ` Youling Tang
2025-08-12 6:25 ` Yao Zi
2025-08-11 9:26 ` [PATCH 4/6] LoongArch/kexec_file: Add crash dump support Youling Tang
2025-08-11 9:26 ` [PATCH 5/6] LoongArch/kexec_file: Add "mem" parameter to limit memory usage of kdump kernel Youling Tang
2025-08-11 9:26 ` [PATCH 6/6] LoongArch: Enable CONFIG_KEXEC_FILE Youling Tang
2025-08-11 16:20 ` [PATCH 0/6] Add kexec_file support for LoongArch Vincent Li
2025-08-12 6:21 ` 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=20250811092659.14903-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 \
/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®