Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ehJS7-0003rF-Rk for mharc-grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJS0-0003mh-Cf for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehJRy-0003JI-TD for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:08 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:46580) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ehJRy-0003G8-Jh for grub-devel@gnu.org; Thu, 01 Feb 2018 13:19:06 -0500 Received: by mail-wr0-x244.google.com with SMTP id g21so20008010wrb.13 for ; Thu, 01 Feb 2018 10:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/4MIf+FgtjYbgcC8Kf+5piqh1FRCd5P2vfkhu+wE04M=; b=b3AntV76evTIOm6JoRn+n7/fxzVmdCN28Sd8NKejVvCUSJrK75TiSlsdzsqsLu0DYD N2yj8ALk2C2hVHr1Fz6oigluFVp3yodnasCO4tsehHIFLWT5EWDUFV/GiROM+Wy83tmq c6P4v/Vbf3fkHs2HPIBxafzyRQAg33TlfnRV4= 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; bh=/4MIf+FgtjYbgcC8Kf+5piqh1FRCd5P2vfkhu+wE04M=; b=kf+F/3EK0fN0aLg48ki7f9iGk/IQU3W5Z/qCNH5e2rGFBagU+zpx0c85Cv1zs4th5R 9l8D5I70MVFa2fwK/1+ag9wpfi9xPQrn0AurR6dyLzUkt7+UcQhosRxPTK68UBEW1ei2 SbI8a0LmTXQmcppaaghDd8A3H2Iqk/OJNVuUejcjVKajhpGArIHhXNn+RkFmfhBHb36x QqZ2ZfGxVZmLJCjRTgbuJ59qyo8RwKxwplkWgZqdx/ar9IehytcYJrayGPso34k99xXH kyW0KQ4bP3Wrw11nkYkY8rgOh7hiHWoZQTqHW1Ncr28Fp/ekRQxwXLbcaBbCybATQjJK WcHw== X-Gm-Message-State: AKwxytdl8LnQf34JRMvW7YlQuPxQCCJFp90pgMbvxmjeA1QOocKAvNxx X6LcIiQFKWEhdlRxaKnIJX7henRZEoc= X-Google-Smtp-Source: AH8x224FV5eHQ//+z/qaVBrmGBHVmMh8S+9d6vTMKgbQK34McgtH2CA99aHT9BSg4XdK0nLXzJUSgQ== X-Received: by 10.223.173.2 with SMTP id p2mr18672086wrc.107.1517509145353; Thu, 01 Feb 2018 10:19:05 -0800 (PST) Received: from vanye.hemma.eciton.net (cpc92316-cmbg19-2-0-cust118.5-4.cable.virginm.net. [82.12.0.119]) by smtp.gmail.com with ESMTPSA id b11sm163911wrf.23.2018.02.01.10.19.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 10:19:04 -0800 (PST) From: Leif Lindholm To: grub-devel@gnu.org Cc: Daniel Kiper Subject: [PATCH 03/10] make GRUB_LINUX_MAGIC_SIGNATURE architecture-specific Date: Thu, 1 Feb 2018 18:18:51 +0000 Message-Id: <20180201181858.1472-4-leif.lindholm@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180201181858.1472-1-leif.lindholm@linaro.org> References: <20180201181858.1472-1-leif.lindholm@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 18:19:09 -0000 Rename GRUB_LINUX_MAGIC_SIGNATURE GRUB_LINUX_I386_MAGIC_SIGNATURE, to be usable in code that supports more than one image type. Signed-off-by: Leif Lindholm --- grub-core/commands/file.c | 4 ++-- grub-core/loader/i386/linux.c | 2 +- grub-core/loader/i386/pc/linux.c | 6 +++--- grub-core/loader/i386/xen_file.c | 2 +- include/grub/i386/linux.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/grub-core/commands/file.c b/grub-core/commands/file.c index 12fba99e0..474666d3a 100644 --- a/grub-core/commands/file.c +++ b/grub-core/commands/file.c @@ -508,7 +508,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) /* FIXME: some really old kernels (< 1.3.73) will fail this. */ if (lh.header != - grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0200) break; @@ -521,7 +521,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and still not support 32-bit boot. */ if (lh.header != - grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0203) break; diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 083f9417c..9bd5afb65 100644 --- a/grub-core/loader/i386/linux.c +++ b/grub-core/loader/i386/linux.c @@ -721,7 +721,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and still not support 32-bit boot. */ - if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0203) { grub_error (GRUB_ERR_BAD_OS, "version too old for 32-bit boot" diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c index a293b17aa..31a687644 100644 --- a/grub-core/loader/i386/pc/linux.c +++ b/grub-core/loader/i386/pc/linux.c @@ -169,7 +169,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), maximal_cmdline_size = 256; - if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + if (lh.header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) && grub_le_to_cpu16 (lh.version) >= 0x0200) { grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL); @@ -322,7 +322,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), goto fail; } - if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + if (lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0200) /* Clear the heap space. */ grub_memset (grub_linux_real_chunk @@ -407,7 +407,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), lh = (struct linux_kernel_header *) grub_linux_real_chunk; - if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + if (!(lh->header == grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) && grub_le_to_cpu16 (lh->version) >= 0x0200)) { grub_error (GRUB_ERR_BAD_OS, "the kernel is too old for initrd"); diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c index 99fad4cad..6e76e16aa 100644 --- a/grub-core/loader/i386/xen_file.c +++ b/grub-core/loader/i386/xen_file.c @@ -43,7 +43,7 @@ grub_xen_file (grub_file_t file) goto fail; if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55) - || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) + || lh.header != grub_cpu_to_le32_compile_time (GRUB_LINUX_I386_MAGIC_SIGNATURE) || grub_le_to_cpu16 (lh.version) < 0x0208) { grub_error (GRUB_ERR_BAD_OS, "version too old for xen boot"); diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h index 2ff1621a4..3ff432be9 100644 --- a/include/grub/i386/linux.h +++ b/include/grub/i386/linux.h @@ -19,7 +19,7 @@ #ifndef GRUB_I386_LINUX_HEADER #define GRUB_I386_LINUX_HEADER 1 -#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ +#define GRUB_LINUX_I386_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ #define GRUB_LINUX_DEFAULT_SETUP_SECTS 4 #define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF #define GRUB_LINUX_MAX_SETUP_SECTS 64 -- 2.11.0