From nobody Wed Nov 5 05:32:32 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15306360224931018.9919349772756; Tue, 3 Jul 2018 09:40:22 -0700 (PDT) Received: from localhost ([::1]:41650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faOLl-0003NX-Pw for importer@patchew.org; Tue, 03 Jul 2018 12:40:21 -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) 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) 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-Google-Smtp-Source: AAOMgpcydnMBgv3tQG1OqfDl8JlaklMMQ2fjEZGEB3VnNVI1bpC2GP/WFw/7G6om3lN5BHy8oidEMw== X-Received: by 2002:a1c:a341:: with SMTP id m62-v6mr12520748wme.3.1530633629877; Tue, 03 Jul 2018 09:00:29 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=20Benn=C3=A9e?= , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 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=C3=A9e --- scripts/qemu-binfmt-conf.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 } =20 +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=3D"/usr/share/binfmts" QEMU_PATH=3D/usr/local/bin FLAGS=3D"" =20 -options=3D$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,= help,credential: -- "$@") +options=3D$(getopt -o ds:Q:e:hc: -l debian,systemd:,qemu-path:,exportdir:,= help,clear,credential: -- "$@") eval set -- "$options" =20 while true ; do @@ -354,6 +362,10 @@ while true ; do FLAGS=3D"" fi ;; + --clear) + shift + BINFMT_SET=3Dqemu_clear_interpreter + ;; *) break ;; --=20 2.17.1