Changeset 1230 in MondoRescue
- Timestamp:
- Mar 8, 2007, 5:41:17 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.2/mindi/mindi
r1021 r1230 69 69 NET_MODS="sunrpc nfs nfs_acl lockd loop mii 3c59x e100 bcm5700 bnx2 e1000 eepro100 ne2k-pci tg3 pcnet32 8139cp 8139too 8390 vmxnet vmnet" 70 70 EXTRA_MODS="$CDROM_MODS vfat fat loop md-mod linear raid0 raid1 xor raid5 lvm-mod dm-mod jfs xfs xfs_support pagebuf reiserfs ext2 ext3 minix nfs nfs_acl nfsd lockd sunrpc jbd" 71 # Replace with that line for HP OCMP e.g. 72 #DENY_MODS="MPS_Driver_Mapper mps octtldrv tscttl streams" 73 DENY_MODS="" 71 74 72 75 LOGFILE=/var/log/mindi.log … … 831 834 832 835 836 # Check kernel filesystem capabilites for accessing initrd image 837 # 838 # Interface definition: 839 # param #1: absolute path to kernel image 840 GetInitrdFilesystemToUse() { 841 842 # interface test: make sure we have one parameter 843 if [ $# -ne 1 ]; then 844 Die "GetInitrdFilesystemToUse(): Expected 1 parameter, got $#." 845 fi 846 847 # interface parameters 848 local lvKernelImage=$1 849 850 # local constants (filesystem magic strings) 851 local lcMagicCramfs="<3>cramfs: wrong magic" 852 local lcMagicExt2fs="<3>EXT2-fs: blocksize too small for device." 853 local lcMagicInitfs="<6>checking if image is initramfs..." 854 855 # local variables 856 local lvOffset 857 local lvScanRes 858 local lvUseFilesystem 859 860 # say where we are. 861 echo " GetInitrdFilesystemToUse(): called with parameter: $lvKernelImage.\n" >> $LOGFILE 862 863 # verify that file exists 864 [ ! -f $lvKernelImage ] && Die "File $lvKernelImage not found. Terminating." 865 866 # get offet of gzip magic "1f8b0800" in file 867 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'` 868 [ $lvOffset -eq 0 ] && Die "gzip magic not found in file $lvKernelImage. Terminating." 869 lvOffset=`expr $lvOffset / 2` 870 echo " GetInitrdFilesystemToUse(): gzip magic found at lvOffset $lvOffset.\n" >> $LOGFILE 871 872 # scan kernel image for initrd filessystem support 873 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c | strings | grep -e "$lcMagicCramfs" -e "$lcMagicExt2fs" -e "$lcMagicInitfs"` 874 875 # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs 876 if [ `echo $lvScanRes | grep -c "$lcMagicExt2fs"` -eq 1 ]; then 877 lvUseFilesystem="ext2fs" 878 elif [ `echo $lvScanRes | grep -c "$lcMagicInitfs"` -eq 1 ]; then 879 lvUseFilesystem="initramfs" 880 elif [ `echo $lvScanRes | grep -c "$lcMagicCramfs"` -eq 1 ]; then 881 lvUseFilesystem="cramfs" 882 else 883 lvUseFilesystem="UNSUPPORTED" 884 fi 885 886 # say what we are using 887 echo " GetInitrdFilesystemToUse(): Filesytem to use for initrd is $lvUseFilesystem.\n" >> $LOGFILE 888 889 # return file system to use 890 echo "$lvUseFilesystem" 891 892 } 893 833 894 # Searches parent raid device of given disk device 834 895 # $1: disk device (i.e. /dev/hda1) … … 886 947 local module_list module fname oss r kern 887 948 oss="/root/oss/modules" 888 module_list="`lsmod | sed -n '2,$s/ .*//p'`" 949 module_list="`lsmod | sed -n '2,$s/ .*//'`" 950 # Remove unwanted modules from list 951 for i in $DENY_MODS; do 952 module_list=`echo ${module_list} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 953 done 889 954 ### 890 955 ### Sq-Modification ... Use kernelname for module search path if specified … … 949 1014 echo "Problem with dead link on $file -> $link" >> $LOGFILE 950 1015 fi 951 if [ "`echo $link | cut -c1`" = "/" ]; then 952 echo "$link `ReadAllLink $link`" 953 else 954 d=`dirname $file` 955 echo "$link `ReadAllLink $d/$link`" 956 fi 1016 if [ -h "$d" ]; then 1017 echo "$link $d" 1018 else 1019 echo "$link" 1020 fi 957 1021 } 958 1022 … … 1071 1135 1072 1136 echo -en "for outerloop in 1 2 3 4 5 ; do\necho -en \".\"\n" >> $outfile 1073 list_to_echo="`lsmod | sed -n '2,$s/ .*//p'`" 1137 # BERLIOS: That code is duplicated - Should be done once only 1138 list_to_echo="`lsmod | sed -n '2,$s/ .*//'`" 1139 # Remove unwanted modules from list 1140 for i in $DENY_MODS; do 1141 list_to_echo=`echo ${list_to_echo} | tr ' ' '\n' | grep -Ev "^${i}$" | tr '\n' ' '` 1142 done 1074 1143 1075 1144 # Make temporary modprobe.conf file if we are told so … … 1734 1803 rootpart="" 1735 1804 fi 1736 outstr="image= vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS"1805 outstr="image=/vmlinuz\n\tlabel=$i\n\tinitrd=/mindi.rdz\n\t${rootpart}append=\" rw ramdisk=$ramdisksize ramdisk_size=$ramdisksize maxcpus=1 $ooo_mode $ADDITIONAL_BOOT_PARAMS" 1737 1806 1738 1807 outstr=$outstr" $ooo_mode" … … 1792 1861 1793 1862 MakeLiloConfFile $disksize > $liloconf 1863 1864 # Copy it so that CD-ROM menu entry is satisfied 1865 if [ "$ARCH" = "ia64" ] ; then 1866 mountefi=0 1867 df -T | grep /boot/efi | grep -q vfat 1868 if [ $? -ne 0 ]; then 1869 mount /boot/efi 1870 if [ $? -ne 0 ]; then 1871 echo "You have to mount your EFI partition when using mindi" 1872 MindiExit -1 1873 fi 1874 mountefi=1 1875 fi 1876 cp /boot/efi/elilo.efi $mountpoint 1877 cp $liloconf $mountpoint/elilo.efi $mountpoint/efi/boot 1878 if [ $mountefi -eq 1 ]; then 1879 umount /boot/efi 2>&1 > /dev/null 1880 fi 1881 fi 1794 1882 1795 1883 echo "Copying $MINDI_TMP/mindi.rdz to $mountpoint..." >> $LOGFILE … … 1814 1902 1815 1903 # copy the kernel across 1816 rm -Rf $mountpoint/lost+found1904 [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found 1817 1905 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null 1818 1906 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` … … 1954 2042 1955 2043 # copy the kernel across 1956 rm -Rf $mountpoint/lost+found2044 [ "$mountpoint" != "" ] && rm -Rf $mountpoint/lost+found 1957 2045 dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null 1958 2046 free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4` … … 2274 2362 bigdir=$1 2275 2363 minidir_root=$2 2276 rm -Rf $minidir_root/*2364 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/* 2277 2365 2278 2366 TryToFitDataIntoSeveralDirs $bigdir $minidir_root … … 2283 2371 fi 2284 2372 RejigHyperlinks $minidir_root $noof_disks 2285 rm -Rf $bigdir/*2373 [ "$bigdir" != "" ] && rm -Rf $bigdir/* 2286 2374 return $noof_disks 2287 2375 } … … 2461 2549 cd $old_pwd 2462 2550 echo -en "\rThe files have been subdivided into $noof_disks directories. \r" 2463 rm -Rf $minidir_root/compressed2551 [ "$minidir_root" != "" ] && rm -Rf $minidir_root/compressed 2464 2552 if [ "$retval" -gt "0" ] ; then 2465 2553 return 0 … … 2593 2681 echo "$disksize" > $mountpoint/tmp/$disksize.siz 2594 2682 find $mountpoint -name CVS -exec rm -rf '{}' \; 2595 umount $mountpoint || Die "Cannot unmount $tempfile" 2596 dd if=$tempfile bs=1k 2> /dev/null | gzip -v9 > $rdz_fname 2> /dev/null 2597 # gzip -9 $tempfile 2598 # mv $tempfile.gz $rdz_fname 2683 # Determine what filesystem to use for initrd image 2684 echo "Call GetInitrdFilesystemToUse() with parameter ${kernelpath} to get filesystem to use for initrd." >> $LOGFILE 2685 gvFileSystem=`GetInitrdFilesystemToUse ${kernelpath}` 2686 [ -z gvFileSystem ] && Die "GetFilesystemToUse() failed. Terminating." 2687 case "$gvFileSystem" in 2688 "ext2fs") 2689 # say what will be used 2690 echo "Creating an ext2 initrd image..." >> $LOGFILE 2691 # kernel expects linuxrc in ext2 filesystem 2692 ( cd $mountpoint && ln -sf sbin/init linuxrc ) 2693 # unmount loop filesystem and create image file using the standard approach 2694 umount $mountpoint || Die "Cannot unmount $tempfile" 2695 dd if=$tempfile bs=1k 2> /dev/null | gzip -v9 > $rdz_fname 2> /dev/null 2696 # log that we are done 2697 echo "...done." >> $LOGFILE 2698 ;; 2699 "initramfs") 2700 # say what will be used 2701 echo "Creating a gzip'ed cpio (AKA initramfs) initrd image..." >> $LOGFILE 2702 # make sure that cpio is there 2703 which cpio &> /dev/null; [ $? -eq 0 ] || Die "cpio not found. Please install package cpio and try again." 2704 # go into filesystem 2705 cd $mountpoint 2706 # kernel expects init in cpio filesystem 2707 ln -sf sbin/init init 2708 # create cpio image file and unmount loop filesystem 2709 find . -print | cpio -o -H newc | gzip -9 > $old_pwd/$rdz_fname 2> /dev/null 2710 cd $old_pwd 2711 umount $mountpoint || Die "Cannot unmount $tempfile" 2712 # log that we are done 2713 echo "...done." >> $LOGFILE 2714 ;; 2715 *) 2716 Die "Filesystem $gvFileSystem not supported for initrd image. Terminating." 2717 ;; 2718 esac 2599 2719 if [ "$res" -eq "0" ] ; then 2600 2720 echo -en "..." … … 2649 2769 [ "`du -sm $imagesdir/all.tar.gz | cut -f1`" -ge "30" ] && Die "You have too many tools in your shed" 2650 2770 cd $old_pwd 2651 rm -Rf $minidir_root2771 [ "$minidir_root" != "" ] && rm -Rf $minidir_root 2652 2772 echo -e "$DONE" 2653 2773 } … … 2764 2884 echo "df result:" >> $LOGFILE 2765 2885 echo "----------" >> $LOGFILE 2766 df >> $LOGFILE 2886 df -T >> $LOGFILE 2887 echo "-------------" >> $LOGFILE 2888 echo "mount result:" >> $LOGFILE 2889 echo "-------------" >> $LOGFILE 2890 mount >> $LOGFILE 2767 2891 echo "-------------" >> $LOGFILE 2768 2892 echo "lsmod result:" >> $LOGFILE 2769 2893 echo "-------------" >> $LOGFILE 2770 2894 lsmod >> $LOGFILE 2895 echo "-------------" >> $LOGFILE 2896 echo "Liste of extra modules is:" >> $LOGFILE 2897 echo "$EXTRA_MODS" >> $LOGFILE 2771 2898 echo "-------------" >> $LOGFILE 2772 2899
Note:
See TracChangeset
for help on using the changeset viewer.