用户工具

站点工具


jaysnote:ramfs_rootfs_initramfs

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版 两侧同时换到之后的修订记录
jaysnote:ramfs_rootfs_initramfs [2018/11/16 22:46]
jaylee
jaysnote:ramfs_rootfs_initramfs [2018/11/19 13:51]
jaylee
行 49: 行 49:
   - 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 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/early-userspace/buffer-format.txt).  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 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/early-userspace/buffer-format.txt).  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.)   - 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.)
行 115: 行 117:
 ``` ```
  
-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.+>  **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: External initramfs images:
行 125: 行 127:
  
 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. 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.
- 
-## 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 initramfs image.  The files in the external archive will overwrite any conflicting files in the built-in initramfs archive.  
  
 ## Contents of initramfs: ## Contents of initramfs:
jaysnote/ramfs_rootfs_initramfs.txt · 最后更改: 2021/06/22 23:14 (外部编辑)