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 || gen_die "compressing baselayout cpio"
40 rm -rf "${TEMP}/initramfs-base-temp" > /dev/null
44 if [ -d "${TEMP}/initramfs-busybox-temp" ]
46 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
49 mkdir -p "${TEMP}/initramfs-busybox-temp/bin/"
50 tar -xjf "${BUSYBOX_BINCACHE}" -C "${TEMP}/initramfs-busybox-temp/bin" busybox ||
51 gen_die 'Could not extract busybox bincache!'
52 chmod +x "${TEMP}/initramfs-busybox-temp/bin/busybox"
54 mkdir -p "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/"
55 cp "${GK_SHARE}/defaults/udhcpc.scripts" ${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script
56 chmod +x "${TEMP}/initramfs-busybox-temp/usr/share/udhcpc/default.script"
58 # Set up a few default symlinks
59 for i in ${BUSYBOX_APPLETS:-[ ash sh mount uname echo cut cat}; do
60 rm -f ${TEMP}/initramfs-busybox-temp/bin/$i > /dev/null
61 ln -s busybox ${TEMP}/initramfs-busybox-temp/bin/$i ||
62 gen_die "Busybox error: could not link ${i}!"
65 cd "${TEMP}/initramfs-busybox-temp/"
66 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
67 || gen_die "compressing busybox cpio"
69 rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
73 if [ -d "${TEMP}/initramfs-blkid-temp" ]
75 rm -r "${TEMP}/initramfs-blkid-temp/"
78 mkdir -p "${TEMP}/initramfs-blkid-temp/sbin/"
79 [ "${DISKLABEL}" = '1' ] && { /bin/bzip2 -dc "${BLKID_BINCACHE}" > "${TEMP}/initramfs-blkid-temp/sbin/blkid" ||
80 gen_die "Could not extract blkid binary cache!"; }
81 chmod a+x "${TEMP}/initramfs-blkid-temp/sbin/blkid"
82 cd "${TEMP}/initramfs-blkid-temp/"
83 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
84 || gen_die "compressing blkid cpio"
86 rm -rf "${TEMP}/initramfs-blkid-temp" > /dev/null
90 # if [ -d "${TEMP}/initramfs-fuse-temp" ]
92 # rm -r "${TEMP}/initramfs-fuse-temp"
95 # mkdir -p "${TEMP}/initramfs-fuse-temp/lib/"
96 # tar -C "${TEMP}/initramfs-fuse-temp/lib/" -xjf "${FUSE_BINCACHE}"
97 # cd "${TEMP}/initramfs-fuse-temp/"
98 # find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
99 # || gen_die "compressing fuse cpio"
100 # rm -rf "${TEMP}/initramfs-fuse-temp" > /dev/null
103 append_unionfs_fuse() {
104 if [ -d "${TEMP}/initramfs-unionfs-fuse-temp" ]
106 rm -r "${TEMP}/initramfs-unionfs-fuse-temp"
109 mkdir -p "${TEMP}/initramfs-unionfs-fuse-temp/sbin/"
110 bzip2 -dc "${UNIONFS_FUSE_BINCACHE}" > "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs" ||
111 gen_die 'Could not extract unionfs-fuse binary cache!'
112 chmod a+x "${TEMP}/initramfs-unionfs-fuse-temp/sbin/unionfs"
113 cd "${TEMP}/initramfs-unionfs-fuse-temp/"
114 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
115 || gen_die "compressing unionfs fuse cpio"
117 rm -rf "${TEMP}/initramfs-unionfs-fuse-temp" > /dev/null
121 # if [ -d "${TEMP}/initramfs-suspend-temp" ];
123 # rm -r "${TEMP}/initramfs-suspend-temp/"
125 # print_info 1 'SUSPEND: Adding support (compiling binaries)...'
127 # mkdir -p "${TEMP}/initramfs-suspend-temp/"
128 # /bin/tar -jxpf "${SUSPEND_BINCACHE}" -C "${TEMP}/initramfs-suspend-temp" ||
129 # gen_die "Could not extract suspend binary cache!"
130 # mkdir -p "${TEMP}/initramfs-suspend-temp/etc"
131 # cp -f /etc/suspend.conf "${TEMP}/initramfs-suspend-temp/etc" ||
132 # gen_die 'Could not copy /etc/suspend.conf'
133 # cd "${TEMP}/initramfs-suspend-temp/"
134 # find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
135 # || gen_die "compressing suspend cpio"
136 # rm -r "${TEMP}/initramfs-suspend-temp/"
140 if [ -d "${TEMP}/initramfs-multipath-temp" ]
142 rm -r "${TEMP}/initramfs-multipath-temp"
144 print_info 1 ' Multipath support being added'
145 mkdir -p "${TEMP}/initramfs-multipath-temp/bin/"
146 mkdir -p "${TEMP}/initramfs-multipath-temp/etc/"
147 mkdir -p "${TEMP}/initramfs-multipath-temp/sbin/"
148 mkdir -p "${TEMP}/initramfs-multipath-temp/lib/"
151 for i in /lib/{ld-*,libc-*,libc.*,libdl-*,libdl.*,libsysfs*so*,libdevmapper*so*,libpthread*,librt*,libreadline*,libncurses*}
153 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
154 || gen_die "Could not copy file ${i} for MULTIPATH"
157 for i in /usr/lib/libaio*
159 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/lib" \
160 || gen_die "Could not copy file ${i} for MULTIPATH"
163 # Copy files to /sbin
164 for i in /sbin/{multipath,kpartx,mpath_prio_*,devmap_name,dmsetup} /lib64/udev/scsi_id
166 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/sbin" \
167 || gen_die "Could not copy file ${i} for MULTIPATH"
171 for i in /bin/mountpoint
173 cp -a "${i}" "${TEMP}/initramfs-multipath-temp/bin" \
174 || gen_die "Could not copy file ${i} for MULTIPATH"
177 if [ -x /sbin/multipath ]
179 cp /etc/multipath.conf "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy /etc/multipath.conf please check this'
181 # /etc/scsi_id.config does not exist in newer udevs
182 # copy it optionally.
183 if [ -x /sbin/scsi_id -a -f /etc/scsi_id.config ]
185 cp /etc/scsi_id.config "${TEMP}/initramfs-multipath-temp/etc/" || gen_die 'could not copy scsi_id.config'
187 cd "${TEMP}/initramfs-multipath-temp"
188 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
189 || gen_die "compressing multipath cpio"
191 rm -r "${TEMP}/initramfs-multipath-temp/"
195 if [ -d "${TEMP}/initramfs-dmraid-temp" ]
197 rm -r "${TEMP}/initramfs-dmraid-temp/"
199 print_info 1 'DMRAID: Adding support (compiling binaries)...'
201 mkdir -p "${TEMP}/initramfs-dmraid-temp/"
202 /bin/tar -jxpf "${DMRAID_BINCACHE}" -C "${TEMP}/initramfs-dmraid-temp" ||
203 gen_die "Could not extract dmraid binary cache!";
204 cd "${TEMP}/initramfs-dmraid-temp/"
205 RAID456=`find . -type f -name raid456.ko`
206 if [ -n "${RAID456}" ]
208 cd "${RAID456/raid456.ko/}"
209 ln -sf raid456.kp raid45.ko
210 cd "${TEMP}/initramfs-dmraid-temp/"
212 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
213 || gen_die "compressing dmraid cpio"
215 rm -r "${TEMP}/initramfs-dmraid-temp/"
219 if [ -d "${TEMP}/initramfs-iscsi-temp" ]
221 rm -r "${TEMP}/initramfs-iscsi-temp/"
223 print_info 1 'iSCSI: Adding support (compiling binaries)...'
226 mkdir -p "${TEMP}/initramfs-iscsi-temp/bin/"
227 /bin/bzip2 -dc "${ISCSI_BINCACHE}" > "${TEMP}/initramfs-iscsi-temp/bin/iscsistart" ||
228 gen_die "Could not extract iscsi binary cache!"
229 chmod a+x "${TEMP}/initramfs-iscsi-temp/bin/iscsistart"
230 cd "${TEMP}/initramfs-iscsi-temp/"
231 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
232 || gen_die "compressing iscsi cpio"
234 rm -rf "${TEMP}/initramfs-iscsi-temp" > /dev/null
238 if [ -d "${TEMP}/initramfs-lvm-temp" ]
240 rm -r "${TEMP}/initramfs-lvm-temp/"
243 mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
244 mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
245 if [ -e '/sbin/lvm.static' ]
247 print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm.static)...'
248 cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
249 gen_die 'Could not copy over lvm!'
250 elif [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable'
252 print_info 1 ' LVM: Adding support (using local static binary /sbin/lvm)...'
253 cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm" ||
254 gen_die 'Could not copy over lvm!'
256 print_info 1 ' LVM: Adding support (compiling binaries)...'
258 /bin/tar -jxpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" ||
259 gen_die "Could not extract lvm binary cache!";
260 mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static ${TEMP}/initramfs-lvm-temp/bin/lvm ||
261 gen_die 'LVM error: Could not move lvm.static to lvm!'
265 # lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over lvm.conf!'
269 cp /etc/lvm/lvm.conf "${TEMP}/initramfs-lvm-temp/etc/lvm/" ||
270 gen_die 'Could not copy over lvm.conf!'
272 # gen_die 'Could not copy over lvm.conf!'
275 cd "${TEMP}/initramfs-lvm-temp/"
276 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
277 || gen_die "compressing lvm cpio"
279 rm -r "${TEMP}/initramfs-lvm-temp/"
283 if [ -d "${TEMP}/initramfs-mdadm-temp" ]
285 rm -r "${TEMP}/initramfs-mdadm-temp/"
288 mkdir -p "${TEMP}/initramfs-mdadm-temp/etc/"
289 mkdir -p "${TEMP}/initramfs-mdadm-temp/sbin/"
290 if [ "${MDADM}" = '1' ]
292 if [ -n "${MDADM_CONFIG}" ]
294 if [ -f "${MDADM_CONFIG}" ]
296 cp -a "${MDADM_CONFIG}" "${TEMP}/initramfs-mdadm-temp/etc/mdadm.conf" \
297 || gen_die "Could not copy mdadm.conf!"
299 gen_die 'sl${MDADM_CONFIG} does not exist!'
302 print_info 1 ' MDADM: Skipping inclusion of mdadm.conf'
305 if [ -e '/sbin/mdadm' ] && LC_ALL="C" ldd /sbin/mdadm | grep -q 'not a dynamic executable' \
306 && [ -e '/sbin/mdmon' ] && LC_ALL="C" ldd /sbin/mdmon | grep -q 'not a dynamic executable'
308 print_info 1 ' MDADM: Adding support (using local static binaries /sbin/mdadm and /sbin/mdmon)...'
309 cp /sbin/mdadm /sbin/mdmon "${TEMP}/initramfs-mdadm-temp/sbin/" ||
310 gen_die 'Could not copy over mdadm!'
312 print_info 1 ' MDADM: Adding support (compiling binaries)...'
314 /bin/tar -jxpf "${MDADM_BINCACHE}" -C "${TEMP}/initramfs-mdadm-temp" ||
315 gen_die "Could not extract mdadm binary cache!";
318 cd "${TEMP}/initramfs-mdadm-temp/"
319 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
320 || gen_die "compressing mdadm cpio"
322 rm -rf "${TEMP}/initramfs-mdadm-temp" > /dev/null
326 splash_geninitramfs=`which splash_geninitramfs 2>/dev/null`
327 if [ -x "${splash_geninitramfs}" ]
329 [ -z "${SPLASH_THEME}" ] && [ -e /etc/conf.d/splash ] && source /etc/conf.d/splash
330 [ -z "${SPLASH_THEME}" ] && SPLASH_THEME=default
331 print_info 1 " >> Installing splash [ using the ${SPLASH_THEME} theme ]..."
332 if [ -d "${TEMP}/initramfs-splash-temp" ]
334 rm -r "${TEMP}/initramfs-splash-temp/"
336 mkdir -p "${TEMP}/initramfs-splash-temp"
339 [ -n "${SPLASH_RES}" ] && tmp="-r ${SPLASH_RES}"
340 splash_geninitramfs -c "${TEMP}/initramfs-splash-temp" ${tmp} ${SPLASH_THEME} || gen_die "Could not build splash cpio archive"
341 if [ -e "/usr/share/splashutils/initrd.splash" ]; then
342 mkdir -p "${TEMP}/initramfs-splash-temp/etc"
343 cp -f "/usr/share/splashutils/initrd.splash" "${TEMP}/initramfs-splash-temp/etc"
345 cd "${TEMP}/initramfs-splash-temp/"
346 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
347 || gen_die "compressing splash cpio"
349 rm -r "${TEMP}/initramfs-splash-temp/"
351 print_warning 1 ' >> No splash detected; skipping!'
356 cd ${INITRAMFS_OVERLAY}
357 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
358 || gen_die "compressing overlay cpio"
362 if [ -d "${TEMP}/initramfs-luks-temp" ]
364 rm -r "${TEMP}/initramfs-luks-temp/"
367 mkdir -p "${TEMP}/initramfs-luks-temp/lib/luks/"
368 mkdir -p "${TEMP}/initramfs-luks-temp/sbin"
369 cd "${TEMP}/initramfs-luks-temp"
373 if is_static /bin/cryptsetup
375 print_info 1 "Including LUKS support"
376 cp /bin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
377 chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
378 elif is_static /sbin/cryptsetup
380 print_info 1 "Including LUKS support"
381 cp /sbin/cryptsetup ${TEMP}/initramfs-luks-temp/sbin/cryptsetup
382 chmod +x "${TEMP}/initramfs-luks-temp/sbin/cryptsetup"
384 print_info 1 "LUKS support requires static cryptsetup at /bin/cryptsetup or /sbin/cryptsetup"
385 print_info 1 "Not including LUKS support"
389 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
390 || gen_die "appending cryptsetup to cpio"
393 rm -r "${TEMP}/initramfs-luks-temp/"
397 if [ -z "${FIRMWARE_FILES}" -a ! -d "${FIRMWARE_DIR}" ]
399 gen_die "specified firmware directory (${FIRMWARE_DIR}) does not exist"
401 if [ -d "${TEMP}/initramfs-firmware-temp" ]
403 rm -r "${TEMP}/initramfs-firmware-temp/"
405 mkdir -p "${TEMP}/initramfs-firmware-temp/lib/firmware"
406 cd "${TEMP}/initramfs-firmware-temp"
407 if [ -n "${FIRMWARE_FILES}" ]
411 for i in ${FIRMWARE_FILES}
413 cp -L "${i}" ${TEMP}/initramfs-firmware-temp/lib/firmware/
417 cp -a "${FIRMWARE_DIR}"/* ${TEMP}/initramfs-firmware-temp/lib/firmware/
419 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
420 || gen_die "appending firmware to cpio"
422 rm -r "${TEMP}/initramfs-firmware-temp/"
426 if [ -d "${TEMP}/initramfs-gpg-temp" ]
428 rm -r "${TEMP}/initramfs-gpg-temp"
431 mkdir -p "${TEMP}/initramfs-gpg-temp/sbin/"
432 if [ ! -e ${GPG_BINCACHE} ] ; then
433 print_info 1 ' GPG: Adding support (compiling binaries)...'
436 bzip2 -dc "${GPG_BINCACHE}" > "${TEMP}/initramfs-gpg-temp/sbin/gpg" ||
437 gen_die 'Could not extract gpg binary cache!'
438 chmod a+x "${TEMP}/initramfs-gpg-temp/sbin/gpg"
439 cd "${TEMP}/initramfs-gpg-temp/"
440 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
441 rm -rf "${TEMP}/initramfs-gpg-temp" > /dev/null
458 print_info 2 "initramfs: >> Searching for modules..."
459 if [ "${INSTALL_MOD_PATH}" != '' ]
461 cd ${INSTALL_MOD_PATH}
466 if [ -d "${TEMP}/initramfs-modules-${KV}-temp" ]
468 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
470 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/lib/modules/${KV}"
471 for i in `gen_dep_list`
473 mymod=`find ./lib/modules/${KV} -name "${i}${MOD_EXT}" 2>/dev/null| head -n 1 `
476 print_warning 2 "Warning :: ${i}${MOD_EXT} not found; skipping..."
480 print_info 2 "initramfs: >> Copying ${i}${MOD_EXT}..."
481 cp -ax --parents "${mymod}" "${TEMP}/initramfs-modules-${KV}-temp"
484 cp -ax --parents ./lib/modules/${KV}/modules* ${TEMP}/initramfs-modules-${KV}-temp 2>/dev/null
486 mkdir -p "${TEMP}/initramfs-modules-${KV}-temp/etc/modules"
487 for group_modules in ${!MODULES_*}; do
488 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
489 print_list ${!group_modules} > "${TEMP}/initramfs-modules-${KV}-temp/etc/modules/${group}"
491 cd "${TEMP}/initramfs-modules-${KV}-temp/"
492 find . | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
493 || gen_die "compressing modules cpio"
495 rm -r "${TEMP}/initramfs-modules-${KV}-temp/"
498 # check for static linked file with objdump
500 LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
505 if [ -d "${TEMP}/initramfs-aux-temp" ]
507 rm -r "${TEMP}/initramfs-aux-temp/"
509 mkdir -p "${TEMP}/initramfs-aux-temp/etc"
510 mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
511 if [ -f "${CMD_LINUXRC}" ]
513 cp "${CMD_LINUXRC}" "${TEMP}/initramfs-aux-temp/init"
514 print_info 2 " >> Copying user specified linuxrc: ${CMD_LINUXRC} to init"
518 cp "${GK_SHARE}/netboot/linuxrc.x" "${TEMP}/initramfs-aux-temp/init"
520 if [ -f "${GK_SHARE}/arch/${ARCH}/linuxrc" ]
522 cp "${GK_SHARE}/arch/${ARCH}/linuxrc" "${TEMP}/initramfs-aux-temp/init"
524 cp "${GK_SHARE}/defaults/linuxrc" "${TEMP}/initramfs-aux-temp/init"
529 # Make sure it's executable
530 chmod 0755 "${TEMP}/initramfs-aux-temp/init"
532 # Make a symlink to init .. incase we are bundled inside the kernel as one
534 cd ${TEMP}/initramfs-aux-temp
536 # ln ${TEMP}/initramfs-aux-temp/init ${TEMP}/initramfs-aux-temp/linuxrc
538 if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.scripts" ]
540 cp "${GK_SHARE}/arch/${ARCH}/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
542 cp "${GK_SHARE}/defaults/initrd.scripts" "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
545 if [ -f "${GK_SHARE}/arch/${ARCH}/initrd.defaults" ]
547 cp "${GK_SHARE}/arch/${ARCH}/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
549 cp "${GK_SHARE}/defaults/initrd.defaults" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
552 if [ -n "${REAL_ROOT}" ]
554 sed -i "s:^REAL_ROOT=.*$:REAL_ROOT='${REAL_ROOT}':" "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
557 echo -n 'HWOPTS="$HWOPTS ' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
558 for group_modules in ${!MODULES_*}; do
559 group="$(echo $group_modules | cut -d_ -f2 | tr "[:upper:]" "[:lower:]")"
560 echo -n "${group} " >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
562 echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
564 if [ -f "${GK_SHARE}/arch/${ARCH}/modprobe" ]
566 cp "${GK_SHARE}/arch/${ARCH}/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
568 cp "${GK_SHARE}/defaults/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
570 if isTrue $CMD_DOKEYMAPAUTO
572 echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
574 if isTrue $CMD_KEYMAP
576 mkdir -p "${TEMP}/initramfs-aux-temp/lib/keymaps"
577 /bin/tar -C "${TEMP}/initramfs-aux-temp/lib/keymaps" -zxf "${GK_SHARE}/defaults/keymaps.tar.gz"
580 cd ${TEMP}/initramfs-aux-temp/sbin && ln -s ../init init
582 chmod +x "${TEMP}/initramfs-aux-temp/init"
583 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
584 chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
585 chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
589 cd "${GK_SHARE}/netboot/misc"
590 cp -pPRf * "${TEMP}/initramfs-aux-temp/"
593 cd "${TEMP}/initramfs-aux-temp/"
594 find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
595 || gen_die "compressing auxilary cpio"
597 rm -r "${TEMP}/initramfs-aux-temp/"
602 local func="append_${name}"
604 [ $# -eq 0 ] && gen_die "append_data() called with zero arguments"
605 if [ $# -eq 1 ] || isTrue ${var}
607 print_info 1 " >> Appending ${name} cpio data..."
608 ${func} || gen_die "${func}() failed"
613 print_info 1 "initramfs: >> Initializing..."
616 CPIO="${TMPDIR}/initramfs-${KV}"
617 echo | cpio ${CPIO_ARGS} -F "${CPIO}" 2>/dev/null \
618 || gen_die "Could not create empty cpio at ${CPIO}"
620 append_data 'base_layout'
621 append_data 'auxilary' "${BUSYBOX}"
622 append_data 'busybox' "${BUSYBOX}"
623 append_data 'lvm' "${LVM}"
624 append_data 'dmraid' "${DMRAID}"
625 append_data 'iscsi' "${ISCSI}"
626 append_data 'mdadm' "${MDADM}"
627 append_data 'luks' "${LUKS}"
628 append_data 'multipath' "${MULTIPATH}"
629 append_data 'gpg' "${GPG}"
631 if [ "${NORAMDISKMODULES}" = '0' ]
633 append_data 'modules'
635 print_info 1 "initramfs: Not copying modules..."
638 append_data 'blkid' "${DISKLABEL}"
640 append_data 'unionfs_fuse' "${UNIONFS}"
642 append_data 'splash' "${SPLASH}"
644 if isTrue "${FIRMWARE}" && [ -n "${FIRMWARE_DIR}" ]
646 append_data 'firmware'
649 # This should always be appended last
650 if [ "${INITRAMFS_OVERLAY}" != '' ]
652 append_data 'overlay'
656 mv -f "${CPIO}.gz" "${CPIO}"
658 if isTrue "${INTEGRATED_INITRAMFS}"
660 # cp ${TMPDIR}/initramfs-${KV} ${KERNEL_DIR}/usr/initramfs_data.cpio.gz
661 mv ${TMPDIR}/initramfs-${KV} ${TMPDIR}/initramfs-${KV}.cpio.gz
662 # sed -i "s|^.*CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"|" ${KERNEL_DIR}/.config
663 sed -i '/^.*CONFIG_INITRAMFS_SOURCE=.*$/d' ${KERNEL_DIR}/.config
664 echo -e "CONFIG_INITRAMFS_SOURCE=\"${TMPDIR}/initramfs-${KV}.cpio.gz\"\nCONFIG_INITRAMFS_ROOT_UID=0\nCONFIG_INITRAMFS_ROOT_GID=0" >> ${KERNEL_DIR}/.config
667 if ! isTrue "${CMD_NOINSTALL}"
669 if ! isTrue "${INTEGRATED_INITRAMFS}"
671 copy_image_with_preserve "initramfs" \
672 "${TMPDIR}/initramfs-${KV}" \
673 "initramfs-${KNAME}-${ARCH}-${KV}"