From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id ABC2DE013A6 for ; Wed, 13 Jun 2012 17:35:14 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 13 Jun 2012 17:35:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="156083772" Received: from unknown (HELO envy.home) ([10.255.12.119]) by azsmga001.ch.intel.com with ESMTP; 13 Jun 2012 17:35:13 -0700 Message-ID: <4FD93175.7070202@linux.intel.com> Date: Wed, 13 Jun 2012 17:33:57 -0700 From: Darren Hart User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: Yocto Project X-Enigmail-Version: 1.4.2 Subject: RFC: poky-tiny: init procedure X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 00:35:14 -0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit For those of you using poky-tiny or are interested in building very very small systems, I would appreciate your thoughts here. Currently poky-tiny images will boot and run /bin/sh, which results in error messages to the console about being unable to open the tty and job control being disabled (this is a common problem, if not commonly understood). The shell must be session leader to open the tty, and the tty must not be /dev/console (it should be a vt or a physical tty like ttyS0), the tty is required for job control (handling signals, etc.). The Problem: poky-tiny should boot to a shell without error messages and have job-control. The Vision: The goals of poky-tiny are to be an initial starting point from which to build a distribution that does what you want, and NOTHING more. The Proposal: o Do not include the standard Busybox init o Do provide a basic /init script that can be easily modified o Do provide a basic shell o Without init, this requires setsid and cttyhack to easily find the right device o Do not provide inittab functionality I can accomplish this by updating busybox to include: CONFIG_SETSID=y CONFIG_CTTYHACK=y And providing a basic init script as follows: #!/bin/sh mount none -t proc /proc mount none -t sysfs /sys mkdir /dev/pts mount none -t devpts /dev/pts ifup lo # Become session leader and try to find a real tty (e.g. ttyS0) setsid cttyhack sh This results in a system that boots with the virtual filesystems mounted, the local network interface up, and a shell with job control running. Nothing else. Potential Problems: Should the script be /init (for initramfs images) or /sbin/init for images on block devices. Note that the default method of running poky-tiny is with an initramfs as it doesn't support any block devices by default. Adding services like dropbear to your image will not get started on boot as their init scripts will not be run. I'm OK with documenting this behavior as part of creating your own distribution based on tiny. If the shell crashes, or you exit, the kernel panics (because init returns). Thoughts/Comments/Criticism welcome. Thanks! -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel