Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mgC5G-0006ei-4j for mharc-grub-devel@gnu.org; Thu, 28 Oct 2021 16:33:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgC53-0006VK-91 for grub-devel@gnu.org; Thu, 28 Oct 2021 16:32:59 -0400 Received: from mail-lj1-f174.google.com ([209.85.208.174]:44681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgC51-0004WP-Ad for grub-devel@gnu.org; Thu, 28 Oct 2021 16:32:56 -0400 Received: by mail-lj1-f174.google.com with SMTP id s19so12748054ljj.11 for ; Thu, 28 Oct 2021 13:32:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wCBVK/8Oz/SZ06X1uIP/gK15uuQmqZq8nK9wZ/O6cXY=; b=w4CjZiWxWpnZ+nlr+Mji25UTLBuaQ1/nuhyb0JPW85ee2ZM9djVfFDHWAHan8P/baq 112eU1pQfOD24xmH5LMRnM4djxMrP9fgGZ6g29YnLPIl8F0LWvWAdMxlhDi49HkkdPgz N37SUeZEdiSi+v8rlC2YbNyy3Ai27ZyUNhK2tv6LrujoMzLECBId+NuwWecwEHbauNy+ RVK7wOqd95lvKGkKHXfNA2jPcj+ZGzb2eXGf7bZPH1ATVUA5JeA3kicxeH8gzwq7/61o HnjVEmfgf9SE6MMDLKV+TV494yN1ng5zzTf06gJtdoxHWtUTbledtBnjEqd6WyWTEEuT zp7g== X-Gm-Message-State: AOAM533r42qNgacVh7gdJsKOO1SQZPKkJ8TpsyIXfHofAnEFR6O29HRA dTcbO0vUqdnhahN2mEY4XY7bd9t1mbAEtH7a X-Google-Smtp-Source: ABdhPJwWq27n24kXM4VXZkTEuSBQsURQyFqEyFt0gdDGd86ecLfr2JZCOFz8pCYixcbpAjZD2mYK8w== X-Received: by 2002:a2e:a171:: with SMTP id u17mr6866525ljl.371.1635453171483; Thu, 28 Oct 2021 13:32:51 -0700 (PDT) Received: from amanita.localdomain ([2a00:1370:811f:5cd1:1618:c3ff:fe69:39f3]) by smtp.gmail.com with ESMTPSA id v22sm291719lfr.175.2021.10.28.13.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 13:32:51 -0700 (PDT) From: Nikita Ermakov To: GRUB development mailing list Cc: Ard Biesheuvel , Atish Patra , Daniel Kiper , Heinrich Schuchardt , Leif Lindholm , Fu Wei , Atish Patra Subject: [PATCH v3 6/7] RISC-V: Update image header Date: Thu, 28 Oct 2021 23:31:19 +0300 Message-Id: <20211028203118.7908-7-arei@altlinux.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211028203118.7908-1-arei@altlinux.org> References: <20211028203118.7908-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.208.174; envelope-from=coffe92@gmail.com; helo=mail-lj1-f174.google.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2021 20:32:59 -0000 From: Atish Patra Update the RISC-V Linux kernel image headers as per the current header. Reference: /Documentation/riscv/boot-image-header.rst Signed-off-by: Atish Patra --- include/grub/riscv32/linux.h | 15 ++++++++------- include/grub/riscv64/linux.h | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/grub/riscv32/linux.h b/include/grub/riscv32/linux.h index 512b777c8..de0dbdcd1 100644 --- a/include/grub/riscv32/linux.h +++ b/include/grub/riscv32/linux.h @@ -19,20 +19,21 @@ #ifndef GRUB_RISCV32_LINUX_HEADER #define GRUB_RISCV32_LINUX_HEADER 1 -#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x52534356 /* 'RSCV' */ +#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x05435352 /* 'RSC\0x5' */ -/* From linux/Documentation/riscv/booting.txt */ +/* From linux/Documentation/riscv/boot-image-header.rst */ struct linux_riscv_kernel_header { grub_uint32_t code0; /* Executable code */ grub_uint32_t code1; /* Executable code */ - grub_uint64_t text_offset; /* Image load offset */ - grub_uint64_t res0; /* reserved */ - grub_uint64_t res1; /* reserved */ + grub_uint64_t text_offset; /* Image load offset, little endian */ + grub_uint64_t image_size; /* Effective Image size, little endian */ + grub_uint64_t flags; /* kernel flags, little endian */ + grub_uint32_t version; /* Version of this header */ + grub_uint32_t res1; /* reserved */ grub_uint64_t res2; /* reserved */ grub_uint64_t res3; /* reserved */ - grub_uint64_t res4; /* reserved */ - grub_uint32_t magic; /* Magic number, little endian, "RSCV" */ + grub_uint32_t magic; /* Magic number, little endian, "RSC\x05" */ grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ }; diff --git a/include/grub/riscv64/linux.h b/include/grub/riscv64/linux.h index 3630c30fb..7c28bc922 100644 --- a/include/grub/riscv64/linux.h +++ b/include/grub/riscv64/linux.h @@ -19,22 +19,23 @@ #ifndef GRUB_RISCV64_LINUX_HEADER #define GRUB_RISCV64_LINUX_HEADER 1 -#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x52534356 /* 'RSCV' */ +#define GRUB_LINUX_RISCV_MAGIC_SIGNATURE 0x05435352 /* 'RSC\0x5' */ #define GRUB_EFI_PE_MAGIC 0x5A4D -/* From linux/Documentation/riscv/booting.txt */ +/* From linux/Documentation/riscv/boot-image-header.rst */ struct linux_riscv_kernel_header { grub_uint32_t code0; /* Executable code */ grub_uint32_t code1; /* Executable code */ - grub_uint64_t text_offset; /* Image load offset */ - grub_uint64_t res0; /* reserved */ - grub_uint64_t res1; /* reserved */ + grub_uint64_t text_offset; /* Image load offset, little endian */ + grub_uint64_t image_size; /* Effective Image size, little endian */ + grub_uint64_t flags; /* kernel flags, little endian */ + grub_uint32_t version; /* Version of this header */ + grub_uint32_t res1; /* reserved */ grub_uint64_t res2; /* reserved */ grub_uint64_t res3; /* reserved */ - grub_uint64_t res4; /* reserved */ - grub_uint32_t magic; /* Magic number, little endian, "RSCV" */ + grub_uint32_t magic; /* Magic number, little endian, "RSC\x05" */ grub_uint32_t hdr_offset; /* Offset of PE/COFF header */ }; -- 2.33.1