public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Adam Borowski <kilobyte@angband.pl>,
	nicolas.pitre@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: Kernel-only deployments?
Date: Thu, 23 Aug 2018 13:39:38 -0700	[thread overview]
Message-ID: <20180823203938.GW4225@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180823191604.GB3243@localhost>

On Thu, Aug 23, 2018 at 12:16:04PM -0700, Josh Triplett wrote:
> On Thu, Aug 23, 2018 at 08:54:17PM +0200, Adam Borowski wrote:
> > 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.
> 
> "pause" ($34) would also suffice, and would not require an argument or a
> .data section.

Cute!  ;-)

							Thanx, Paul


  reply	other threads:[~2018-08-23 20:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-23 17:43 Kernel-only deployments? Paul E. McKenney
2018-08-23 18:16 ` Geert Uytterhoeven
2018-08-23 18:43   ` Paul E. McKenney
2018-08-23 18:42 ` Nicolas Pitre
2018-08-23 20:37   ` Paul E. McKenney
2018-08-23 18:54 ` Adam Borowski
2018-08-23 19:06   ` Willy Tarreau
2023-02-15  2:35     ` Zhangjin Wu
2023-02-15  9:47       ` Willy Tarreau
2023-02-16 13:09         ` Zhangjin Wu
2018-08-23 19:16   ` Josh Triplett
2018-08-23 20:39     ` Paul E. McKenney [this message]
2018-08-23 20:39   ` Paul E. McKenney
2018-08-23 19:12 ` Josh Triplett
2018-08-23 20:45   ` Paul E. McKenney
2018-08-23 19:22 ` Ray Clinton
2018-08-23 20:49   ` Paul E. McKenney
2018-08-23 19:52 ` Bernd Petrovitsch
2018-08-23 20:54   ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180823203938.GW4225@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=josh@joshtriplett.org \
    --cc=kilobyte@angband.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pitre@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox