Changeset 2429 in MondoRescue
- Timestamp:
- Sep 28, 2009, 11:46:16 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi/mindi
r2424 r2429 646 646 647 647 # Check kernel filesystem capabilites for accessing initrd image 648 # Could be ext2 FS (old mode) or initramfs (new mode) 648 649 # 649 650 # Interface definition: … … 681 682 if [ $? -eq 0 ]; then 682 683 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 683 else 684 # Since 2.6.30 kernel can use lzma and bzip2 in addition to gzip for initramfs compression 685 # get offet of gzip magic "1f8b0800" in file (or 1f8b9e ??) 686 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'` 687 if [ $lvOffset -eq 0 ]; then 688 # get offet of bzip2 magic "425a" in file 689 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "425a")}'` 690 if [ $lvOffset -eq 0 ]; then 691 # get offet of lzma magic "5d00" in file 692 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "5d00")}'` 693 if [ $lvOffset -eq 0 ]; then 694 Die "No magic compression pattern found in file $lvKernelImage. Terminating." 695 else 696 comp="lzma" 697 fi 698 else 699 comp="bzip2" 700 fi 684 685 # determine which filesystem to use for initrd image: ext2|3fs, gzip'ed cpio (initramfs) or cramfs 686 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 687 lvUseFilesystem="ext2fs" 688 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 689 lvUseFilesystem="ext3fs" 690 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 691 lvUseFilesystem="initramfs" 692 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 693 lvUseFilesystem="cramfs" 701 694 else 702 comp="gzip" 703 fi 704 705 lvOffset=`expr $lvOffset / 2` 706 echo " GetInitrdFilesystemToUse(): $comp magic found in $lvKernelImage at lvOffset $lvOffset.\n" >> $LOGFILE 707 708 # scan kernel image for initrd filessystem support 709 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | $comp -dc 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 710 fi 711 712 # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs 713 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 714 lvUseFilesystem="ext2fs" 715 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 716 lvUseFilesystem="ext3fs" 717 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 695 lvUseFilesystem="UNSUPPORTED" 696 fi 697 698 else 699 # In that case, we are after 2.6.30 and use the supported initramfs 718 700 lvUseFilesystem="initramfs" 719 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 720 lvUseFilesystem="cramfs" 721 else 722 lvUseFilesystem="UNSUPPORTED" 723 fi 724 701 fi 725 702 # say what we are using 726 echo " GetInitrdFilesystemToUse(): Filesytem to use for init rdis $lvUseFilesystem.\n" >> $LOGFILE703 echo " GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem.\n" >> $LOGFILE 727 704 728 705 # return file system to use
Note:
See TracChangeset
for help on using the changeset viewer.