From patchwork Thu Aug 2 17:29:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 952900 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41hHHJ4KgWz9s3q for ; Fri, 3 Aug 2018 03:29:48 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="KJ0vGq73"; 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 41hHHJ2qpTzF21T for ; Fri, 3 Aug 2018 03:29:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="KJ0vGq73"; dkim-atps=neutral X-Original-To: Petitboot@lists.ozlabs.org Delivered-To: Petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=geoff@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="KJ0vGq73"; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::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 41hHH74S0xzF2Ct for ; Fri, 3 Aug 2018 03:29:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Cc:To:Subject:From:References: In-Reply-To:Message-Id:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7eH6g2bwNZtOcNPz0RL965XLOJM9fVu1B4n4CMGuKe8=; b=KJ0vGq73EVEnGTS0mDY5LxR/6 JZMje1L9smhOKyHrBnrtjHAtgC2hz+JB/szvba7PRgLcoDqq3k4R6SYBHJZoQC+sqX8kM0GIhnTtQ zqnVQZLYPY8YYaxCm64sWQWgDvr8SxGcTdRULWpVBBRQOvIzJUYubyvLGJ0F7/Pwt8KfD7qXnn2Gv LQuKC1H3+PCOrsmaaXncqUreJVNviHdG5Yn34MZfBKcLw4FlGIC5qdKWfJ4kqgJwXGAJRin+tR3xp RGqI5ZCYd6PFMXbw07gzn75uzZecOILjxYZH0OuKOGIDiCmL6Vpa6FWzlbCydBKDR5F5nJTOiBc13 gfMYKtqMg==; Received: from geoff by merlin.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1flHPq-0007Wd-97; Thu, 02 Aug 2018 17:29:34 +0000 Message-Id: <7ca198d87bd13d441627ca6789fd198da33c168f.1533230644.git.geoff@infradead.org> In-Reply-To: References: From: Geoff Levand Patch-Date: Thu, 2 Aug 2018 10:19:53 -0700 Subject: [PATCH v2 06/30] discover: Add --debug to kexec To: Samuel Mendoza-Jonas Date: Thu, 02 Aug 2018 17:29:34 +0000 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ge Song , Petitboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" If verbose logging is enabled then add '--debug' to the kexec command line. Adds a new routine pb_log_get_debug() that can be used to query the log debug state. Signed-off-by: Geoff Levand --- discover/boot.c | 16 ++++++++++------ lib/log/log.c | 5 +++++ lib/log/log.h | 1 + 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/discover/boot.c b/discover/boot.c index 7faec9f..3de7d28 100644 --- a/discover/boot.c +++ b/discover/boot.c @@ -62,7 +62,7 @@ static int kexec_load(struct boot_task *boot_task) struct process *process; char *s_initrd = NULL; char *s_args = NULL; - const char *argv[7]; + const char *argv[8]; char *s_dtb = NULL; const char **p; int result; @@ -107,27 +107,31 @@ static int kexec_load(struct boot_task *boot_task) *p++ = pb_system_apps.kexec; /* 1 */ *p++ = "-l"; /* 2 */ + if (pb_log_get_debug()) { + *p++ = "--debug"; /* 3 */ + } + if (local_initrd) { s_initrd = talloc_asprintf(boot_task, "--initrd=%s", local_initrd); assert(s_initrd); - *p++ = s_initrd; /* 3 */ + *p++ = s_initrd; /* 4 */ } if (local_dtb) { s_dtb = talloc_asprintf(boot_task, "--dtb=%s", local_dtb); assert(s_dtb); - *p++ = s_dtb; /* 4 */ + *p++ = s_dtb; /* 5 */ } s_args = talloc_asprintf(boot_task, "--append=%s", boot_task->args ?: "\"\""); assert(s_args); - *p++ = s_args; /* 5 */ + *p++ = s_args; /* 6 */ - *p++ = local_image; /* 6 */ - *p++ = NULL; /* 7 */ + *p++ = local_image; /* 7 */ + *p++ = NULL; /* 8 */ result = process_run_sync(process); if (result) { diff --git a/lib/log/log.c b/lib/log/log.c index 0b145e0..5466d81 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -88,6 +88,11 @@ void pb_log_set_debug(bool _debug) debug = _debug; } +bool pb_log_get_debug(void) +{ + return debug; +} + FILE *pb_log_get_stream(void) { static FILE *null_stream; diff --git a/lib/log/log.h b/lib/log/log.h index 2d4fd91..c2ad58e 100644 --- a/lib/log/log.h +++ b/lib/log/log.h @@ -26,6 +26,7 @@ void __pb_log_init(FILE *stream, bool debug); #endif void pb_log_set_debug(bool debug); +bool pb_log_get_debug(void); FILE *pb_log_get_stream(void); #endif /* _LOG_H */