Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2085759imm; Thu, 23 Aug 2018 13:58:25 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzb27F/wRM98faUHqxPLI/IGQuxP6cBXNUqhFWmGtAZABcsqUj70ATa5VkcxyBe62siSqoU X-Received: by 2002:a17:902:d211:: with SMTP id t17-v6mr25263544ply.258.1535057905193; Thu, 23 Aug 2018 13:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535057905; cv=none; d=google.com; s=arc-20160816; b=ICPHh6E/nBLhARbpBrx4atSaTmROoLSAGOVJzHr4djVm9SibzPy6OIlMKeDsLnuZaK d9UwTPqcV8AAnfvhRcSELTNynL0zsBEEDbzsKXX6/3moDWhXBX0DE5N4p8bOt2SSWa7Q c0xq/YvbzQV1WAqO2VyCdz3cttvX9CO0DyemUw/m14vWt7hGOu5SzSxppHfHjjtlnfsV 9pGTVzaCKtuRyE8MjlgLfQ4ow0iE8Mj2kKbI58f+yfLLPBw8kqb8UL6frBoqWeu9uJEF tdFcCFZNCliHjMrweU9+S0CukexBabioRDXqsYZu3NFYrI+L04wP+DsRu1yoWuZ/X0u5 iOVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=EyBTbzd8C+SpszBrm5T6YM7YqAPcwVHzjuQL+VBAhAA=; b=jErujcTJWcZImsC/bRob0lCxpHqoKhdCsMVvxt7OV9Ka5VejKSKRwuD/S4EDtMEwyU Ao2md4UcGkRvAgQJ/h9+wKuOiWTUal2wVK/5FVZmsyCDPluyV2Abj/kzL9OBYkwrMlnB Xh2vaRupBAI0R0DMbxsJaL4kQjC5O52dv5Jp9di8A1U5sw+eLM6KCNSXJvEKRCAj8vLH CeZtrK7UHORU7RXYsXAi13qlYLdeYw+4DpV+kS9ZJgiyh+PjrZAkQRV876wJjkCg0+Rs WVTa6P9QZOgm/hvbusFfd1+TlYfDvJG03l6RdZAmT9mJc8DdeiTXZqio8uCkD1mAExgB DkWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z8-v6si4961762plk.15.2018.08.23.13.58.09; Thu, 23 Aug 2018 13:58:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727537AbeHXA0U (ORCPT + 99 others); Thu, 23 Aug 2018 20:26:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59562 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727383AbeHXA0U (ORCPT ); Thu, 23 Aug 2018 20:26:20 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7NKddJT027209 for ; Thu, 23 Aug 2018 16:54:53 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2m231vk92f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 23 Aug 2018 16:54:53 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 23 Aug 2018 16:54:52 -0400 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 23 Aug 2018 16:54:48 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7NKsmOj25952390; Thu, 23 Aug 2018 20:54:48 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 587A3B2065; Thu, 23 Aug 2018 16:53:52 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29138B2064; Thu, 23 Aug 2018 16:53:52 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.159]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 23 Aug 2018 16:53:52 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 776C516C86E3; Thu, 23 Aug 2018 13:54:48 -0700 (PDT) Date: Thu, 23 Aug 2018 13:54:48 -0700 From: "Paul E. McKenney" To: Bernd Petrovitsch Cc: nicolas.pitre@linaro.org, josh@joshtriplett.org, linux-kernel@vger.kernel.org Subject: Re: Kernel-only deployments? Reply-To: paulmck@linux.vnet.ibm.com References: <20180823174359.GA13033@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18082320-0060-0000-0000-000002A35378 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009599; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01077843; UDB=6.00555749; IPR=6.00857817; MB=3.00022894; MTD=3.00000008; XFM=3.00000015; UTC=2018-08-23 20:54:50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18082320-0061-0000-0000-0000464525C0 Message-Id: <20180823205448.GZ4225@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-23_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808230213 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 23, 2018 at 09:52:17PM +0200, Bernd Petrovitsch wrote: > Hi all! > > On Thu, 2018-08-23 at 10:43 -0700, Paul E. McKenney wrote: > > [...] > > Does anyone do kernel-only deployments, for example, setting up an > > embedded device having a Linux kernel and absolutely no userspace > > whatsoever? > [...] > > You see, rcutorture runs entirely out of initrd, never mounting a real > > root partition. The user has been required to supply the initrd, but > > IMHO running programs from the initrd is in user-space, but anyways: Agreed, rcutorture still has a userspace, albeit a small one. I was wondering if I should take the next step and eliminate userspace entirely. Josh Triplett pointed out that doing so would reduce my test coverage, so the answer is that I should not eliminate userspace entirely for rcutorture. > Ages ago at some former employer, we built an embedded Linux device on > an MPC-860 board (but that shouldn't make a significant difference to > other architectures) based on the (at that time) brand new 2.4 kernel > which ran completely out of the initrd (which obviously contained the > whole root filesystem). Cute! The rcutorture test scripts do something similar, but you clearly got there long before I did. > [...] > > by throwing out everything not absolutely needed by the dash and sleep > > binaries, which got me down to about 2.5MB, 1.8MB of which was libc. > > We had a working glibc binary (which as the largest binary on the > filesystem) and just used it (and never got time and/or necessity to > use something else like ulibc, newlibc or build glibc ourselves to > leave all unneeded stuff out). > > We basically built the filesystem - the distribution as such;-) - from > scratch (only self-crafted `configure` calls around[0]) and - thus - > used busybox and ash (IIRC) - so throw dash, core-utils etc. away and > just use busybox (or something similar) for further space savings. > > The whole startup and daemon management was done with busybox' "init" > via a simple /etc/inittab (that were the good old times;-) and it was > enough as one can start one-time programs at boot time (e.g. to load > kernel modules (and remove the file in the filesystem from the > filesystem[0]) or configure stuff via sysctl) and restart daemons. We > didn't need run-levels ... Indeed, concerns about possible additional boot-time kernel-userspace interactions led me to use dracut or mkinitramfs if available, and hand-craft the "init" binary only if neither was present. > > This situation of course prompted me to create an initrd containing > > a statically linked binary named "init" and absolutely nothing else > > (not even /dev or /tmp directories), which weighs in at not quite 800KB. > > That is probably the smallest solution - if it's enough. If it's all > GPL, just link it statically against dietlibc .... Sounds like there are a number of reduced-weight libc libraries available. > We had all of the usual directories and a somewhat filled /dev > (completely static in the initrd IIRC, no udev or similar dynamic stuff > was needed) as we had dropbear as ssh-server, a small webserver+CGI- > script for a web interface and a SNMP agent (hacked net-smtp as we had > our own configuration daemon and needed SNMP only as a transport > protocol). Cool! Me, I currently leave networking out. I compile it into the kernel to catch build problems, but don't actually exercise the networking code. > [...] > > MfG, > Bernd > > [0]: Every byte counts and size does matter;-) ;-) ;-) ;-) Thanx, Paul > -- > Bernd Petrovitsch Email : bernd@petrovitsch.priv.at > LUGA : http://www.luga.at >