Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1lmcBg-00088x-Lw for mharc-grub-devel@gnu.org; Fri, 28 May 2021 09:06:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmcBa-0007wc-Aq for grub-devel@gnu.org; Fri, 28 May 2021 09:05:59 -0400 Received: from mail-lf1-f52.google.com ([209.85.167.52]:43579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmcBV-0002I7-Oq for grub-devel@gnu.org; Fri, 28 May 2021 09:05:58 -0400 Received: by mail-lf1-f52.google.com with SMTP id x38so5187340lfa.10 for ; Fri, 28 May 2021 06:05:53 -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=Gbr0A7dXe1c9OWZO04m7lkI9j/4TOJzJUXGwHY9FRzY=; b=c0bui1f3AFhdm0JAljVt0dnqDwsnaHpbwKYH3EwWLGDz63y+jgBXi2saKU2Q2fwI42 GP/SU6J3w3xfu5S+JZWDO+UZbiZMs/OQhCMrqgx8pHj4mdtdPXZ/B9PiyL4zeLe2/6jC ZNbqlwsfhRMP1oKK0yYAuttHNeBSE62hnfpyvRhdNcmpQzmAnK/nokhwbnKPCWa8ztTn jyYitaQjpxzI0FrH+jcAPEyjLIXzHicgfU6vAs16P5wNjOYblSdyGitNqQmWkZ/Yw8Un X3PvE+KlDJypTmrR2t4MzRE+sR8u6WJ1J/NY7NPP6B+R3zmRU+fsVU/Uyb4cbM/uR16f 9krw== X-Gm-Message-State: AOAM533kSzzknqohWu1vQ1ygXyXPuVihhXVU2dInCGCrR+DnOsR34FuN EFPqMKLeLRTe+H76ygY5PVkkEBiUq/hTAxRZkgu9lQ== X-Google-Smtp-Source: ABdhPJyDUqfzxza/DmTY6VbOVPoRhxj0AJep9jKHL1MFS1P7Ty+CwoVT8kSBVdQb6rvBUErwYxKHPg== X-Received: by 2002:ac2:4e84:: with SMTP id o4mr725080lfr.306.1622207150836; Fri, 28 May 2021 06:05:50 -0700 (PDT) Received: from localhost.localdomain (109-252-124-217.nat.spd-mgts.ru. [109.252.124.217]) by smtp.gmail.com with ESMTPSA id m25sm468129lfr.288.2021.05.28.06.05.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 May 2021 06:05:50 -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 6/8] RISC-V: Update image header Date: Fri, 28 May 2021 16:04:55 +0300 Message-Id: <20210528130457.13501-7-arei@altlinux.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210528130457.13501-1-arei@altlinux.org> References: <20210528130457.13501-1-arei@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.167.52; envelope-from=coffe92@gmail.com; helo=mail-lf1-f52.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, 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: Fri, 28 May 2021 13:05: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.31.1