From patchwork Thu Sep 15 09:34:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koen Vandeputte X-Patchwork-Id: 670294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sZYGJ6YMxz9s5g for ; Thu, 15 Sep 2016 19:36:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ncentric.com header.i=@ncentric.com header.b=IB7eaUxk; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkT48-0005aj-UE; Thu, 15 Sep 2016 09:34:44 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkT44-0005Sr-L7 for lede-dev@lists.infradead.org; Thu, 15 Sep 2016 09:34:43 +0000 Received: by mail-wm0-x235.google.com with SMTP id i130so89717268wmf.0 for ; Thu, 15 Sep 2016 02:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncentric.com; s=google; h=from:to:subject:date:message-id; bh=z8p66fE7oc3jzeoBOqfWDzndYNCdyX+HZupGqvym1Mg=; b=IB7eaUxk4QtUq2cvXrQHOEU4byPR3lwflRQouwFkrmNNDBov3xIIqQNET0j7veNRjn nhGEuIl1yd3miUcqbyG63zix3OHXIDUAxdMsU+/2e7uhyXRZDaaipNCv4wL9qyTtVJKU ohftTvuceDosfD5PXIsEutpydL4Qxf3hQJGic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=z8p66fE7oc3jzeoBOqfWDzndYNCdyX+HZupGqvym1Mg=; b=cIb+T24BkW4iMhKBAXNx2eQRyHDpMzkmgdz0DkrECnokWdcoEau1lcEspQ80oZV5KI sOhHYod9ikWa5uRcnxoLt7cGZ2M842a0t3jFJYQC8lGyC+CO6XL6mN9P+yXZIYaNsanP UVSix9beCC7ZfjvNzjfxfdZ1/aBo0ai8H852xKLnldMSq5VG8Udz+6lV7XlFTK91cbt7 O1owCvl6ZnQT8nVrvTofM8MIVYTv2TbK/w6xKupfWE4VxQ5hJ9JtbbJeWWB+IbFsF4IA eftn4yhvPalL3AncP7i8Ld3+54avScmNbjAlCGCtDTsRFReNIKLfZuNcTyAMT/W1Vaao z/qA== X-Gm-Message-State: AE9vXwMaq9n6tBlsZbuSGW54pRBRLLmRL95R2qlN4Hth8Of4/1zbrw9p7ektjEadWR0hPQ== X-Received: by 10.194.234.69 with SMTP id uc5mr7806893wjc.76.1473932058001; Thu, 15 Sep 2016 02:34:18 -0700 (PDT) Received: from localhost.localdomain (d515300d8.static.telenet.be. [81.83.0.216]) by smtp.googlemail.com with ESMTPSA id bw9sm2509348wjc.33.2016.09.15.02.34.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Sep 2016 02:34:17 -0700 (PDT) From: Koen Vandeputte To: lede-dev@lists.infradead.org Date: Thu, 15 Sep 2016 11:34:08 +0200 Message-Id: <1473932048-27062-1-git-send-email-koen.vandeputte@ncentric.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160915_023441_041325_136DBF18 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:235 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH] cns3xxx: backport upstream SPI Flash partition sizes X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org As indicated by Tim Harvey: The 4.4 kernel is not easily sized down to below the 1.5MB limit imposed by the SPI flash MTD partition mapping. Increase this to 2MB where it is for NOR flash devices. Additionally add a check that ensures the kernel fits within the 2MB limit. This resolves boot issues on SPI based boards such as the GW2380/82. https://github.com/Gateworks/openwrt/commit/17b860f32fe5739042445eb852109682d6ff7d99 Signed-off-by: Koen Vandeputte --- .../linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c | 16 ++++++++-------- target/linux/cns3xxx/image/Makefile | 6 +++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c index fb519d2..3c21404 100644 --- a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c +++ b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c @@ -168,12 +168,12 @@ static struct mtd_partition laguna_spi_partitions[] = { .offset = SZ_256K, }, { .name = "kernel", - .size = SZ_1M + SZ_512K, + .size = SZ_2M, .offset = SZ_512K, }, { .name = "rootfs", - .size = SZ_16M - SZ_2M, - .offset = SZ_2M, + .size = SZ_16M - SZ_2M - SZ_512K, + .offset = SZ_2M + SZ_512K, }, }; @@ -988,19 +988,19 @@ static int __init laguna_model_setup(void) if (laguna_info.config2_bitmap & (SPI_FLASH_LOAD)) { switch (laguna_info.spi_flash_size) { case 1: - laguna_spi_partitions[3].size = SZ_4M - SZ_2M; + laguna_spi_partitions[3].size = SZ_4M - SZ_2M - SZ_512K; break; case 2: - laguna_spi_partitions[3].size = SZ_8M - SZ_2M; + laguna_spi_partitions[3].size = SZ_8M - SZ_2M - SZ_512K; break; case 3: - laguna_spi_partitions[3].size = SZ_16M - SZ_2M; + laguna_spi_partitions[3].size = SZ_16M - SZ_2M - SZ_512K; break; case 4: - laguna_spi_partitions[3].size = SZ_32M - SZ_2M; + laguna_spi_partitions[3].size = SZ_32M - SZ_2M - SZ_512K; break; case 5: - laguna_spi_partitions[3].size = SZ_64M - SZ_2M; + laguna_spi_partitions[3].size = SZ_64M - SZ_2M - SZ_512K; break; } spi_register_board_info(ARRAY_AND_SIZE(laguna_spi_devices)); diff --git a/target/linux/cns3xxx/image/Makefile b/target/linux/cns3xxx/image/Makefile index 8f29c6c..d71a860 100644 --- a/target/linux/cns3xxx/image/Makefile +++ b/target/linux/cns3xxx/image/Makefile @@ -9,6 +9,10 @@ include $(INCLUDE_DIR)/image.mk define Image/Prepare mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage $(KDIR)/uImage + @if [ `stat -c%s "$(KDIR)/uImage"` -gt `expr 2048 \* 1024` ]; then \ + echo "Error: Kernel is too big" >&2; \ + exit 1; \ + fi endef # Build sysupgrade image @@ -39,7 +43,7 @@ define Image/Build/squashfs dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \ ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_nor.bin ( \ - dd if=$(KDIR)/uImage bs=1536k conv=sync; \ + dd if=$(KDIR)/uImage bs=2048k conv=sync; \ dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \ ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_spi.bin endef