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 v4 1/7] LoongArch: Add struct loongarch_image_header for kernel image
Date: Wed, 3 Sep 2025 11:00:54 +0800 [thread overview]
Message-ID: <20250903030100.196744-2-youling.tang@linux.dev> (raw)
In-Reply-To: <20250903030100.196744-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 | 36 ++++++++++++++++++++++++++++++
1 file changed, 36 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..ff539711c9ea
--- /dev/null
+++ b/arch/loongarch/include/asm/image.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * LoongArch binary image header for EFI(PE/COFF) format.
+ *
+ * Author: Youling Tang <tangyouling@kylinos.cn>
+ * Copyright (C) 2025 KylinSoft Corporation.
+ */
+
+#ifndef __ASM_IMAGE_H
+#define __ASM_IMAGE_H
+#ifndef __ASSEMBLER__
+
+/**
+ * struct loongarch_image_header
+ *
+ * @dos_sig: Optional PE format 'MZ' signature.
+ * @padding_1: Reserved.
+ * @kernel_entry: Kernel image entry pointer.
+ * @kernel_asize: An estimated size of the memory image size in LSB byte order.
+ * @text_offset: The image load offset in LSB byte order.
+ * @padding_2: Reserved.
+ * @pe_header: Optional offset to a PE format header.
+ **/
+
+struct loongarch_image_header {
+ uint8_t dos_sig[2];
+ uint16_t padding_1[3];
+ uint64_t kernel_entry;
+ uint64_t kernel_asize;
+ uint64_t text_offset;
+ uint32_t padding_2[7];
+ uint32_t pe_header;
+};
+
+#endif /* __ASSEMBLER__ */
+#endif /* __ASM_IMAGE_H */
--
2.43.0
next prev parent reply other threads:[~2025-09-03 3:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 3:00 [PATCH v4 0/7] Add kexec_file support for LoongArch Youling Tang
2025-09-03 3:00 ` Youling Tang [this message]
2025-09-03 3:00 ` [PATCH v4 2/7] LoongArch: Add preparatory infrastructure for kexec_file Youling Tang
2025-09-03 3:00 ` [PATCH v4 3/7] LoongArch/kexec_file: Support loading EFI binary file Youling Tang
2025-09-03 3:00 ` [PATCH v4 4/7] LoongArch/kexec_file: Support loading ELF " Youling Tang
2025-09-03 3:00 ` [PATCH v4 5/7] LoongArch/kexec_file: Add crash dump support Youling Tang
2025-09-03 3:00 ` [PATCH v4 6/7] LoongArch: Automatically disable kaslr when the kernel loads from kexec_file Youling Tang
2025-09-03 3:01 ` [PATCH v4 7/7] LoongArch: Enable CONFIG_KEXEC_FILE Youling Tang
2025-09-21 14:03 ` [PATCH v4 0/7] 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=20250903030100.196744-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.