From patchwork Tue Dec 26 11:47:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Kuzov X-Patchwork-Id: 852961 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FNvccSIg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Zn6ErX/G"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z5Z4M4LlGz9s82 for ; Tue, 26 Dec 2017 22:48:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=iGlz39BXjdM77XCMm8LY5GvVbzezYEo6RGiM6WP+3F4=; b=FNvccSIgTAoYU5 B+t3FcTtO7Kw7z6SQAzMwXLbKeSeuFbf7QR4tCXkTNE1277FdeFNXUFGkVQZzwMAsMiXIW8umgBiI sZOyKbasTCUZNUAA27tmQm6I6rKXIyTfMqckxKgWXlLpjRvJ8CYPnddFl3Nb5XQDHKyepSvIwFcOh z5pbNB2EVNKsbNEPezC/1YoyAZY9uY1/GZFb8cWzpmDYSLzm1v7n8ambz0YyuP3XnsM6EF0HOViZ2 /OTW2jgIuiW39DUp5m2i43NoQ5gjYqQy8ul6Lxgdwqo57vdrzmmXTjUeZQZCSYyqCwy/P0eOy5W5q u4fwMxRsIRinvuOpFg2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eTniS-0004iL-9X; Tue, 26 Dec 2017 11:48:16 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eTniO-0004h8-Qo for lede-dev@lists.infradead.org; Tue, 26 Dec 2017 11:48:14 +0000 Received: by mail-lf0-x241.google.com with SMTP id a12so3133963lfe.13 for ; Tue, 26 Dec 2017 03:48:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=4JIGIYJc6WwyRy0AbcnKccPcWY6i3JNTJpvaIDarCdQ=; b=Zn6ErX/GBP+ZCQdLx4RUns4X0vrXw5TU1wNzo5OMue/dox9tCC82E+5gTkHgGZVrSz vnEnyekqdIXwpSEwCHsf0v5b/4E7M+f24LHSCXekOy1PkinDBBClgTleF7WpNlzLD59J J+4GgwsWMnwgQirjtkfbH0dSQp8vJl98lxBfMEZVKx07lPpV6e5iKNzYRj8T+OF8VR1o fKozE01QFjbDf/fCJrSZFwWa58n/d5BNgk+w7Otl9AMvjXkTIDVZv8+yUehMxo5JKB8R nMUEvhOyq2xmWXXn3dz9fmuD7ZGKJtXpbL3qI8di1ABhL/CcnFh1YifJ3rNHbVqeweGf m6+w== 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; bh=4JIGIYJc6WwyRy0AbcnKccPcWY6i3JNTJpvaIDarCdQ=; b=pM0XZB57sQmTFQb70OF7e8UKYrShRa8KnwaXWCfrcQ0UW7EyY0bLLYvEHcFrdw2z+2 QEIXbMYYF5ci97XVwRhdqwnNnz3txnmR0l+ff+mr/o8lj9KDxCKMK0l3Za2U6MUIZAHI IrSsKFktp4Oz+uyt0X48rIpUkUX8aR50osW8eBH40CpFoR+g/+y8u2mZncSb3XZ4nY2z NobY/ABjL9CbFPa8Q+63EPf7ubTEwR/0ViOB/9AiUdsy4+dfxQvEIhvIe9oroEt4Jvab fd7B//M+9uqPJx1/LtcWP7fV9HjmecE8q1z9Ta9iyxGX6Wbgh7wL8/Mtox1g3LsOLjXx vZUA== X-Gm-Message-State: AKGB3mJ/Qan/Guk7Dx3VMHQxi4FmUHZa8IEl8JwZ7IkJ6IoD61wLZujK nTVLVX2InncL4n20bQNmz999JQ== X-Google-Smtp-Source: ACJfBovLqhFXEyA0GjD3FMdJZBIizQ4vDNV3O/D8POIcwKG+04nWGIrZJrpFU635SsHbId6qNl8dlg== X-Received: by 10.25.196.212 with SMTP id u203mr9822977lff.126.1514288880567; Tue, 26 Dec 2017 03:48:00 -0800 (PST) Received: from work.g0x.ru ([37.44.44.156]) by smtp.gmail.com with ESMTPSA id 19sm5773425ljf.0.2017.12.26.03.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Dec 2017 03:48:00 -0800 (PST) From: Konstantin Kuzov To: lede-dev@lists.infradead.org Date: Tue, 26 Dec 2017 14:47:56 +0300 Message-Id: <20171226114756.19641-1-master.nosferatu@gmail.com> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171226_034812_896478_F3364FFC X-CRM114-Status: GOOD ( 15.48 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4010:c07:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (master.nosferatu[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH] kexec-tools: fix non-device tree devices on mips X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Konstantin Kuzov MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add additional argument '--no-dtb' which disables device tree search in currently loaded kernel. Signed-off-by: Konstantin Kuzov --- .../140-mips_disable_devicetree_support.patch | 147 +++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 package/boot/kexec-tools/patches/140-mips_disable_devicetree_support.patch diff --git a/package/boot/kexec-tools/patches/140-mips_disable_devicetree_support.patch b/package/boot/kexec-tools/patches/140-mips_disable_devicetree_support.patch new file mode 100644 index 0000000000..f862e2f58b --- /dev/null +++ b/package/boot/kexec-tools/patches/140-mips_disable_devicetree_support.patch @@ -0,0 +1,147 @@ +diff -urN a/kexec/arch/mips/include/arch/options.h b/kexec/arch/mips/include/arch/options.h +--- a/kexec/arch/mips/include/arch/options.h 2016-12-09 12:42:06.000000000 +0300 ++++ b/kexec/arch/mips/include/arch/options.h 2017-12-20 13:19:37.327807439 +0300 +@@ -5,6 +5,7 @@ + #define OPT_APPEND (OPT_ARCH_MAX+0) + #define OPT_DTB (OPT_ARCH_MAX+1) + #define OPT_RAMDISK (OPT_ARCH_MAX+2) ++#define OPT_NO_DTB (OPT_ARCH_MAX+3) + + /* Options relevant to the architecture (excluding loader-specific ones), + * in this case none: +@@ -14,7 +15,8 @@ + {"command-line", 1, 0, OPT_APPEND}, \ + {"append", 1, 0, OPT_APPEND}, \ + {"dtb", 1, 0, OPT_DTB }, \ +- {"initrd", 1, 0, OPT_RAMDISK }, ++ {"initrd", 1, 0, OPT_RAMDISK }, \ ++ {"no-dtb", 0, 0, OPT_NO_DTB }, + + + #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" +diff -urN a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c +--- a/kexec/arch/mips/kexec-elf-mips.c 2016-12-09 12:42:06.000000000 +0300 ++++ b/kexec/arch/mips/kexec-elf-mips.c 2017-12-14 09:08:28.793909864 +0300 +@@ -141,45 +141,49 @@ + else + cmdline_addr = 0; + +- /* MIPS systems that have been converted to use device tree +- * passed through UHI will use commandline in the DTB and +- * the DTB passed as a separate buffer. Note that +- * CMDLINE_PREFIX is skipped here intentionally, as it is +- * used only in the legacy method */ +- +- if (arch_options.dtb_file) { +- dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length); +- } else { +- create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX)); +- } +- +- if (arch_options.initrd_file) { +- initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size); + +- /* Create initrd entries in dtb - although at this time +- * they would not point to the correct location */ +- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size); +- +- initrd_base = add_buffer(info, initrd_buf, initrd_size, +- initrd_size, sizeof(void *), +- _ALIGN_UP(kernel_addr + kernel_size + dtb_length, +- pagesize), 0x0fffffff, 1); +- +- /* Now that the buffer for initrd is prepared, update the dtb +- * with an appropriate location */ +- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size); ++ if (!arch_options.no_dtb) { ++ /* MIPS systems that have been converted to use device tree ++ * passed through UHI will use commandline in the DTB and ++ * the DTB passed as a separate buffer. Note that ++ * CMDLINE_PREFIX is skipped here intentionally, as it is ++ * used only in the legacy method */ ++ ++ if (arch_options.dtb_file) { ++ dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length); ++ } else { ++ create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX)); ++ } ++ ++ if (arch_options.initrd_file) { ++ initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size); ++ ++ /* Create initrd entries in dtb - although at this time ++ * they would not point to the correct location */ ++ dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size); ++ ++ initrd_base = add_buffer(info, initrd_buf, initrd_size, ++ initrd_size, sizeof(void *), ++ _ALIGN_UP(kernel_addr + kernel_size + dtb_length, ++ pagesize), 0x0fffffff, 1); ++ ++ /* Now that the buffer for initrd is prepared, update the dtb ++ * with an appropriate location */ ++ dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size); ++ } + } + +- + /* This is a legacy method for commandline passing used + * currently by Octeon CPUs only */ + add_buffer(info, cmdline_buf, sizeof(cmdline_buf), + sizeof(cmdline_buf), sizeof(void *), + cmdline_addr, 0x0fffffff, 1); + +- add_buffer(info, dtb_buf, dtb_length, dtb_length, 0, +- _ALIGN_UP(kernel_addr + kernel_size, pagesize), +- 0x0fffffff, 1); ++ if (!arch_options.no_dtb) { ++ add_buffer(info, dtb_buf, dtb_length, dtb_length, 0, ++ _ALIGN_UP(kernel_addr + kernel_size, pagesize), ++ 0x0fffffff, 1); ++ } + + return 0; + } +diff -urN a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c +--- a/kexec/arch/mips/kexec-mips.c 2017-12-14 09:07:45.775790753 +0300 ++++ b/kexec/arch/mips/kexec-mips.c 2017-12-20 13:19:57.362395864 +0300 +@@ -83,6 +83,7 @@ + " --append=STRING Set the kernel command line to STRING.\n" + " --dtb=FILE Use FILE as the device tree blob.\n" + " --initrd=FILE Use FILE as initial ramdisk.\n" ++ " --no-dtb Don't try to find device tree\n" + ); + } + +@@ -115,6 +116,9 @@ + case OPT_RAMDISK: + arch_options.initrd_file = optarg; + break; ++ case OPT_NO_DTB: ++ arch_options.no_dtb = 1; ++ break; + default: + break; + } +diff -urN a/kexec/arch/mips/kexec-mips.h b/kexec/arch/mips/kexec-mips.h +--- a/kexec/arch/mips/kexec-mips.h 2016-12-09 12:42:06.000000000 +0300 ++++ b/kexec/arch/mips/kexec-mips.h 2017-12-14 09:08:28.794909844 +0300 +@@ -22,6 +22,7 @@ + char *dtb_file; + char *initrd_file; + int core_header_type; ++ int no_dtb; + }; + + extern struct memory_ranges usablemem_rgns; +diff -urN a/kexec/arch/ppc/ops.h b/kexec/arch/ppc/ops.h +--- a/kexec/arch/ppc/ops.h 2016-12-09 12:42:06.000000000 +0300 ++++ b/kexec/arch/ppc/ops.h 2017-12-20 13:19:12.232322959 +0300 +@@ -14,7 +14,6 @@ + + #define COMMAND_LINE_SIZE 512 + #define MAX_PATH_LEN 256 +-#define MAX_PROP_LEN 256 /* What should this be? */ + + typedef void (*kernel_entry_t)(unsigned long r3, unsigned long r4, void *r5); +