3 create_base_layout_cpio() {
4 if [ -d "${TEMP}/initramfs-base-temp" ]
6 rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
8 mkdir -p ${TEMP}/initramfs-base-temp/dev
9 mkdir -p ${TEMP}/initramfs-base-temp/bin
10 mkdir -p ${TEMP}/initramfs-base-temp/etc
11 mkdir -p ${TEMP}/initramfs-base-temp/usr
12 mkdir -p ${TEMP}/initramfs-base-temp/proc
13 mkdir -p ${TEMP}/initramfs-base-temp/temp
14 mkdir -p ${TEMP}/initramfs-base-temp/sys
15 mkdir -p ${TEMP}/initramfs-temp/.initrd
16 mkdir -p ${TEMP}/initramfs-base-temp/var/lock/dmraid
17 mkdir -p ${TEMP}/initramfs-base-temp/sbin
18 mkdir -p ${TEMP}/initramfs-base-temp/usr/bin
19 mkdir -p ${TEMP}/initramfs-base-temp/usr/sbin
20 ln -s ../lib ${TEMP}/initramfs-base-temp/lib64
22 echo "/dev/ram0 / ext2 defaults" > ${TEMP}/initramfs-base-temp/etc/fstab
23 echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab
25 if [ "${DEVFS}" -eq '1' ]
27 echo "REGISTER .* MKOLDCOMPAT" > ${TEMP}/initramfs-base-temp/etc/devfsd.conf
28 echo "UNREGISTER .* RMOLDCOMPAT" >> ${TEMP}/initramfs-base-temp/etc/devfsd.conf
29 echo "REGISTER .* MKNEWCOMPAT" >> ${TEMP}/initramfs-base-temp/etc/devfsd.conf
30 echo "UNREGISTER .* RMNEWCOMPAT" >> ${TEMP}/initramfs-base-temp/etc/devfsd.conf
33 # SGI LiveCDs need the following binary (no better place for it than here)
34 # getdvhoff is a DEPEND of genkernel, so it *should* exist
35 if [ "${MIPS_EMBEDDED_IMAGE}" != '' ]
37 [ -e /usr/lib/getdvhoff/getdvhoff ] \
38 && cp /usr/lib/getdvhoff/getdvhoff ${TEMP}/initramfs-base-temp/bin \
39 || gen_die "sys-boot/getdvhoff not merged!"
42 cd ${TEMP}/initramfs-base-temp/dev
43 mknod -m 660 console c 5 1
44 mknod -m 660 null c 1 3
45 mknod -m 600 tty1 c 4 1
46 cd "${TEMP}/initramfs-base-temp/"
47 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz
48 rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
51 create_busybox_cpio() {
52 if [ -d "${TEMP}/initramfs-busybox-temp" ]
54 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
56 mkdir -p "${TEMP}/initramfs-busybox-temp/bin/"
57 cp "${BUSYBOX_BINCACHE}" "${TEMP}/initramfs-busybox-temp/bin/busybox.bz2" ||
58 gen_die 'Could not copy busybox from bincache!'
59 bunzip2 "${TEMP}/initramfs-busybox-temp/bin/busybox.bz2" ||
60 gen_die 'Could not uncompress busybox!'
61 chmod +x "${TEMP}/initramfs-busybox-temp/bin/busybox"
63 # down devfsd we use with dietlibc
64 # cp "${DEVFSD_CONF_BINCACHE}" "${TEMP}/initramfs-temp/etc/devfsd.conf.bz2" ||
65 # gen_die "could not copy devfsd.conf from bincache"
66 # bunzip2 "${TEMP}/initramfs-temp/etc/devfsd.conf.bz2" ||
67 # gen_die "could not uncompress devfsd.conf"
68 for i in '[' ash sh mount uname echo cut; do
69 rm -f ${TEMP}/initramfs-busybox-temp/bin/$i > /dev/null
70 ln ${TEMP}/initramfs-busybox-temp/bin/busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
71 gen_die "Busybox error: could not link ${i}!"
74 cd "${TEMP}/initramfs-busybox-temp/"
75 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-busybox-${BUSYBOX_VER}.cpio.gz
76 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
79 create_insmod_cpio() {
80 if [ -d "${TEMP}/initramfs-insmod-temp" ]
82 rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
84 mkdir -p "${TEMP}/initramfs-insmod-temp/bin/"
85 cp "${MODULE_INIT_TOOLS_BINCACHE}" "${TEMP}/initramfs-insmod-temp/bin/insmod.static.bz2" ||
86 gen_die 'Could not copy insmod.static from bincache!'
88 bunzip2 "${TEMP}/initramfs-insmod-temp/bin/insmod.static.bz2" ||
89 gen_die 'Could not uncompress insmod.static!'
90 mv "${TEMP}/initramfs-insmod-temp/bin/insmod.static" "${TEMP}/initramfs-insmod-temp/bin/insmod"
91 chmod +x "${TEMP}/initramfs-insmod-temp/bin/insmod"
93 cd "${TEMP}/initramfs-insmod-temp/"
94 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz
95 rm -rf "${TEMP}/initramfs-insmod-temp" > /dev/null
99 if [ -d "${TEMP}/initramfs-udev-temp" ]
101 rm -r "${TEMP}/initramfs-udev-temp/"
104 mkdir -p "${TEMP}/initramfs-udev-temp/bin/"
105 [ "${UDEV}" -eq '1' ] && { /bin/tar -jxpf "${UDEV_BINCACHE}" -C "${TEMP}/initramfs-udev-temp" ||
106 gen_die "Could not extract udev binary cache!"; }
107 cd "${TEMP}/initramfs-udev-temp/"
108 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-udev-${UDEV_VER}.cpio.gz
109 rm -rf "${TEMP}/initramfs-udev-temp" > /dev/null
113 if [ -d "${TEMP}/initramfs-blkid-temp" ]
115 rm -r "${TEMP}/initramfs-blkid-temp/"
118 mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
119 [ "${DISKLABEL}" -eq '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
120 gen_die "Could not extract blkid binary cache!"; }
121 chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
122 cd "${TEMP}/initramfs-blkid-temp/"
123 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz
124 rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
128 if [ -d "${TEMP}/initramfs-devfs-temp" ]
130 rm -r "${TEMP}/initramfs-devfs-temp/"
133 print_info 1 'DEVFS: Adding support (compiling binaries)...'
135 mkdir -p "${TEMP}/initramfs-devfs-temp/bin/"
136 cp "${DEVFSD_BINCACHE}" "${TEMP}/initramfs-devfs-temp/bin/devfsd.bz2" || gen_die "could not copy devfsd executable from bincache"
137 bunzip2 "${TEMP}/initramfs-devfs-temp/bin/devfsd.bz2" || gen_die "could not uncompress devfsd"
138 chmod +x "${TEMP}/initramfs-devfs-temp/bin/devfsd"
139 cd "${TEMP}/initramfs-devfs-temp/"
140 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-devfs-${DEVFSD_VER}.cpio.gz
141 rm -rf "${TEMP}/initramfs-devfs-temp" > /dev/null
144 create_unionfs_modules_cpio(){
146 if [ "${UNIONFS}" -eq '1' ]
148 if [ -d "${TEMP}/initramfs-unionfs-modules-temp" ]
150 rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
152 print_info 1 'UNIONFS MODULES: Adding support (compiling)...'
153 compile_unionfs_modules
154 mkdir -p "${TEMP}/initramfs-unionfs-modules-temp/"
155 /bin/tar -jxpf "${UNIONFS_MODULES_BINCACHE}" -C "${TEMP}/initramfs-unionfs-modules-temp" ||
156 gen_die "Could not extract unionfs modules binary cache!";
157 cd "${TEMP}/initramfs-unionfs-modules-temp/"
158 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz
159 rm -r "${TEMP}/initramfs-unionfs-modules-temp/"
163 create_unionfs_tools_cpio(){
165 if [ "${UNIONFS}" -eq '1' ]
167 if [ -d "${TEMP}/initramfs-unionfs-tools-temp" ]
169 rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
171 print_info 1 'UNIONFS TOOLS: Adding support (compiling)...'
172 compile_unionfs_utils
173 mkdir -p "${TEMP}/initramfs-unionfs-tools-temp/bin/"
174 /bin/tar -jxpf "${UNIONFS_BINCACHE}" -C "${TEMP}/initramfs-unionfs-tools-temp" ||
175 gen_die "Could not extract unionfs tools binary cache!";
176 cd "${TEMP}/initramfs-unionfs-tools-temp/"
177 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz
178 rm -r "${TEMP}/initramfs-unionfs-tools-temp/"
182 create_dmraid_cpio(){
184 if [ "${DMRAID}" = '1' ]
186 if [ -d "${TEMP}/initramfs-dmraid-temp" ]
188 rm -r "${TEMP}/initramfs-dmraid-temp/"
190 print_info 1 'DMRAID: Adding support (compiling binaries)...'
192 mkdir -p "${TEMP}/initramfs-dmraid-temp/"
193 /bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
194 gen_die "Could not extract dmraid binary cache!";
195 cd "${TEMP}/initramfs-dmraid-temp/"
196 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-dmraid-${DMRAID_VER}.cpio.gz
197 rm -r "${TEMP}/initramfs-dmraid-temp/"
203 if [ "${LVM2}" -eq '1' ]
205 if [ -d "${TEMP}/initramfs-lvm2-temp" ]
207 rm -r "${TEMP}/initramfs-lvm2-temp/"
210 mkdir -p "${TEMP}/initramfs-lvm2-temp/bin/"
211 if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
213 print_info 1 ' LVM2: Adding support (using local static binaries)...'
214 cp /sbin/lvm "${TEMP}/initramfs-lvm2-temp/bin/lvm" ||
215 gen_die 'Could not copy over lvm!'
217 print_info 1 ' LVM2: Adding support (compiling binaries)...'
219 /bin/tar -jxpf "${LVM2_BINCACHE}" -C "${TEMP}/initramfs-lvm2-temp" ||
220 gen_die "Could not extract lvm2 binary cache!";
221 mv ${TEMP}/initramfs-lvm2-temp/sbin/lvm.static ${TEMP}/initramfs-lvm2-temp/bin/lvm ||
222 gen_die 'LVM2 error: Could not move lvm.static to lvm!'
224 cd "${TEMP}/initramfs-lvm2-temp/"
225 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-lvm2-${LVM2_VER}.cpio.gz
226 rm -r "${TEMP}/initramfs-lvm2-temp/"
227 else # Deprecation warning; remove in a few versions.
228 if [ -e '/sbin/lvm' ]
230 if ldd /sbin/lvm|grep -q 'not a dynamic executable';
232 print_warning 1 'LVM2: For support, use --lvm2!'
240 if [ -e '/sbin/evms_activate' ]
242 if [ -d "${TEMP}/initramfs-evms2-temp" ]
244 rm -r "${TEMP}/initramfs-evms2-temp/"
246 mkdir -p "${TEMP}/initramfs-evms2-temp/lib/evms"
247 mkdir -p "${TEMP}/initramfs-evms2-temp/etc/"
248 mkdir -p "${TEMP}/initramfs-evms2-temp/bin/"
249 mkdir -p "${TEMP}/initramfs-evms2-temp/sbin/"
250 if [ "${EVMS2}" -eq '1' ]
252 print_info 1 ' EVMS2: Adding support...'
253 mkdir -p ${TEMP}/initramfs-evms2-temp/lib
254 cp -a /lib/ld-* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
255 cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
256 cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
257 cp -a /lib/libpthread* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
258 cp -a /lib/libuuid*so* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
259 cp -a /lib/libevms*so* "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
260 cp -a /lib/evms "${TEMP}/initramfs-evms2-temp/lib" || gen_die 'Could not copy files for EVMS2!'
261 cp -a /lib/evms/* "${TEMP}/initramfs-evms2-temp/lib/evms" || gen_die 'Could not copy files for EVMS2!'
262 cp -a /etc/evms.conf "${TEMP}/initramfs-evms2-temp/etc" || gen_die 'Could not copy files for EVMS2!'
263 cp /sbin/evms_activate "${TEMP}/initramfs-evms2-temp/sbin/evms_activate" || gen_die 'Could not copy over evms_activate!'
265 # Fix EVMS2 complaining that it can't find the swap utilities.
266 # These are not required in the initramfs
267 for swap_libs in "${TEMP}/initramfs-evms2-temp/lib/evms/*/swap*.so"
272 cd "${TEMP}/initramfs-evms2-temp/"
273 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-evms2.cpio.gz
274 rm -r "${TEMP}/initramfs-evms2-temp/"
279 if [ "${GENSPLASH}" -eq '1' ]
281 if [ -x /sbin/splash ]
283 [ -z "${GENSPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
284 [ -z "${GENSPLASH_THEME}" ] && GENSPLASH_THEME=default
285 print_info 1 " >> Installing gensplash [ using the ${GENSPLASH_THEME} theme ]..."
288 [ -n "${GENSPLASH_RES}" ] && tmp="-r ${GENSPLASH_RES}"
289 splash_geninitramfs -g ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz ${tmp} ${GENSPLASH_THEME}
290 if [ -e "/usr/share/splashutils/initrd.splash" ]; then
291 if [ -d "${TEMP}/initramfs-gensplash-temp" ]
293 rm -r "${TEMP}/initramfs-gensplash-temp/"
295 mkdir -p "${TEMP}/initramfs-gensplash-temp/etc"
296 cd "${TEMP}/initramfs-gensplash-temp/"
297 gunzip -c ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz | cpio -idm --quiet -H newc
298 cp "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-gensplash-temp/etc"
299 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz
300 rm -r "${TEMP}/initramfs-gensplash-temp/"
303 print_warning 1 ' >> No splash detected; skipping!'
307 create_initramfs_overlay_cpio(){
308 cd ${INITRAMFS_OVERLAY}
309 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-overlay.cpio.gz
320 create_initramfs_modules() {
326 print_info 2 "initramfs: >> Searching for modules..."
327 if [ "${INSTALL_MOD_PATH}" != '' ]
329 cd ${INSTALL_MOD_PATH}
334 if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
336 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
338 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
339 for i in `gen_dep_list`
341 mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
344 print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
348 print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
349 cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
352 cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
354 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
355 for group_modules in ${!MODULES_*}; do
356 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
357 print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
359 cd "${TEMP}/initramfs-modules-${KV}-temp/"
360 find . | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-modules-${KV}.cpio.gz
361 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
364 create_initramfs_aux() {
365 if [ -d "${TEMP}/initramfs-aux-temp" ]
367 rm -r "${TEMP}/initramfs-aux-temp/"
369 mkdir -p "${TEMP}/initramfs-aux-temp/etc"
370 mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
371 if [ -f "${CMD_LINUXRC}" ]
373 cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
374 print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
376 if [ -f "${GK_SHARE}/${ARCH}/linuxrc" ]
378 cp "${GK_SHARE}/${ARCH}/linuxrc" "${TEMP}/initramfs-aux-temp/init"
380 cp "${GK_SHARE}/generic/linuxrc" "${TEMP}/initramfs-aux-temp/init"
384 # Make a symlink to init .. incase we are bundled inside the kernel as one big cpio.
385 cd ${TEMP}/initramfs-aux-temp
387 # ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
389 if [ -f "${GK_SHARE}/${ARCH}/initrd.scripts" ]
391 cp "${GK_SHARE}/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
393 cp "${GK_SHARE}/generic/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
396 if [ -f "${GK_SHARE}/${ARCH}/initrd.defaults" ]
398 cp "${GK_SHARE}/${ARCH}/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
400 cp "${GK_SHARE}/generic/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
403 echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
404 for group_modules in ${!MODULES_*}; do
405 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
406 echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
408 echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
410 if [ -f "${GK_SHARE}/${ARCH}/modprobe" ]
412 cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
414 cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
416 if isTrue $CMD_DOKEYMAPAUTO
418 echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
420 mkdir -p "${TEMP}/initramfs-aux-temp/lib/keymaps"
421 /bin/tar -C "${TEMP}/initramfs-aux-temp/lib/keymaps" -zxf "${GK_SHARE}/generic/keymaps.tar.gz"
422 if isTrue $CMD_BLADECENTER
424 echo 'MY_HWOPTS="${MY_HWOPTS} bladecenter"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
427 cd ${TEMP}/initramfs-aux-temp/sbin && ln -s ../init init
429 chmod +x "${TEMP}/initramfs-aux-temp/init"
430 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
431 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
432 chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
433 cd "${TEMP}/initramfs-aux-temp/"
434 find . -print | cpio --quiet -o -H newc | gzip -9 > ${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz
435 rm -r "${TEMP}/initramfs-aux-temp/"
438 merge_initramfs_cpio_archives(){
439 cd "${CACHE_CPIO_DIR}"
440 MERGE_LIST="initramfs-base-layout.cpio.gz initramfs-aux.cpio.gz"
441 if [ ! -e "${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz" ]
443 gen_die "${CACHE_CPIO_DIR}/initramfs-base-layout.cpio.gz is missing."
445 if [ ! -e "${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz" ]
447 gen_die "${CACHE_CPIO_DIR}/initramfs-aux.cpio.gz is missing."
450 if [ "${BUSYBOX}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-busybox-${BUSYBOX_VER}.cpio.gz ]
452 MERGE_LIST="${MERGE_LIST} initramfs-busybox-${BUSYBOX_VER}.cpio.gz"
455 if [ "${NOINITRDMODULES}" = '' -a -e ${CACHE_CPIO_DIR}/initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz ]
457 MERGE_LIST="${MERGE_LIST} initramfs-insmod-${MODULE_INIT_TOOLS_VER}.cpio.gz"
460 if [ "${UDEV}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-udev-${UDEV_VER}.cpio.gz ]
462 MERGE_LIST="${MERGE_LIST} initramfs-udev-${UDEV_VER}.cpio.gz"
464 if [ "${DISKLABEL}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-blkid-${E2FSPROGS_VER}.cpio.gz ]
466 MERGE_LIST="${MERGE_LIST} initramfs-blkid-${E2FSPROGS_VER}.cpio.gz"
468 if [ "${UNIONFS}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz ]
470 MERGE_LIST="${MERGE_LIST} initramfs-unionfs-${UNIONFS_VER}-tools.cpio.gz"
472 if [ "${UNIONFS}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz ]
474 MERGE_LIST="${MERGE_LIST} initramfs-unionfs-${UNIONFS_VER}-modules-${KV}.cpio.gz"
476 if [ "${EVMS2}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-evms2.cpio.gz" ]
478 MERGE_LIST="${MERGE_LIST} initramfs-evms2.cpio.gz"
480 if [ "${LVM2}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-lvm2-${LVM2_VER}.cpio.gz" ]
482 MERGE_LIST="${MERGE_LIST} initramfs-lvm2-${LVM2_VER}.cpio.gz"
484 if [ "${DEVFS}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-devfs-${DEVFSD_VER}.cpio.gz" ]
486 MERGE_LIST="${MERGE_LIST} initramfs-devfs-${DEVFSD_VER}.cpio.gz"
488 if [ "${DMRAID}" -eq '1' -a -e ${CACHE_CPIO_DIR}/initramfs-dmraid-${DMRAID_VER}.cpio.gz ]
490 MERGE_LIST="${MERGE_LIST} initramfs-dmraid-${DMRAID_VER}.cpio.gz"
492 if [ "${NOINITRDMODULES}" = '' -a -e "${CACHE_CPIO_DIR}/initramfs-modules-${KV}.cpio.gz" ]
494 MERGE_LIST="${MERGE_LIST} initramfs-modules-${KV}.cpio.gz"
496 if [ "${GENSPLASH}" -eq '1' -a -e "${CACHE_CPIO_DIR}/initramfs-splash-${KV}.cpio.gz" ]
498 MERGE_LIST="${MERGE_LIST} initramfs-splash-${KV}.cpio.gz"
500 # This should always be appended last
501 if [ "${INITRAMFS_OVERLAY}" != '' -a -e "${CACHE_CPIO_DIR}/initramfs-overlay.cpio.gz" ]
503 MERGE_LIST="${MERGE_LIST} initramfs-overlay.cpio.gz"
507 print_info 1 "Merging"
508 for i in ${MERGE_LIST}
513 cat ${MERGE_LIST} > ${TMPDIR}/initramfs-${KV}
515 # Pegasos hack for merging the initramfs into the kernel at compile time
516 [ "${KERNEL_MAKE_DIRECTIVE}" == 'zImage.initrd' -a "${GENERATE_Z_IMAGE}" = '1' ] ||
517 [ "${KERNEL_MAKE_DIRECTIVE_2}" == 'zImage.initrd' -a "${GENERATE_Z_IMAGE}" = '1' ] &&
518 cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/arch/${ARCH}/boot/images/ramdisk.image.gz &&
519 rm ${TMPDIR}/initramfs-${KV}
521 # Mips also mimics Pegasos to merge the initramfs into the kernel
522 if [ "${MIPS_EMBEDDED_IMAGE}" != '' ]; then
523 cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/initramfs.cpio.gz
524 gunzip -f ${KERNEL_DIR}/initramfs.cpio.gz
529 if [ "${CLEAR_CPIO_CACHE}" == 'yes' ]
532 if [ -d ${CACHE_CPIO_DIR} ]
534 print_info 1 " >> Clearing old cpio archives..."
535 rm -r ${CACHE_CPIO_DIR}
539 if [ ! -d ${CACHE_CPIO_DIR} ]
541 mkdir -p ${CACHE_CPIO_DIR}
548 print_info 1 "initramfs: >> Initializing..."
550 mkdir -p ${CACHE_CPIO_DIR}
551 print_info 1 " >> Creating base_layout cpio archive..."
552 create_base_layout_cpio
554 print_info 1 " >> Creating auxilary cpio archive..."
557 if [ "${BUSYBOX}" -eq '1' ]
559 print_info 1 " >> Creating busybox cpio archive..."
563 if [ "${DEVFS}" -eq '1' ]
565 print_info 1 " >> Creating devfs cpio archive..."
569 if [ "${UDEV}" -eq '1' ]
571 print_info 1 " >> Creating udev cpio archive..."
575 if [ "${UNIONFS}" -eq '1' ]
577 print_info 1 " >> Creating unionfs modules cpio archive..."
578 create_unionfs_modules_cpio
579 print_info 1 " >> Creating unionfs tools cpio archive..."
580 create_unionfs_tools_cpio
583 if [ "${LVM2}" -eq '1' ]
586 print_info 1 " >> Creating lvm2 cpio archive..."
590 if [ "${DMRAID}" -eq '1' ]
592 print_info 1 " >> Creating dmraid cpio archive..."
596 if [ "${EVMS2}" -eq '1' -a -e '/sbin/evms_activate' ]
598 print_info 1 " >> Creating evms2 cpio archive..."
602 if [ "${NOINITRDMODULES}" = '' ]
604 print_info 1 " >> Creating insmod cpio archive..."
606 print_info 1 " >> Creating modules cpio archive..."
607 create_initramfs_modules
609 print_info 1 "initramfs: Not copying modules..."
612 if [ "${DISKLABEL}" -eq '1' ]
614 print_info 1 " >> Creating blkid cpio archive..."
620 if [ "${INITRAMFS_OVERLAY}" != '' ]
622 print_info 1 " >> Creating initramfs_overlay cpio archive..."
623 create_initramfs_overlay_cpio
626 merge_initramfs_cpio_archives
628 if ! isTrue "${CMD_NOINSTALL}"
630 cp ${TMPDIR}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} ||
631 gen_die 'Could not copy the initramfs to /boot!'