From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1loYB2-0005yO-5M for mharc-grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loYB0-0005ta-Rc for grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:22 -0400 Received: from mail-lf1-f51.google.com ([209.85.167.51]:38700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loYAz-00047K-76 for grub-devel@gnu.org; Wed, 02 Jun 2021 17:13:22 -0400 Received: by mail-lf1-f51.google.com with SMTP id r5so5513533lfr.5 for ; Wed, 02 Jun 2021 14:13:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZFqfqCc8FX/Sy03i0jbmyCt8cfgbrxEzroMLeu7gnmA=; b=YzwbJqm5G1a4wJPovsanfxxcRUo/Hg4YCrCJfNabiyWbIg9KUlKkdsHB6ztDuSq+wO mt9YuYyhlMxc9nVkXhKlkMUNTamjjx0SxWXZCl8LKOQSK2SM6qXdkFeazP65wbj4oNzY 7V9X7S4hEH/FRH9cwiDS4eA9iBTstSnoxlH1mOmYa7jKDd6mThdY8KsnEeCtamd03NUl 1i/7MaVDa1CMzkCbQJR24B2HJqwfiCFl3S/R/APhLWlVzBGdO2OzhFtu66qWQ1ATsxxJ 4O3oJ5wv723uXGWIDcz830rusQu2nocSDYnQfqOz1avJtaVplSGL8nHT5Ghs/Z4igNvw +4QA== X-Gm-Message-State: AOAM531Eft4x9fqTvS9vYD/KEYjDdZ00L/6nbqphMByhcl/nIW2wL2hF gRZWCA7N1c6CinGhG/NiXwTAiF4484PO2e05 X-Google-Smtp-Source: ABdhPJwoJvga0QwvRnVFPIMc2bZJUVGAMZTJQhEUowWySjKJy0mHwiDswgEm48f0A/hDQGeAULZqwg== X-Received: by 2002:a05:6512:3703:: with SMTP id z3mr15131898lfr.468.1622668399349; Wed, 02 Jun 2021 14:13:19 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:811f:4a8d:2d8:61ff:fed1:d10a]) by smtp.gmail.com with ESMTPSA id p3sm101361lfa.116.2021.06.02.14.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 14:13:19 -0700 (PDT) From: Nikita Ermakov To: GRUB development mailing list Cc: Ard Biesheuvel , Atish Patra , Daniel Kiper , Heinrich Schuchardt , Leif Lindholm , Nikita Ermakov , Atish Patra Subject: [PATCH v2 6/7] RISC-V: Update image header Date: Thu, 3 Jun 2021 00:12:34 +0300 Message-Id: <20210602211235.377366-7-arei@altlinux.org> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20210602211235.377366-1-arei@altlinux.org> References: <20210602211235.377366-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.167.51; envelope-from=coffe92@gmail.com; helo=mail-lf1-f51.google.com X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, 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: Wed, 02 Jun 2021 21:13:23 -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.29.3