mkinitramfs는 initrd.img 파일을 만드는 스크립트이다.
$ whereis mkinitramfs
mkinitramfs: /usr/sbin/mkinitramfs /usr/share/man/man8/mkinitramfs.8.gz
$ ll mkinitramfs*
-rwxr-xr-x 1 root root 9588 2010-04-27 00:16 mkinitramfs*
-rwxr-xr-x 1 root root 1931 2010-04-27 00:16 mkinitramfs-kpkg*
$ file mkinitramfs*
mkinitramfs: POSIX shell script text executable
mkinitramfs-kpkg: POSIX shell script text executable
이 녀석의 인자로는 [version] 이라는 값이 들어가는데,
이 값은, /lib/modules/[version] 값의 경로에서 필요한 데이터를 추출한다.
$ mkinitramfs
Usage: /usr/sbin/mkinitramfs [OPTION]... <-o outfile> [version]
Options:
-d confdir Specify an alternative configuration directory.
-k Keep temporary directory used to make the image.
-o outfile Write to outfile.
-r root Override ROOT setting in mkinitrd.conf.
See mkinitramfs(8) for further details.
아무튼 나의 경우에는, apt-get으로 받은 우분투 커널 소스를 컴파일 하여 설치된 경로가
/usr/src/linux-source-2.6.32 였고, 컴파일 하여 생성되는 모듈들의 경로는
/lib/modules/2.6.32.15+drm33.5/ 였다. 이런 이유로, uname 으로 출력되는 경로와 다르게 되어
기본값으로 생성되는 initrd.img의 내용에는 modules.dep 파일이 없어서 구동이 되지 않는다.
물론, initrd.img의 크기는 실제 장착된 메모리의 용량을 넘어서지만 않으면 된다고 하지만,
내가 생성해낸 이 파일의 용량은 65M가 되어서 부팅에 조금 오래 걸리고,
약간의 설정상 문제가 있는지 Xwindow가 구동하지 않았다 -_-
기본적인 우분투의 initrd.img의 크기는 7.6M 정도이다.
더보기 접기
mkinitramfs 스크립트가 참조하는 디렉토리 및 파일
/etc/modules
/etc/initramfs-tools
├── /etc/initramfs-tools/conf.d
│ └── /etc/initramfs-tools/conf.d/resume
├── /etc/initramfs-tools/hooks
├── /etc/initramfs-tools/initramfs.conf
├── /etc/initramfs-tools/modules
├── /etc/initramfs-tools/scripts
│ ├── /etc/initramfs-tools/scripts/init-bottom
│ ├── /etc/initramfs-tools/scripts/init-premount
│ ├── /etc/initramfs-tools/scripts/init-top
│ ├── /etc/initramfs-tools/scripts/local-bottom
│ ├── /etc/initramfs-tools/scripts/local-premount
│ ├── /etc/initramfs-tools/scripts/local-top
│ ├── /etc/initramfs-tools/scripts/nfs-bottom
│ ├── /etc/initramfs-tools/scripts/nfs-premount
│ ├── /etc/initramfs-tools/scripts/nfs-top
│ └── /etc/initramfs-tools/scripts/panic
└── /etc/initramfs-tools/update-initramfs.conf
$ tree /usr/lib/initramfs-tools/
/usr/lib/initramfs-tools/
└── bin
├── busybox
└── wait-for-root
$ tree /etc/initramfs-tools
/etc/initramfs-tools
├── conf.d
│ └── resume
├── hooks
├── initramfs.conf
├── modules
├── scripts
│ ├── init-bottom
│ ├── init-premount
│ ├── init-top
│ ├── local-bottom
│ ├── local-premount
│ ├── local-top
│ ├── nfs-bottom
│ ├── nfs-premount
│ ├── nfs-top
│ └── panic
└── update-initramfs.conf
만들어진 커널과 각종 설정 파일은 아래의 경로에 위치한다.
/boot
├── System.map-*
├── abi-*
├── config-*
├── grub/
│ └── grub.cfg
├── initrd.img-*
├── memtest86+.bin
├── vmcoreinfo-*
└── vmlinuz-*
initrd.img의 내용. /lib/modules/modules.dep 파일이 없다고 나오는 것은
실제 하드 디스크의 파일이 아닌 램디스크 상의 modules.dep 파일이다.
initrd.img
├── bin
│ ├── busybox
│ ├── cpio
│ ├── date
│ ├── dd
│ ├── dmesg
│ ├── fstype
│ ├── halt
│ ├── insmod
│ ├── ipconfig
│ ├── kbd_mode
│ ├── loadkeys
│ ├── losetup
│ ├── mount
│ ├── nfsmount
│ ├── ntfs-3g
│ ├── pivot_root
│ ├── poweroff
│ ├── reboot
│ ├── resume
│ ├── run-init
│ ├── setfont
│ ├── sh
│ └── sleep
├── conf
│ ├── arch.conf
│ ├── conf.d
│ │ └── resume
│ └── initramfs.conf
├── etc
│ ├── console-setup
│ │ ├── Uni1-VGA16.psf
│ │ └── cached.kmap.gz
│ ├── default
│ │ └── console-setup
│ ├── modprobe.d
│ │ ├── alsa-base.conf
│ │ ├── blacklist-ath_pci.conf
│ │ ├── blacklist-firewire.conf
│ │ ├── blacklist-framebuffer.conf
│ │ ├── blacklist-modem.conf
│ │ ├── blacklist-oss.conf
│ │ ├── blacklist-watchdog.conf
│ │ ├── blacklist.conf
│ │ ├── libpisock9.conf
│ │ ├── nvidia-graphics-drivers.conf
│ │ └── oss-compat.conf
│ └── udev
│ └── udev.conf
├── init
├── initrd.img-2.6.32.15+drm33.5
├── lib
│ ├── firmware/
│ ├── klibc-3l753vPzJwYEL0GJGYa3oGaUPp4.so
│ ├── ld-linux.so.2
│ ├── libblkid.so.1
│ ├── libc.so.6
│ ├── libcom_err.so.2
│ ├── libdevmapper.so.1.02.1
│ ├── libdl.so.2
│ ├── libe2p.so.2
│ ├── libext2fs.so.2
│ ├── libfuse.so.2
│ ├── libntfs-3g.so.75
│ ├── libproc-3.2.8.so
│ ├── libpthread.so.0
│ ├── librt.so.1
│ ├── libselinux.so.1
│ ├── libudev.so.0
│ ├── libuuid.so.1
│ ├── modules
│ │ └── 2.6.32-24-generic
│ │ ├── kernel
│ │ │ └── drivers
│ │ ├── modules.alias
│ │ ├── modules.alias.bin
│ │ ├── modules.dep
│ │ ├── modules.dep.bin
│ │ ├── modules.order
│ │ ├── modules.symbols
│ │ └── modules.symbols.bin
│ └── udev
│ ├── ata_id
│ ├── blkid
│ ├── edd_id
│ ├── firmware
│ ├── path_id
│ ├── rules.d
│ │ ├── 50-firmware.rules
│ │ ├── 50-udev-default.rules
│ │ ├── 55-dm.rules
│ │ ├── 60-persistent-storage-dm.rules
│ │ ├── 60-persistent-storage.rules
│ │ ├── 61-persistent-storage-edd.rules
│ │ ├── 64-device-mapper.rules
│ │ ├── 80-drivers.rules
│ │ └── 95-udev-late.rules
│ ├── scsi_id
│ └── usb_id
├── sbin
│ ├── blkid
│ ├── depmod
│ ├── dmsetup
│ ├── dumpe2fs
│ ├── hwclock
│ ├── modprobe
│ ├── mount.fuse
│ ├── mount.ntfs
│ ├── mount.ntfs-3g
│ ├── pkill
│ ├── rmmod
│ ├── udevadm
│ ├── udevd
│ └── wait-for-root
└── scripts
├── functions
├── init-bottom
│ ├── ORDER
│ └── udev
├── init-top
│ ├── ORDER
│ ├── all_generic_ide
│ ├── blacklist
│ └── udev
├── local
├── local-bottom
│ ├── ORDER
│ └── ntfs_3g
├── local-premount
│ ├── ORDER
│ ├── fixrtc
│ ├── ntfs_3g
│ └── resume
├── nfs
├── nfs-top
│ ├── ORDER
│ └── udev
└── panic
├── ORDER
├── console_setup
└── keymap
접기