From patchwork Sat May 13 19:56:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 762070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wQHj40RBhz9s9Y for ; Sun, 14 May 2017 05:58:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EnYgfle+"; dkim-atps=neutral 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:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=+hssoMzh2DMyZVHzEbaXv8S3PiylBg5NguqVxja0XHE=; b=EnYgfle+90QeSFVGaqAM9EU7xr 2FN6IdNs5Nu05RAkfreG3QFrRmtdNSe3DelAHl0n0PVUK5RiIGmoOfygx/jXiD+rfC/zCUQ6mQ71T uu3jkO/4HXa4H9sul3M0XbyiCHfXeRUhZXOSe4DRetw4C5K2tr3OxPnL6ZwgQui+of0a5T652IIp8 AZBco7I5tHX+efvNxXEAfsRygM4/13OZkR4hWrFscWZQB96hvQze3lJFuAvwaU9fFEDa14oNshX/7 q06Mk0JV/U48Dia4jyMoCXvfLlnJtFqlBt6c9JC4jmP8GamZtxD9lttuy/ceVt8w8nbNBep1EZf+S WSsXvQrw==; 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 1d9dBY-0005V6-Eh; Sat, 13 May 2017 19:58:40 +0000 Received: from chaos.universe-factory.net ([2a02:2918:505:100::22]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d9dAd-0003qX-F2 for lede-dev@lists.infradead.org; Sat, 13 May 2017 19:57:53 +0000 Received: from localhost.localdomain (unknown [IPv6:fd1b:c28a:2fd6::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by chaos.universe-factory.net (Postfix) with ESMTPSA id 5BD65186C95 for ; Sat, 13 May 2017 21:56:55 +0200 (CEST) From: Matthias Schiffer To: lede-dev@lists.infradead.org Date: Sat, 13 May 2017 21:56:36 +0200 Message-Id: <004b1838236e90df576577b17e5ae628f6cd6ba1.1494704975.git.mschiffer@universe-factory.net> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170513_125744_555176_D65D1B3A X-CRM114-Status: UNSURE ( 8.24 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH v2 06/19] procd: remove procd-nand package 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: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We always want to support staged upgrades now, so it's better to include upgraded into the main package. /lib/upgrade/nand.sh is moved to base-files. The procd-nand-firstboot package is removed for now, it may return later as a separate package. Signed-off-by: Matthias Schiffer --- package/base-files/Makefile | 13 +++++-- .../files => base-files/files/lib/upgrade}/nand.sh | 0 package/system/procd/Makefile | 41 ++-------------------- package/system/procd/files/nand-preinit.sh | 21 ----------- 4 files changed, 14 insertions(+), 61 deletions(-) rename package/{system/procd/files => base-files/files/lib/upgrade}/nand.sh (100%) delete mode 100644 package/system/procd/files/nand-preinit.sh diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 512fa66ca7..912449c85a 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -18,7 +18,9 @@ PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ PKG_BUILD_DEPENDS:=usign/host PKG_LICENSE:=GPL-2.0 -PKG_CONFIG_DEPENDS := CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE +PKG_CONFIG_DEPENDS := \ + CONFIG_SIGNED_PACKAGES CONFIG_TARGET_INIT_PATH CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE \ + CONFIG_NAND_SUPPORT include $(INCLUDE_DIR)/package.mk @@ -30,7 +32,7 @@ endif define Package/base-files SECTION:=base CATEGORY:=Base system - DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:lede-keyring +fstools +fwtool + DEPENDS:=+netifd +libc +procd +jsonfilter +SIGNED_PACKAGES:usign +SIGNED_PACKAGES:lede-keyring +NAND_SUPPORT:ubi-utils +fstools +fwtool TITLE:=Base filesystem for Lede URL:=http://openwrt.org/ VERSION:=$(PKG_RELEASE)-$(REVISION) @@ -105,9 +107,16 @@ ifdef CONFIG_SIGNED_PACKAGES endef endif +ifeq ($(CONFIG_NAND_SUPPORT),) + define Package/base-files/nand-support + rm -f $(1)/lib/upgrade/nand.sh + endef +endif + define Package/base-files/install $(CP) ./files/* $(1)/ $(Package/base-files/install-key) + $(Package/base-files/nand-support) if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \ $(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \ fi diff --git a/package/system/procd/files/nand.sh b/package/base-files/files/lib/upgrade/nand.sh similarity index 100% rename from package/system/procd/files/nand.sh rename to package/base-files/files/lib/upgrade/nand.sh diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 43ea23aab0..d7b8a058a9 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -22,11 +22,9 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=John Crispin -PKG_FLAGS:=nonshared - PKG_CONFIG_DEPENDS:= \ CONFIG_TARGET_INIT_PATH CONFIG_KERNEL_SECCOMP \ - CONFIG_NAND_SUPPORT CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \ + CONFIG_PROCD_SHOW_BOOT CONFIG_PROCD_ZRAM_TMPFS \ CONFIG_KERNEL_NAMESPACES CONFIG_PACKAGE_procd-ujail CONFIG_PACKAGE_procd-seccomp include $(INCLUDE_DIR)/package.mk @@ -42,7 +40,7 @@ TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lrt) define Package/procd SECTION:=base CATEGORY:=Base system - DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus +NAND_SUPPORT:procd-nand + DEPENDS:=+ubusd +ubus +libjson-script +ubox +USE_GLIBC:librt +libubox +libubus TITLE:=OpenWrt system process manager endef @@ -60,20 +58,6 @@ define Package/procd-seccomp TITLE:=OpenWrt process seccomp helper + utrace endef -define Package/procd-nand - SECTION:=utils - CATEGORY:=Utilities - DEPENDS:=@NAND_SUPPORT +ubi-utils - TITLE:=OpenWrt sysupgrade nand helper -endef - -define Package/procd-nand-firstboot - SECTION:=utils - CATEGORY:=Utilities - DEPENDS:=procd-nand - TITLE:=OpenWrt firstboot nand helper -endef - define Package/procd/config menu "Configuration" depends on PACKAGE_procd @@ -91,10 +75,6 @@ endmenu endef -ifeq ($(CONFIG_NAND_SUPPORT),y) - CMAKE_OPTIONS += -DBUILD_UPGRADED=1 -endif - ifeq ($(CONFIG_PROCD_SHOW_BOOT),y) CMAKE_OPTIONS += -DSHOW_BOOT_ON_CONSOLE=1 endif @@ -114,7 +94,7 @@ endif define Package/procd/install $(INSTALL_DIR) $(1)/sbin $(1)/etc $(1)/lib/functions - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger} $(1)/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{init,procd,askfirst,udevtrigger,upgraded} $(1)/sbin/ $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libsetlbf.so $(1)/lib $(INSTALL_BIN) ./files/reload_config $(1)/sbin/ $(INSTALL_DATA) ./files/hotplug*.json $(1)/etc/ @@ -133,21 +113,6 @@ define Package/procd-seccomp/install $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libpreload-trace.so $(1)/lib endef -define Package/procd-nand/install - $(INSTALL_DIR) $(1)/sbin $(1)/lib/upgrade - - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/upgraded $(1)/sbin/ - $(INSTALL_DATA) ./files/nand.sh $(1)/lib/upgrade/ -endef - -define Package/procd-nand-firstboot/install - $(INSTALL_DIR) $(1)/lib/preinit - - $(INSTALL_DATA) ./files/nand-preinit.sh $(1)/lib/preinit/60-nand-firstboot.sh -endef - $(eval $(call BuildPackage,procd)) $(eval $(call BuildPackage,procd-ujail)) $(eval $(call BuildPackage,procd-seccomp)) -$(eval $(call BuildPackage,procd-nand)) -$(eval $(call BuildPackage,procd-nand-firstboot)) diff --git a/package/system/procd/files/nand-preinit.sh b/package/system/procd/files/nand-preinit.sh deleted file mode 100644 index cf596246d1..0000000000 --- a/package/system/procd/files/nand-preinit.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# Copyright (C) 2014 OpenWrt.org - -nand_takeover() { - . /lib/upgrade/nand.sh - mtd=$(find_mtd_index "$CI_UBIPART") - esize=$(cat /proc/mtd | grep mtd$mtd |cut -d" " -f 3) - [ -z "$esize" ] && return 1 - esize=$(printf "%d" 0x$esize) - for a in `seq 0 64`; do - mtd -o $((a * esize)) -l 400 dump /dev/mtd$mtd > /tmp/takeover.hdr - MAGIC=$(dd if=/tmp/takeover.hdr bs=1 skip=261 count=5 2> /dev/null) - SIZE=$(printf "%d" 0x$(dd if=/tmp/takeover.hdr bs=4 count=1 2> /dev/null | hexdump -v -n 4 -e '1/1 "%02x"')) - [ "$MAGIC" = "ustar" ] && { - mtd -o $((a * esize)) -l $((SIZE + 4)) dump /dev/mtd$mtd | dd bs=1 skip=4 of=/tmp/sysupgrade.tar - nand_do_upgrade_stage2 /tmp/sysupgrade.tar - } - done -} - -boot_hook_add initramfs nand_takeover