From patchwork Tue Dec 18 04:19:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Mendoza-Jonas X-Patchwork-Id: 1014968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JlDh1tN2z9sC7 for ; Tue, 18 Dec 2018 15:20:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="ecRgGZvV"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="UA14DFuf"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43JlDg5SgtzDqXP for ; Tue, 18 Dec 2018 15:20:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="ecRgGZvV"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="UA14DFuf"; dkim-atps=neutral X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=mendozajonas.com (client-ip=66.111.4.25; helo=out1-smtp.messagingengine.com; envelope-from=sam@mendozajonas.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=mendozajonas.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mendozajonas.com header.i=@mendozajonas.com header.b="ecRgGZvV"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="UA14DFuf"; dkim-atps=neutral Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43JlDV74XwzDqWs for ; Tue, 18 Dec 2018 15:20:10 +1100 (AEDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4B2D022AD6; Mon, 17 Dec 2018 23:20:08 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 17 Dec 2018 23:20:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= mendozajonas.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm1; bh=l2Sox6JXhQxSozbS70lfe52ti78FG7K/HShevIwYPIA=; b=ecRgG ZvV4MgYNeJsvWU1Mvpo1g4gWB3jSAIfQ6fzA/mtvu2D5ikywueUxnDdTPQ9dZ/he tBBSL+rGZM/Q/Eq6VNflYt5ThsDYjhqa48GLBFQAnhnmGflFqQ8x6Ga8RcRq2RgV Ays1QBfyuqkRcg2mt7sVcmS0STP2hjh5ELqAoZmTprZ4Q7UPgDne3gaT9hJMsi43 3TthClaPYYmJh8LiW41sbWFU8SWIwEjQN58jLaY0gNZcKu19Yh+KC8cNHo0/saID 2MCvjkd2baHR1FjQ3aBi9iQFnGa4jEOqgzciPo+WksjxFV509U55oF2igIzF+rR1 tIEZwfhIOdVp+l/Zg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=l2Sox6JXhQxSozbS70lfe52ti78FG7K/HShevIwYPIA=; b=UA14DFuf UXVgOmRdGGYbpIvX7+UTmHs/+qtGJWxb70jLc2l4s0rkHhH8vztSwxAmPft8SyCD v1yIK+4fLwpne/2lRSYrm3bohfI5iRzjO+nMT6E5TbuSLxyH6hfkKeOgeSCnIThf xYP8golzXEOQ8cdvjteyhjVW3vv2Md4B8gq4bDRx22V1mSiSTetrxkMhH9p+rm8n 5hzIbIwkBWcBafdUzqr1yRaxLJz7E4cOAKwScgnM17k8/dHu3dde6jXWafoo9d5q EtyglQWMxZSnbWK3Ta4tKmsqnWIRRV/IAb6AEf3bFuhd4xJcrWSEvJX7jloBSavJ nNX4UCAT1FMSeg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudeigedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpe furghmuhgvlhcuofgvnhguohiirgdqlfhonhgrshcuoehsrghmsehmvghnughoiigrjhho nhgrshdrtghomheqnecukfhppeduvddvrdelledrkedvrddutdenucfrrghrrghmpehmrg hilhhfrhhomhepshgrmhesmhgvnhguohiirghjohhnrghsrdgtohhmnecuvehluhhsthgv rhfuihiivgeptd X-ME-Proxy: Received: from v4.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id D878B100E5; Mon, 17 Dec 2018 23:20:06 -0500 (EST) From: Samuel Mendoza-Jonas To: petitboot@lists.ozlabs.org Subject: [RFC PATCH 3/8] utils: Add plugin_commands parameter Date: Tue, 18 Dec 2018 15:19:48 +1100 Message-Id: <20181218041953.8960-4-sam@mendozajonas.com> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181218041953.8960-1-sam@mendozajonas.com> References: <20181218041953.8960-1-sam@mendozajonas.com> MIME-Version: 1.0 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Mendoza-Jonas Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" This points to an optional JSON file providing detailed command examples. The format is an array of command objects which define a platform name if appropriate, command name, command executable, argument format string, and an array of arguments containing name and arguments. At the moment three argument types are recognised: FieldString, FieldInt, and FieldFloat (string, int64_t, and double respectively). For example: [ { "platform": "any", "name": "Set NVRAM parameter", "cmd": "nvram", "arg_fmt": "-p {} --update-config {}={}", "args": [ { "name": "Partition", "arg": { "FieldString": "common" } }, { "name": "Parameter", "arg": { "FieldString": "some" } }, { "name": "Value", "arg": { "FieldString": "value" } } ], "help": "Example: Set an NVRAM parameter" }, { "platform": "witherspoon", "name": "Foo Memory Allocation", "cmd": "nvram", "arg_fmt": "-p {} --update-config foo_mem_amt={}", "args": [ { "name": "Partition", "arg": { "FieldString": "ibm,skiboot" } }, { "name": "Amount (MB)", "arg": { "FieldInt": 0 } } ], "help": "Memory to be allocated for some feature" } ] Signed-off-by: Samuel Mendoza-Jonas --- discover/user-event.c | 2 ++ utils/pb-plugin | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/discover/user-event.c b/discover/user-event.c index d3d4a5e8..cbbec1a0 100644 --- a/discover/user-event.c +++ b/discover/user-event.c @@ -601,6 +601,8 @@ static int user_event_plugin(struct user_event *uev, struct event *event) opt->date = talloc_strdup(opt, event_get_param(event, "date")); opt->plugin_file = talloc_strdup(opt, event_get_param(event, "source_file")); + opt->command_file = talloc_strdup(opt, + event_get_param(event, "plugin_commands")); executables = talloc_strdup(opt, event_get_param(event, "executables")); if (!executables) { diff --git a/utils/pb-plugin b/utils/pb-plugin index a42d0515..b162f4b9 100755 --- a/utils/pb-plugin +++ b/utils/pb-plugin @@ -2,7 +2,7 @@ __dest=/ __pb_mount_dir=/var/petitboot/mnt/dev/ -plugin_abi=1 +plugin_abi=2 plugin_ext=pb-plugin plugin_meta=pb-plugin.conf plugin_meta_dir=etc/preboot-plugins/ @@ -235,6 +235,7 @@ do_install() name=$PLUGIN_NAME id=$PLUGIN_ID version=$PLUGIN_VERSION \ vendor=$PLUGIN_VENDOR vendor_id=$PLUGIN_VENDOR_ID \ date=$PLUGIN_DATE executables="$PLUGIN_EXECUTABLES" \ + plugin_commands="${__dest}/${PLUGIN_COMMANDS}" \ source_file=$url installed="yes" echo "Plugin installed" @@ -364,6 +365,10 @@ shell environment (eg, /usr/bin/my-raid-config). If multiple executables are provided, separate with a space. EOF read executables +cat <