€•ÕŒsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ6/translations/zh_CN/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/zh_TW/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/it_IT/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/ja_JP/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/ko_KR/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/pt_BR/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ6/translations/sp_SP/filesystems/ramfs-rootfs-initramfs”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒP/var/lib/git/docbuild/linux/Documentation/filesystems/ramfs-rootfs-initramfs.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒRamfs, rootfs and initramfs”h]”hŒRamfs, rootfs and initramfs”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒOctober 17, 2005”h]”hŒOctober 17, 2005”…”�”}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhŒ field_list”“”)�”}”(hhh]”hŒfield”“”)�”}”(hhh]”(hŒ field_name”“”)�”}”(hŒAuthor”h]”hŒAuthor”…”�”}”(hhùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h÷hhôh³hÇh´KubhŒ field_body”“”)�”}”(hŒRob Landley ”h]”hÞ)�”}”(hŒRob Landley ”h]”(hŒ Rob Landley <”…”�”}”(hj h²hh³Nh´NubhŒ reference”“”)�”}”(hŒrob@landley.net”h]”hŒrob@landley.net”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:rob@landley.net”uh1jhj ubhŒ>”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhôubeh}”(h]”h ]”h"]”h$]”h&]”uh1hòh³hÇh´K hhïh²hubah}”(h]”h ]”h"]”h$]”h&]”uh1híhhÊh²hh³hÇh´K ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒWhat is ramfs?”h]”hŒWhat is ramfs?”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjCh²hh³hÇh´K ubhÞ)�”}”(hŒ¡Ramfs is a very simple filesystem that exports Linux's disk caching mechanisms (the page cache and dentry cache) as a dynamically resizable RAM-based filesystem.”h]”hŒ£Ramfs is a very simple filesystem that exports Linux’s disk caching mechanisms (the page cache and dentry cache) as a dynamically resizable RAM-based filesystem.”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjCh²hubhÞ)�”}”(hXNormally all files are cached in memory by Linux. Pages of data read from backing store (usually the block device the filesystem is mounted on) are kept around in case it's needed again, but marked as clean (freeable) in case the Virtual Memory system needs the memory for something else. Similarly, data written to files is marked clean as soon as it has been written to backing store, but kept around for caching purposes until the VM reallocates the memory. A similar mechanism (the dentry cache) greatly speeds up access to directories.”h]”hX!Normally all files are cached in memory by Linux. Pages of data read from backing store (usually the block device the filesystem is mounted on) are kept around in case it’s needed again, but marked as clean (freeable) in case the Virtual Memory system needs the memory for something else. Similarly, data written to files is marked clean as soon as it has been written to backing store, but kept around for caching purposes until the VM reallocates the memory. A similar mechanism (the dentry cache) greatly speeds up access to directories.”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjCh²hubhÞ)�”}”(hXWith ramfs, there is no backing store. Files written into ramfs allocate dentries and page cache as usual, but there's nowhere to write them to. This means the pages are never marked clean, so they can't be freed by the VM when it's looking to recycle memory.”h]”hX With ramfs, there is no backing store. Files written into ramfs allocate dentries and page cache as usual, but there’s nowhere to write them to. This means the pages are never marked clean, so they can’t be freed by the VM when it’s looking to recycle memory.”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjCh²hubhÞ)�”}”(hX<The amount of code required to implement ramfs is tiny, because all the work is done by the existing Linux caching infrastructure. Basically, you're mounting the disk cache as a filesystem. Because of this, ramfs is not an optional component removable via menuconfig, since there would be negligible space savings.”h]”hX>The amount of code required to implement ramfs is tiny, because all the work is done by the existing Linux caching infrastructure. Basically, you’re mounting the disk cache as a filesystem. Because of this, ramfs is not an optional component removable via menuconfig, since there would be negligible space savings.”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hjCh²hubeh}”(h]”Œ what-is-ramfs”ah ]”h"]”Œwhat is ramfs?”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒramfs and ramdisk:”h]”hŒramfs and ramdisk:”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj”h²hh³hÇh´K'ubhÞ)�”}”(hXìThe older "ram disk" mechanism created a synthetic block device out of an area of RAM and used it as backing store for a filesystem. This block device was of fixed size, so the filesystem mounted on it was of fixed size. Using a ram disk also required unnecessarily copying memory from the fake block device into the page cache (and copying changes back out), as well as creating and destroying dentries. Plus it needed a filesystem driver (such as ext2) to format and interpret this data.”h]”hXðThe older “ram diskâ€� mechanism created a synthetic block device out of an area of RAM and used it as backing store for a filesystem. This block device was of fixed size, so the filesystem mounted on it was of fixed size. Using a ram disk also required unnecessarily copying memory from the fake block device into the page cache (and copying changes back out), as well as creating and destroying dentries. Plus it needed a filesystem driver (such as ext2) to format and interpret this data.”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K)hj”h²hubhÞ)�”}”(hXþCompared to ramfs, this wastes memory (and memory bus bandwidth), creates unnecessary work for the CPU, and pollutes the CPU caches. (There are tricks to avoid this copying by playing with the page tables, but they're unpleasantly complicated and turn out to be about as expensive as the copying anyway.) More to the point, all the work ramfs is doing has to happen _anyway_, since all file access goes through the page and dentry caches. The RAM disk is simply unnecessary; ramfs is internally much simpler.”h]”hXCompared to ramfs, this wastes memory (and memory bus bandwidth), creates unnecessary work for the CPU, and pollutes the CPU caches. (There are tricks to avoid this copying by playing with the page tables, but they’re unpleasantly complicated and turn out to be about as expensive as the copying anyway.) More to the point, all the work ramfs is doing has to happen _anyway_, since all file access goes through the page and dentry caches. The RAM disk is simply unnecessary; ramfs is internally much simpler.”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K1hj”h²hubhÞ)�”}”(hŒòAnother reason ramdisks are semi-obsolete is that the introduction of loopback devices offered a more flexible and convenient way to create synthetic block devices, now from files instead of from chunks of memory. See losetup (8) for details.”h]”hŒòAnother reason ramdisks are semi-obsolete is that the introduction of loopback devices offered a more flexible and convenient way to create synthetic block devices, now from files instead of from chunks of memory. See losetup (8) for details.”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K9hj”h²hubeh}”(h]”Œramfs-and-ramdisk”ah ]”h"]”Œramfs and ramdisk:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K'ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒramfs and tmpfs:”h]”hŒramfs and tmpfs:”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj×h²hh³hÇh´K?ubhÞ)�”}”(hXYOne downside of ramfs is you can keep writing data into it until you fill up all memory, and the VM can't free it because the VM thinks that files should get written to backing store (rather than swap space), but ramfs hasn't got any backing store. Because of this, only root (or a trusted user) should be allowed write access to a ramfs mount.”h]”hX]One downside of ramfs is you can keep writing data into it until you fill up all memory, and the VM can’t free it because the VM thinks that files should get written to backing store (rather than swap space), but ramfs hasn’t got any backing store. Because of this, only root (or a trusted user) should be allowed write access to a ramfs mount.”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KAhj×h²hubhÞ)�”}”(hŒêA ramfs derivative called tmpfs was created to add size limits, and the ability to write the data to swap space. Normal users can be allowed write access to tmpfs mounts. See Documentation/filesystems/tmpfs.rst for more information.”h]”hŒêA ramfs derivative called tmpfs was created to add size limits, and the ability to write the data to swap space. Normal users can be allowed write access to tmpfs mounts. See Documentation/filesystems/tmpfs.rst for more information.”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KGhj×h²hubeh}”(h]”Œramfs-and-tmpfs”ah ]”h"]”Œramfs and tmpfs:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K?ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒWhat is rootfs?”h]”hŒWhat is rootfs?”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´KLubhÞ)�”}”(hXZRootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is always present in Linux systems. The kernel uses an immutable empty filesystem called nullfs as the true root of the VFS hierarchy, with the mutable rootfs (tmpfs/ramfs) mounted on top of it. This allows pivot_root() and unmounting of the initramfs to work normally.”h]”hX\Rootfs is a special instance of ramfs (or tmpfs, if that’s enabled), which is always present in Linux systems. The kernel uses an immutable empty filesystem called nullfs as the true root of the VFS hierarchy, with the mutable rootfs (tmpfs/ramfs) mounted on top of it. This allows pivot_root() and unmounting of the initramfs to work normally.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KNhj h²hubhÞ)�”}”(hŒ‡Most systems just mount another filesystem over rootfs and ignore it. The amount of space an empty instance of ramfs takes up is tiny.”h]”hŒ‡Most systems just mount another filesystem over rootfs and ignore it. The amount of space an empty instance of ramfs takes up is tiny.”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KThj h²hubhÞ)�”}”(hŒ’If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by default. To force ramfs, add "rootfstype=ramfs" to the kernel command line.”h]”hŒ–If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by default. To force ramfs, add “rootfstype=ramfsâ€� to the kernel command line.”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KWhj h²hubeh}”(h]”Œwhat-is-rootfs”ah ]”h"]”Œwhat is rootfs?”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KLubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒWhat is initramfs?”h]”hŒWhat is initramfs?”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjOh²hh³hÇh´K\ubhÞ)�”}”(hXlAll 2.6 Linux kernels contain a gzipped "cpio" format archive, which is extracted into rootfs when the kernel boots up. After extracting, the kernel checks to see if rootfs contains a file "init", and if so it executes it as PID 1. If found, this init process is responsible for bringing the system the rest of the way up, including locating and mounting the real root device (if any). If rootfs does not contain an init program after the embedded cpio archive is extracted into it, the kernel will fall through to the older code to locate and mount a root partition, then exec some variant of /sbin/init out of that.”h]”hXtAll 2.6 Linux kernels contain a gzipped “cpioâ€� format archive, which is extracted into rootfs when the kernel boots up. After extracting, the kernel checks to see if rootfs contains a file “initâ€�, and if so it executes it as PID 1. If found, this init process is responsible for bringing the system the rest of the way up, including locating and mounting the real root device (if any). If rootfs does not contain an init program after the embedded cpio archive is extracted into it, the kernel will fall through to the older code to locate and mount a root partition, then exec some variant of /sbin/init out of that.”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K^hjOh²hubhÞ)�”}”(hŒ5All this differs from the old initrd in several ways:”h]”hŒ5All this differs from the old initrd in several ways:”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhjOh²hubhŒ block_quote”“”)�”}”(hXH- The old initrd was always a separate file, while the initramfs archive is linked into the linux kernel image. (The directory ``linux-*/usr`` is devoted to generating this archive during the build.) - The old initrd file was a gzipped filesystem image (in some file format, such as ext2, that needed a driver built into the kernel), while the new initramfs archive is a gzipped cpio archive (like tar only simpler, see cpio(1) and Documentation/driver-api/early-userspace/buffer-format.rst). The kernel's cpio extraction code is not only extremely small, it's also __init text and data that can be discarded during the boot process. - The program run by the old initrd (which was called /initrd, not /init) did some setup and then returned to the kernel, while the init program from initramfs is not expected to return to the kernel. (If /init needs to hand off control it can overmount / with a new root device and exec another init program. See the switch_root utility, below.) - When switching another root device, initrd would pivot_root and then umount the ramdisk. With nullfs as the true root, pivot_root() works normally from the initramfs. Userspace can simply do:: chdir(new_root); pivot_root(".", "."); umount2(".", MNT_DETACH); This is the preferred method for switching root filesystems. ”h]”hŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒÇThe old initrd was always a separate file, while the initramfs archive is linked into the linux kernel image. (The directory ``linux-*/usr`` is devoted to generating this archive during the build.) ”h]”hÞ)�”}”(hŒÆThe old initrd was always a separate file, while the initramfs archive is linked into the linux kernel image. (The directory ``linux-*/usr`` is devoted to generating this archive during the build.)”h]”(hŒ~The old initrd was always a separate file, while the initramfs archive is linked into the linux kernel image. (The directory ”…”�”}”(hj�h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``linux-*/usr``”h]”hŒ linux-*/usr”…”�”}”(hj—h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j•hj�ubhŒ9 is devoted to generating this archive during the build.)”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kjhj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj„ubjˆ)�”}”(hX°The old initrd file was a gzipped filesystem image (in some file format, such as ext2, that needed a driver built into the kernel), while the new initramfs archive is a gzipped cpio archive (like tar only simpler, see cpio(1) and Documentation/driver-api/early-userspace/buffer-format.rst). The kernel's cpio extraction code is not only extremely small, it's also __init text and data that can be discarded during the boot process. ”h]”hÞ)�”}”(hX¯The old initrd file was a gzipped filesystem image (in some file format, such as ext2, that needed a driver built into the kernel), while the new initramfs archive is a gzipped cpio archive (like tar only simpler, see cpio(1) and Documentation/driver-api/early-userspace/buffer-format.rst). The kernel's cpio extraction code is not only extremely small, it's also __init text and data that can be discarded during the boot process.”h]”hX³The old initrd file was a gzipped filesystem image (in some file format, such as ext2, that needed a driver built into the kernel), while the new initramfs archive is a gzipped cpio archive (like tar only simpler, see cpio(1) and Documentation/driver-api/early-userspace/buffer-format.rst). The kernel’s cpio extraction code is not only extremely small, it’s also __init text and data that can be discarded during the boot process.”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Knhjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj„ubjˆ)�”}”(hX[The program run by the old initrd (which was called /initrd, not /init) did some setup and then returned to the kernel, while the init program from initramfs is not expected to return to the kernel. (If /init needs to hand off control it can overmount / with a new root device and exec another init program. See the switch_root utility, below.) ”h]”hÞ)�”}”(hXZThe program run by the old initrd (which was called /initrd, not /init) did some setup and then returned to the kernel, while the init program from initramfs is not expected to return to the kernel. (If /init needs to hand off control it can overmount / with a new root device and exec another init program. See the switch_root utility, below.)”h]”hXZThe program run by the old initrd (which was called /initrd, not /init) did some setup and then returned to the kernel, while the init program from initramfs is not expected to return to the kernel. (If /init needs to hand off control it can overmount / with a new root device and exec another init program. See the switch_root utility, below.)”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KuhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj„ubjˆ)�”}”(hXIWhen switching another root device, initrd would pivot_root and then umount the ramdisk. With nullfs as the true root, pivot_root() works normally from the initramfs. Userspace can simply do:: chdir(new_root); pivot_root(".", "."); umount2(".", MNT_DETACH); This is the preferred method for switching root filesystems. ”h]”(hÞ)�”}”(hŒÂWhen switching another root device, initrd would pivot_root and then umount the ramdisk. With nullfs as the true root, pivot_root() works normally from the initramfs. Userspace can simply do::”h]”hŒÁWhen switching another root device, initrd would pivot_root and then umount the ramdisk. With nullfs as the true root, pivot_root() works normally from the initramfs. Userspace can simply do:”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K{hjåubhŒ literal_block”“”)�”}”(hŒ@chdir(new_root); pivot_root(".", "."); umount2(".", MNT_DETACH);”h]”hŒ@chdir(new_root); pivot_root(".", "."); umount2(".", MNT_DETACH);”…”�”}”hjùsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j÷h³hÇh´KhjåubhÞ)�”}”(hŒ 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”h]”hXn#!/bin/sh # Copyright 2006 Rob Landley 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”…”�”}”hjÎsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j÷h³hÇh´K¼hj1h²hubhŒnote”“”)�”}”(hXWThe 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.”h]”hÞ)�”}”(hXWThe 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.”h]”hXcThe 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.”…”�”}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÒhjÞubah}”(h]”h ]”h"]”h$]”h&]”uh1jÜhj1h²hh³hÇh´Nubeh}”(h]”Œpopulating-initramfs”ah ]”h"]”Œpopulating initramfs:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K†ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒExternal initramfs images:”h]”hŒExternal initramfs images:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjþh²hh³hÇh´KÝubhÞ)�”}”(hXIf 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.”h]”hXIf 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.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kßhjþh²hubhÞ)�”}”(hXThis 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).”h]”hXThis 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).”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kähjþh²hubhÞ)�”}”(hX/It can also be used to supplement the kernel's built-in initramfs 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.”h]”hX1It can also be used to supplement the kernel’s built-in initramfs 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.”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kéhjþh²hubeh}”(h]”Œexternal-initramfs-images”ah ]”h"]”Œexternal initramfs images:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KÝubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒContents of initramfs:”h]”hŒContents of initramfs:”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjAh²hh³hÇh´KïubhÞ)�”}”(hŒêAn initramfs archive is a complete self-contained root filesystem for Linux. If you don't already understand what shared libraries, devices, and paths you need to get a minimal root filesystem up and running, here are some references:”h]”hŒìAn initramfs archive is a complete self-contained root filesystem for Linux. If you don’t already understand what shared libraries, devices, and paths you need to get a minimal root filesystem up and running, here are some references:”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KñhjAh²hubjƒ)�”}”(hhh]”(jˆ)�”}”(hŒ*https://www.tldp.org/HOWTO/Bootdisk-HOWTO/”h]”hÞ)�”}”(hjeh]”j)�”}”(hjeh]”hŒ*https://www.tldp.org/HOWTO/Bootdisk-HOWTO/”…”�”}”(hjjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jeuh1jhjgubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Köhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj`h²hh³hÇh´Nubjˆ)�”}”(hŒAhttps://www.tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html”h]”hÞ)�”}”(hj†h]”j)�”}”(hj†h]”hŒAhttps://www.tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j†uh1jhjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K÷hj„ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj`h²hh³hÇh´Nubjˆ)�”}”(hŒ1http://www.linuxfromscratch.org/lfs/view/stable/ ”h]”hÞ)�”}”(hŒ0http://www.linuxfromscratch.org/lfs/view/stable/”h]”j)�”}”(hj«h]”hŒ0http://www.linuxfromscratch.org/lfs/view/stable/”…”�”}”(hj­h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j«uh1jhj©ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Køhj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj`h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j!j"uh1j‚h³hÇh´KöhjAh²hubhÞ)�”}”(hŒÍThe "klibc" package (https://www.kernel.org/pub/linux/libs/klibc) is designed to be a tiny C library to statically link early userspace code against, along with some related utilities. It is BSD licensed.”h]”(hŒThe “klibcâ€� package (”…”�”}”(hjÍh²hh³Nh´Nubj)�”}”(hŒ+https://www.kernel.org/pub/linux/libs/klibc”h]”hŒ+https://www.kernel.org/pub/linux/libs/klibc”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j×uh1jhjÍubhŒ�) is designed to be a tiny C library to statically link early userspace code against, along with some related utilities. It is BSD licensed.”…”�”}”(hjÍh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KúhjAh²hubhÞ)�”}”(hŒÈI use uClibc (https://www.uclibc.org) and busybox (https://www.busybox.net) myself. These are LGPL and GPL, respectively. (A self-contained initramfs package is planned for the busybox 1.3 release.)”h]”(hŒI use uClibc (”…”�”}”(hjîh²hh³Nh´Nubj)�”}”(hŒhttps://www.uclibc.org”h]”hŒhttps://www.uclibc.org”…”�”}”(hjöh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jøuh1jhjîubhŒ) and busybox (”…”�”}”(hjîh²hh³Nh´Nubj)�”}”(hŒhttps://www.busybox.net”h]”hŒhttps://www.busybox.net”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j uh1jhjîubhŒ~) myself. These are LGPL and GPL, respectively. (A self-contained initramfs package is planned for the busybox 1.3 release.)”…”�”}”(hjîh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KþhjAh²hubhÞ)�”}”(hXIn theory you could use glibc, but that's not well suited for small embedded uses like this. (A "hello world" program statically linked against glibc is over 400k. With uClibc it's 7k. Also note that glibc dlopens libnss to do name lookups, even when otherwise statically linked.)”h]”hX#In theory you could use glibc, but that’s not well suited for small embedded uses like this. (A “hello worldâ€� program statically linked against glibc is over 400k. With uClibc it’s 7k. Also note that glibc dlopens libnss to do name lookups, even when otherwise statically linked.)”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjAh²hubhÞ)�”}”(hŒ´A good first step is to get initramfs to run a statically linked "hello world" program as init, and test it under an emulator like qemu (www.qemu.org) or User Mode Linux, like so::”h]”hŒ·A good first step is to get initramfs to run a statically linked “hello worldâ€� program as init, and test it under an emulator like qemu (www.qemu.org) or User Mode Linux, like so:”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjAh²hubjø)�”}”(hX^cat > hello.c << EOF #include #include int main(int argc, char *argv[]) { printf("Hello world!\n"); sleep(999999999); } EOF gcc -static hello.c -o init echo init | cpio -o -H newc | gzip > test.cpio.gz # Testing external initramfs using the initrd loading mechanism. qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero”h]”hX^cat > hello.c << EOF #include #include int main(int argc, char *argv[]) { printf("Hello world!\n"); sleep(999999999); } EOF gcc -static hello.c -o init echo init | cpio -o -H newc | gzip > test.cpio.gz # Testing external initramfs using the initrd loading mechanism. qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero”…”�”}”hj>sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1j÷h³hÇh´M hjAh²hubhÞ)�”}”(hŒ¢When debugging a normal root filesystem, it's nice to be able to boot with "init=/bin/sh". The initramfs equivalent is "rdinit=/bin/sh", and it's just as useful.”h]”hŒ®When debugging a normal root filesystem, it’s nice to be able to boot with “init=/bin/shâ€�. The initramfs equivalent is “rdinit=/bin/shâ€�, and it’s just as useful.”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MhjAh²hubeh}”(h]”Œcontents-of-initramfs”ah ]”h"]”Œcontents of initramfs:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KïubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒWhy cpio rather than tar?”h]”hŒWhy cpio rather than tar?”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjbh²hh³hÇh´MubhÞ)�”}”(hŒLThis decision was made back in December, 2001. The discussion started here:”h]”hŒLThis decision was made back in December, 2001. The discussion started here:”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M!hjbh²hubjƒ)�”}”(hhh]”jˆ)�”}”(hŒ@https://lore.kernel.org/lkml/a03cke$640$1@cesium.transmeta.com/ ”h]”hÞ)�”}”(hŒ?https://lore.kernel.org/lkml/a03cke$640$1@cesium.transmeta.com/”h]”j)�”}”(hjŠh]”hŒ?https://lore.kernel.org/lkml/a03cke$640$1@cesium.transmeta.com/”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jŠuh1jhjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M#hj„ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hj�h²hh³hÇh´Nubah}”(h]”h ]”h"]”h$]”h&]”j!j"uh1j‚h³hÇh´M#hjbh²hubhÞ)�”}”(hŒIAnd spawned a second thread (specifically on tar vs cpio), starting here:”h]”hŒIAnd spawned a second thread (specifically on tar vs cpio), starting here:”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M%hjbh²hubjƒ)�”}”(hhh]”jˆ)�”}”(hŒ9https://lore.kernel.org/lkml/3C25A06D.7030408@zytor.com/ ”h]”hÞ)�”}”(hŒ8https://lore.kernel.org/lkml/3C25A06D.7030408@zytor.com/”h]”j)�”}”(hjÃh]”hŒ8https://lore.kernel.org/lkml/3C25A06D.7030408@zytor.com/”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÃuh1jhjÁubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M'hj½ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjºh²hh³hÇh´Nubah}”(h]”h ]”h"]”h$]”h&]”j!j"uh1j‚h³hÇh´M'hjbh²hubhÞ)�”}”(hŒ^The quick and dirty summary version (which is no substitute for reading the above threads) is:”h]”hŒ^The quick and dirty summary version (which is no substitute for reading the above threads) is:”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M)hjbh²hubhŒenumerated_list”“”)�”}”(hhh]”(jˆ)�”}”(hXòcpio is a standard. It's decades old (from the AT&T days), and already widely used on Linux (inside RPM, Red Hat's device driver disks). Here's a Linux Journal article about it from 1996: http://www.linuxjournal.com/article/1213 It's not as popular as tar because the traditional cpio command line tools require _truly_hideous_ command line arguments. But that says nothing either way about the archive format, and there are alternative tools, such as: https://linux.die.net/man/1/afio ”h]”(hÞ)�”}”(hŒ½cpio is a standard. It's decades old (from the AT&T days), and already widely used on Linux (inside RPM, Red Hat's device driver disks). Here's a Linux Journal article about it from 1996:”h]”hŒÃcpio is a standard. It’s decades old (from the AT&T days), and already widely used on Linux (inside RPM, Red Hat’s device driver disks). Here’s a Linux Journal article about it from 1996:”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M,hjøubj})�”}”(hŒ)http://www.linuxjournal.com/article/1213 ”h]”hÞ)�”}”(hŒ(http://www.linuxjournal.com/article/1213”h]”j)�”}”(hjh]”hŒ(http://www.linuxjournal.com/article/1213”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M0hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j|h³hÇh´M0hjøubhÞ)�”}”(hŒàIt's not as popular as tar because the traditional cpio command line tools require _truly_hideous_ command line arguments. But that says nothing either way about the archive format, and there are alternative tools, such as:”h]”hŒâIt’s not as popular as tar because the traditional cpio command line tools require _truly_hideous_ command line arguments. But that says nothing either way about the archive format, and there are alternative tools, such as:”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M2hjøubj})�”}”(hŒ!https://linux.die.net/man/1/afio ”h]”hÞ)�”}”(hŒ https://linux.die.net/man/1/afio”h]”j)�”}”(hj@h]”hŒ https://linux.die.net/man/1/afio”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j@uh1jhj>ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M7hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1j|h³hÇh´M7hjøubeh}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjõh²hh³hÇh´Nubjˆ)�”}”(hX‚The cpio archive format chosen by the kernel is simpler and cleaner (and thus easier to create and parse) than any of the (literally dozens of) various tar archive formats. The complete initramfs archive format is explained in buffer-format.rst, created in usr/gen_init_cpio.c, and extracted in init/initramfs.c. All three together come to less than 26k total of human-readable text. ”h]”hÞ)�”}”(hX�The cpio archive format chosen by the kernel is simpler and cleaner (and thus easier to create and parse) than any of the (literally dozens of) various tar archive formats. The complete initramfs archive format is explained in buffer-format.rst, created in usr/gen_init_cpio.c, and extracted in init/initramfs.c. All three together come to less than 26k total of human-readable text.”h]”hX�The cpio archive format chosen by the kernel is simpler and cleaner (and thus easier to create and parse) than any of the (literally dozens of) various tar archive formats. The complete initramfs archive format is explained in buffer-format.rst, created in usr/gen_init_cpio.c, and extracted in init/initramfs.c. All three together come to less than 26k total of human-readable text.”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M9hjbubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjõh²hh³hÇh´Nubjˆ)�”}”(hŒ²The GNU project standardizing on tar is approximately as relevant as Windows standardizing on zip. Linux is not part of either, and is free to make its own technical decisions. ”h]”hÞ)�”}”(hŒ±The GNU project standardizing on tar is approximately as relevant as Windows standardizing on zip. Linux is not part of either, and is free to make its own technical decisions.”h]”hŒ±The GNU project standardizing on tar is approximately as relevant as Windows standardizing on zip. Linux is not part of either, and is free to make its own technical decisions.”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M@hjzubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjõh²hh³hÇh´Nubjˆ)�”}”(hŒãSince this is a kernel internal format, it could easily have been something brand new. The kernel provides its own tools to create and extract this format anyway. Using an existing standard was preferable, but not essential. ”h]”hÞ)�”}”(hŒâSince this is a kernel internal format, it could easily have been something brand new. The kernel provides its own tools to create and extract this format anyway. Using an existing standard was preferable, but not essential.”h]”hŒâSince this is a kernel internal format, it could easily have been something brand new. The kernel provides its own tools to create and extract this format anyway. Using an existing standard was preferable, but not essential.”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MDhj’ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjõh²hh³hÇh´Nubjˆ)�”}”(hXàAl Viro made the decision (quote: "tar is ugly as hell and not going to be supported on the kernel side"): - https://lore.kernel.org/lkml/Pine.GSO.4.21.0112222109050.21702-100000@weyl.math.psu.edu/ explained his reasoning: - https://lore.kernel.org/lkml/Pine.GSO.4.21.0112222240530.21702-100000@weyl.math.psu.edu/ - https://lore.kernel.org/lkml/Pine.GSO.4.21.0112230849550.23300-100000@weyl.math.psu.edu/ and, most importantly, designed and implemented the initramfs code. ”h]”(hÞ)�”}”(hŒjAl Viro made the decision (quote: "tar is ugly as hell and not going to be supported on the kernel side"):”h]”hŒnAl Viro made the decision (quote: “tar is ugly as hell and not going to be supported on the kernel sideâ€�):”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MIhjªubj})�”}”(hŒ[- https://lore.kernel.org/lkml/Pine.GSO.4.21.0112222109050.21702-100000@weyl.math.psu.edu/ ”h]”jƒ)�”}”(hhh]”jˆ)�”}”(hŒYhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112222109050.21702-100000@weyl.math.psu.edu/ ”h]”hÞ)�”}”(hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112222109050.21702-100000@weyl.math.psu.edu/”h]”j)�”}”(hjÉh]”hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112222109050.21702-100000@weyl.math.psu.edu/”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”jÉuh1jhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MLhjÃubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjÀubah}”(h]”h ]”h"]”h$]”h&]”j!j"uh1j‚h³hÇh´MLhj¼ubah}”(h]”h ]”h"]”h$]”h&]”uh1j|h³hÇh´MLhjªubhÞ)�”}”(hŒexplained his reasoning:”h]”hŒexplained his reasoning:”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MNhjªubj})�”}”(hŒ¶- https://lore.kernel.org/lkml/Pine.GSO.4.21.0112222240530.21702-100000@weyl.math.psu.edu/ - https://lore.kernel.org/lkml/Pine.GSO.4.21.0112230849550.23300-100000@weyl.math.psu.edu/ ”h]”jƒ)�”}”(hhh]”(jˆ)�”}”(hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112222240530.21702-100000@weyl.math.psu.edu/”h]”hÞ)�”}”(hjh]”j)�”}”(hjh]”hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112222240530.21702-100000@weyl.math.psu.edu/”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1jhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MPhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjubjˆ)�”}”(hŒYhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112230849550.23300-100000@weyl.math.psu.edu/ ”h]”hÞ)�”}”(hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112230849550.23300-100000@weyl.math.psu.edu/”h]”j)�”}”(hj-h]”hŒXhttps://lore.kernel.org/lkml/Pine.GSO.4.21.0112230849550.23300-100000@weyl.math.psu.edu/”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j-uh1jhj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MQhj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjubeh}”(h]”h ]”h"]”h$]”h&]”j!j"uh1j‚h³hÇh´MPhjÿubah}”(h]”h ]”h"]”h$]”h&]”uh1j|h³hÇh´MPhjªubhÞ)�”}”(hŒCand, most importantly, designed and implemented the initramfs code.”h]”hŒCand, most importantly, designed and implemented the initramfs code.”…”�”}”(hjUh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MShjªubeh}”(h]”h ]”h"]”h$]”h&]”uh1j‡hjõh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ)”uh1jóhjbh²hh³hÇh´M,ubeh}”(h]”Œwhy-cpio-rather-than-tar”ah ]”h"]”Œwhy cpio rather than tar?”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒFuture directions:”h]”hŒFuture directions:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj|h²hh³hÇh´MVubhÞ)�”}”(hXVToday (2.6.16), initramfs is always compiled in, but not always used. The kernel falls back to legacy boot code that is reached only if initramfs does not contain an /init program. The fallback is legacy code, there to ensure a smooth transition and allowing early boot functionality to gradually move to "early userspace" (I.E. initramfs).”h]”hXZToday (2.6.16), initramfs is always compiled in, but not always used. The kernel falls back to legacy boot code that is reached only if initramfs does not contain an /init program. The fallback is legacy code, there to ensure a smooth transition and allowing early boot functionality to gradually move to “early userspaceâ€� (I.E. initramfs).”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´MXhj|h²hubhÞ)�”}”(hX#The move to early userspace is necessary because finding and mounting the real root device is complex. Root partitions can span multiple devices (raid or separate journal). They can be out on the network (requiring dhcp, setting a specific MAC address, logging into a server, etc). They can live on removable media, with dynamically allocated major/minor numbers and persistent naming issues requiring a full udev implementation to sort out. They can be compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned, and so on.”h]”hX#The move to early userspace is necessary because finding and mounting the real root device is complex. Root partitions can span multiple devices (raid or separate journal). They can be out on the network (requiring dhcp, setting a specific MAC address, logging into a server, etc). They can live on removable media, with dynamically allocated major/minor numbers and persistent naming issues requiring a full udev implementation to sort out. They can be compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned, and so on.”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´M^hj|h²hubhÞ)�”}”(hŒÀThis kind of complexity (which inevitably includes policy) is rightly handled in userspace. Both klibc and busybox/uClibc are working on simple initramfs packages to drop into a kernel build.”h]”hŒÀThis kind of complexity (which inevitably includes policy) is rightly handled in userspace. Both klibc and busybox/uClibc are working on simple initramfs packages to drop into a kernel build.”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mghj|h²hubhÞ)�”}”(hŒôThe klibc package has now been accepted into Andrew Morton's 2.6.17-mm tree. The kernel's current early boot code (partition detection, etc) will probably be migrated into a default initramfs, automatically created and used by the kernel build.”h]”hŒøThe klibc package has now been accepted into Andrew Morton’s 2.6.17-mm tree. The kernel’s current early boot code (partition detection, etc) will probably be migrated into a default initramfs, automatically created and used by the kernel build.”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Mkhj|h²hubeh}”(h]”Œfuture-directions”ah ]”h"]”Œfuture directions:”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´MVubeh}”(h]”Œramfs-rootfs-and-initramfs”ah ]”h"]”Œramfs, rootfs and initramfs”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jøŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jÒjÏj‘jŽjÔjÑj jjLjIj.j+jûjøj>j;j_j\jyjvjÊjÇuŒ nametypes”}”(jÒ‰j‘‰jÔ‰j ‰jL‰j.‰jû‰j>‰j_‰jy‰jʉuh}”(jÏhÊjŽjCjÑj”jj×jIj j+jOjøj1j;jþj\jAjvjbjÇj|uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.