From patchwork Wed Feb 6 13:02:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 1037490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="odOKNT7z"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="KEsSRP0R"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43vhSQ5YQWz9s7h for ; Thu, 7 Feb 2019 00:02:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Ok2ZzH7gHSDAotV8wf3jP5rILxnOCGCZ16Wlrb5KJo4=; b=odO KNT7zrbbLsQ+WlPQq5crsiO6w0JfmOnJjQo7lfiO/iZ7G9Hagdu3zPArBGKi7cAzW9EJF/BCx4XMT F4oYiAJzHefpLDA4d7CxhYSa0rOiMsaMQavG7gz1yBrbtX22JD2UxTS0rLd2XWnVG1VmUF64Qy2/Q uIhGPoevz1sj4ruYIElmwjyq8ouznoNfRMUT7ie2aaTyZPWMIQEQhAG3jWqTdq4NwtjBSxw9H3OoZ mxAJMWXAVYvqKAcVR/3YCkldyT1gzq6u+vr4DiF+GHaMMZYJ/7dN/HPWVj+fTBeCY366JrEbjgXVS 6r+VkkDZKvnWJxmjTRJ9xRRRUJKPPxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1grMqi-0001G0-Py; Wed, 06 Feb 2019 13:02:44 +0000 Received: from smtprelay4.synopsys.com ([198.182.47.9] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1grMqf-0001Fe-TE for linux-snps-arc@lists.infradead.org; Wed, 06 Feb 2019 13:02:43 +0000 Received: from mailhost.synopsys.com (dc8-mailhost2.synopsys.com [10.13.135.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtprelay.synopsys.com (Postfix) with ESMTPS id 9256824E257D; Wed, 6 Feb 2019 05:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1549458160; bh=ChBzC4oocolSNs3kIImq20IjjkhjBt6LwPim01KsAkc=; h=From:To:Cc:Subject:Date:From; b=KEsSRP0R5BWdWFf9Cs44rEVDOPq8HUJIPXM6xzE/nAIEXCtyHhjV1TrXt+9KD/4vq FogmOMEmRRAQoIA7sLY3zf126nXZ/vYcXd6jZXS31G6AsXOD6JMb4fC6zYkmSXaPtZ fvYejXXBftFuPsBVAqGqeKC212iSLQg2hrFnHKM1B9MMZE1IavwKonNjuUf34FZtnT ubd1cxOorFatw2CydKupyUKavE+3UNi2qwEgBoCg6k00zpxB8h+OoY/rCZuwI8Sth/ l+DmavFRVNwMd4GAEUxBtntHftASoeCZnbDeGewvh1He+qfwYDPkPZsV3K1BoZBPsN PPVP9VRymiqDQ== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 43B54A0062; Wed, 6 Feb 2019 13:02:36 +0000 (UTC) From: Alexey Brodkin To: linux-yocto@yoctoproject.org Subject: [PATCH] don't check console device file on fs when booting with initrd/initramfs Date: Wed, 6 Feb 2019 16:02:33 +0300 Message-Id: <20190206130233.43745-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.16.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190206_050241_944782_6961766B X-CRM114-Status: GOOD ( 13.77 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.47.9 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leon Woestenberg , linux-snps-arc@lists.infradead.org, Alexey Brodkin , Ross Burton , Khem Raj MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In case of initrd/initramfs /dev/console might not exist that early as devtmpfs is mounted a bit later by /init process so disable this check in that case. Signed-off-by: Alexey Brodkin --- init/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/init/main.c b/init/main.c index 387a2d7dc90b..5b904bc78fa4 100644 --- a/init/main.c +++ b/init/main.c @@ -1112,7 +1112,9 @@ static int __ref kernel_init(void *unused) static noinline void __init kernel_init_freeable(void) { +#ifndef CONFIG_BLK_DEV_INITRD struct kstat console_stat; +#endif /* * Wait until kthreadd is all set-up. */ @@ -1144,11 +1146,17 @@ static noinline void __init kernel_init_freeable(void) do_basic_setup(); - /* Use /dev/console to infer if the rootfs is setup properly */ +#ifndef CONFIG_BLK_DEV_INITRD + /* + * Use /dev/console to infer if the rootfs is setup properly. + * In case of initrd or initramfs /dev/console might be instantiated + * later by /init so don't do this check for CONFIG_BLK_DEV_INITRD + */ if (vfs_lstat((char __user *) "/dev/console", (struct kstat __user *) &console_stat) || !S_ISCHR(console_stat.mode)) { panic("/dev/console is missing or not a character device!\nPlease ensure your rootfs is properly configured\n"); } +#endif /* Open the /dev/console on the rootfs, this should never fail */ if (ksys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)