From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EC15C4338F for ; Thu, 29 Jul 2021 13:25:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 219B160184 for ; Thu, 29 Jul 2021 13:25:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237492AbhG2NZ6 (ORCPT ); Thu, 29 Jul 2021 09:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237344AbhG2NZ4 (ORCPT ); Thu, 29 Jul 2021 09:25:56 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55881C061765; Thu, 29 Jul 2021 06:25:53 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id nb11so10731361ejc.4; Thu, 29 Jul 2021 06:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0yqI1c2xw6Ag4eb0/wFVzwBfqXP1l2U+gD4rpUuRLoc=; b=rBzqcLkQUSK/5Xxs67ffLOpTFT5R7Lgl8aYDi8EIGc3wNbbGhsKCgH6E6buXmf+D71 ezaPl7v8a3PFO117edsBvpz3i7LaFpArjdii14swjFFY7nlYB3SC3JzB18urKI6f6xOR VVh2upVCSS0AXzHPsGlbo1qiv8cPl5ABZDFOb39wUFaYIQRa1JXM7/ERZ9XIPqDd0sth Ae6pW5ERAFJZf3S3sBeZ57wFI/5GZGf8JrsIvmmPB9X7uT1xaRqyCGYacVlIm+EzLUwf NeDV4GLuigXikY+FrxJlWDfS6Bf52rd6JzyFd3tXpSUuoBngecUT8v2tHKcfQICiyq8V DJCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0yqI1c2xw6Ag4eb0/wFVzwBfqXP1l2U+gD4rpUuRLoc=; b=cL0d8AVSs3JHk0WI4bhYfq/AgPVWPWumZoZPaVCHTIDi2JvJEDB4gEoW5wvK1eNzUA P9hh/8ecrJxbDcSO3tpoBBU+SA8xQ0NJ21nq0gRwcQ4+uRwnGYx0osuzCT/KSAtfyenf piRnAkQEQGSlE6+OzE/zphbHGJV74ZlaF2sIxSXcwz6FRg2dFq/qFdXfdJNs5qk7jELW J3ym/7oz2mhzwaaS/x58CKJ5+FpQIPE/LNGdOJGwBUKHTTF98WhNMs2CSlft6Dpve//I sn2qICVr+ywi4UvXtyn35qTilY3Zg0P0DQxbGqmPNWDIJLnDx5SbFCZTFm+GtkMK6B4/ onwQ== X-Gm-Message-State: AOAM532ek4sohpDZCJgqxmG9KnZziPSV5N1VflXcw5yqAwv7cxYgx8p/ cUSpdQctoFnB+filQuXhbVY+uWaYEA+BwCDvkZ4= X-Google-Smtp-Source: ABdhPJx1gOhljOB1Dl3tZLRJDmAsBaEumKcoFb6pN85XzBviPWkXKr7euYXCy0Mr6I0AoYuuuQ04uaXw3MPCPyxjt6A= X-Received: by 2002:a17:906:3915:: with SMTP id f21mr4712718eje.178.1627565151886; Thu, 29 Jul 2021 06:25:51 -0700 (PDT) MIME-Version: 1.0 References: <20210605034447.92917-1-dong.menglong@zte.com.cn> <20210605034447.92917-3-dong.menglong@zte.com.cn> <20210605115019.umjumoasiwrclcks@wittgenstein> <20210607103147.yhniqeulw4pmvjdr@wittgenstein> <20210607121524.GB3896@www> <20210617035756.GA228302@www> <20210617143834.ybxk6cxhpavlf4gg@wittgenstein> <20210727123701.zlcrrf4p2fsmeeas@wittgenstein> In-Reply-To: From: Menglong Dong Date: Thu, 29 Jul 2021 21:25:40 +0800 Message-ID: Subject: Re: [PATCH v6 2/2] init/do_mounts.c: create second mount for initramfs To: Petr Mladek Cc: Christian Brauner , Alexander Viro , Kees Cook , Sami Tolvanen , johan@kernel.org, ojeda@kernel.org, jeyu@kernel.org, masahiroy@kernel.org, joe@perches.com, Jan Kara , hare@suse.de, Jens Axboe , tj@kernel.org, gregkh@linuxfoundation.org, song@kernel.org, NeilBrown , Andrew Morton , Rasmus Villemoes , Barret Rhoden , f.fainelli@gmail.com, palmerdabbelt@google.com, wangkefeng.wang@huawei.com, Masami Hiramatsu , Steven Rostedt , vbabka@suse.cz, Alexander Potapenko , johannes.berg@intel.com, "Eric W. Biederman" , jojing64@gmail.com, terrelln@fb.com, geert@linux-m68k.org, linux-fsdevel@vger.kernel.org, LKML , Luis Chamberlain , arnd@arndb.de, Chris Down , mingo@kernel.org, Bjorn Helgaas , Josh Triplett Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Wed, Jul 28, 2021 at 4:07 PM Petr Mladek wrote: > [...] > > I guess that you have seen the following message printed by > console_on_rootfs(): > > "Warning: unable to open an initial console." > > This function is responsible for opening stdin, stdout, stderr > file to be used by the init process. > > I am not sure how this is supposed to work with the pivot_root > and initramfs. > > > Some more details: > > console_on_rootfs() tries to open /dev/console. It is created > by tty_init(). The open() callback calls: > > + tty_kopen() > + tty_lookup_driver() > + console_device() > > , where console_device() iterates over all registered consoles > and returns the first with tty binding. > > There is ttynull_console that might be used as a fallback. But I > am not sure if this is what you want. I didn't figure out the relation between initramfs and initial console, could you please tell me how this warning came up? I can't reproduce it in qemu with this command: qemu-system-x86_64 -nographic -m 2048M -smp cores=4,sockets=1 -s -kernel ./bzImage -initrd ./rootfs.cpio -append "rdinit=/init console=ttyS0" Thanks! Menglong Dong > > Best Regards, > Petr