-The following shell script can create a prebuilt cpio archive you can
-use in place of the above config file:
-
- #!/bin/sh
-
- # Copyright 2006 Rob Landley <rob@landley.net> and TimeSys Corporation.
- # Licensed under GPL version 2
-
- if [ $# -ne 2 ]
- then
- echo "usage: mkinitramfs directory imagename.cpio.gz"
- exit 1
- fi
-
- if [ -d "$1" ]
- then
- echo "creating $2 from $1"
- (cd "$1"; find . | cpio -o -H newc | gzip) > "$2"
- else
- echo "First argument must be a directory"
- exit 1
- fi
-
-Note: The cpio man page contains some bad advice that will break your initramfs
-archive if you follow it. It says "A typical way to generate the list
-of filenames is with the find command; you should give find the -depth option
-to minimize problems with permissions on directories that are unwritable or not
-searchable." Don't do this when creating initramfs.cpio.gz images, it won't
-work. The Linux kernel cpio extractor won't create files in a directory that
-doesn't exist, so the directory entries must go before the files that go in
-those directories. The above script gets them in the right order.
-
-External initramfs images:
---------------------------
-
-If the kernel has initrd support enabled, an external cpio.gz archive can also
-be passed into a 2.6 kernel in place of an initrd. In this case, the kernel
-will autodetect the type (initramfs, not initrd) and extract the external cpio
-archive into rootfs before trying to run /init.
-
-This has the memory efficiency advantages of initramfs (no ramdisk block
-device) but the separate packaging of initrd (which is nice if you have
-non-GPL code you'd like to run from initramfs, without conflating it with
-the GPL licensed Linux kernel binary).
-
-It can also be used to supplement the kernel's built-in initamfs image. The
-files in the external archive will overwrite any conflicting files in
-the built-in initramfs archive. Some distributors also prefer to customize
-a single kernel image with task-specific initramfs images, without recompiling.
-