4 CPIO_ARGS="--quiet -o -H newc"
7 if [ -d "${TEMP}/initramfs-base-temp" ]
9 rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
12 mkdir -p ${TEMP}/initramfs-base-temp/dev
13 mkdir -p ${TEMP}/initramfs-base-temp/bin
14 mkdir -p ${TEMP}/initramfs-base-temp/etc
15 mkdir -p ${TEMP}/initramfs-base-temp/usr
16 mkdir -p ${TEMP}/initramfs-base-temp/proc
17 mkdir -p ${TEMP}/initramfs-base-temp/temp
18 mkdir -p ${TEMP}/initramfs-base-temp/sys
19 mkdir -p ${TEMP}/initramfs-temp/.initrd
20 mkdir -p ${TEMP}/initramfs-base-temp/var/lock/dmraid
21 mkdir -p ${TEMP}/initramfs-base-temp/sbin
22 mkdir -p ${TEMP}/initramfs-base-temp/usr/bin
23 mkdir -p ${TEMP}/initramfs-base-temp/usr/sbin
24 ln -s lib ${TEMP}/initramfs-base-temp/lib64
26 echo "/dev/ram0 / ext2 defaults 0 0" > ${TEMP}/initramfs-base-temp/etc/fstab
27 echo "proc /proc proc defaults 0 0" >> ${TEMP}/initramfs-base-temp/etc/fstab
29 cd ${TEMP}/initramfs-base-temp/dev
30 mknod -m 660 console c 5 1
31 mknod -m 660 null c 1 3
32 mknod -m 600 tty1 c 4 1
34 date '+%Y%m%d' > ${TEMP}/initramfs-base-temp/etc/build_date
36 cd "${TEMP}/initramfs-base-temp/"
37 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
38 rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
42 if [ -d "${TEMP}/initramfs-busybox-temp" ]
44 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
47 mkdir -p "${TEMP}/initramfs-busybox-temp/bin/"
48 tar -xjf "${BUSYBOX_BINCACHE}" -C "${TEMP}/initramfs-busybox-temp/bin" busybox ||
49 gen_die 'Could not extract busybox bincache!'
50 chmod +x "${TEMP}/initramfs-busybox-temp/bin/busybox"
52 mkdir -p "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/"
53 cp "${GK_SHARE}/defaults/udhcpc.scripts" ${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script
54 chmod +x "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script"
56 # Set up a few default symlinks
57 for i in '[' ash sh mount uname echo cut cat; do
58 rm -f ${TEMP}/initramfs-busybox-temp/bin/$i > /dev/null
59 ln ${TEMP}/initramfs-busybox-temp/bin/busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
60 gen_die "Busybox error: could not link ${i}!"
63 cd "${TEMP}/initramfs-busybox-temp/"
64 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
65 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
69 if [ -d "${TEMP}/initramfs-blkid-temp" ]
71 rm -r "${TEMP}/initramfs-blkid-temp/"
74 mkdir -p "${TEMP}/initramfs-blkid-temp/bin/"
75 [ "${DISKLABEL}" -eq '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/bin/blkid" ||
76 gen_die "Could not extract blkid binary cache!"; }
77 chmod a+x "${TEMP}/initramfs-blkid-temp/bin/blkid"
78 cd "${TEMP}/initramfs-blkid-temp/"
79 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
80 rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
84 # if [ -d "${TEMP}/initramfs-fuse-temp" ]
86 # rm -r "${TEMP}/initramfs-fuse-temp"
89 # mkdir -p "${TEMP}/initramfs-fuse-temp/lib/"
90 # tar -C "${TEMP}/initramfs-fuse-temp/lib/" -xjf "${FUSE_BINCACHE}"
91 # cd "${TEMP}/initramfs-fuse-temp/"
92 # find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
93 # rm -rf "${TEMP}/initramfs-fuse-temp" > /dev/null
96 append_unionfs_fuse() {
97 if [ -d "${TEMP}/initramfs-unionfs-fuse-temp" ]
99 rm -r "${TEMP}/initramfs-unionfs-fuse-temp"
102 mkdir -p "${TEMP}/initramfs-unionfs-fuse-temp/sbin/"
103 bzip2 -dc "${UNIONFS_FUSE_BINCACHE}" > "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs" ||
104 gen_die 'Could not extract unionfs-fuse binary cache!'
105 chmod a+x "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs"
106 cd "${TEMP}/initramfs-unionfs-fuse-temp/"
107 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
108 rm -rf "${TEMP}/initramfs-unionfs-fuse-temp" > /dev/null
112 # if [ -d "${TEMP}/initramfs-suspend-temp" ];
114 # rm -r "${TEMP}/initramfs-suspend-temp/"
116 # print_info 1 'SUSPEND: Adding support (compiling binaries)...'
118 # mkdir -p "${TEMP}/initramfs-suspend-temp/"
119 # /bin/tar -jxpf "${SUSPEND_BINCACHE}" -C "${TEMP}/initramfs-suspend-temp" ||
120 # gen_die "Could not extract suspend binary cache!"
121 # mkdir -p "${TEMP}/initramfs-suspend-temp/etc"
122 # cp -f /etc/suspend.conf "${TEMP}/initramfs-suspend-temp/etc" ||
123 # gen_die 'Could not copy /etc/suspend.conf'
124 # cd "${TEMP}/initramfs-suspend-temp/"
125 # find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
126 # rm -r "${TEMP}/initramfs-suspend-temp/"
130 if [ -d "${TEMP}/initramfs-multipath-temp" ]
132 rm -r "${TEMP}/initramfs-multipath-temp"
134 print_info 1 ' Multipath support being added'
135 mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
136 mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
137 mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
138 mkdir -p "${TEMP}/initramfs-multipath-temp/lib/"
141 for i in /lib/{ld-*,libc-*,libc.*,libdl-*,libdl.*,libsysfs*so*,libdevmapper*so*,libpthread*,librt*,libreadline*,libncurses*}
143 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
144 || gen_die "Could not copy file ${i} for MULTIPATH"
147 for i in /usr/lib/libaio*
149 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
150 || gen_die "Could not copy file ${i} for MULTIPATH"
153 # Copy files to /sbin
154 for i in /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id
156 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/sbin" \
157 || gen_die "Could not copy file ${i} for MULTIPATH"
161 for i in /bin/mountpoint
163 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/bin" \
164 || gen_die "Could not copy file ${i} for MULTIPATH"
167 if [ -x /sbin/multipath ]
169 cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
171 # /etc/scsi_id.config does not exist in newer udevs
172 # copy it optionally.
173 if [ -x /sbin/scsi_id -a -f /etc/scsi_id.config ]
175 cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy scsi_id.config'
177 cd "${TEMP}/initramfs-multipath-temp"
178 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
179 rm -r "${TEMP}/initramfs-multipath-temp/"
183 if [ -d "${TEMP}/initramfs-dmraid-temp" ]
185 rm -r "${TEMP}/initramfs-dmraid-temp/"
187 print_info 1 'DMRAID: Adding support (compiling binaries)...'
189 mkdir -p "${TEMP}/initramfs-dmraid-temp/"
190 /bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
191 gen_die "Could not extract dmraid binary cache!";
192 cd "${TEMP}/initramfs-dmraid-temp/"
193 RAID456=`find . -type f -name raid456.ko`
194 if [ -n "${RAID456}" ]
196 cd "${RAID456/raid456.ko/}"
197 ln -sf raid456.kp raid45.ko
198 cd "${TEMP}/initramfs-dmraid-temp/"
200 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
201 rm -r "${TEMP}/initramfs-dmraid-temp/"
205 if [ -d "${TEMP}/initramfs-lvm-temp" ]
207 rm -r "${TEMP}/initramfs-lvm-temp/"
210 mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
211 mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
212 if [ -e '/sbin/lvm.static' ]
214 print_info 1 ' LVM: Adding support (using local static binaries)...'
215 cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
216 gen_die 'Could not copy over lvm!'
217 elif [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable'
219 print_info 1 ' LVM: Adding support (using local static binaries)...'
220 cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
221 gen_die 'Could not copy over lvm!'
223 print_info 1 ' LVM: Adding support (compiling binaries)...'
225 /bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" ||
226 gen_die "Could not extract lvm binary cache!";
227 mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/bin/lvm ||
228 gen_die 'LVM error: Could not move lvm.static to lvm!'
232 # lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over lvm.conf!'
236 cp /etc/lvm/lvm.conf "${TEMP}/initramfs-lvm-temp/etc/lvm/" ||
237 gen_die 'Could not copy over lvm.conf!'
239 # gen_die 'Could not copy over lvm.conf!'
242 cd "${TEMP}/initramfs-lvm-temp/"
243 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
244 rm -r "${TEMP}/initramfs-lvm-temp/"
248 if [ -d "${TEMP}/initramfs-evms-temp" ]
250 rm -r "${TEMP}/initramfs-evms-temp/"
252 mkdir -p "${TEMP}/initramfs-evms-temp/lib/evms"
253 mkdir -p "${TEMP}/initramfs-evms-temp/etc/"
254 mkdir -p "${TEMP}/initramfs-evms-temp/bin/"
255 mkdir -p "${TEMP}/initramfs-evms-temp/sbin/"
256 if [ "${EVMS}" -eq '1' ]
258 print_info 1 ' EVMS: Adding support...'
259 mkdir -p ${TEMP}/initramfs-evms-temp/lib
260 cp -a /lib/ld-* "${TEMP}/initramfs-evms-temp/lib" \
261 || gen_die 'Could not copy files for EVMS!'
262 if [ -n "`ls /lib/libgcc_s*`" ]
264 cp -a /lib/libgcc_s* "${TEMP}/initramfs-evms-temp/lib" \
265 || gen_die 'Could not copy files for EVMS!'
267 cp -a /lib/libc-* /lib/libc.* "${TEMP}/initramfs-evms-temp/lib" \
268 || gen_die 'Could not copy files for EVMS!'
269 cp -a /lib/libdl-* /lib/libdl.* "${TEMP}/initramfs-evms-temp/lib" \
270 || gen_die 'Could not copy files for EVMS!'
271 cp -a /lib/libpthread* "${TEMP}/initramfs-evms-temp/lib" \
272 || gen_die 'Could not copy files for EVMS!'
273 cp -a /lib/libuuid*so* "${TEMP}/initramfs-evms-temp/lib" \
274 || gen_die 'Could not copy files for EVMS!'
275 cp -a /lib/libevms*so* "${TEMP}/initramfs-evms-temp/lib" \
276 || gen_die 'Could not copy files for EVMS!'
277 cp -a /lib/evms "${TEMP}/initramfs-evms-temp/lib" \
278 || gen_die 'Could not copy files for EVMS!'
279 cp -a /lib/evms/* "${TEMP}/initramfs-evms-temp/lib/evms" \
280 || gen_die 'Could not copy files for EVMS!'
281 cp -a /etc/evms.conf "${TEMP}/initramfs-evms-temp/etc" \
282 || gen_die 'Could not copy files for EVMS!'
283 cp /sbin/evms_activate "${TEMP}/initramfs-evms-temp/sbin" \
284 || gen_die 'Could not copy over evms_activate!'
286 # Fix EVMS complaining that it can't find the swap utilities.
287 # These are not required in the initramfs
288 for swap_libs in "${TEMP}/initramfs-evms-temp/lib/evms/*/swap*.so"
293 cd "${TEMP}/initramfs-evms-temp/"
294 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
295 rm -r "${TEMP}/initramfs-evms-temp/"
299 if [ -d "${TEMP}/initramfs-mdadm-temp" ]
301 rm -r "${TEMP}/initramfs-mdadm-temp/"
304 mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
305 if [ "${MDADM}" -eq '1' ]
307 cp -a /etc/mdadm.conf "${TEMP}/initramfs-mdadm-temp/etc" \
308 || gen_die "Could not copy mdadm.conf!"
310 cd "${TEMP}/initramfs-mdadm-temp/"
311 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
312 rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
316 splash_geninitramfs=`which splash_geninitramfs 2>/dev/null`
317 if [ -x "${splash_geninitramfs}" ]
319 [ -z "${SPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
320 [ -z "${SPLASH_THEME}" ] && SPLASH_THEME=default
321 print_info 1 " >> Installing splash [ using the ${SPLASH_THEME} theme ]..."
322 if [ -d "${TEMP}/initramfs-splash-temp" ]
324 rm -r "${TEMP}/initramfs-splash-temp/"
326 mkdir -p "${TEMP}/initramfs-splash-temp"
329 [ -n "${SPLASH_RES}" ] && tmp="-r ${SPLASH_RES}"
330 splash_geninitramfs -c "${TEMP}/initramfs-splash-temp" ${tmp} ${SPLASH_THEME} || gen_die "Could not build splash cpio archive"
331 if [ -e "/usr/share/splashutils/initrd.splash" ]; then
332 mkdir -p "${TEMP}/initramfs-splash-temp/etc"
333 cp -f "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-splash-temp/etc"
335 cd "${TEMP}/initramfs-splash-temp/"
336 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
337 || gen_die "compressing splash cpio"
338 rm -r "${TEMP}/initramfs-splash-temp/"
340 print_warning 1 ' >> No splash detected; skipping!'
345 cd ${INITRAMFS_OVERLAY}
346 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
350 if [ -d "${TEMP}/initramfs-luks-temp" ]
352 rm -r "${TEMP}/initramfs-luks-temp/"
355 mkdir -p "${TEMP}/initramfs-luks-temp/lib/luks/"
356 mkdir -p "${TEMP}/initramfs-luks-temp/sbin"
357 cd "${TEMP}/initramfs-luks-temp"
361 if is_static /bin/cryptsetup
363 print_info 1 "Including LUKS support"
364 cp /bin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
365 chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
366 elif is_static /sbin/cryptsetup
368 print_info 1 "Including LUKS support"
369 cp /sbin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
370 chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
372 print_info 1 "LUKS support requires static cryptsetup at /bin/cryptsetup or /sbin/cryptsetup"
373 print_info 1 "Not including LUKS support"
377 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
378 || gen_die "appending cryptsetup to cpio"
381 rm -r "${TEMP}/initramfs-luks-temp/"
385 if [ -z "${FIRMWARE_FILES}" -a ! -d "${FIRMWARE_DIR}" ]
387 gen_die "specified firmware directory (${FIRMWARE_DIR}) does not exist"
389 if [ -d "${TEMP}/initramfs-firmware-temp" ]
391 rm -r "${TEMP}/initramfs-firmware-temp/"
393 mkdir -p "${TEMP}/initramfs-firmware-temp/lib/firmware"
394 cd "${TEMP}/initramfs-firmware-temp"
395 if [ -n "${FIRMWARE_FILES}" ]
399 for i in ${FIRMWARE_FILES}
401 cp -L "${i}" ${TEMP}/initramfs-firmware-temp/lib/firmware/
405 cp -a "${FIRMWARE_DIR}"/* ${TEMP}/initramfs-firmware-temp/lib/firmware/
407 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
408 || gen_die "appending firmware to cpio"
409 rm -r "${TEMP}/initramfs-firmware-temp/"
426 print_info 2 "initramfs: >> Searching for modules..."
427 if [ "${INSTALL_MOD_PATH}" != '' ]
429 cd ${INSTALL_MOD_PATH}
434 if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
436 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
438 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
439 for i in `gen_dep_list`
441 mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
444 print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
448 print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
449 cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
452 cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
454 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
455 for group_modules in ${!MODULES_*}; do
456 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
457 print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
459 cd "${TEMP}/initramfs-modules-${KV}-temp/"
460 find . | cpio ${CPIO_ARGS} --append -F "${CPIO}"
462 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
465 # check for static linked file with objdump
467 LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
472 if [ -d "${TEMP}/initramfs-aux-temp" ]
474 rm -r "${TEMP}/initramfs-aux-temp/"
476 mkdir -p "${TEMP}/initramfs-aux-temp/etc"
477 mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
478 if [ -f "${CMD_LINUXRC}" ]
480 cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
481 print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
485 cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init"
487 if [ -f "${GK_SHARE}/arch/${ARCH}/linuxrc" ]
489 cp "${GK_SHARE}/arch/${ARCH}/linuxrc" "${TEMP}/initramfs-aux-temp/init"
491 cp "${GK_SHARE}/defaults/linuxrc" "${TEMP}/initramfs-aux-temp/init"
496 # Make sure it's executable
497 chmod 0755 "${TEMP}/initramfs-aux-temp/init"
499 # Make a symlink to init .. incase we are bundled inside the kernel as one
501 cd ${TEMP}/initramfs-aux-temp
503 # ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
505 if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.scripts" ]
507 cp "${GK_SHARE}/arch/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
509 cp "${GK_SHARE}/defaults/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
512 if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.defaults" ]
514 cp "${GK_SHARE}/arch/${ARCH}/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
516 cp "${GK_SHARE}/defaults/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
519 if [ -n "${REAL_ROOT}" ]
521 sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
524 echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
525 for group_modules in ${!MODULES_*}; do
526 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
527 echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
529 echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
531 if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ]
533 cp "${GK_SHARE}/arch/${ARCH}/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
535 cp "${GK_SHARE}/defaults/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
537 if isTrue $CMD_DOKEYMAPAUTO
539 echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
541 if isTrue $CMD_KEYMAP
543 mkdir -p "${TEMP}/initramfs-aux-temp/lib/keymaps"
544 /bin/tar -C "${TEMP}/initramfs-aux-temp/lib/keymaps" -zxf "${GK_SHARE}/defaults/keymaps.tar.gz"
546 if isTrue $CMD_SLOWUSB
548 echo 'MY_HWOPTS="${MY_HWOPTS} slowusb"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
551 cd ${TEMP}/initramfs-aux-temp/sbin && ln -s ../init init
553 chmod +x "${TEMP}/initramfs-aux-temp/init"
554 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
555 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
556 chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
560 cd "${GK_SHARE}/netboot/misc"
561 cp -pPRf * "${TEMP}/initramfs-aux-temp/"
564 cd "${TEMP}/initramfs-aux-temp/"
565 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
567 rm -r "${TEMP}/initramfs-aux-temp/"
572 local func="append_${name}"
574 [ $# -eq 0 ] && gen_die "append_data() called with zero arguments"
575 if [ $# -eq 1 ] || isTrue ${var}
577 print_info 1 " >> Appending ${name} cpio data..."
583 print_info 1 "initramfs: >> Initializing..."
586 CPIO="${TMPDIR}/initramfs-${KV}"
587 echo | cpio ${CPIO_ARGS} -F "${CPIO}" 2>/dev/null \
588 || gen_die "Could not create empty cpio at ${CPIO}"
590 append_data 'base_layout'
591 append_data 'auxilary' "${BUSYBOX}"
592 append_data 'busybox' "${BUSYBOX}"
593 append_data 'lvm' "${LVM}"
594 append_data 'dmraid' "${DMRAID}"
595 append_data 'evms' "${EVMS}"
596 append_data 'mdadm' "${MDADM}"
597 append_data 'luks' "${LUKS}"
598 append_data 'multipath' "${MULTIPATH}"
600 if [ "${NORAMDISKMODULES}" -eq '0' ]
602 append_data 'modules'
604 print_info 1 "initramfs: Not copying modules..."
607 append_data 'blkid' "${DISKLABEL}"
609 append_data 'unionfs_fuse' "${UNIONFS}"
611 append_data 'splash' "${SPLASH}"
613 if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
615 append_data 'firmware'
618 # This should always be appended last
619 if [ "${INITRAMFS_OVERLAY}" != '' ]
621 append_data 'overlay'
625 mv -f "${CPIO}.gz" "${CPIO}"
627 if isTrue "${INTEGRATED_INITRAMFS}"
629 # cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/usr/initramfs_data.cpio.gz
630 mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio.gz
631 # sed -i "s|^.*CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"|" ${KERNEL_DIR}/.config
632 sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_DIR}/.config
633 echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config
636 if ! isTrue "${CMD_NOINSTALL}"
638 if ! isTrue "${INTEGRATED_INITRAMFS}"
640 copy_image_with_preserve "initramfs" \
641 "${TMPDIR}/initramfs-${KV}" \
642 "initramfs-${KNAME}-${ARCH}-${KV}"