From patchwork Fri Jan 9 12:33:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Stam X-Patchwork-Id: 427059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3834E1401B5 for ; Fri, 9 Jan 2015 23:33:33 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id B0ABC283EE7; Fri, 9 Jan 2015 13:31:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6ADCC2809BA for ; Fri, 9 Jan 2015 13:31:11 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_FROM_MX=-3.1; rate: -7.6 Received: from smtp.eu1.fugro.com (smtp.eu1.fugro.com [46.34.88.151]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 9 Jan 2015 13:31:10 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.07,730,1413244800"; d="scan'208";a="46932242" X-IRP-Internal: 1 X-IRP-FugroSender: 200661 Received: from unknown (HELO ldam-msx2.fugro-nl.local) ([10.10.101.22]) by smtp.eu1.fugro.com with ESMTP; 09 Jan 2015 12:33:19 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Fri, 9 Jan 2015 13:33:18 +0100 Message-ID: In-Reply-To: <54AEED81.4090901@exegin.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [OpenWrt-Devel] procd/inittab with a delayed console Thread-Index: AdArhNhiJRdEaB56Q4GgGl2tGHgfygAgddfw References: <54AEED81.4090901@exegin.com> From: "Stam, Michel [FINT]" To: "Owen Kirby" , Subject: Re: [OpenWrt-Devel] procd/inittab with a delayed console X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Hello Owen, I was wondering, is the kernel driver for your console not placed in /etc/modules-boot.d ? /sbin/init executes procd, but prior to doing this executes kmodloader to load all modules in /etc/modules-boot.d. If your module is mentioned in this directory, this should load your console driver, thus making it available before procd checks /etc/inittab. This, to me, seems the most logical solution, as consoles should be available to the init process early on during boot, and not hot-plugged in afterwards. Do you agree? To put modules in /etc/modules-boot.d, make sure that their KernelPackage definition contains: AUTOLOAD:=$(call AutoLoad,,,1) Where is the load order and is the name of your kernel module (or modules). The presence of the ,1 argument indicates whether the module is placed in /etc/modules-boot.d or /etc/modules.d. Kind regards, Michel Stam Embedded System Engineer Hi, I'm not sure if this is a bug with procd's implementation of inittab or if I'm just doing something wrong in my inittab. However, we have a board that has multiple serial console ports, one of which relies on a kernel module and procd refuses to start a console on the second port. What seems to be happening is that procd loads inittab before the kernel modules are loaded, therefore the tty device doesn't exist yet and the check for dev_exist() fails and procd never forks a worker for that console. I was able to fix it for my board with the following patch, but I'm not sure if this is would be the entire fix for the problem since it seems like fork_worker() should be a little more graceful in handling tty devices that don't exist yet. Any thoughts or suggestions on better ways to fix this? Thanks, Owen diff --git a/inittab.c b/inittab.c index 2efbf4d..7b12e10 100644 --- a/inittab.c +++ b/inittab.c @@ -161,7 +161,7 @@ static void askfirst(struct init_action *a) { int i; - if (!dev_exist(a->id) || (console && !strcmp(console, a->id))) { + if (console && !strcmp(console, a->id)) { DEBUG(4, "Skipping %s\n", a->id); return; }