From patchwork Thu Mar 23 16:46:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Richter X-Patchwork-Id: 742775 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vpssz3zXxz9s3w for ; Fri, 24 Mar 2017 03:47:35 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vpssz1LNszDqY7 for ; Fri, 24 Mar 2017 03:47:35 +1100 (AEDT) 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 3vpsrs1Lz9zDq8x for ; Fri, 24 Mar 2017 03:46:37 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2NGhpNY067653 for ; Thu, 23 Mar 2017 12:46:31 -0400 Received: from e28smtp03.in.ibm.com (e28smtp03.in.ibm.com [125.16.236.3]) by mx0a-001b2d01.pphosted.com with ESMTP id 29btuxxcwj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Mar 2017 12:46:30 -0400 Received: from localhost by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Mar 2017 22:16:27 +0530 Received: from d28relay01.in.ibm.com (9.184.220.58) by e28smtp03.in.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 23 Mar 2017 22:16:27 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay01.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2NGkQ4X13500522 for ; Thu, 23 Mar 2017 22:16:26 +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 v2NGkQUt012508 for ; Thu, 23 Mar 2017 22:16:26 +0530 Received: from machine.austin.ibm.com ([9.53.92.218]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v2NGkMxQ012433; Thu, 23 Mar 2017 22:16:25 +0530 From: Eric Richter To: petitboot@lists.ozlabs.org Subject: [PATCH 1/4] lib: Add system config option to enable kexec_file_load Date: Thu, 23 Mar 2017 11:46:17 -0500 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490287580-21725-1-git-send-email-erichte@linux.vnet.ibm.com> References: <1490287580-21725-1-git-send-email-erichte@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17032316-0008-0000-0000-000005477507 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17032316-0009-0000-0000-000013527C4E Message-Id: <1490287580-21725-2-git-send-email-erichte@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-23_15:, , 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-1702020001 definitions=main-1703230147 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 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 18edf57..a20bba9 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -322,6 +322,8 @@ int pb_protocol_config_len(const struct config *config) len += 4; /* allow_writes */ + len += 4; /* kexec_method */ + len += 4; /* n_consoles */ for (i = 0; i < config->n_consoles; i++) len += 4 + optional_strlen(config->consoles[i]); @@ -582,6 +584,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_consoles); pos += 4; for (i = 0; i < config->n_consoles; i++) @@ -1121,6 +1126,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_consoles)) goto out; diff --git a/lib/types/types.h b/lib/types/types.h index 7f4ae1f..b21b2b2 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -171,6 +171,8 @@ struct config { bool allow_writes; + bool kexec_method; + char *boot_console; bool manual_console; char *lang;