From nobody Thu Nov 6 06:13: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=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540090287806237.4921522817732; Sat, 20 Oct 2018 19:51:27 -0700 (PDT) Received: from localhost ([::1]:57252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gE3pu-0001AA-Qr for importer@patchew.org; Sat, 20 Oct 2018 22:51:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gE3ol-0000Yz-0Y for qemu-devel@nongnu.org; Sat, 20 Oct 2018 22:50:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gE3oh-0005b9-2U for qemu-devel@nongnu.org; Sat, 20 Oct 2018 22:50:13 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:37059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gE3od-0005WE-SD for qemu-devel@nongnu.org; Sat, 20 Oct 2018 22:50:09 -0400 Received: by mail-lj1-x241.google.com with SMTP id 63-v6so33995561ljs.4 for ; Sat, 20 Oct 2018 19:50:06 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net. (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id z67-v6sm5933945lfa.14.2018.10.20.19.50.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Oct 2018 19:50:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=ZqNz6QVpUjhZtokV/fH9wVoo8nVv9Q6J77rRwnLUuro=; b=T60RydUs2RhxHT1kAj5w2GfVpbfub9m807rIrNkpYSVhuLwCVT27n+9ozYdMJDcABK vpG8e2xLKucLw1uBgtPvgvA0IPuka5DXt1wwDtGIrtjy5lAbr60G7a5TmVYTyA/iFBS/ AA2/pPpO6Br6WrnAohFiHO9npXjxwH3KTHEadixL0UScKemX0DhU03tdz8gg7xHWS+yi acd+H6etInINAFfiH+EuRS3/H4r+K6vgeYTuANkhY2/51Gf4ybWGI59lyDwD8wtW6KYb UhzqgCqcXEQY+nmkipyB29QNQisHW88Nrsoo2jpOHg7s5P1sWK5TnU2Uj26ZrCrpDLg+ k4KQ== 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=ZqNz6QVpUjhZtokV/fH9wVoo8nVv9Q6J77rRwnLUuro=; b=qphYzw66LwVUn+RkZVsWzbWJaAp/8GzoWEMyngB+xe5vlTvji6Ry9XlNAPu7htUgGZ k+8C3h9JhYd7pDWQBGVFWu+lmotSkDu2kgYM9cBTnoa/TcQaQnRrIRkbV0fv6IpspU0C CVuSrXu02HKV/3Wn1qBuettOZhXJBunuyTjmnJEM6dgORK3nEofIjMGPf9T68P3DuKy8 q0QrzoZMlwGUUAhsLus09bA7iXpMeaG4HZIKB+f7qo8ZAMKzzAIxshnCvYZ1CDfa5O3n /z+lUPBq7ZvFvPByJnMHUZ6EPdNbdCizok+hZeqqE6fuwpfBG9I5jW9D856SdYi5QBRw xg6Q== X-Gm-Message-State: AGRZ1gKdY5xLfNZrQFgQKVFErhODMWklz3XsXjOihHIK92hhbZOk92Sy G5eqk4ZjweeQ1iJvtrTZLyJcRVvspO4= X-Google-Smtp-Source: ACcGV6071HwrQmXKR3JiUUAeFtEsl60tRjxmGuNhR8pEpf9q66k6Kh3mZKC9GCmvZg4OOsYq5j/eyw== X-Received: by 2002:a2e:574f:: with SMTP id r15-v6mr8599161ljd.106.1540090205083; Sat, 20 Oct 2018 19:50:05 -0700 (PDT) From: Max Filippov To: qemu-devel@nongnu.org Date: Sat, 20 Oct 2018 19:49:53 -0700 Message-Id: <20181021024953.9905-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::241 Subject: [Qemu-devel] [PATCH v2] scripts/qemu-binfmt-conf.sh: add bFL handler registration 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: Max Filippov , 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: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" bFLT format header doesn't have enough information to register a handler for a specific architecture. Add switch -f / --flat that registers one of the qemu binaries as a handler for bFLT executable images. Signed-off-by: Max Filippov --- Changes v1->v2: - drop unintended changes to dtc; scripts/qemu-binfmt-conf.sh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index b5a16742a149..39f61065c698 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -132,6 +132,9 @@ or1k_magic=3D'\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x= 00\x00\x00\x00\x00\x02\x00\ or1k_mask=3D'\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\= xff\xff\xfe\xff\xff' or1k_family=3Dor1k =20 +flat_magic=3D'bFLT\x00\x00\x00\x04' +flat_mask=3D'\xff\xff\xff\xff\xff\xff\xff\xff' + qemu_get_family() { cpu=3D${HOST_ARCH:-$(uname -m)} case "$cpu" in @@ -170,6 +173,7 @@ usage() { Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU] [--help][--credential yes|no][--exportdir PATH] [--persistent yes|no][--qemu-suffix SUFFIX] + [--flat CPU] =20 Configure binfmt_misc to use qemu interpreter =20 @@ -188,7 +192,9 @@ Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian]= [--systemd CPU] calculated according to the binary to interpret --persistent: if yes, the interpreter is loaded when binfmt is configured and remains in memory. All future uses - are cloned from the open file. + are cloned from the open file + --flat: register QEMU for this CPU architecture as a handler + for the bFLT executable format. =20 To import templates with update-binfmts, use : =20 @@ -311,6 +317,13 @@ qemu_set_binfmts() { $BINFMT_SET fi done + if [ -n "$QEMU_FLAT" ] ; then + cpu=3D"${QEMU_FLAT}_bflt" + qemu=3D"$QEMU_PATH/qemu-$QEMU_FLAT" + magic=3D$flat_magic + mask=3D$flat_mask + $BINFMT_SET + fi } =20 CHECK=3Dqemu_check_bintfmt_misc @@ -324,7 +337,7 @@ CREDENTIAL=3Dno PERSISTENT=3Dno QEMU_SUFFIX=3D"" =20 -options=3D$(getopt -o ds:Q:S:e:hc:p: -l debian,systemd:,qemu-path:,qemu-su= ffix:,exportdir:,help,credential:,persistent: -- "$@") +options=3D$(getopt -o ds:Q:S:e:hc:p:f: -l debian,systemd:,qemu-path:,qemu-= suffix:,exportdir:,help,credential:,persistent:,flat: -- "$@") eval set -- "$options" =20 while true ; do @@ -380,6 +393,21 @@ while true ; do shift PERSISTENT=3D"$1" ;; + -f|--flat) + shift + QEMU_FLAT=3D"$1" + for cpu in ${qemu_target_list} ; do + if [ "$cpu" =3D "$1" ] ; then + break + fi + done + + if [ "$cpu" !=3D "$1" ] ; then + echo "ERROR: unknown CPU \"$1\"" 1>&2 + usage + exit 1 + fi + ;; *) break ;; --=20 2.11.0