From patchwork Tue Jul 3 16:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 140990 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1375483ljj; Tue, 3 Jul 2018 09:39:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+t0TkF8xVXLSfSEsKgEzjydyow6lsBij/tsZlk9y5pOXDYfAVPFKtX80iRlNva0p92Z8U X-Received: by 2002:a37:424a:: with SMTP id p71-v6mr27287642qka.209.1530635948001; Tue, 03 Jul 2018 09:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530635947; cv=none; d=google.com; s=arc-20160816; b=lFgqkmsdedXDvmiw5fHKVHgfU6rwrbbSi076+l2n+s66NIuPBK7SQXlWrFKYqQT9wD HqDEBJjn1dA2Fx9D1CPn8I8fPhRqpuysXkc30vZKFiET7tJKfBZCnJ6qsBzXd9Nf61oQ bYc864fABt+wRoYmF9cmgHNDBA4H3/pU4NsakRry1DKJxSOvcSlhyjsRhRznQX7mkBE1 kfk8Man80FUtDTSJXVFSakTqDTA7tXZ24lSO7lBxq4JUFNZ+hDQBgOEgRuu8dwt0gkgf NjA65dyOXPbbep57ca7DSrVGjinhIWIzET1NbldXzYNVdatanK4l06frW20gH7nA8lFA foUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=2E8u4Ao1dJMyUBIBvRRZ/qQSTXjAObz+O1HD8ik7388=; b=CK8u4N6PKn+rLvrNtbl1OfGHhiG3PJiVP0v2lvQwh3zCZCJP4wtuaNEAw2DL1IIVjN iKIccFEvxL8eT75EdJzL8j36EjG3PxFjJ0mITgrxcQucEjKZMKW/0SAIyaNs/HbOi3az G90G3FLENtEzkEHw8TDI1qlRLIBL8pzFIdIwho58ZPz04XIDISBrAFSfqfJX2cH2pf65 7QWaDusDbrRgfQiYMLNcnpQviBZlS+FQI2ZNrhPwTQm+6iItbtAqLJ4fjKmrwyiLsm6W uS7asCPI8ZmvaqNdRzzUgppNf7JeLnCOjQU1gRzZgAsOl3du32rclxeROhw0IJieUUoM Y3jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Pj24sMot; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g19-v6si1460000qtb.302.2018.07.03.09.39.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 03 Jul 2018 09:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Pj24sMot; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faOKZ-0002V3-7B for patch@linaro.org; Tue, 03 Jul 2018 12:39:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faNjG-0005K0-Q4 for qemu-devel@nongnu.org; Tue, 03 Jul 2018 12:00:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faNjD-00063j-KL for qemu-devel@nongnu.org; Tue, 03 Jul 2018 12:00:34 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:38016) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1faNjD-00061H-3m for qemu-devel@nongnu.org; Tue, 03 Jul 2018 12:00:31 -0400 Received: by mail-wm0-x22d.google.com with SMTP id 69-v6so2844285wmf.3 for ; Tue, 03 Jul 2018 09:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2E8u4Ao1dJMyUBIBvRRZ/qQSTXjAObz+O1HD8ik7388=; b=Pj24sMotEMpbYmMjYxKAFHnY4MGFFmDo70P4h7rany+rfFnMMuYGCTHnvccQ2cNPGS 9ItBJ428b56QPDAkGqDxNntcNfmUgYd9Rp5LONPeus0cemtvg7Vp+FUDRRi2kw42IJKA qPYEZ/Sar6JSvXijQpJiLs9kFCoSGIHp7TZUE= 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=2E8u4Ao1dJMyUBIBvRRZ/qQSTXjAObz+O1HD8ik7388=; b=dGptxH6CcHQEYYzczMD910K/2JumMpfzvzXfrnFUVrAD6lvk07Pbnq8iJ5mXKXcgUQ btDugCkjLPp/nZwzFquuWepbYbpVv9I0pnCObWKyiz1iSQxIqn0rFHhDcaYUCj3ZKI14 aNnsYTHRc7yaKSwWyRtgxNps1IXdR+wS8MOjB1B8F6LCEet1VAqZvsIH7jp0ideQ6P51 VHOEg2kSKLt948OPbcxjIrt93KEAsbbN9NRRbBJiPu4HI+b+PyzzjMm/2AuF1AKXIvZz VKyPNXonqkqaFvn425Iv+2vrGvg/tzDpN+8L16l27NJitDb8Ez6Ozl233Q7wY2bjia9+ xSfA== X-Gm-Message-State: APt69E1Msjd/g4GDQIjc9eMgsPgMS9KFXSYeKtft1syELY1aMtqE9aUB j1vPzjxqSS34IWisJS6UQlzC5Q== X-Received: by 2002:a1c:a341:: with SMTP id m62-v6mr12520748wme.3.1530633629877; Tue, 03 Jul 2018 09:00:29 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 136-v6sm3672884wmr.18.2018.07.03.09.00.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Jul 2018 09:00:29 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 30BB63E0154; Tue, 3 Jul 2018 17:00:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Tue, 3 Jul 2018 17:00:22 +0100 Message-Id: <20180703160022.10705-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22d Subject: [Qemu-devel] [PATCH] scripts/qemu-binfmt-conf.sh: allow clearing of entries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Riku Voipio , =?utf-8?q?Alex_Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently running the script twice will fail with "sh: echo: I/O error" as the registration is already complete. Add a new option --clear to reset the entries to save the user doing it by hand. Signed-off-by: Alex Bennée --- scripts/qemu-binfmt-conf.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index d7eefda0b8..13ef4713e6 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -160,7 +160,7 @@ qemu_get_family() { usage() { cat < /proc/sys/fs/binfmt_misc/register } +qemu_clear_interpreter() { + if [ -e /proc/sys/fs/binfmt_misc/qemu-$cpu ]; then + echo "Removing qemu-$cpu as binfmt interpreter for $cpu" + echo -1 > /proc/sys/fs/binfmt_misc/qemu-$cpu + fi +} + qemu_generate_systemd() { echo "Setting $qemu as binfmt interpreter for $cpu for systemd-binfmt.service" qemu_generate_register > "$EXPORTDIR/qemu-$cpu.conf" @@ -302,7 +310,7 @@ DEBIANDIR="/usr/share/binfmts" QEMU_PATH=/usr/local/bin FLAGS="" -options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,credential: -- "$@") +options=$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,help,clear,credential: -- "$@") eval set -- "$options" while true ; do @@ -354,6 +362,10 @@ while true ; do FLAGS="" fi ;; + --clear) + shift + BINFMT_SET=qemu_clear_interpreter + ;; *) break ;;