Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3175874ybk; Mon, 18 May 2020 20:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+L2riSqnEotQYjZzVU+8izKrk2jWqC47do2OmAuosbc+Zog0+2w8f67AAxjT68J1nWLUZ X-Received: by 2002:a50:eacb:: with SMTP id u11mr15795669edp.162.1589859228515; Mon, 18 May 2020 20:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589859228; cv=none; d=google.com; s=arc-20160816; b=cG2iWoVivIMFpmYyfU9WFd53KyJnXZ0Qd8dyR/OUJE01cfWGFPaQ2k7fnp6HBQBztx ZFQ/Oqm3L6raBwYr/vYCyqFxtf/KexEbYcodUjqayQhxBVgXn+a9Pbhuca0Vg+FOBlwU nzJa1qvEcueohleD11RIS8aA/zHffUqsfS2Z3qKYUWjsHm0PCdreDt6GaUJtAq1sGrTS 6gvVOAlZHi9O7K50AejvFR8Yji8pSbsRnFDMsMazdHJEyy6TxZnjU6WNP/C1+ejYDcIe uHp1r0LcM9h47wgsLXNLxyQ1OWFu18VTyG4rdK0wFJLM22TXcQQlJn9Dix/wA9bBSrUa hE7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:thread-index :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=RGfZ532J3gLw92Q4ZIc2vJjgJxK/jDXqROr+BXHIUK0=; b=iKMRKz4vhMGX0Uh9n7CKnLhgZxnU/vFb7S+lWk4gNwQALXOsMBx2e0iJFfbW6AltRp DwyUIP/Yd/C2vYGeKfqVQh9LDRaSFAVKQ1+EwqhrrP9A20Iyg/MAaDXV4sxGkl//suXb WrOOGf8Jdz5LtbDd2BGmVPqYvV8FVHTIm5Uqxkrb/dF3lGVRMHSYAkbvy7rIjndBGXxQ jrACmSlKh+dVnpozyysJr4RgMAdDnZuPUCM9wio4Y8yDKDh0UAfgOYiG24Y34Nv29eXY iVLq4aH0TA1wNybMKBY19UNhyBCjqY0xVDDD/u3zh1LMg3LJqDzBhM3CGYzw6X9SvV47 0Syw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si7655136ejc.214.2020.05.18.20.33.26; Mon, 18 May 2020 20:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728154AbgESD3u (ORCPT + 99 others); Mon, 18 May 2020 23:29:50 -0400 Received: from mail-m1271.qiye.163.com ([115.236.127.1]:15308 "EHLO mail-m1271.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbgESD3u (ORCPT ); Mon, 18 May 2020 23:29:50 -0400 Received: from SZ11061793 (unknown [58.251.74.226]) by mail-m1271.qiye.163.com (Hmail) with ESMTPA id 0048E582472; Tue, 19 May 2020 11:29:46 +0800 (CST) From: =?gb2312?B?zfWzzLjV?= To: "'Masami Hiramatsu'" , "'Steven Rostedt \(VMware'" , "'Andrew Morton'" , "'Kees Cook'" , "'Thomas Gleixner'" , "'Dominik Brodowski'" , "'Arvind Sankar'" , "'Mike Rapoport'" , "'Alexander Potapenko'" , Cc: Subject: [PATCH] init/main.c: Print all command line when boot Date: Tue, 19 May 2020 11:29:46 +0800 Message-ID: <010201d62d8d$bf7605f0$3e6211d0$@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AdYtjIsiN79CRE3nQBWNrTxxhAKwaQ== Content-Language: zh-cn X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgYFAkeWUFZT1VPTU9LS0tJSU5LTUxKT1lXWShZQU hPN1dZLVlBSVdZCQ4XHghZQVk1NCk2OjckKS43PlkG X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6NSI6DCo6Dzg3ESsMPTYJCEIz AwsaFA5VSlVKTkNCQ05DQkNMQk1NVTMWGhIXVQwaFRwYEx4VHBwaFRw7DRINFFUYFBZFWVdZEgtZ QVlOQ1VJTkpVTE9VSUlNWVdZCAFZQUlDTkM3Bg++ X-HM-Tid: 0a722afaef3798b6kuuu0048e582472 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Function pr_notice print max length maybe less than the command line length, need more times to print all. For example, arm64 has 2048 bytes command line length, but printk maximum length is only 1024 bytes. Signed-off-by: Chenggang Wang --- init/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c index 03371976d387..4cf676cc3305 100644 --- a/init/main.c +++ b/init/main.c @@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void) rest_init(); } +static void __init print_cmdline(void) +{ + const char *prefix = "Kernel command line: "; + int len = -strlen(prefix); + + len += pr_notice("%s%s\n", prefix, boot_command_line); + while (boot_command_line[len]) + len += pr_notice("%s\n", &boot_command_line[len]); +} + asmlinkage __visible void __init start_kernel(void) { char *command_line; @@ -858,7 +868,7 @@ asmlinkage __visible void __init start_kernel(void) build_all_zonelists(NULL); page_alloc_init(); - pr_notice("Kernel command line: %s\n", saved_command_line); + print_cmdline(); /* parameters may set static keys */ jump_label_init(); parse_early_param(); -- 2.20.1