110654 发表于 2016-4-5 13:52:03

关于AHCI模式在PE无法识别硬盘,F6IMG代码是grub4dos,版主救命啊

本帖最后由 110654 于 2016-4-5 14:01 编辑

目前个人发现天意PE晨风PE的兼容AHCI模式能识别硬盘是因为加了F6IMG模块驱动批处理,其代码是grub4dos
其原理是:(复制文章-来自百度)

title WinPE V1.0
if exist ()/BOOT/GRUB/F6IMG || find --set-root /BOOT/GRUB/F6IMG
command /BOOT/GRUB/F6IMG
chainloader /ldrxpe

将F6IMG放入BOOT/GRUB下。SRS文件夹放在U盘根目录下,grldr文件记住要用最新的。
这样就可以了。
我之前也是一直都不成功,现在OK了。


=====



原理是这样。f6img是个批处理。它会自动搜索磁盘根目录/SRS文件夹下的驱动包。(驱动包要自备。可以支持gz。img等格式。)自动获取机器id判断驱动。并虚拟为软驱fd0。这样就可以为下一步启动的pe提供srs驱动。让它能识别硬盘。最好把f6img放在boot/grub文件夹下。驱动包放在/SRS文件夹下。这样可以免路径。但是grub必须是目前最新的版本。例如你ud根目录有个pe.iso。这样写就可以:
command f6img (如果路径不是默认路径的话要指明路径如:command /DIY/F6IMG /DIY/SRS 注意空格,后面路径是驱动包路径 )
map --mem ()/pe.iso (0×ff)
chainloader (0×ff)


===



grldr文件记住要用最新的---唉,之前百思不得其解。下载最新
http://code.google.com/p/grub4dos-chenall/downloads/detail?name=grub4dos-0.4.6a-2012-03-26.7z&can=2&q=

运行F6IMG成功。



===



原理是这样。f6img是个批处理。它会自动搜索磁盘根目录/SRS文件夹下的驱动包。(驱动包要自备。可以支持gz img等格式。)自动获取机器id判断驱动。并虚拟为软驱fd0。这样就可以为下一步启动的pe提供srs驱动。让它能识别硬盘。最好把f6img放在boot/grub文件夹下。驱动包放在/SRS文件夹下。这样可以免路径。但是grub必须是目前最新的版本。例如你ud根目录有个pe.iso。这样写就可以:
command f6img (如果路径不是默认路径的话要指明路径如:command /DIY/F6IMG /DIY/SRS 注意空格,后面路径是驱动包路径 )
map --mem ()/pe.iso (0×ff)
chainloader (0×ff)


=====



终于找到这个:command /DIY/F6IMG /DIY/SRS 注意空格,后面路径是驱动包路径 )
 这个最有用,终于可以将SRS放到其他目录了



那么grub2做为主引导的,为了兼容这个AHCI,就必须修改F6IMG其中的代码批处理
下面是部分代码:(截取天意PE)

!BAT
checkrange 20111106:-1 read 0x8278 > nul || clear && echo -e \n Not supported grub4dos version!\n && exit
calc *0x8280&0xff/2 > nul || debug 1 > nul && command | call :zip_fix =
read 0x82b8 > nul && calc *0x82b9&0xff/2 > nul || debug 1 > nul && command | call :zip_fix =
setlocal && debug 0 || set *
map --mem=0x20000 %~f0 (rd)
cat --locate=\x1f\x8b --number=1 (rd)+1 > nul || exit 1
calc *0x82d8=*0x82d8-%?% > nul
calc *0x82d0=*0x82d0+%?% > nul
map --mem (rd)+1 (1) && map --rehook
map --mem (fd1)/f6.gz (0) && map --rehook
insmod (1)/F6.MOD > nul || exit
if /i %1==--x64 shift 1 || if /i %2==--x64 || echo -n ! set x64=64 && cat --locatei=WinVBlock32 --replace=WinVBlock64 --number=1 (1)/txtsetup.oem > nul
::检测本机的SRSID是否符合标准,标准的ID截取前21位,否则使用完整ID搜索.
chkpci -srs | set WHID=
clear && if not exist WHID && echo -e \n$ Can't Found $ACHI/RAID controller!\n&& goto :end
if /i "%WHID:~0,7%"=="PCI\VEN" set SRSID=%WHID:~0,21% || set SRSID=%WHID%
if "%1"=="" set /u srs=/srs/ || if "%~x1"==".lzma" call :.lzma %~f1 || set /u srs=%~pnx1 && rootnoverify %~d1
if "%srs:~-1%"=="/" || set srs=%srs%/
checkrange 0x21 read 0x8280 || find --set-root ls %srs% > nul || echo -e \n$ Can't Find the $%srs%$!\n && goto :end
if exist %srs%%%SRSID:~8,4%.lzma call :.lzma %srs%%%SRSID:~8,4%.lzma || call :%SRSID:~8,4% || call :OTHER
root %srs% || root %@root%%%srs%
ls | call :find_oem %@root% || echo -e \n$ Copy drivers $success!\n ! if exist x64 echo -e \n$The controller x64 drivers are $not found$! Your hardware ID is:\n $ %WHID% || echo -e \n$The controller x86 drivers are $not found$! Your hardware ID is:\n $ %WHID%

:end
map --unmap=2 && map --rehook
endlocal && delmod fat > nul && delmod chkpci > nul
exit

:.lzma
if exist %1 map --mem %1 (2) && map --rehook && rootnoverify (2) > nul && set /u srs=(2)/
exit

:1002
:1022
if exist %srs%AMD.lzma call :.lzma %srs%AMD.lzma
exit

:182F
:1166
if exist %srs%BCM.lzma call :.lzma %srs%BCM.lzma
exit

:OTHER
if exist%srs%OTHER.lzma call :.lzma %srs%OTHER.lzma
exit
::处理U盘被识别为ZIP,为了保持和非ZIP一致,调整U盘为HD0
:zip_fix
setlocal
set /a hd0=*0x475&0xff+0x7f > nul
call :move
map (0) (hd0) > nul || goto :end
map --rehook
map --floppies=0
endlocal
set bdtmp=%~5
set bdtmp=%bdtmp:~4%
if "%bdtmp%"=="(bd)" || if "%~d4"=="(fd0)" command --set-path=(hd0)%~p4 || if "%~d4"=="(fd0,0)" command --set-path=(hd0,0)%~p4
read 0x82b8 > nul && calc *0x82b9=*0x82b9&0xffffff00|0x80 > nul
set bdtmp= && exit
:move
if %hd0%==127 exit
set /a hd1=%hd0%+1 > nul
map (%hd0%) (%hd1%) > nul
set /a hd0=%hd0%-1 > nul
goto :move
::递归算法将所有包含txtsetup.oem并匹配ID
:find_oem
if "%2"=="" && root %1 > nul && exit
if exist %~dp2txtsetup.oem && cat --locatei=%SRSID:~-16% --number=1 %~dp2txtsetup.oem > nul && ls %~dp2txtsetup.oem | set oemfile= && goto :copy_oem
ls %~f2/ > nul && root %~f2 > nul && ls | call :find_oem %~dp2 ! if /i "%~nx2"=="%~n2.lzma" && call :.map %~f2 && ls (2)/ | call :find_oem %~dp2
shift 2 && goto :find_oem
::复制匹配oem文件下所有的镜像文件到虚拟软驱A盘中。
:copy_oem
root %~dp2 > nul && ls | call :xcopy %@root% (0)/
cat --length=0 (0)/%oemfile% > nul
calc *0x8290/0x200+1 > nul
call :ass_oem %?% (md)0x200+%@retval% (0)/%oemfile% && exit 1
exit
:xcopy
if "%3"=="" && root %1 && exit
ls %~f3/ > nul && root %~f3 && fat mkdir %2%~nx3 && ls | call :xcopy %~dp3 %2%~nx3/ ! fat copy /o %~f3 %2
shift 3 && goto :xcopy

#处理txtsetup.oem文件


知识有限,无法理解这类高深的批处理,但从中看到了map命令,grub2中是没有这个命令的,所以就无法执行这个批处理,所以在gurb2的菜单指引了F6IMG仍然无法成功
我相信grub2应该可以实现这样的批处理,版主救命啊。。。。
求版主出来主持大局????

lbw2007 发表于 2016-4-5 20:59:52

帮顶吧。grub2执行不了grub4dos的批处理的,你想多了。
页: [1]
查看完整版本: 关于AHCI模式在PE无法识别硬盘,F6IMG代码是grub4dos,版主救命啊