From patchwork Thu Feb 1 18:18:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 126569 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1951847ljc; Thu, 1 Feb 2018 10:21:46 -0800 (PST) X-Google-Smtp-Source: AH8x224ds+aNsd3M1mAwk8U57aCeWCmNPQdcShVdd8fmKXgau4fuEV0SOTovbznsOv5fimG28Fa7 X-Received: by 10.37.186.135 with SMTP id s7mr25168794ybg.436.1517509305976; Thu, 01 Feb 2018 10:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517509305; cv=none; d=google.com; s=arc-20160816; b=Hhpd/JeZS2C11j+uugaEicjl6g5Y77fsEaskmEcv/2OkeDgyo9hUyaBuDLeZzD1/4X Nk0GKNorqQ4YREFm4AJOj3S2bn4vEKUtawbYawOZ6mr1z6uK0ib6MxnVTpn0tmvnrnjT VYfbA7HjWmwRzYtZDJ0dDRufLXOMA0jk0YwU6N8gl1lGGvHZ7WtSjHkVnbRtFeyiyo6s cACn2zrqBjwomJlS1pd6ZpoZFkbSA5zspck6znviWXaioasE3FJh0e1g3JB0Iaa+3VcU haYcBN4EkyEKJwq/fOoUnIxFlkIQVe/DW4lZCtkQvNDRSjHcjMTal1J1I8UQh2V5E2J/ /AyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:arc-authentication-results; bh=OKygyyE26LGmuw3VkEZB7n2w7jVxkcnQ+1L6OzYq/c4=; b=KmeiavXzVyb7sDHbPrm6hhgji3Qe0cjPuljArmUb7oKTTXXnGDg+gi3VUc79PWOu9y 9o1Isq/Y1TCQxcYzhYS2Le74mbDOQlfCma2MWVwjkkgvcPKS+/YlTCdfyj4+HyGKTFmv lqxO84d6aSSZls+g4m7lQ/3qRVXpnxmBW0liDI9XuyKSk8TzoEMqcwCCzmyMwh38NKqQ qmpILv9ua3yvgtpnWdmXicZjnd2ithyo7mFDHdTwI/FTzBXGLnHDFVReMY4b6t5fVjuZ JnIIoxv0hey2AiMhNLOy9jOcRCkXGb6Lf53Jk1Ww/s6JsZ7OUyDOnALYSKDJ0GjWMOSQ XlTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b3AntV76; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x26si32015ybd.431.2018.02.01.10.21.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 01 Feb 2018 10:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=b3AntV76; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehJUX-0005d2-C0 for patch@linaro.org; Thu, 01 Feb 2018 13:21:45 -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-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 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: , Reply-To: The development of GNU GRUB Cc: Daniel Kiper MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" 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(-) -- 2.11.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel 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