From patchwork Sun Dec 20 17:02:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1418836 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=0+7sARjy; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=KLCO5TFl; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CzTW72NwHz9sTX for ; Mon, 21 Dec 2020 04:05:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=2wxwETux4DT5XHtvfG1wEQzsQzfKabeOeMQte7+FDa0=; b=0+7sARjyKdPb2a6CwDCM+r7MNv Ivm0C0W8TEJVElHv6f18vleNFbKIlLuJ21yykPLkjaX7PG2JPwniXAUvWWUMVuh33xHvzbDLqpaYx iVKTLqD2AlgqgwcKZifr/iVQZUOeJ4bZnCje+TVRUdfIRyNYgJP+aZ5mQuoSAjbtYe4sg4qRcDxNz ervkgh5yJgYm6LTpYv8F//TUZlM+lq4gVmqcakJBfFYbenxohffwkqBbb4zyeJjtIRFeEO5cSIvyI NPhRBAUZcwF2X0CEg/zOREFPypDe2VUQGdUJRoSrPTHIAg5vn6hxFoxTAD86qYpfTLCKSetYR75Gg OKv1WiqQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kr26s-0007Cz-Bd; Sun, 20 Dec 2020 17:03:06 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kr26n-0007Br-V1 for openwrt-devel@lists.openwrt.org; Sun, 20 Dec 2020 17:03:02 +0000 Received: by mail-ej1-x632.google.com with SMTP id w1so10237224ejf.11 for ; Sun, 20 Dec 2020 09:03:00 -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:mime-version :content-transfer-encoding; bh=gRbPTRoE23GBxzWvX4r/Eqt1dJBUoir7uGIXHTFgck0=; b=KLCO5TFl+hkzH80XcBxmDUElB/yhIjMdGl0qDWR+VYaNx796qxOPWw/Ag0EdBJ63TJ O5coPMWcWKa3eF0F7CIVHvVZIWa4IPrycVGI5ouKbeHtjxd1/bfXkoVDsTFUMD+Hyt1y ujk3B3UEuhkdV/rnz/2vZp7XfpmaHMpB0mA2pGbw65iKA6Ki1Cbb8fpwXH+aux5+Fc/9 UrLB/7l8No6M0CjRedlIk9QP51VHQs09uiY/QVvW0ErGVSpM5rbbtAjVDd+4pl1XRdej iMTwbXiSYBf+9pRwLKTazUGHMCcMqTe7bO98i8G87/qgJbdDC15B+DMRmBPMpPzX2jtr 3EXQ== 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:mime-version :content-transfer-encoding; bh=gRbPTRoE23GBxzWvX4r/Eqt1dJBUoir7uGIXHTFgck0=; b=KazK09vgiwMCxgvo69oT5cpJLNgpNxzhjX7nj6s51TbXJs7uTCF7CsoWbbsbb+Uhu6 OQOP+SkflLfKa9PKzrEKK8qO5y60N15FMV7XOg7Xl+ZbtZNqRogIdbZ8DfJb06VpBTG2 MaG6o8cF0U5bhpTUEO48DObOQie0JZG1swQrAX2ErKL9AY5MbkyEpNy7Z9ZtSenUy0u1 Jip8iA8AhCOBUozLhruyulPjI5C60v1GCDKpI+NmlRs0uORO1mKX4r1mdY1Y1rMuBFP/ auk9JRz+6bgYRIp7k/CoCJTsUQ1cmwMPUF7aAqtJElsSgB28tAKaTiJOTbQ0rc+amx1w juGw== X-Gm-Message-State: AOAM532aNDYiB6+mXWzUhL1l9ahiv/0n1Yjy+udMud79JK7OcWh/mdg5 9PItPe0kzX6dEijPhgIsnznoid8h6a0= X-Google-Smtp-Source: ABdhPJzXKVEU4477h8JS3Rhsc8jh5KUjVGUO1zRmquxjhS0RVComc2n5dWvOf9k94qOCAdH2CHg6/A== X-Received: by 2002:a17:907:d09:: with SMTP id gn9mr12152134ejc.349.1608483779566; Sun, 20 Dec 2020 09:02:59 -0800 (PST) Received: from localhost.localdomain ([88.207.4.44]) by smtp.googlemail.com with ESMTPSA id dk16sm8130197ejb.85.2020.12.20.09.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Dec 2020 09:02:58 -0800 (PST) From: Robert Marko To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2] base-files: upgrade: fix initramfs detection Date: Sun, 20 Dec 2020 18:02:53 +0100 Message-Id: <20201220170254.1572403-1-robimarko@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201220_120302_084361_B2B1BB41 X-CRM114-Status: GOOD ( 14.02 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:632 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [robimarko[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Marko Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to now use tmpfs, it causes $(rootfs_type) to now return tmpfs when running initramfs image instead of being empty. This broke initramfs detection which prevents config files from being saved as it does not work from initramfs. So, lets test for $(rootfs_type) returning "tmpfs" instead. Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail) Signed-off-by: Robert Marko --- package/base-files/Makefile | 2 +- package/base-files/files/sbin/sysupgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index fbcb694592..fb1267ea5b 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=240 +PKG_RELEASE:=241 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index ca2eb298dc..3300d8e1ea 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -216,7 +216,7 @@ include /lib/upgrade do_save_conffiles() { local conf_tar="$1" - [ -z "$(rootfs_type)" ] && { + [ "$(rootfs_type)" = "tmpfs" ] && { echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit rm -f "$conf_tar" From patchwork Sun Dec 20 17:02:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1418835 X-Patchwork-Delegate: daniel@makrotopia.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Upk7ossr; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=j2pceR1p; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CzTW74D52z9sWQ for ; Mon, 21 Dec 2020 04:05:22 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TulbqcZI5+RAamlZkYbcb4pdc4JXSctcVGN3h5EaCoc=; b=Upk7ossrtRwAdIYhWgja4rphm em0s4X911KvJ+9YflrPxEZc309Sh0YRmR1cFplHRcHAnuGeg+UowqtYStegOUYCOLum8n+/fwUZXi P2gThgxeutWCvMMRoIOpq2eQwzpQE/U2DcDYZpWgueON9AgL7GbzL2DaBgUhmoghSxBHoUo+GRB/V ZsVb/Z4UkBYlaBJ61WwRMk3v8tc8H0TdWPgcD+QAF2Dc8iVJuEi9L5X+dVmsKm/oGP99jQhUIbhSs TYBQG9yYZv0Qv15W/p1rBnbWWHKoyEUFrrWfEuTo/hnMhRuWzpe02Hb7w3w+nZSpjBdIUSJ0orh4g e2jUNYbag==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kr26u-0007DR-2y; Sun, 20 Dec 2020 17:03:08 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kr26p-0007Cc-N5 for openwrt-devel@lists.openwrt.org; Sun, 20 Dec 2020 17:03:04 +0000 Received: by mail-ej1-x630.google.com with SMTP id n26so10266344eju.6 for ; Sun, 20 Dec 2020 09:03:03 -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 :mime-version:content-transfer-encoding; bh=dqzvoc2RgQi2I4SOSXrf57LIu9GKTiwwxuuPMpmuQvI=; b=j2pceR1pynB+Rie6IA+owTvVCsErAeYG7cEueL9eJIedeyoiRfsAAmU3BqTDrBi8pA ud4VnEhF+1iNdf3jUrtxK1xhIGp45TpXLz9glF8323EojoIrxdJPB/dXRDPsCTmwygN7 Ww24EZUvHBjZ907WAtxlMyHbL6oE0cJwO4n09SiGdZFB79jKHjby2aGW7+jmYAt+FOCO uFI9p3xPQDzigXvAonk7L4NgTa+MaH49WXgblqXGlVw8ftJn6nTXjHN7W5jIXQtKRF0Q C2Wn6zRpw03v4kn74u6hD4tuFuGnx7beHAfJhVzz7utTwLt/uQn0JjPScyFDcd8FccP4 ezdA== 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:mime-version:content-transfer-encoding; bh=dqzvoc2RgQi2I4SOSXrf57LIu9GKTiwwxuuPMpmuQvI=; b=pLXno2eWWLXr1lGSufRdT8P329zX6wTOhN1IOggY+i/lsLVlLsiE7hpaBDSWygGBZN PP4N3RUWheCzMDeYHg7CEM3TuE4XqkBMUJ8uk90Dw0jhzr0zzneuF095W+Jo8BCZ1DDA c96VRHDFCpdILVQX7whplD4Om6jPttjXhOTgRv3HBFVPmu8SiHGlm5tr893gJFOpV0xD FyiBnIZgYVOwJ2odHb24xm60EF+073MI/GNHKiV18ri8dRJcqQnRlRzfuBHLmZ1z3coe brUszrDzgki/JNf/mZa0XTCslW004GN96la96MYcck63HQj0qzmvooJH77ZQmfk22HXx ibpg== X-Gm-Message-State: AOAM530x9bYogukHnMxLZpvEcy/PSZxvP6fcwYasJf8QbAKckJlzvYd+ TGNnG4t+dtOrZ6+1c17RpyWm/PbdsXY= X-Google-Smtp-Source: ABdhPJwlWTcx9EI57gUw3PDKff9I4bcYgt8zeqYH43TeiQHF0mSo1V6tHxPlLPpidFxDk+GVfQM8SA== X-Received: by 2002:a17:906:7a18:: with SMTP id d24mr12561677ejo.324.1608483782322; Sun, 20 Dec 2020 09:03:02 -0800 (PST) Received: from localhost.localdomain ([88.207.4.44]) by smtp.googlemail.com with ESMTPSA id dk16sm8130197ejb.85.2020.12.20.09.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Dec 2020 09:03:01 -0800 (PST) From: Robert Marko To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] treewide: fix initramfs detection Date: Sun, 20 Dec 2020 18:02:54 +0100 Message-Id: <20201220170254.1572403-2-robimarko@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201220170254.1572403-1-robimarko@gmail.com> References: <20201220170254.1572403-1-robimarko@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201220_120303_799080_356EE7EE X-CRM114-Status: GOOD ( 14.20 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:630 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [robimarko[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -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_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Marko Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to now use tmpfs, it causes $(rootfs_type) to now return tmpfs when running initramfs image instead of being empty. This broke initramfs detection which is required so that when installing on MikroTik devices firmware partition would first get erased fully before writing. So, lets test for $(rootfs_type) returning "tmpfs" instead. Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail) Signed-off-by: Robert Marko --- target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh | 2 +- target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index 5ee5492369..97d388168f 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -39,7 +39,7 @@ platform_do_upgrade() { ;; *) # NOR devices: erase firmware if booted from initramfs - [ -z "$(rootfs_type)" ] && mtd erase firmware + [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware default_do_upgrade "$1" ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index c68b012d0b..99ed36e429 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -31,7 +31,7 @@ platform_do_upgrade() { mikrotik,routerboard-760igs|\ mikrotik,routerboard-m11g|\ mikrotik,routerboard-m33g) - [ -z "$(rootfs_type)" ] && mtd erase firmware + [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware ;; asus,rt-ac65p|\ asus,rt-ac85p)