From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 65ABF1381FB for ; Wed, 26 Dec 2012 22:11:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B976A21C090; Wed, 26 Dec 2012 22:11:03 +0000 (UTC) Received: from mail-qc0-f177.google.com (mail-qc0-f177.google.com [209.85.216.177]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C1B4C21C018 for ; Wed, 26 Dec 2012 22:09:35 +0000 (UTC) Received: by mail-qc0-f177.google.com with SMTP id u28so4609543qcs.22 for ; Wed, 26 Dec 2012 14:09:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=XTRpVVgO3qleOx63DDswXXPXkE1kB4FWabtMiXMAR5w=; b=dc4R6kPViUHEZw4sEYu2UPj/0WLcMBa37zq66qI9SGDPDP7uxKl4h3ZIPpaedF+4si 2QWnYlH6uvJRLVt668IEkrHIpt692/KXvOrr9/zaQrCqSRBkyB4Ce4Anm/rhJhhRlD0b gJbPmFEoGwyAls3m0rOo3+ZmB6dQr7NTQT1Fua0dOoFT3QATHJQpxgopsGCav7uT8QZq 3K/KDh/W86JeE0Dp/gceJfi+MyW0yCwXti4Z0M5TSWCL9aYVM4xnXwhw/GEc31yJnbkL ud5Xu88ZWaesch2ilmpXudT/ZzD+Kd7PF53iHYKAs14qZWUlKbeCG5vdx2ANvlpZtx3j DJHA== Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.224.60.12 with SMTP id n12mr13637429qah.23.1356559774913; Wed, 26 Dec 2012 14:09:34 -0800 (PST) Received: by 10.229.186.132 with HTTP; Wed, 26 Dec 2012 14:09:34 -0800 (PST) In-Reply-To: References: <20121226170926.6a67f4a9@digimed.co.uk> Date: Wed, 26 Dec 2012 14:09:34 -0800 Message-ID: Subject: Re: [gentoo-user] Building an initramfs into the kernel From: Mark Knecht To: Gentoo User Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: 11fbb6c2-de52-4d58-9b68-9b55d0595990 X-Archives-Hash: 030e488f6386ed699927d9648c29147a On Wed, Dec 26, 2012 at 1:49 PM, Mark Knecht wrote: > Actually, I think the initramfs wiki covers this, albeit it's 'not > easy'. Their words. > > I think I'm covered for now. > > Cheers, > Mark While extracting it from the kernel image may be involved, and for now using Neil's example init script which probably isn't exactly right for my needs, there is an intermediate step I quickly discovered. After building the new kernel there is an initramfs_data_cpio file created in /usr/src/linux/usr. I copied this file to a new directory under /root and then ran cpio -i -d -H newc --no-absolute-filenames < initramfs_data.cpio which creates all of the initramfs file structure in this directory. I can then list it and it appears everything is there: c2stable initramfs-work # ls -lR .: total 2620 drwxr-xr-x 2 root root 4096 Dec 26 14:00 bin drwxr-xr-x 2 root root 4096 Dec 26 14:00 dev drwxr-xr-x 2 root root 4096 Dec 26 14:00 etc -rwxr-xr-x 1 root root 2017 Dec 26 14:00 init -rw-r--r-- 1 root root 2640384 Dec 26 13:59 initramfs_data.cpio drwxr-xr-x 2 root root 4096 Dec 26 14:00 lib drwxr-xr-x 2 root root 4096 Dec 26 14:00 proc drwxr-xr-x 2 root root 4096 Dec 26 14:00 realroot drwxr-xr-x 2 root root 4096 Dec 26 14:00 sbin drwxr-xr-x 2 root root 4096 Dec 26 14:00 sys ./bin: total 2020 -rwxr-xr-x 1 root root 2061600 Dec 26 14:00 busybox lrwxrwxrwx 1 root root 7 Dec 26 14:00 sh -> busybox ./dev: total 0 crw------- 1 root root 5, 1 Dec 26 14:00 console crw-rw-rw- 1 root root 1, 3 Dec 26 14:00 null crw-rw-rw- 1 root root 5, 0 Dec 26 14:00 tty crw-rw-rw- 1 root root 1, 9 Dec 26 14:00 urandom ./etc: total 4 -rwxr-xr-x 1 root root 3017 Dec 26 14:00 mdadm.conf ./lib: total 4 -rwxr-xr-x 1 root root 528 Dec 26 14:00 libext2fs.so ./proc: total 0 ./realroot: total 0 ./sbin: total 568 -rwxr-xr-x 1 root root 216744 Dec 26 14:00 e2fsck -rwxr-xr-x 1 root root 353928 Dec 26 14:00 mdadm ./sys: total 0 c2stable initramfs-work # c2stable initramfs-work # cat init #!/bin/busybox sh rescue_shell() { busybox --install -s echo $1 exec /bin/sh } ### Mount the /proc and /sys filesystems. mount -t proc none /proc grep -q initdebug