Removing bootsplash support since it hasn't been in a kernel we've supported for...
[genkernel.git] / gen_initrd.sh
index f1979953ce485f0604e5ce2afd864b287bd3c019..005f5da204876deb418e5e540350d6b296aedd91 100644 (file)
@@ -8,28 +8,26 @@ create_initrd_loop() {
                gen_die 'Could not create loopback mount directory!'
        dd if=/dev/zero of=${TMPDIR}/initrd-${KV} bs=1k count=${1} >> "${DEBUGFILE}" 2>&1 ||
                gen_die "Could not zero initrd-${KV}"
-       mke2fs -F -N500 -q "${TMPDIR}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 ||
+       mke2fs -F -N750 -q "${TMPDIR}/initrd-${KV}" >> "${DEBUGFILE}" 2>&1 ||
                gen_die "Could not format initrd-${KV}!"
        mount -t ext2 -o loop "${TMPDIR}/initrd-${KV}" "${TEMP}/initrd-mount" >> "${DEBUGFILE}" 2>&1 ||
                gen_die 'Could not mount the initrd filesystem!'
 }
 
-create_initrd_unmount_loop()
-{
+create_initrd_unmount_loop() {
        cd ${TEMP}
        umount "${TEMP}/initrd-mount" ||
                gen_die 'Could not unmount initrd system!'
 }
 
-move_initrd_to_loop()
-{
+move_initrd_to_loop() {
        cd "${TEMP}/initrd-temp"
        mv * "${TEMP}/initrd-mount" >> ${DEBUGFILE} 2>&1
 }
 
 # check for static linked file with objdump
 is_static() {
-       objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
+       LANG="C" LC_ALL="C" objdump -T $1 2>&1 | grep "not a dynamic object" > /dev/null
        return $?
 }
 
@@ -80,29 +78,12 @@ create_base_initrd_sys() {
                chmod +x "${TEMP}/initrd-temp/bin/blkid"
        fi
 
-       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.bz2" ||
+       cp "${BUSYBOX_BINCACHE}" "${TEMP}/initrd-temp/bin/busybox.tar.bz2" ||
                gen_die 'Could not copy busybox from bincache!'
-       bunzip2 "${TEMP}/initrd-temp/bin/busybox.bz2" ||
-               gen_die 'Could not uncompress busybox!'
+       tar -xjf "${TEMP}/initrd-temp/bin/busybox.tar.bz2" -C "${TEMP}/initrd-temp/bin" busybox ||
+               gen_die 'Could not extract busybox bincache!'
        chmod +x "${TEMP}/initrd-temp/bin/busybox"
 
-       if [ "${NOINITRDMODULES}" = '' ]
-       then
-               if [ "${PAT}" -gt "4" ]
-               then
-                       cp "${MODULE_INIT_TOOLS_BINCACHE}" "${TEMP}/initrd-temp/bin/insmod.static.bz2" ||
-                               gen_die 'Could not copy insmod.static from bincache!'
-               else
-                       cp "${MODUTILS_BINCACHE}" "${TEMP}/initrd-temp/bin/insmod.static.bz2" ||
-                               gen_die 'Could not copy insmod.static from bincache'
-               fi
-
-               bunzip2 "${TEMP}/initrd-temp/bin/insmod.static.bz2" ||
-                       gen_die 'Could not uncompress insmod.static!'
-               mv "${TEMP}/initrd-temp/bin/insmod.static" "${TEMP}/initrd-temp/bin/insmod"
-               chmod +x "${TEMP}/initrd-temp/bin/insmod"
-       fi
-
        # devfsd
        if [ "${DEVFS}" -eq '1' ]
        then
@@ -111,21 +92,6 @@ create_base_initrd_sys() {
                chmod +x "${TEMP}/initrd-temp/bin/devfsd"
        fi
 
-       # udev
-#      if [ "${UDEV}" -eq '1' ]
-#      then
-#              /bin/tar -jxpf "${UDEV_BINCACHE}" -C "${TEMP}/initrd-temp" || gen_die 'Could not extract udev binary cache!'
-#              if [ ! -e "${TEMP}/initrd-temp/bin/udevstart" ]
-#              then
-#                  ln -sf "./udev" "${TEMP}/initrd-temp/bin/udevstart" ||      gen_die 'Could not symlink udev -> udevstart!'
-#              fi
-               
-#              if [ ! -e "${TEMP}/initrd-temp/bin/udevsend" ]
-#              then
-#                  ln -sf "./udev" "${TEMP}/initrd-temp/bin/udevsend" ||       gen_die 'Could not symlink udev -> udevsend!'
-#              fi
-#      fi
-       
        #unionfs modules
        if [ "${UNIONFS}" -eq '1' ]
        then
@@ -144,7 +110,6 @@ create_base_initrd_sys() {
                        gen_die "Could not extract unionfs tools binary cache!";
        fi
 
-
        # DMRAID 
        if [ "${DMRAID}" = '1' ]
        then
@@ -157,7 +122,7 @@ create_base_initrd_sys() {
        # LVM2
        if [ "${LVM2}" = '1' ]
        then
-               if [ -e '/sbin/lvm' ] && ldd /sbin/lvm|grep -q 'not a dynamic executable';
+               if [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 'not a dynamic executable';
                then
                        print_info 1 'LVM2: Adding support (using local static binaries)...'
                        cp /sbin/lvm "${TEMP}/initrd-temp/bin/lvm" ||
@@ -176,8 +141,18 @@ create_base_initrd_sys() {
                                gen_die "LVM2 error: Could not link ${i}!"
                done
                mkdir -p ${TEMP}/initrd-temp/etc/lvm
-               cp /etc/lvm/lvm.conf "${TEMP}/initrd-temp/etc/lvm/lvm.conf" ||
-                       gen_die 'Could not copy over lvm.conf!'
+               if [ -x /sbin/lvm ]
+               then
+#                      lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over lvm.conf!'
+#                      ret=$?
+#                      if [ ${ret} != 0 ]
+#                      then
+                               cp /etc/lvm/lvm.conf "${TEMP}/initrd-temp/etc/lvm/" ||
+                                       gen_die 'Could not copy over lvm.conf!'
+#                      else
+#                              gen_die 'Could not copy over lvm.conf!'
+#                      fi
+               fi
        fi
        
        # EVMS2
@@ -194,7 +169,7 @@ create_base_initrd_sys() {
                                || gen_die 'Could not copy files for EVMS2!'
                        if [ -n "`ls /lib/libgcc_s*`" ]
                        then
-                               cp -a /lib/libgcc_s* "${TEMP}/initramfs-evms2-temp/lib" \
+                               cp -a /lib/libgcc_s* "${TEMP}/initrd-temp/lib" \
                                        || gen_die 'Could not copy files for EVMS2!'
                        fi
                        cp -a /lib/libc-* /lib/libc.* "${TEMP}/initrd-temp/lib" \
@@ -225,9 +200,9 @@ create_base_initrd_sys() {
        fi      
 
        for i in '[' ash basename cat chroot clear cp dirname echo env false find \
-       grep gunzip gzip ln ls loadkmap losetup lsmod mkdir mknod more mount mv \
-       pivot_root ps awk pwd rm rmdir rmmod sed sh sleep tar test touch true umount uname \
-       xargs yes zcat chmod chown cut kill killall; do
+       grep gunzip gzip ln ls loadkmap losetup lsmod mdev mkdir mknod more mount \
+       mv pivot_root ps awk pwd rm rmdir rmmod sed sh sleep tar test touch true \
+       umount uname xargs yes zcat chmod chown cut kill killall; do
                rm -f ${TEMP}/initrd-temp/bin/$i > /dev/null
                ln  ${TEMP}/initrd-temp/bin/busybox ${TEMP}/initrd-temp/bin/$i ||
                        gen_die "Busybox error: could not link ${i}!"
@@ -237,13 +212,13 @@ create_base_initrd_sys() {
        then
                if is_static /bin/cryptsetup
                then
-                       print_info "Including LUKS support"
+                       print_info "Including LUKS support"
                        rm -f ${TEMP}/initrd-temp/sbin/cryptsetup
                        cp /bin/cryptsetup ${TEMP}/initrd-temp/sbin/cryptsetup
                        chmod +x "${TEMP}/initrd-temp/sbin/cryptsetup"
                else
-                       print_info "LUKS support requires static cryptsetup at /bin/cryptsetup"
-                       print_info "Not including LUKS support"
+                       print_info "LUKS support requires static cryptsetup at /bin/cryptsetup"
+                       print_info "Not including LUKS support"
                fi
        fi
 }
@@ -385,7 +360,7 @@ create_initrd() {
        create_initrd_aux
 
        INITRD_CALC_SIZE=`calc_initrd_size`
-       INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 100`
+       INITRD_SIZE=`expr ${INITRD_CALC_SIZE} + 250`
        print_info 1 "        :: Size is at ${INITRD_SIZE}K"
        print_info 1 "        >> Creating loopback filesystem..."
        create_initrd_loop ${INITRD_SIZE}
@@ -402,32 +377,11 @@ create_initrd() {
                mv ${TMPDIR}/initrd-${KV}.gz ${TMPDIR}/initrd-${KV}
        fi
 
-       if [ "${BOOTSPLASH}" -eq "1" ]
-       then
-               if [ -x /sbin/splash ]
-               then
-                       [ -z "${BOOTSPLASH_THEME}" ] && [ -e /etc/conf.d/bootsplash.conf ] && source /etc/conf.d/bootsplash.conf
-                       [ -z "${BOOTSPLASH_THEME}" ] && [ -e /etc/conf.d/bootsplash ] && source /etc/conf.d/bootsplash
-                       [ -z "${BOOTSPLASH_THEME}" ] && BOOTSPLASH_THEME=default
-                       print_info 1 "        >> Installing bootsplash [ using the ${BOOTSPLASH_THEME} theme ]..."
-                       for bootRes in '800x600' '1024x768' '1280x1024' '1600x1200'
-                       do
-                               if [ -f "/etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg" ]
-                               then
-                                       /sbin/splash -s -f /etc/bootsplash/${BOOTSPLASH_THEME}/config/bootsplash-${bootRes}.cfg >> ${TMPDIR}/initrd-${KV} ||
-                                               gen_die "Error: could not copy ${bootRes} bootsplash!"
-                               else
-                                       print_warning 1 "splash: Did not find a bootsplash for the ${bootRes} resolution..."
-                               fi
-                       done
-               else
-                       print_warning 1 '        >> No bootsplash detected; skipping!'
-               fi
-       fi
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               cp ${TMPDIR}/initrd-${KV} ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ||
-                       gen_die 'Could not copy the initrd to ${BOOTDIR}!'
+               copy_image_with_preserve "initrd" \
+                       "${TMPDIR}/initrd-${KV}" \
+                       "initrd-${KNAME}-${ARCH}-${KV}"
        fi
 
        # Pegasos hack for merging the initrd into the kernel at compile time