From patchwork Sun Dec 17 14:18:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 849628 X-Patchwork-Delegate: noltari@gmail.com 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="I0YEmMVX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="MIUg6Xk1"; 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 3z05rn0BT4z9s4q for ; Mon, 18 Dec 2017 01:19:21 +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=edzHqnmBC4uh3Z3wFubvT8As5Uwa7l53vO2clS13HKw=; b=I0YEmMVXvLFGBt L9tcR8ASXqaRxGoJEjVYU+mPf9h9D4bV66BIYzqMrCrLTP3krPtZonLQMEp+YZsmmPOu1hE1GZU5D x2F7MNF+bi8tiMbEuv7I7QHINzNJ36TAz2oF7ETaNi3ujSZVC7xRlk31fCfV7KhwEcIxBDNOjjmu4 nIAmj3t3IiXS8zwn9/eA5bIWzp9D6E0NcGXyPM/mAObA/OoZt1DMbFE+pxblQkxMmSg10T21SZyqi ZgBk/jwAQ8BdJtdoL6bq7Ho1j7CvqU4Ukb6LdsO7rnD7NufN4lHyQOVg4S07Va0afXxKqi9g4hO7q 41R6sqMVB87R12HLMkpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmf-0002WP-Uz; Sun, 17 Dec 2017 14:19:17 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmb-0002Tf-HC for lede-dev@lists.infradead.org; Sun, 17 Dec 2017 14:19:15 +0000 Received: by mail-wr0-x244.google.com with SMTP id z104so2872138wrb.2 for ; Sun, 17 Dec 2017 06:18:52 -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=sclripMz9MJRjez7GpIvcvhGq5SoewKBEKaHKn2ABbc=; b=MIUg6Xk1b4naGtG/jthP1g+mpvuDiTcxDklBrRrAGV+qrA9HdqhfY0nNHJyujtn3Ee FiRFEuThVsp9B89Oqfd1Zf+4Y6u9wO8QVGqGoka9Dyn4ySZSzEc1THJHea5B17QiJcX9 /MywVysDlNeS+ic04hSiO8K9cjwfPo+gU8ZGVKVHF1jGg4g5+n9I96uOEyNO87wUv9xw voq3X+O9XtzSaLIi44Sk4Bn0Q0YBFQOnN+WjPo8Ao+MLOkHvR6HtAy1uCpt6Skju4obJ dYQTjP7PvmfSd8+hEmI7rQO8yQAHCTO5KsZkC9AW9xk5iCD8k3GP1+aNSn6mInnje77B zczQ== 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=sclripMz9MJRjez7GpIvcvhGq5SoewKBEKaHKn2ABbc=; b=oxST55DYd7icJW3Co19uW4Lg9AUd7D1fs63nnzG/5QrRU85Gw4TQYGKFLrfpxlXfQn nVweXk0HpXC8drUMwbGLS6JWFJwX8FcSSYoYWwoq0yaCQMuYH4pOqDYA6xIE6I2voVnL IqcpvzPXF+GbNLGeSe8sN88NyOHpjfse1fan+ufdisFMcZ8my18KpMqNyNUsGLn+up2j 3RodD6L9BjEdvwk2xv+JOOtqpKF9vfwmalAGHZYN/jmNkOV4J94ugJePeoTotaAqWoRP psEPvNs0YBAwkBWz593DsweUDbazSTtXT/Yjvp3+NcpI9STxDVSrk2JVHMRBRKYsp7CH 1EvQ== X-Gm-Message-State: AKGB3mJlmjy3jZkCT5tQLZPasPoSENqXase89ET9VUXrBv3nTBTQjLuN OgW+xHk+LxMaxZREtcuMkF/K3VQe X-Google-Smtp-Source: ACJfBoudZhQvj8a4xYS66NCo4Rr5H0d2YjqCK57xDHWFZaVw6+lN+7+0GK9MoCyRnPyl3rFL74elWg== X-Received: by 10.223.144.201 with SMTP id i67mr13775722wri.163.1513520331024; Sun, 17 Dec 2017 06:18:51 -0800 (PST) Received: from debian64.daheim (p200300D5FBDD4AFC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbdd:4afc::830]) by smtp.gmail.com with ESMTPSA id r64sm9505441wrb.62.2017.12.17.06.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Dec 2017 06:18:50 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.90_RC4) (envelope-from ) id 1eQZmD-0002FO-MY; Sun, 17 Dec 2017 15:18:49 +0100 From: Christian Lamparter To: lede-dev@lists.infradead.org Date: Sun, 17 Dec 2017 15:18:46 +0100 Message-Id: X-Mailer: git-send-email 2.15.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171217_061913_840656_4F67802B X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. 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:400c:c0c:0:0:0:244 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]gmail.com) -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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 1/4] brcm2708: convert to metadata 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: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch converts all the raspberrypi images to utilize the common metadata-based image verification. Note: the CM1 and CM3 currently use the same "rpi-cm" boardname. Signed-off-by: Christian Lamparter --- .../linux/brcm2708/base-files/lib/upgrade/platform.sh | 17 ++--------------- target/linux/brcm2708/image/Makefile | 7 +++++-- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh index b7613b446d..5b8e1e15b3 100644 --- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh @@ -1,20 +1,7 @@ -get_magic_at() { - local file="$1" - local pos="$2" - get_image "$file" | dd bs=1 count=2 skip="$pos" 2>/dev/null | hexdump -v -n 2 -e '1/1 "%02x"' -} +REQUIRE_IMAGE_METADATA=1 platform_check_image() { - local file="$1" - local magic - - magic=$(get_magic_at "$file" 510) - [ "$magic" != "55aa" ] && { - echo "Failed to verify MBR boot signature." - return 1 - } - - return 0; + return 0 } platform_do_upgrade() { diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index 7909c6d814..41730b6803 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -50,13 +50,14 @@ define Device/Default FILESYSTEMS := ext4 KERNEL := kernel-bin | kernel-img KERNEL_IMG := kernel.img - IMAGES := sdcard.img - IMAGE/sdcard.img := boot-img | sdcard-img + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := boot-img | sdcard-img | gzip | append-metadata endef define Device/rpi DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w + SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero-w endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -65,6 +66,7 @@ endif define Device/rpi-2 DEVICE_TITLE := Raspberry Pi 2B/3B/3CM DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3 + SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm endef ifeq ($(SUBTARGET),bcm2709) TARGET_DEVICES += rpi-2 @@ -74,6 +76,7 @@ define Device/rpi-3 KERNEL_IMG := kernel8.img DEVICE_TITLE := Raspberry Pi 3B (64 bit) DEVICE_DTS := broadcom/bcm2710-rpi-3-b + SUPPORTED_DEVICES := rpi-3-b endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 From patchwork Sun Dec 17 14:18:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 849630 X-Patchwork-Delegate: noltari@gmail.com 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="DZP6CkYm"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="myHSDDf4"; 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 3z05sN3vK4z9t2c for ; Mon, 18 Dec 2017 01:19:52 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PsWxaw+GZgIgFEin9rECf37feR75scoRwhV9Yr3trcY=; b=DZP6CkYmCKjWjc zEZaUX5heWl4+weVYS/5JWwUKQsZUrfuXDiwJYHPaUy2PaQt623Zf9YqLUDQ0S2mzGEpEfoxO5Fqj 2+q/I9LNeuTiul+0sdLdNHVnqrRLFSQcM/bFENHJjunjDo/d9qsWUN5YBZ3LZyAOsA9RsnXBFGIdP O87OuDvTuBBpVcrAnAJRTrLnGDxwFCHgwuRQrUiZdT9id12il0+V8a1E6FUMCj4iwLzOdEm+wwPQh N1Ek9S96RKTkbI1EhJNdRPaJxmXBf9e+GvWInjFRQjDIRHdhqZaa+0gRXpkyxU8flQ8IJJhS9XIsg wopRNQiixqh70824iyPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQZnC-0002wa-UD; Sun, 17 Dec 2017 14:19:50 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmd-0002Tj-D5 for lede-dev@lists.infradead.org; Sun, 17 Dec 2017 14:19:17 +0000 Received: by mail-wr0-x241.google.com with SMTP id z104so2872152wrb.2 for ; Sun, 17 Dec 2017 06:18:53 -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:in-reply-to:references :in-reply-to:references; bh=vufzmGuNM7AndGU0hlb+xGUa/p2rn4sR+6LzTWojwV4=; b=myHSDDf4lpQ8Ywgah0gxp3q4dwQyXhQeSUxpSbEnkezc1z5J32RSw6U3Pw4022dCRR au0KcTEQrRzMTJTV+2NlOgvwVB8T/A/R4K/qix0COQOOF1RBeL2wuoO+lt23Cd4TQ0FR dmI45iof/V8wgeqxo5K8F78E0EFDMvCAZCHKdMGnmC+0TjcWYg+lA5sZsmVoDzmd5RP4 uc/tbYAyiVzBR/AdR/ZbzPE3eiYnoTLki5NmQdjC3H1smses83E4rilyNR9wfGcBZBtn vRHJOsnjrQetMAkG00s5MJ3RsEZ8cfMbbyctmNz3peSEymRNjpIfhFldwaYELr/kYUHg TLBg== 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:in-reply-to:references; bh=vufzmGuNM7AndGU0hlb+xGUa/p2rn4sR+6LzTWojwV4=; b=ET9nKSoXpvuQ7vKRwwFahFQlW9+K2ImclqIveM3VT53pOB2jDyp7JMyW7Wus0OECA5 Bx4F6R9kj71p3zOMJYdhPxpZfB8BdDiPDEk9fk1m9vdZ4l+UqRSiGP5jppJjzNdD+eQV +dAHNiLMkVtTttJYXVT7rutGrmcYFwuIBmtpEKmFLlgkTMmxR7Ud/WefyEC7Ec6ZhnuZ 90ixXJ5OCtO0cB2VP13+OO/RiMG8bhfFD9Uj41izTs82iX0+oVhxO6Y1XbnlHau5ONMv NGfav0RHBuNEpi+L5dU7pWjqzlg4WQ2FQaz4yaQjDaYQJcAemsAOZu/P2LmGo0EwSEyx e6xA== X-Gm-Message-State: AKGB3mITGS35h67mugD6cMn4lDyoZOjNcKkVRYKW8t4plvz/xri8GBjH hnpQJr+xuw7P7zR2Xefv7wmXVQ1B X-Google-Smtp-Source: ACJfBouma28539gSTsDzo+gdtJqMLGUtxtqioDnIK5KCbjv2sBc/EAZxl9UBQdoZHynFWf/6AEZ4XQ== X-Received: by 10.223.160.61 with SMTP id k58mr14123150wrk.252.1513520332017; Sun, 17 Dec 2017 06:18:52 -0800 (PST) Received: from debian64.daheim (p200300D5FBDD4AFC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbdd:4afc::830]) by smtp.gmail.com with ESMTPSA id 20sm6764993wms.8.2017.12.17.06.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Dec 2017 06:18:50 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.90_RC4) (envelope-from ) id 1eQZmD-0002FR-PT; Sun, 17 Dec 2017 15:18:49 +0100 From: Christian Lamparter To: lede-dev@lists.infradead.org Date: Sun, 17 Dec 2017 15:18:47 +0100 Message-Id: X-Mailer: git-send-email 2.15.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171217_061915_609050_DC8BB5FE X-CRM114-Status: GOOD ( 10.20 ) 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:400c:c0c:0:0:0:241 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]gmail.com) -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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 2/4] brcm2708: add compatible strings 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: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This patch adds the compatible string for the various RPIs from 4.14 upstream. Note: The 4.14 upstream does not include the compute modules. If the CM* would just house the SoC, it could in theory use the "raw" chip compatible string. However, these CM boards also come with RAM and eMMC. So they have to have a proper comaptible. For now, "raspberrypi,compute-module-{1|3}" will be good enough. Note2: The original CM was renamed to CM1 when CM3 was released. Signed-off-by: Christian Lamparter --- .../960-add-rasbperrypi-compatible.patch | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 target/linux/brcm2708/patches-4.9/960-add-rasbperrypi-compatible.patch diff --git a/target/linux/brcm2708/patches-4.9/960-add-rasbperrypi-compatible.patch b/target/linux/brcm2708/patches-4.9/960-add-rasbperrypi-compatible.patch new file mode 100644 index 0000000000..db2f6c9b80 --- /dev/null +++ b/target/linux/brcm2708/patches-4.9/960-add-rasbperrypi-compatible.patch @@ -0,0 +1,70 @@ +--- a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts 2017-12-01 00:09:35.165577128 +0100 ++++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts 2017-12-01 00:10:02.418981698 +0100 +@@ -4,6 +4,7 @@ + #include "bcm283x-rpi-smsc9512.dtsi" + + / { ++ compatible = "raspberrypi,model-zero-w", "brcm,bcm2835"; + model = "Raspberry Pi Zero W"; + }; + +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts 2017-12-01 00:23:43.869682792 +0100 ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts 2017-12-01 00:25:07.686338314 +0100 +@@ -8,6 +8,7 @@ + #include "bcm283x-rpi-smsc9514.dtsi" + + / { ++ compatible = "raspberrypi,3-model-b", "brcm,bcm2837", "brcm,bcm2836"; + model = "Raspberry Pi 3 Model B"; + }; + +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 2017-12-01 00:24:16.899675426 +0100 ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts 2017-12-01 00:24:53.973005148 +0100 +@@ -4,6 +4,7 @@ + #include "bcm283x-rpi-smsc9514.dtsi" + + / { ++ compatible = "raspberrypi,2-model-b", "brcm,bcm2836"; + model = "Raspberry Pi 2 Model B"; + }; + +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts 2017-12-01 00:32:37.426847451 +0100 ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts 2017-12-01 00:33:22.656955034 +0100 +@@ -4,6 +4,7 @@ + #include "bcm283x-rpi-smsc9512.dtsi" + + / { ++ compatible = "raspberrypi,model-b", "brcm,bcm2835"; + model = "Raspberry Pi Model B"; + }; + +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 2017-12-01 00:34:04.227056139 +0100 ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts 2017-12-01 00:33:48.953685419 +0100 +@@ -4,6 +4,7 @@ + #include "bcm283x-rpi-smsc9514.dtsi" + + / { ++ compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; + model = "Raspberry Pi Model B+"; + }; + +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts 2017-12-01 00:21:41.226415322 +0100 ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts 2017-12-01 00:21:08.206444802 +0100 +@@ -3,6 +3,7 @@ + #include "bcm2708-rpi-cm.dtsi" + + / { ++ compatible = "raspberrypi,compute-module-1", "brcm,bcm2835"; + model = "Raspberry Pi Compute Module"; + }; + +--- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts 2017-12-01 00:40:17.454702202 +0100 ++++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts 2017-12-01 00:40:10.521349773 +0100 +@@ -3,6 +3,7 @@ + #include "bcm2710.dtsi" + + / { ++ compatible = "raspberrypi,compute-module-3", "brcm,bcm2837", "brcm,bcm2836"; + model = "Raspberry Pi Compute Module 3"; + }; + From patchwork Sun Dec 17 14:18:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 849629 X-Patchwork-Delegate: noltari@gmail.com 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="HGcmzntQ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ncNyOB4b"; 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 3z05s10zhTz9s4q for ; Mon, 18 Dec 2017 01:19:33 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=esupjW4MCozhWsLKexV4fxdxRFly0nAg3dEu8CXwyKM=; b=HGcmzntQ9/eEFN IDx0pQGjtkOKkvczG04iw3Vs9uBFuIN70iPF4yEdE9lqlbJn34xOuPo5WhL3GNQ0O32yaMJheJYnx ogNnK9Jp3H1YFe1cD4KwHdxfQxE+l8por4U9aqP5yhYQ2GmC0eIzU84HmiWb87c63Xl4cqc9yMZWw LlVu3EqPcZf6vdRSTEQdMdy2LtlXZ3pi2qGE9S8d/Cg7e9pq8tXwVl6WvkRB/RciBpWTkizswbaPz VNcyF3bhoRbbcvkWurdO81gzt2F6qsNcpU4XDq3M4rEGZyYniznTUEw4xYXSTat2FSy4yEXXyXVKR XJG7BPYOHmT4RqO+8Cgg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmt-0002gw-Dy; Sun, 17 Dec 2017 14:19:31 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmc-0002Tq-V0 for lede-dev@lists.infradead.org; Sun, 17 Dec 2017 14:19:17 +0000 Received: by mail-wr0-x242.google.com with SMTP id p69so3001929wrb.8 for ; Sun, 17 Dec 2017 06:18:54 -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:in-reply-to:references :in-reply-to:references; bh=gWBcrBpsxInO45ub02V++hHry+ZZZvf8gcR57zgKOX0=; b=ncNyOB4bqSwzj5zauHCGnsM05IWaYAsefApkLWjvbrf1k4l2EHA6PiyinMXAQKCFk1 dbNKATlmrlDENmQ2cYrepGHytY6I5imZEnTioShwBeYjVbEC1z6RkjPFgSRXcwmds68d bV3AJVUILvKB+Uop2iFEL0WDsDxPKTg6BbWesZ6cPt78k/Sk/wCEEZCi/rPPub77GAmx riIBZImc92++wDSfEgs6u0bL1Ux5tX5lW4H8lXbONQON3S0SUciw24Txju+VDkiY0nCS /zfYymFlBJP+uptgyePKMaMi/gkYrZD4DyJe+FGAPy/bikK9LRwsAUYjEvOAjeAlyVVl 1meQ== 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:in-reply-to:references; bh=gWBcrBpsxInO45ub02V++hHry+ZZZvf8gcR57zgKOX0=; b=s5w7pkF/5hyEd+ylCsDKWGjm1z9uJZ3F3oYUEmusk6sqKRzF92nPRKRptzvezrYRKq EWqHmpQo6P6P37qo6ZEsZpkxoVco4GZx00qj8joFQFwRBtWjujeZf1A0IjUhtSLu96eS u8IVdZiAGwS731topFQhpNcXW53bOpur6rAm6ihiX5l85YM7HJneYJmE5XOSaLXuZyJN xjfUCQVa5wuFio2vKRXsbFU0ONMNohGPFXDb2+3f40iluYKHaYTVaIBZKjX/1GybIkoE t43EWzhgGqXL1QD1EgLajbAwN0vGz9/sPyWUndCylkxRRLJz4Uc6g+7374Hr5647acGx LX8Q== X-Gm-Message-State: AKGB3mLTdkyXYFCr0cQ2fm4k/fdLP3jxWn2pSvL05t7o8l8DGqEZdTYR kGoIP0RQnLGf/RgJll+7p6nsijSu X-Google-Smtp-Source: ACJfBov7O+xrEqW2ruNDMcgDPeyqcpUVQZ1k0CdTld/NvmbPStB5XLSqVbZAocA5L7GSXFBz2y1rTQ== X-Received: by 10.223.135.227 with SMTP id c32mr6847760wrc.183.1513520332774; Sun, 17 Dec 2017 06:18:52 -0800 (PST) Received: from debian64.daheim (p200300D5FBDD4AFC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbdd:4afc::830]) by smtp.gmail.com with ESMTPSA id m133sm13406194wmd.40.2017.12.17.06.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Dec 2017 06:18:52 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.90_RC4) (envelope-from ) id 1eQZmD-0002FV-Qw; Sun, 17 Dec 2017 15:18:49 +0100 From: Christian Lamparter To: lede-dev@lists.infradead.org Date: Sun, 17 Dec 2017 15:18:48 +0100 Message-Id: <0a64c40c0438e51fcea9cd3e7eb47a479e3b5fc2.1513520257.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171217_061915_319575_BD19BDD8 X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. 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:400c:c0c:0:0:0:242 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]gmail.com) -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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 3/4] brcm2708: convert to dt-based board-detection 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: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use the values populated by the generic board detect function. The first compatible from the device tree source file will be the board name in userspace. The model property from the device tree source file will be the model name. Change the board name where used in the userspace and drop the target specific board detect, to use the generic one. Signed-off-by: Christian Lamparter --- .../brcm2708/base-files/etc/board.d/02_network | 12 +++--- target/linux/brcm2708/base-files/etc/diag.sh | 11 +++--- target/linux/brcm2708/base-files/lib/brcm2708.sh | 43 ---------------------- .../lib/preinit/01_preinit_do_brcm2708.sh | 10 ----- .../lib/preinit/05_set_preinit_iface_brcm2708 | 9 +++-- target/linux/brcm2708/image/Makefile | 6 +-- 6 files changed, 20 insertions(+), 71 deletions(-) delete mode 100644 target/linux/brcm2708/base-files/lib/brcm2708.sh delete mode 100644 target/linux/brcm2708/base-files/lib/preinit/01_preinit_do_brcm2708.sh diff --git a/target/linux/brcm2708/base-files/etc/board.d/02_network b/target/linux/brcm2708/base-files/etc/board.d/02_network index 29bcf33e33..a9c947b65a 100755 --- a/target/linux/brcm2708/base-files/etc/board.d/02_network +++ b/target/linux/brcm2708/base-files/etc/board.d/02_network @@ -11,13 +11,15 @@ board_config_update board=$(board_name) case "$board" in -rpi-2-b |\ -rpi-3-b |\ -rpi-b |\ -rpi-b-plus) +raspberrypi,model-b |\ +raspberrypi,model-b-plus |\ +raspberrypi,model-b-rev2 |\ +raspberrypi,2-model-b |\ +raspberrypi,3-model-b) ucidef_set_interface_lan "eth0" ;; -rpi-zero-w) + +raspberrypi,model-zero-w) ucidef_set_interface_lan "wlan0" ;; esac diff --git a/target/linux/brcm2708/base-files/etc/diag.sh b/target/linux/brcm2708/base-files/etc/diag.sh index 6f5810ed58..ce0f591517 100644 --- a/target/linux/brcm2708/base-files/etc/diag.sh +++ b/target/linux/brcm2708/base-files/etc/diag.sh @@ -7,14 +7,13 @@ set_state() { case "$(board_name)" in - rpi-2-b |\ - rpi-b-plus) + raspberrypi,2-model-b |\ + raspberrypi,model-b-plus) status_led="led1" ;; - rpi-b |\ - rpi-cm |\ - rpi-zero |\ - rpi-zero-w) + raspberrypi,model-b |\ + raspberrypi,model-zero |\ + raspberrypi,model-zero-w) status_led="led0" ;; esac diff --git a/target/linux/brcm2708/base-files/lib/brcm2708.sh b/target/linux/brcm2708/base-files/lib/brcm2708.sh deleted file mode 100644 index 76e678ff97..0000000000 --- a/target/linux/brcm2708/base-files/lib/brcm2708.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# Copyright (C) 2015-2016 OpenWrt.org -# Copyright (C) 2017 LEDE project - -ifname="" - -brcm2708_detect() { - local board_name model - - model=$(cat /proc/device-tree/model) - case "$model" in - "Raspberry Pi 2 Model B Rev"*) - board_name="rpi-2-b" - ;; - "Raspberry Pi 3 Model B Rev"*) - board_name="rpi-3-b" - ;; - "Raspberry Pi Compute Module Rev"*) - board_name="rpi-cm" - ;; - "Raspberry Pi Model B Plus Rev"* |\ - "Raspberry Pi Model B+ Rev"*) - board_name="rpi-b-plus" - ;; - "Raspberry Pi Model B Rev"*) - board_name="rpi-b" - ;; - "Raspberry Pi Zero Rev"*) - board_name="rpi-zero" - ;; - "Raspberry Pi Zero W Rev"*) - board_name="rpi-zero-w" - ;; - *) - board_name="unknown" - ;; - esac - - [ -e "/tmp/sysinfo" ] || mkdir -p "/tmp/sysinfo" - - echo "$board_name" > /tmp/sysinfo/board_name - echo "$model" > /tmp/sysinfo/model -} diff --git a/target/linux/brcm2708/base-files/lib/preinit/01_preinit_do_brcm2708.sh b/target/linux/brcm2708/base-files/lib/preinit/01_preinit_do_brcm2708.sh deleted file mode 100644 index 294364848d..0000000000 --- a/target/linux/brcm2708/base-files/lib/preinit/01_preinit_do_brcm2708.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Copyright (C) 2015 OpenWrt.org - -do_brcm2708() { - . /lib/brcm2708.sh - - brcm2708_detect -} - -boot_hook_add preinit_main do_brcm2708 diff --git a/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 b/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 index 95497cc586..76eb5905e8 100644 --- a/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 +++ b/target/linux/brcm2708/base-files/lib/preinit/05_set_preinit_iface_brcm2708 @@ -6,10 +6,11 @@ set_preinit_iface() { . /lib/functions.sh case "$(board_name)" in - rpi-2-b |\ - rpi-3-b |\ - rpi-b |\ - rpi-b-plus) + raspberrypi,2-model-b |\ + raspberrypi,3-model-b |\ + raspberrypi,model-b |\ + raspberrypi,model-b-plus |\ + raspberrypi,model-b-rev2) ifname=eth0 ;; esac diff --git a/target/linux/brcm2708/image/Makefile b/target/linux/brcm2708/image/Makefile index 41730b6803..9ea9a07a9d 100644 --- a/target/linux/brcm2708/image/Makefile +++ b/target/linux/brcm2708/image/Makefile @@ -57,7 +57,7 @@ endef define Device/rpi DEVICE_TITLE := Raspberry Pi B/B+/CM/Zero/ZeroW DEVICE_DTS := bcm2708-rpi-b bcm2708-rpi-b-plus bcm2708-rpi-cm bcm2708-rpi-0-w - SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero-w + SUPPORTED_DEVICES := rpi-b rpi-b-plus rpi-cm rpi-zero rpi-zero-w raspberrypi,model-b raspberrypi,model-b-plus raspberrypi,compute-module-1 raspberrypi,model-b-rev2 raspberrypi,model-zero raspberrypi,model-zero-w endef ifeq ($(SUBTARGET),bcm2708) TARGET_DEVICES += rpi @@ -66,7 +66,7 @@ endif define Device/rpi-2 DEVICE_TITLE := Raspberry Pi 2B/3B/3CM DEVICE_DTS := bcm2709-rpi-2-b bcm2710-rpi-3-b bcm2710-rpi-cm3 - SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm + SUPPORTED_DEVICES := rpi-2-b rpi-3-b rpi-cm raspberrypi,2-model-b raspberrypi,3-model-b raspberrypi,compute-module-3 endef ifeq ($(SUBTARGET),bcm2709) TARGET_DEVICES += rpi-2 @@ -76,7 +76,7 @@ define Device/rpi-3 KERNEL_IMG := kernel8.img DEVICE_TITLE := Raspberry Pi 3B (64 bit) DEVICE_DTS := broadcom/bcm2710-rpi-3-b - SUPPORTED_DEVICES := rpi-3-b + SUPPORTED_DEVICES := rpi-3-b raspberrypi,3-model-b endef ifeq ($(SUBTARGET),bcm2710) TARGET_DEVICES += rpi-3 From patchwork Sun Dec 17 14:18:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 849631 X-Patchwork-Delegate: noltari@gmail.com 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="Zvv5MNXE"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hR7rQZUp"; 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 3z05sx1nK7z9t2c for ; Mon, 18 Dec 2017 01:20:21 +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:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pmDHQ0IhpuY5zIM8JYQL6EANpiLvdg5TgnkS2jgWbXQ=; b=Zvv5MNXEEIgtR6 VamiIJe+t38KLdquxz8DyTTEC0M25uOK5QEL1kwLJtIgSPkCNgv1VWFQ2ywsK2w16PIgKP8XrzcM5 0DgoHg4XaRb1oWmonyX/QZ4KB2EJWx2zkI/XojkPWTGYmOw6baD1qc5vIpNOtlS5Y0dCQhJ+lUwNp CRjIKcUupdqbXzHbNQGSZcDkxI2xgXO4ISTjwOzrV4IIHGWaIo5iMxgVqbE+XxmkhI/47cL9r8uyp nZEuOgjOMVm5a/+1hUNLzx41oMkwpBufjO7XpoMKTuimnV54XZK0vh2cSP+/y6y5DMHX/MaN162iL FEuJHfS6QWp2APKI0s/A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eQZnU-0003QQ-JT; Sun, 17 Dec 2017 14:20:08 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eQZmd-0002Tt-RW for lede-dev@lists.infradead.org; Sun, 17 Dec 2017 14:19:18 +0000 Received: by mail-wr0-x243.google.com with SMTP id h1so11791496wre.12 for ; Sun, 17 Dec 2017 06:18:55 -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:in-reply-to:references :in-reply-to:references; bh=j3PsSg5G160DUfBgE5rBr+pELBWhYCl/ZCgPMPplVDM=; b=hR7rQZUpj07qCXaUSDJTdpFK2aRxhYIVPZfPnrdokY1qbi9P8tc1OyJiv3UWLHEX3V XEcHCKCKABObljIPyNR2LN1r6keWiktlQmxXq7426eUz2bOCjNUr0sKvOhQg1QVYcfid qrL7QAXZ2b7E06gHrBVn8X9txV3DO/MrIQjZJWXof3P4+PQ2dHzoSuPIL2rpETdNknnP NTJD/f5av+mh7hTvxpBom6NmYns99U5XhfJbU/7O8iQhga70+8CAG4hQvcRY9rzgyipU o5mItF4Hs5fzRXQOCgcc8ev6W8ueN5gjJ4Lsh4PZ+7/TuZ0rSuvGmQVIxs6lzDEK0i3D s09g== 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:in-reply-to:references; bh=j3PsSg5G160DUfBgE5rBr+pELBWhYCl/ZCgPMPplVDM=; b=JxqfhG5VOtKHSfzC+mPtpSXqvzCkGfojcI26J2oydE/+UDIRX/hdNMqH7aflWxSb4C rONs7oZzN8SXkYwNM+xN+HvsKN/9gnzBBjBlO7i37voXRXGm662K/O2XTILuEuY8W1jz Yuc6IjVJQeHA8Vj6NsBr9uRY552MoDy1L1oHCbctDnowu67IhQWfAGSZ7MK3XtAVTcxS Zsmm0nY3MKoH0YqC+159uqpJgoPC8+PvBQ3fPoc7oBNZBYUyQeWU5DaOKTb/Te0iKZAC VCJaOJsJ1Yof3Iq9welhZzizA8QyQ0hCO3Qav3aA9an4Cv37zeRITvKWW7Y8awzpcxSu 3x4w== X-Gm-Message-State: AKGB3mK1JHfkRshAAiPxthTV6CNg44AAZSOLiqUkyYwDHBDZRIRlwNdJ RlNICp/N4Ye6j0F1/9ieuONbdvUc X-Google-Smtp-Source: ACJfBov/cX5lgLhNif8Ztx+Z/AbwMR+9Fjmfw0FEzo8kze4HiiyNbUwT6ZVJUHsMD6XoQoImmsZC0g== X-Received: by 10.223.146.167 with SMTP id 36mr13859495wrn.102.1513520333515; Sun, 17 Dec 2017 06:18:53 -0800 (PST) Received: from debian64.daheim (p200300D5FBDD4AFC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbdd:4afc::830]) by smtp.gmail.com with ESMTPSA id 137sm8718531wmp.34.2017.12.17.06.18.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Dec 2017 06:18:52 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.90_RC4) (envelope-from ) id 1eQZmD-0002Fb-SX; Sun, 17 Dec 2017 15:18:49 +0100 From: Christian Lamparter To: lede-dev@lists.infradead.org Date: Sun, 17 Dec 2017 15:18:49 +0100 Message-Id: <177c63781ae9b2d975249e3658ed5423a8587563.1513520257.git.chunkeey@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: References: In-Reply-To: <0a64c40c0438e51fcea9cd3e7eb47a479e3b5fc2.1513520257.git.chunkeey@gmail.com> References: <0a64c40c0438e51fcea9cd3e7eb47a479e3b5fc2.1513520257.git.chunkeey@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171217_061916_111612_E22E196A X-CRM114-Status: GOOD ( 13.86 ) 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:400c:c0c:0:0:0:243 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]gmail.com) -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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 4/4] brcm2708: use x86's upgrade scripts for all rpi targets 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: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Advantages: - preserves existing partition layout on the sd-card. Only the boot and rootfs partition will be overwritten. Please note that sysupgrade will refuse to upgrade, if the existing installation has an incompatible partition layout. Future changes to the bootfs and/or rootfs partition size will likely cause breakage to the sysupgrade procedure. In these cases, the ext4-sdcard.img.gz will have to be written to the sdcard manually. Please don't forget to backup your configuration in this case. Signed-off-by: Christian Lamparter --- .../brcm2708/base-files/lib/upgrade/platform.sh | 102 +++++++++++++++++++-- 1 file changed, 93 insertions(+), 9 deletions(-) diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh index 5b8e1e15b3..b9cd8d282f 100644 --- a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh +++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh @@ -1,20 +1,104 @@ +. /lib/functions.sh + REQUIRE_IMAGE_METADATA=1 +# copied from x86's platform.sh + platform_check_image() { - return 0 + local diskdev partdev diff + + [ "$#" -gt 1 ] && return 1 + + export_bootdevice && export_partdevice diskdev -2 || { + echo "Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + + rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image + + if [ -n "$diff" ]; then + echo "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi + + return 0; } platform_do_upgrade() { + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev -2 || { + echo "Unable to determine upgrade device" + return 1 + } + sync - get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync - sleep 1 + + if [ "$SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + #extract the boot sector from the image + get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + else + diff=1 + fi + + if [ -n "$diff" ]; then + get_image "$@" | dd of="/dev/$diskdev" bs=2M conv=fsync + + # Separate removal and addtion is necessary; otherwise, partition 1 + # will be missing if it overlaps with the old partition 2 + partx -d - "/dev/$diskdev" + partx -a - "/dev/$diskdev" + + return 0 + fi + + #iterate over each partition from the image and write it to the boot disk + while read part start size; do + # root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem + # one of which is this offset, I'm not sure what's the best fix, so + # here's a WA. + let part=$((part - 2)) + if export_partdevice partdev $part; then + echo "Writing image to /dev/$partdev..." + get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync + else + echo "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + #copy partition uuid + echo "Writing new UUID to /dev/$diskdev..." + get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync } platform_copy_config() { - mkdir -p /boot - [ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime /dev/mmcblk0p1 /boot - cp -af "$CONF_TAR" /boot/ - tar --directory / -xvf "$CONF_TAR" boot/config.txt - sync - umount /boot + local partdev + + # Same as above /dev/sd[a|b]2 is root, so /boot is -1 + if export_partdevice partdev -1; then + mkdir -p /boot + [ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot + cp -af "$CONF_TAR" /boot/ + tar --directory / -xvf "$CONF_TAR" boot/config.txt + sync + unmount /boot + fi }