From patchwork Fri Sep 9 19:26:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Richter X-Patchwork-Id: 668205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sW6dt4cVdz9s3T for ; Sat, 10 Sep 2016 05:26:58 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sW6dt2TXqzDrqj for ; Sat, 10 Sep 2016 05:26:58 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sW6dk5FTXzDrHp for ; Sat, 10 Sep 2016 05:26:50 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u89JMSZ8019194 for ; Fri, 9 Sep 2016 15:26:48 -0400 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0a-001b2d01.pphosted.com with ESMTP id 25bc2t3x7g-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 09 Sep 2016 15:26:47 -0400 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 10 Sep 2016 00:56:44 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 10 Sep 2016 00:56:41 +0530 X-IBM-Helo: d28dlp03.in.ibm.com X-IBM-MailFrom: erichte@linux.vnet.ibm.com X-IBM-RcptTo: petitboot@lists.ozlabs.org Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id D18181258026 for ; Sat, 10 Sep 2016 00:56:50 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u89JQegO10354734 for ; Sat, 10 Sep 2016 00:56:41 +0530 Received: from d28av01.in.ibm.com (localhost [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u89JQdxD011663 for ; Sat, 10 Sep 2016 00:56:40 +0530 Received: from machine.ibm.com (sig-9-77-134-110.ibm.com [9.77.134.110]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u89JQYex011459; Sat, 10 Sep 2016 00:56:38 +0530 From: Eric Richter To: petitboot@lists.ozlabs.org Subject: [RFC 1/3] lib: Add system config option to enable kexec_file_load Date: Fri, 9 Sep 2016 14:26:10 -0500 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473449172-28074-1-git-send-email-erichte@linux.vnet.ibm.com> References: <1473449172-28074-1-git-send-email-erichte@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090919-0008-0000-0000-0000033907A8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090919-0009-0000-0000-00000F4D204E Message-Id: <1473449172-28074-2-git-send-email-erichte@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-09_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609090291 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Currently, pb-discover only supports one method (syscall) for loading the next kernel for kexec: kexec_load. This patch adds a system configuration option for toggling between using kexec_load (false), and kexec_file_load (true). This will be used in subsequent patches for determining the argument to kexec-lite/kexec-tools, and modified by a menu option. Signed-off-by: Eric Richter --- lib/pb-protocol/pb-protocol.c | 9 +++++++++ lib/types/types.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 1560ef7..e244e7d 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -316,6 +316,8 @@ int pb_protocol_config_len(const struct config *config) len += 4; /* allow_writes */ + len += 4; /* kexec_method */ + len += 4; /* n_tty */ for (i = 0; i < config->n_tty; i++) len += 4 + optional_strlen(config->tty_list[i]); @@ -568,6 +570,9 @@ int pb_protocol_serialise_config(const struct config *config, *(uint32_t *)pos = config->allow_writes; pos += 4; + *(uint32_t *)pos = config->kexec_method; + pos += 4; + *(uint32_t *)pos = __cpu_to_be32(config->n_tty); pos += 4; for (i = 0; i < config->n_tty; i++) @@ -1100,6 +1105,10 @@ int pb_protocol_deserialise_config(struct config *config, goto out; config->allow_writes = !!tmp; + if (read_u32(&pos, &len, &tmp)) + goto out; + config->kexec_method = !!tmp; + if (read_u32(&pos, &len, &config->n_tty)) goto out; diff --git a/lib/types/types.h b/lib/types/types.h index 6b607cd..ff5897f 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -162,6 +162,8 @@ struct config { bool allow_writes; + bool kexec_method; + char *boot_tty; char *lang;