Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1974163imm; Thu, 23 Aug 2018 11:56:14 -0700 (PDT) X-Google-Smtp-Source: AA+uWPy3gTa1AwRPfZCo6aq6LvoJXaJiy+4shtx1/1tJp7EzleWQNYpKWzdk2swrDv2MNuLd1w3H X-Received: by 2002:a63:8c0b:: with SMTP id m11-v6mr56748624pgd.372.1535050573973; Thu, 23 Aug 2018 11:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535050573; cv=none; d=google.com; s=arc-20160816; b=1KNkHNBlUhe7R9jh7JqoJkShMelwDgaT24ynaQURXpvGke57UqILPD1GubyDWHFOmg fgZ2Kg+3f+8AVvD+wy05QEVJNh7drhuSJxVOE66f7+XV9dnaerlv5mi2Q9xYUTonX7zL 2DhUEXA9PfUBllweQhVC7JuXb2a8jonF66fNEvcBY7gwzicvQSWbQlSH3nTjm0NT3LUB HcRSEIaWSWeTwLOew3Jl7IECwFBDWMSdpJdqGl4jI0Tdy2ok0DQG89jsmU73ELrOzXWX GKgMiWPCkFOCkcP1KBEbY1sga8g1o/v5YDVT9i2agV3Vrv8MIQjsrt/UnICuo73kcoPp Zswg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=QCBd0YQJw3VJqdNVtAJeX1KhrQgeYnHIILxxsKeti9E=; b=GGpn0HbDFFzO+Yws/JfXBJ+ToVyNknwIvb+jg/pCvT/U/BkJI9kSwBrtjY3qhMY+C0 PUiPcPxxZs0t8aONgUz32O5gX0J8tStA6PSJFjEpdw1+WoXQjvpkEyKzcNS2qAh7xfj2 42Xu0rFUIWPKia4AlsSk/i9SYf4/wY06K0G09bU2T9wAEPm97MyJkTjnmNs98JIwCbnh yawWuum3eA2DUlvKnP/9zFxGk0WW2NzgLY8sp5yyDkJ1wLGkDX+G2MfUxMj61oP0wHIs LxSeCyZML/YBTAby5/U4zxLkHzmlX8y0ZYq/e3VT9jwjxacly8v+zvdSEA1UAt9rFMG3 X3Lw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n1-v6si5075964pgs.594.2018.08.23.11.55.58; Thu, 23 Aug 2018 11:56:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727442AbeHWWZ0 (ORCPT + 99 others); Thu, 23 Aug 2018 18:25:26 -0400 Received: from tartarus.angband.pl ([89.206.35.136]:42810 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbeHWWZ0 (ORCPT ); Thu, 23 Aug 2018 18:25:26 -0400 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.89) (envelope-from ) id 1fsukM-0001yn-1X; Thu, 23 Aug 2018 20:54:18 +0200 Date: Thu, 23 Aug 2018 20:54:17 +0200 From: Adam Borowski To: "Paul E. McKenney" Cc: nicolas.pitre@linaro.org, josh@joshtriplett.org, linux-kernel@vger.kernel.org Subject: Re: Kernel-only deployments? Message-ID: <20180823185417.y3ung3b553f2d24a@angband.pl> References: <20180823174359.GA13033@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180823174359.GA13033@linux.vnet.ibm.com> X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false 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 10:43:59AM -0700, Paul E. McKenney wrote: > The mkinitramfs approach results in about 40MB of initrd, and dracut > about 10MB. Most of this is completely useless for rcutorture, which > isn't interested in mounting filesystems, opening devices, and almost > all of the other interesting things that mkinitramfs and dracut enable. > > Those who know me will not be at all surprised to learn that I went > overboard making the resulting initrd as small as possible. I started > 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. > 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. > This is a great improvement over 10MB, to say nothing of 40MB, but 800KB > for a C-language "for" loop containing nothing more than a single call to > sleep()? .globl _start .data req: .8byte 999999999, 999999999 .text _start: mov $35, %rax # syscall: nanosleep mov $req, %rdi xor %rsi, %rsi syscall jmp _start as sl.s -o sl.o ld sl.o -o init 'Ere you go, no libc needed. If your arch is not amd64, just say so. If you want to do anything more complex, though -- you really want musl or another lightweight libc instead. Glibc is utterly unfit for static linking. Meow! -- ⢀⣴⠾⠻⢶⣦⠀ .globl _start↵.data↵rc: .ascii "/etc/init.d/rcS\0"↵.text↵_start ⣾⠁⢰⠒⠀⣿⡁ mov $57,%rax↵syscall↵cmp $0,%rax↵jne child↵parent:↵mov $61,%rax ⢿⡄⠘⠷⠚⠋⠀ mov $-1,%rdi↵xor %rsi,%rsi↵xor %rdx,%rdx↵syscall↵jmp parent↵child: ⠈⠳⣄⠀⠀⠀⠀ mov $59,%rax↵mov $rc,%rdi↵xor %rsi,%rsi↵xor %rdx,%rdx↵syscall