Magellan Linux

Diff of /trunk/mkinitrd-magellan/mkinitrd.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1516 by niro, Wed Sep 7 17:48:06 2011 UTC revision 1876 by niro, Wed Jul 11 09:57:18 2012 UTC
# Line 39  PROBE="yes" Line 39  PROBE="yes"
39  MODULES=""  MODULES=""
40  PREMODS=""  PREMODS=""
41  NOSTRIP=false  NOSTRIP=false
42    FIRMWARE_PATH="/lib/firmware"
43    FIRMWARE_FILES=""
44    
45  [ -e /etc/conf.d/mkinitrd ] && . /etc/conf.d/mkinitrd  [ -e /etc/conf.d/mkinitrd ] && . /etc/conf.d/mkinitrd
46    
# Line 342  get_blkid() Line 344  get_blkid()
344   echo ${UUID}   echo ${UUID}
345  }  }
346    
347    add_firmware()
348    {
349     local firmware="$1"
350     local i
351    
352     # check if given firmware is already included in FIRMWARE_FILES
353     for i in ${FIRMWARE_FILES}
354     do
355     [[ ${firmware} = ${i} ]] && return 0
356     done
357    
358     # include firmware
359     FIRMWARE_FILES="${FIRMWARE_FILES} ${firmware}"
360    }
361    
362  # need r00t privs  # need r00t privs
363  [[ $(id -u) != 0 ]] && die "you must be r00t."  [[ $(id -u) != 0 ]] && die "you must be r00t."
364    
# Line 754  add_initrd '#!/bin/sh' Line 771  add_initrd '#!/bin/sh'
771    
772  add_initrd 'mount -t proc proc /proc'  add_initrd 'mount -t proc proc /proc'
773  add_initrd 'mount -t sysfs sysfs /sys'  add_initrd 'mount -t sysfs sysfs /sys'
774  add_initrd 'mount -t tmpfs tmpfs /dev -o rw,mode=0644,size=1024'  add_initrd "if [[ -z \$(grep '[[:space:]]/dev[[:space:]]' /proc/mounts | cut -d ' ' -f2) ]]"
775    add_initrd 'then'
776    add_initrd ' # many video drivers needed exec access'
777    add_initrd ' fstype=ramfs'
778    add_initrd ' # tmpfs was suggested by Greg Kroah-Hartman'
779    add_initrd " [[ \$(grep '[[:space:]]tmpfs' /proc/filesystems | cut -d \$'\\t' -f2) = tmpfs ]] && fstype=tmpfs"
780    add_initrd ' # mount devtmpfs if supported'
781    add_initrd " [[ \$(grep '[[:space:]]devtmpfs' /proc/filesystems | cut -d \$'\\t' -f2) = devtmpfs ]] && fstype=devtmpfs"
782    add_initrd ' mount -t ${fstype} dev /dev -o exec,nosuid,mode=0755,size=10M'
783    add_initrd 'fi'
784    
785  [[ ${IMAGE_TYPE} = loopback ]] && add_initrd 'mount -t ramfs -o remount,rw /dev/ram /'  [[ ${IMAGE_TYPE} = loopback ]] && add_initrd 'mount -t ramfs -o remount,rw /dev/ram /'
786    
# Line 807  do Line 833  do
833   add_initrd "echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online"   add_initrd "echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online"
834   done   done
835   fi   fi
836    
837     # get firmware files if neccessary
838     if [ -x $(which modinfo 2> /dev/null) ]
839     then
840     firmware_blobs=$(modinfo ${module}${text} | grep 'firmware:' | sed 's:^firmware\:.*[[:space:]]\(.*\):\1:')
841     if [[ ! -z ${firmware_blobs} ]]
842     then
843     for firmware in ${firmware_blobs}
844     do
845     add_firmware "${firmware}"
846     done
847     fi
848     else
849     echo "Warning 'modinfo' not found"
850     fi
851  done  done
852    
853  # respect rootdelay kernel param  # respect rootdelay kernel param
# Line 872  add_initrd 'for i in $(cat /proc/cmdline Line 913  add_initrd 'for i in $(cat /proc/cmdline
913  add_initrd 'if [ "${BREAK_ENABLED}" = "yes" ]; then echo "-- Break requested, type 'exit' to resume operation ..."; ash; fi'  add_initrd 'if [ "${BREAK_ENABLED}" = "yes" ]; then echo "-- Break requested, type 'exit' to resume operation ..."; ash; fi'
914    
915  add_initrd 'echo "-- Switching to real sysroot ..."'  add_initrd 'echo "-- Switching to real sysroot ..."'
916  add_initrd 'umount /dev'  add_initrd 'mount --move /dev /sysroot/dev'
917  add_initrd 'umount /sys'  add_initrd 'mount --move /sys /sysroot/sys'
918  add_initrd 'umount /proc'  add_initrd 'mount --move /proc /sysroot/proc'
919    
920  [[ ${IMAGE_TYPE} = initramfs ]] && add_initrd 'exec run-init /sysroot ${INITEXEC} $@ </sysroot/dev/console >/sysroot/dev/console'  [[ ${IMAGE_TYPE} = initramfs ]] && add_initrd 'exec run-init /sysroot ${INITEXEC} $@ </sysroot/dev/console >/sysroot/dev/console'
921  if [[ ${IMAGE_TYPE} = loopback ]]  if [[ ${IMAGE_TYPE} = loopback ]]
# Line 907  do Line 948  do
948   fi   fi
949  done  done
950    
951    # install firmware if neccessary
952    if [[ ! -z ${FIRMWARE_FILES} ]]
953    then
954     for firmware in ${FIRMWARE_FILES}
955     do
956     if [ -e ${FIRMWARE_PATH}/${firmware} ]
957     then
958     echo "installing firmware '${firmware}'"
959     install ${verbose} -d ${DEST}/${FIRMWARE_PATH}/${firmware%/*} || die
960     cp ${verbose} -a ${FIRMWARE_PATH}/${firmware} ${DEST}/${FIRMWARE_PATH}/${firmware%/*} || die
961     fi
962     done
963    fi
964    
965  # create the image  # create the image
966  echo "Creating initrd image '${target}' ..."  echo "Creating initrd image '${target}' ..."
967  if [[ ${IMAGE_TYPE} = initramfs ]]  if [[ ${IMAGE_TYPE} = initramfs ]]

Legend:
Removed from v.1516  
changed lines
  Added in v.1876