• Home
  • Raw
  • Download

Lines Matching +full:keep +full:- +full:a +full:- +full:live

1 .. SPDX-License-Identifier: GPL-2.0
12 --------------
14 Ramfs is a very simple filesystem that exports Linux's disk caching
15 mechanisms (the page cache and dentry cache) as a dynamically resizable
16 RAM-based filesystem.
24 memory. A similar mechanism (the dentry cache) greatly speeds up access to
34 you're mounting the disk cache as a filesystem. Because of this, ramfs is not
39 ------------------
41 The older "ram disk" mechanism created a synthetic block device out of
42 an area of RAM and used it as backing store for a filesystem. This block
44 size. Using a ram disk also required unnecessarily copying memory from the
46 as creating and destroying dentries. Plus it needed a filesystem driver
57 Another reason ramdisks are semi-obsolete is that the introduction of
58 loopback devices offered a more flexible and convenient way to create
63 ----------------
65 One downside of ramfs is you can keep writing data into it until you fill
68 got any backing store. Because of this, only root (or a trusted user) should
69 be allowed write access to a ramfs mount.
71 A ramfs derivative called tmpfs was created to add size limits, and the ability
76 ---------------
78 Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is
92 ------------------
94 All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is
96 checks to see if rootfs contains a file "init", and if so it executes it as PID
101 to locate and mount a root partition, then exec some variant of /sbin/init
106 - The old initrd was always a separate file, while the initramfs archive is
107 linked into the linux kernel image. (The directory ``linux-*/usr`` is
110 - The old initrd file was a gzipped filesystem image (in some file format,
111 such as ext2, that needed a driver built into the kernel), while the new
112 initramfs archive is a gzipped cpio archive (like tar only simpler,
113 see cpio(1) and Documentation/driver-api/early-userspace/buffer-format.rst).
117 - The program run by the old initrd (which was called /initrd, not /init) did
120 off control it can overmount / with a new root device and exec another init
123 - When switching another root device, initrd would pivot_root and then
126 free up the space (find -xdev / -exec rm '{}' ';'), overmount rootfs
127 with the new root (cd /newmount; mount --move . /; chroot .), attach
130 Since this is a remarkably persnickety process (and involves deleting
131 commands before you can run them), the klibc package introduced a helper
136 ---------------------
138 The 2.6 kernel build process always creates a gzipped cpio format initramfs
143 and living in usr/Kconfig) can be used to specify a source for the
146 archive, a directory containing files to be archived, or a text file
160 Run "usr/gen_init_cpio" (after the kernel build) to get a usage message
166 a directory called "initramfs", under the linux-2.6.* directory. See
167 Documentation/driver-api/early-userspace/early_userspace_support.rst for more details.)
169 The kernel does not depend on external cpio tools. If you specify a
170 directory instead of a configuration file, the kernel's build infrastructure
171 creates a configuration file from that directory (usr/Makefile calls
174 from usr/gen_init_cpio.c). The kernel's build-time cpio creation code is
175 entirely self-contained, and the kernel's boot-time extractor is also
176 (obviously) self-contained.
180 (instead of a config file or directory).
182 The following command line can extract a cpio image (either by the above script
185 cpio -i -d -H newc -F initramfs_data.cpio --no-absolute-filenames
187 The following shell script can create a prebuilt cpio archive you can
195 if [ $# -ne 2 ]
201 if [ -d "$1" ]
204 (cd "$1"; find . | cpio -o -H newc | gzip) > "$2"
206 echo "First argument must be a directory"
213 archive if you follow it. It says "A typical way to generate the list
214 of filenames is with the find command; you should give find the -depth
218 won't create files in a directory that doesn't exist, so the directory
223 --------------------------
226 be passed into a 2.6 kernel in place of an initrd. In this case, the kernel
232 non-GPL code you'd like to run from initramfs, without conflating it with
235 It can also be used to supplement the kernel's built-in initramfs image. The
237 the built-in initramfs archive. Some distributors also prefer to customize
238 a single kernel image with task-specific initramfs images, without recompiling.
241 ----------------------
243 An initramfs archive is a complete self-contained root filesystem for Linux.
245 you need to get a minimal root filesystem up and running, here are some
248 - https://www.tldp.org/HOWTO/Bootdisk-HOWTO/
249 - https://www.tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html
250 - http://www.linuxfromscratch.org/lfs/view/stable/
253 designed to be a tiny C library to statically link early userspace
257 myself. These are LGPL and GPL, respectively. (A self-contained initramfs
261 uses like this. (A "hello world" program statically linked against glibc is
265 A good first step is to get initramfs to run a statically linked "hello world"
279 gcc -static hello.c -o init
280 echo init | cpio -o -H newc | gzip > test.cpio.gz
282 qemu -kernel /boot/vmlinuz -initrd test.cpio.gz /dev/zero
284 When debugging a normal root filesystem, it's nice to be able to boot with
289 -------------------------
295 And spawned a second thread (specifically on tar vs cpio), starting here:
302 1) cpio is a standard. It's decades old (from the AT&T days), and already
304 a Linux Journal article about it from 1996:
318 explained in buffer-format.txt, created in usr/gen_init_cpio.c, and
320 total of human-readable text.
326 4) Since this is a kernel internal format, it could easily have been
338 - http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1550.html
339 - http://www.uwsg.iu.edu/hypermail/linux/kernel/0112.2/1638.html
344 ------------------
348 not contain an /init program. The fallback is legacy code, there to ensure a
354 separate journal). They can be out on the network (requiring dhcp, setting a
355 specific MAC address, logging into a server, etc). They can live on removable
357 issues requiring a full udev implementation to sort out. They can be
358 compressed, encrypted, copy-on-write, loopback mounted, strangely partitioned,
363 packages to drop into a kernel build.
365 The klibc package has now been accepted into Andrew Morton's 2.6.17-mm tree.
367 be migrated into a default initramfs, automatically created and used by the