°Ô½Ã¹° 1,369°Ç
   
mkinitrd (make init ramdisk) »ç¿ë
±Û¾´ÀÌ : ÃÖ°í°ü¸®ÀÚ ³¯Â¥ : 2011-03-16 (¼ö) 16:12 Á¶È¸ : 15395
±ÛÁÖ¼Ò :
                                
1. mkinitrd
 - make init ramdis ¾àÀÚ·Î ÃʱâÈ­ ·¥µð½ºÅ© À̹ÌÁö¸¦ ¸¸µé¾îÁÖ´Â ¸í·É¾î·Î ºÎÆýà ºí·Ïµð¹ÙÀ̽º ¸ðµâÀ» À̹ÌÁö·Î ¸¸µé¶§ »ç¿ëÇÏ´Â ¸í··¾îÀÌ´Ù.
 
MKINITRD(8)                                                        MKINITRD(8)
 
 
NAME
       mkinitrd - creates initial ramdisk images for preloading modules
 
 
SYNOPSIS
       mkinitrd [--version] [-v] [-f]
                [--preload=module] [--omit-scsi-modules]
                [--omit-raid-modules] [--omit-lvm-modules]
                [--with=module] [--image-version]
                [--fstab=fstab] [--nocompress]
                [--builtin=module] [--nopivot]
                [--with-fips]
                image kernel-version
 
 
DEscRIPTION
mkinitrd  creates  an  initial  image  used  by  the kernel for preloading the block device modules (such as IDE, SCSI or RAID) which are needed to access the root filesystem. mkinitrd automatically loads filesystem modules (such as ext3 and jbd), IDE modules, all scsi_hostadapter entries in /etc/modprobe.conf, and raid  modules if the system¡¯s root partition is on raid, which makes it simple to build and use kernels using modular device drivers.
Any module options specified in /etc/modprobe.conf are passed to the modules as they are loaded by the initial ramdisk.
The  root  filesystem  used  by  the  kernel  is  specified in the boot configuration file, as always. The traditional root=/dev/hda1 style device specification is allowed. If a label is used, as in root=LABEL=rootPart the initrd will search all available devices for an ext2 or ext3 filesystem with the appropriate label,  and mount that device as the root filesystem.
 
 
FIPS
mkinitrd will add a number of checks to the created initrd if the system is running in fips mode. First the kernel gets integrity checked by running "sha512hmac -c 
/boot/.vmlinuz-kernel-version.hmac" from the initrd. Then all the crypto algorithm modules get loaded using the embedded signature to  integrity  check  them,  and last the tcrypt module gets loaded which runs self tests on all approved crypto algorithms. You can force mkinitrd to add these checks to a created initrd with the
       --with-fips commandline option.
 
       There are a number of limitations to mkinitrd¡¯s fips support:
       /boot  Must be on a separate partition
       /boot  Must not be on nfs, dmraid or mdraid
 
 
OPTIONS
--builtin=module
¸ðµâÀÌ ¸ðµâÇüÅ°¡ ¾Æ´Ñ Ä¿³Î³»ºÎ¿¡¼­ µ¿ÀÛÇØ¾ß ÇÏ´Â ¸ðµâÀ̶ó¸é ÀÌ¿É¼Ç »ç¿ë
Act as if module is built into the kernel being used. mkinitrd will not look for this module, and will not emit an error if it does not exist.  This  option may be used multiple times.
 
-f    
initrd-image À̹ÌÁ¸ÀçÇÏ´Â À̸§À̶ó¸é µ¤¾î¾²±â
Allows mkinitrd to overwrite an existing image file.
 
--fstab=fstab
±âº»ÀûÀ¸·Î /etc/fstabÀ» ÂüÁ¶ÇÏÁö¸¸ ÀÚ½ÅÀÌ ¸¸µç fstabÆÄÀÏÀÌ ÀÖÀ»°æ¿ì »ç¿ë
Use fstab to automatically determine what type of filesystem the root device is on. Normally, /etc/fstab is used.
 
--image-version
The kernel version number is appended to the initrd image path before the image is created.
 
--nocompress
Normally the created initrd image is compressed with gzip. If this option is specified, the compression is skipped.
 
--nopivot
Do  not  use the pivot_root system call as part of the initrd. This lets mkinitrd build proper images for Linux 2.2 kernels at the expense of some features.
In particular, some filesystems (such as ext3) will not work properly and filesystem options will not be used to mount root. This option is not recommended, and will be removed in future versions.
 
--omit-lvm-modules
Do not load any lvm modules, even if /etc/fstab expects them.
 
--omit-raid-modules
Do not load any raid modules, even if /etc/fstab and /etc/raidtab expect them.
 
--omit-scsi-modules
Do not load any scsi modules, including ¡¯scsi_mod¡¯ and ¡¯sd_mod¡¯ modules, even if they are present.  If the root partition is on a scsi device, mkinitrd will still include the necessary scsi modules to support that device.
 
--preload=module 
initrd °¡ ½ÇÇàÇÒ ¶§ SCSI ¸ðµâÀÌ ¿Ã¶ó¿À´Â °ÍÀ» ±âÁØÀ¸·Î SCSI ¸ðµâÀü¿¡ ½ÇÇàµÉ ¸ðµâÀ» ÁöÁ¤ÇÒ¶§ »ç¿ë
Load the module module in the initial ramdisk image. The module gets loaded before any SCSI modules which are specified in /etc/modprobe.conf.  This  option may be used as many times as necessary.
 
-v    
Prints out verbose information while creating the image (normally the mkinitrd runs silently).
 
--version
Prints the version of mkinitrd that¡¯s being used and then exits.
 
--with=module 
initrd °¡ ½ÇÇàÇÒ¶§ SCSI ¸ðµâÀÌ ¿Ã¶ó¿À´Â °ÍÀ» ±âÁØÀ¸·Î SCSI ¸ðµâÈÄ¿¡ ½ÇÇàµÉ ¸ðµâÀ» ÁöÁ¤ÇÒ¶§ »ç¿ë
Load  the  modules module in the initial ramdisk image. The module gets loaded after any SCSI modules which are specified in /etc/modprobe.conf. This option may be used as many times as necessary.
 
---with-fips
Force adding kernel integrity checking to the created initrd.
 
 
FILES
/dev/loop*         
A block loopback device is used to create the image, which makes this script useless on systems without block loopback support available  (only used on kernels < 2.6)
 
/etc/modprobe.conf 
Specifies SCSI modules to be loaded and module options to be used.
 
/etc/modules.conf  
Specifies SCSI modules to be loaded and module options to be used.  (only used on kernels < 2.6)
 
 
2. mkinird <initrd-image> <kernel-version>
* initrd-image : initrdÀÇ ÆÄÀϸí
* kernel-version : Ä¿³Î ¹öÀü
 
initrd-<kernel-version>.imgÀÇ ³»¿ë È®ÀÎ
># file initrd-2.6.18-194.el5.img
initrd-2.6.18-194.el5.img: gzip compressed data, from Unix, last modified: Fri Mar  4 01:25:38 2011, max compression
==> gzip ¾ÐÃà»óÅÂÀÓ
 
># cp initrd-2.6.18-194.el5.img initrd-mojily.gz
># gunzip initrd-mojily.gz
># ls -al initrd-mojily
-rw------- 1 root root 5803520  3¿ù 16 16:59 initrd-mojily
># file initrd-mojily
initrd-mojily: ASCII cpio archive (SVR4 with no CRC)
==> cpio ¾ÐÃàµÇ¾îÀÖÀ½
 
># cpio -idmv < initrd-mojily
==> ¾ÐÃàµð·ºÅ丮 ÇØÁ¦
sys
init
sbin
sysroot
proc
bin
bin/kpartx
bin/dmraid
bin/insmod
bin/nash
bin/modprobe
etc
lib
lib/dm-mem-cache.ko
lib/ohci-hcd.ko
lib/ext3.ko
lib/libata.ko
lib/uhci-hcd.ko
lib/dm-message.ko
lib/ata_piix.ko
lib/dm-log.ko
lib/jbd.ko
lib/firmware
lib/ehci-hcd.ko
lib/scsi_mod.ko
lib/dm-region_hash.ko
lib/dm-mod.ko
lib/sd_mod.ko
lib/dm-raid45.ko
dev
dev/console
dev/zero
dev/tty0
dev/null
dev/tty5
dev/ram0
dev/tty9
dev/tty2
dev/tty7
dev/tty
dev/systty
dev/ttyS3
dev/tty1
dev/ttyS0
dev/tty8
dev/ram1
dev/tty10
dev/tty11
dev/rtc
dev/ttyS2
dev/ram
dev/tty3
dev/ttyS1
dev/mapper
dev/tty4
dev/tty6
dev/tty12
dev/ptmx
11335 blocks

 
># tree
.
|-- bin
|   |-- dmraid
|   |-- insmod
|   |-- kpartx
|   |-- modprobe -> /sbin/nash
|   `-- nash
|-- dev
|   |-- console
|   |-- mapper
|   |-- null
|   |-- ptmx
|   |-- ram -> ram1
|   |-- ram0
|   |-- ram1
|   |-- rtc
|   |-- systty
|   |-- tty
|   |-- tty0
|   |-- tty1
|   |-- tty10
|   |-- tty11
|   |-- tty12
|   |-- tty2
|   |-- tty3
|   |-- tty4
|   |-- tty5
|   |-- tty6
|   |-- tty7
|   |-- tty8
|   |-- tty9
|   |-- ttyS0
|   |-- ttyS1
|   |-- ttyS2
|   |-- ttyS3
|   `-- zero
|-- etc
|-- init
|-- initrd-mojily
|-- lib
|   |-- ata_piix.ko
|   |-- dm-log.ko
|   |-- dm-mem-cache.ko
|   |-- dm-message.ko
|   |-- dm-mod.ko
|   |-- dm-raid45.ko
|   |-- dm-region_hash.ko
|   |-- ehci-hcd.ko
|   |-- ext3.ko
|   |-- firmware
|   |-- jbd.ko
|   |-- libata.ko
|   |-- ohci-hcd.ko
|   |-- scsi_mod.ko
|   |-- sd_mod.ko
|   `-- uhci-hcd.ko
|-- proc
|-- sbin -> bin
|-- sys
`-- sysroot
 
 
3. initrd ³» Æ®¸®º° µð·ºÅ丮
1)init : ÀÌ ÆÄÀÏÀº nash¿¡ ÀÖ´Â ½ÇÇà ÆÄÀÏ·Î ¿ì¸® ½Ã½ºÅÛÀÇ /etc/rc.d/ ¹Ø¿¡ ÀÖ´Â ÆÄÀϵé ó·³ ÃÖÃÊ¿¡ ½ÇÇàµÇ¸é ¾î¶² ¼ø¼­·Î ½ÇÇàµÉ Áö°¡ Á¤ÀÇ µÇ¾î ÀÖ´Â ½ºÅ©¸³Æ® ÆÄÀÏÀÌ´Ù. ÀÌ ÆÄÀÏÀÌ ¾øÀ¸¸é linuxrc ÆÄÀÏÀÌ ÀÖÀ» °ÍÀÌ´Ù.
[root@test initrd_mount]# file init
init: a /bin/nash script text executable
 

2) bin µð·ºÅ丮
  - insmod : /sbin/insmod.static ºÎºÐÀ» Ä«ÇÇÇؼ­ °¡Áö°í ÀÖ´Â °ÍÀÌ´Ù.
ÃÖÃÊ·Î ºÎÆýÿ¡´Â °øÀ¯¶óÀ̺귯¸®¸¦ »ç¿ëÇÏÁö ¸øÇϱ⠶§¹®¿¡ ¶óÀ̺귯¸®°¡ ÇÊ¿ä¾ø´Â static ¿É¼ÇÀ» ÁÖ¾î ÄÄÆÄÀÏ ÇÑ insmod¸¦ »ç¿ëÇÏ¿© ÇÊ¿äÇÑ ¸ðµâÀ» ¿Ã¸®±â À§ÇÏ¿© º¹»çµÈ °ÍÀÌ´Ù.
 - nash : ÀÌ ÆÄÀÏÀº ¸í·É¾îÀÇ ÁýÇÕü¶ó°í º¸´Â °ÍÀÌ ÁÁÀ» °ÍÀÌ´Ù.
¿©·¯°¡ÁöÀÇ ¸í·É¾î°¡ ½Éº¼¸¯ ¸µÅ©ÀÇ À̸§À¸·Î µ¿ÀÛÇÏ°Ô²û ¸¸µé¾îÁø ¸í·ÉÀÌ´Ù. ½© ¿ªÇÒÀ» Çϸ鼭 ¸î °¡ÁöÀÇ ÁÖ¿ä ¸í·É¾î¸¦ ÀÌ¿ëÇÒ ¼ö ÀÖ´Ù.
ÀÌ°Í ¶ÇÇÑ staticÀ¸·Î ÄÄÆÄÀÏ µÈ °ÍÀÌ´Ù.
 - udev : µð¹ÙÀ̽º °ü·Ã ¸í·É¾î·Î ¾î¶² µð¹ÙÀ̽º°¡ ¿¬°áµÇ¾ú´ÂÁö ¾ÈµÇ¾î ÀÖ´Â Áö¸¦ È®ÀÎÇÏ¿© ¿Ã·ÁÁְųª »èÁ¦ÇØ ÁÖ´Â ¿ªÇÒÀ» ÇÑ´Ù.
/sbin/udev.static°¡ º¹»çµÈ °ÍÀÌ´Ù.
 
 
3) dev µð·ºÅ丮
 - console : ½Ã½ºÅÛ Äֿܼ¡ ÀÖ´Â ÆÄÀÏÀ̳ª µð¹ÙÀ̽º µå¶óÀ̹ö¸¦ Á÷Á¢ ÀÔÃâ·ÂÀ» ÇÒ ¼ö ÀÖµµ·Ï Á¦°øµÈ °ÍÀÌ´Ù.
 
 - null : ¿î¿µÃ¼Á¦¸¦ À§ÇÏ¿© Á¦°øµÈ ÆÄÀÏÀ̸ç null device¸¦ ½ÇÇàÇÏ´Â ¿ªÇÒÀ» ÇÑ´Ù.
 - ram : ram µð¹ÙÀ̽º¸¦ À§ÇÏ¿© Á¦°øµÈ ÆÄÀÏ·Î ram¿¡ Á÷Á¢ ÀÔÃâ·ÂÀ» ÇÒ ¼ö ÀÖ°Ô ÇØÁØ´Ù.
 -  tty1~4 : ÀϹÝÀûÀ¸·Î virtual terminals·Î ¾Ë·ÁÁø °É·Î ½Ã½ºÅÛÀ¸·Î ºÎÅÍ ¿Ã¶ó¿À´Â ¸Þ¼¼Áö¸¦ È­¸é»ó¿¡ »Ñ·ÁÁÖ´Â ¿ªÇÒÀ» ÇÑ´Ù.
 - systty : Å°º¸µå³ª ¸ð´ÏÅÍ°¡ ¾ø´Â ȯ°æ¿¡¼­ ½Éº¼¸¯ ¸µÅ©¸¦ ÀÌ¿ëÇÏ¿© µð¹ÙÀ̽º¸¦ »ç¿ëÇÒ ¼ö ÀÖ°Ô ÇØÁØ´Ù.
 
 
4) lib µð·ºÅ丮
ÀÌ µð·ºÅ丮´Â ¸ðµâÀ» °¡Áö°í ÀÖ´Â °ÍÀ» ¾Ë ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ ºÎºÐ¿¡ ÀÖ´Â ¸ðµâÀÌ ¹Ù·Î initrd°¡ ¿Ã·ÁÁÖ´Â ¸ðµâµéÀÌ´Ù.
 
 
5)³ª¸ÓÁö µð·ºÅ丮
 - proc : procfsÀÇ Á¤º¸¸¦ ¸¶¿îÆ® ÇØÁÖ´Â µð·ºÅ丮ÀÌ´Ù.
mount -t proc none proc ¸¦ ÀÌ¿ëÇÏ¿© ÇöÀç /proc¿¡ ÀÖ´Â ³»¿ëÀ̶û µ¿ÀÏÇÑ °ÍÀ» ¸¶¿îÆ® ½ÃŲ´Ù.
 - sys : sysfsÀÇ Á¤º¸¸¦ ¸¶¿îÆ® ÇØÁÖ´Â µð·ºÅ丮ÀÌ´Ù.
mount -t sysfs none sys ¸¦ ÀÌ¿ëÇÏ¿© ¸¶¿îÆ®Çϸç proc°ú´Â ´Ù¸¥ Á¤º¸¸¦ º¼ ¼ö ÀÖ½À´Ï´Ù.
 - loopfs : loop ÀåÄ¡¸¦ ¸¶¿îÆ®Çϱâ À§ÇÑ µð·ºÅ丮ÀÌ´Ù.
losetup ¸í·É¾î¸¦ ÀÌ¿ëÇÏ¿© ·çÇÁ ÀåÄ¡¸¦ Á¤±Ô ÆÄÀÏ ¶Ç´Â ºí·° ÀåÄ¡¿Í ¿¬°á, ·çÇÁ ÀåÄ¡¿Í ºÐ¸®, ·çÇÁ ÀåÄ¡ÀÇ »óÅÂÆľÇÀ» À§ÇÏ¿© ¸¶¿îÆ® ½ÃÄÑ µð·ºÅ丮ÀÌ´Ù.
 - sysroot : ½ÇÁ¦ ¿ì¸®°¡ »ç¿ëÇÏ´Â µð½ºÅ©¸¦ ¸¶¿îÆ® ½ÃÄÑÁÖ±â À§ÇÑ µð·ºÅ丮ÀÌ´Ù. ¸ðµç initrd¿¡¼­ÀÇ ¼³Á¤ ³»¿ëÀÌ ´Ù ½ÇÇàµÈ ÀÌÈÄ¿¡ pivot_root ¸í·É¾î¸¦ »ç¿ëÇÏ¿© ¿ì¸®°¡ ÇöÀç º¸°í ÀÖ´Â µð·ºÅ丮¸¦ ¡°/¡±·Î º¸¿©ÁÖ´Â °ÍÀÌ´Ù.
 
 
4 .initrd´Â ·¥ µð½ºÅ©???
initrd¸¦ Ç®¾î¼­ ¾ÈÀÇ ³»¿ëÀ» º¸¸é ¸ðµâÀ» ¿Ã¸®´Âµ¥ ÇÊ¿äÇÑ °Í°ú ½Ã½ºÅÛ¿¡ ÇÊ¿äÇÑ Á¤º¸¸¦ ¸¶¿îÆ®ÇÒ ÆÄÀÏ ½Ã½ºÅÛÀ» °¡Áö°í ÀÖ´Â °ÍÀ» º¼ ¼ö ÀÖ´Ù.
ÇÏÁö¸¸ ¸ðµâµéÀ» Àß »ìÆ캸¸é ÆÄÀÏ ½Ã½ºÅÛ°ú °ü·ÃµÈ ext3.ko, xfs.ko ÆÄÀÏÀ» º¼ ¼ö ÀÖÀ» °ÍÀÌ´Ù. ÀÌ°ÍÀº ÆÄÀÏ ½Ã½ºÅÛÀÌ ±¸µ¿µÇ±â À§ÇÏ¿© ¿Ã¶ó°¡¾ß ÇÏ´Â ¸ðµâµéÀÌ´Ù.
±×·³, ÀÌ ¸ðµâÀ» ¿Ã·ÁÁÖ´Â ¿ªÇÒÀ» ÇÏ´Â initrd´Â ¾î¶»°Ô µ¿ÀÛÇϱ⿡ ÀÌ·± ¸ðµâÀ» ÆÄÀÏ ½Ã½ºÅÛÀÌ ¿Ã¶ó¿À±âµµ Àü¿¡ ±¸µ¿µÇ°Ô ÇÏ´Â °ÍÀϱî?
ÀÌ°ÍÀº ¹Ù·Î ºÎÆ®·Î´õÀÇ ¿ªÇÒ ¶§¹®ÀÌ´Ù. ºÎÆ®·Î´õ´Â ÃÖÃÊ¿¡ grub.conf³ª lilo.conf¿¡ ¼³Á¤µÈ µð½ºÅ©ÀÇ À§Ä¡¿Í µð·ºÅ丮 À§Ä¡¿¡¼­ vmlinuz¿Í initrd ÆÄÀÏÀ» ·¥À¸·Î º¹»çÇÏ´Â ¿ªÇÒÀ» ÇØÁØ´Ù. ÀÌ°ÍÀº °á±¹ ºÎÆýà »ç¿ëµÇ´Â initrd´Â ·¥À¸·Î º¹»çµÈ initrd¸¦ ÀÌ¿ëÇÏ¿© ·¥»ó¿¡¼­ µ¿ÀÛÀ» ÇÏ´Â °ÍÀÌ´Ù. °á±¹ ·¥À» µð½ºÅ©Ã³·³ »ý°¢ÇÏ°í ±× °÷¿¡ tree¿¡¼­ º» ±¸Á¶¸¦ ±×´ë·Î Ç®¾î¼­ initÀÇ ¼³Á¤ ³»¿ë´ë·Î ½ÇÇàÇÑ ÀÌÈÄ¿¡ ½ÇÁ¦ ¿ì¸®°¡ »ç¿ëÇÏ´Â µð½ºÅ©·Î ³Ñ¾î¿Í /sbin/init¸¦ ½ÇÇàÇÏ°Ô µÈ´Ù.
°á±¹ ·¥¿¡¼­ µ¿ÀÛÇϸ鼭 ·¥À» µð½ºÅ©Ã³·³ ÀÌ¿ëÇϱ⿡ ·¥ µð½ºÅ©¶ó°í ÇÏ´Â °ÍÀÌ´Ù.
 
 
5.mkinitrd ¸í·É¾îÀÇ ¿ªÇÒ
°¡. initrd¸¦ À§ÇÑ ÆÄÀÏ ½Ã½ºÅÛÀ» ±¸¼ºÇÑ´Ù.
³ª. ºÎÆýà ÇÊ¿äÇÑ ¸ðµâÀ» ¿Å°ÜÁØ´Ù.
* 2.6 Ä¿³Î : /etc/modprobe.conf ÆÄÀÏ ÂüÁ¶
* 2.4 Ä¿³Î : /etc/modules.conf ÆÄÀÏ ÂüÁ¶
* modprobe.conf³»ÀÇ usb-controller, scsi_hostadapter¸¦ ÀÌ¿ëÇÑ ¸ðµâ¸¸À» ³Ñ±ä´Ù.
* fstab¸¦ °Ë»öÇÏ¿© ÆÄÀÏ ½Ã½ºÅÛ¿¡ ÇÊ¿äÇÑ ¸ðµâÀ» ¿Ã·ÁÁØ´Ù.
´Ù. initrd¿¡¼­ ÇÊ¿äÇÑ ÆÄÀÏ º¹»çÇØ ÁØ´Ù.
¶ó. initrd¿¡ ÀÖ´Â init¸¦ »ý¼º ½ÃÄÑÁØ´Ù.
 
 
6. À̹ÌÁö ¾ÐÃà (¾ÐÃàµÈ À̹ÌÁö ÇìÀçµÈ°Å ´Ù½Ã ¾ÐÃà)
># find ./ | cpio -H newc -o > ../initrd.mojily
11702 blocks
 

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
   

 



 
»çÀÌÆ®¸í : ¸ðÁö¸®³× | ´ëÇ¥ : ÀÌ°æÇö | °³ÀÎÄ¿¹Â´ÏƼ : ·©Å°´åÄÄ ¿î¿µÃ¼Á¦(OS) | °æ±âµµ ¼º³²½Ã ºÐ´ç±¸ | ÀüÀÚ¿ìÆí : mojily°ñ¹ðÀÌchonnom.com Copyright ¨Ï www.chonnom.com www.kyunghyun.net www.mojily.net. All rights reserved.