| 
 | 
 本帖最后由 2011niumao 于 2017-1-12 19:35 编辑  
 
 
已经找到原因了。是local文件修改时候引入的一个问题。在修改local文件时候把系统一些解析引导参数的指令也跳过去了。只需要调整一个语句的位置就好了。把 if [ -z "$kloop" ]; then 从原先一开始的位置向后移动到local_premount 语句后面,就可以使用root=UUID=XXXXXXXXXXXXXXXXXXx  和root=LABEL=XXX来引导了。测试通过了。以下是新的写法。仅仅是调整 了if [ -z "$kloop" ]; then位置。local_mount_root() 
{ 
 
        local_top 
        local_device_setup "${ROOT}" root 
        ROOT="${DEV}" 
 
        # Get the root filesystem type if not set 
        if [ -z "${ROOTFSTYPE}" ]; then 
                FSTYPE=$(get_fstype "${ROOT}") 
        else 
                FSTYPE=${ROOTFSTYPE} 
        fi 
 
        local_premount 
 
if [ -z "$kloop" ]; then 
 
        if [ "${readonly}" = "y" ] && \ 
           [ -z "$LOOP" ]; then 
                roflag=-r 
        else 
                roflag=-w 
        fi 
 
        # FIXME This has no error checking 
        [ -n "${FSTYPE}" ] && modprobe ${FSTYPE} 
 
        checkfs ${ROOT} root 
 
        # FIXME This has no error checking 
        # Mount root 
        mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt} 
        mountroot_status="$?" 
        if [ "$LOOP" ]; then 
                if [ "$mountroot_status" != 0 ]; then 
                        if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then 
                                panic " 
Could not mount the partition ${ROOT}. 
This could also happen if the file system is not clean because of an operating 
system crash, an interrupted boot process, an improper shutdown, or unplugging 
of a removable device without first unmounting or ejecting it.  To fix this, 
simply reboot into Windows, let it fully start, log in, run 'chkdsk /r', then 
gracefully shut down and reboot back into Windows. After this you should be 
able to reboot again and resume the installation. 
(filesystem = ${FSTYPE}, error code = $mountroot_status) 
" 
                        fi 
                fi 
         
                mkdir -p /host 
                mount -o move ${rootmnt} /host 
 
                while [ ! -e "/host/${LOOP#/}" ]; do 
                        panic "ALERT!  /host/${LOOP#/} does not exist.  Dropping to a shell!" 
                done 
 
                # Get the loop filesystem type if not set 
                if [ -z "${LOOPFSTYPE}" ]; then 
                        eval $(fstype < "/host/${LOOP#/}") 
                else 
                        FSTYPE="${LOOPFSTYPE}" 
                fi 
                if [ "$FSTYPE" = "unknown" ] && [ -x /sbin/blkid ]; then 
                        FSTYPE=$(/sbin/blkid -s TYPE -o value "/host/${LOOP#/}") 
                        [ -z "$FSTYPE" ] && FSTYPE="unknown" 
                fi 
 
                if [ ${readonly} = y ]; then 
                        roflag=-r 
                else 
                        roflag=-w 
                fi 
 
                # FIXME This has no error checking 
                modprobe loop 
                modprobe ${FSTYPE} 
 
                # FIXME This has no error checking 
                mount ${roflag} -o loop -t ${FSTYPE} ${LOOPFLAGS} "/host/${LOOP#/}" ${rootmnt} 
 
                if [ -d ${rootmnt}/host ]; then 
                        mount -o move /host ${rootmnt}/host 
                fi 
        fi 
 
fi 
 
        ###################################### 
        #                            kloop by niumao                                # 
        ###################################### 
 
if [ -n "$kloop" ]; then 
 
        ### reset the value of the root variable  
        HOSTDEV="${ROOT}" 
        NEWROOT="${rootmnt}" 
        [ -n "$kroot" ] && ROOT="$kroot" 
        [ -n "$kroot" ] || ROOT="/dev/loop0" 
        export ROOT 
        realroot="$ROOT" 
         
        ###  auto probe the fs-type of the partition in which vhd-file live and mount it  /host  
        mkdir -p /host 
        if [ -z "$hostfstype" ]; then 
                hostfstype="$(blkid -s TYPE -o value "${HOSTDEV}")" 
                [ -z "$hostfstype"  -o "${hostfstype}" = "ntfs" ] && hostfstype="ntfs-3g" 
        fi 
        [ "${hostfstype}" = "ntfs-3g" ] || modprobe ${hostfstype} 
        mount -t ${hostfstype} -o rw  ${HOSTDEV}  /host 
         
        ### mount the vhd-file on a loop-device  
        if [ "${kloop#/}" !=  "${kloop}" ]; then                
                modprobe  loop   
                kpartx -av /host$kloop 
                [ -e "$realroot" ] || sleep 3 
        fi 
 
        ### probe lvm on vhd-file 
        if [ -n "$klvm" ];  then 
                modprobe dm-mod 
                vgscan 
                vgchange  -ay  $klvm 
                [ -e "$realroot" ] ||  sleep 3 
        fi  
 
        if [ "${readonly}" = "y" ] ; then 
                roflag="-r" 
        else 
                roflag="-w" 
        fi 
          
        ### mount the realroot / in vhd-file on $NEWROOT  
        if [ -z "${kloopfstype}" ]; then 
                kloopfstype="$(blkid -s TYPE -o value "$realroot")" 
                [ -z "${kloopfstype}" ] && kloopfstype="ext4" 
        fi 
        [ -e "$realroot" ] || sleep 3 
        mount    ${roflag} -t "${kloopfstype}"  $realroot $NEWROOT 
         
        ### mount /host in initrd to /host of the realrootfs 
        if [  "${hosthidden}" != "y" ] ; then 
                [ -d "${NEWROOT}"/host ] || mkdir -p ${NEWROOT}/host  
                mount --move /host   ${NEWROOT}/host 
        fi 
fi 
 
        ###################################### 
        #                     kloop by niumao ended                       # 
        ###################################### 
 
}  |   
 
 
 
 |