无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
楼主: chenall
打印 上一主题 下一主题

[原创]支持外置硬盘控制器驱动,可任意方式启动的PE[10-01-13稳定版]

  [复制链接]
1711#
发表于 2010-3-15 10:25:48 | 只看该作者
你用geometry (hd0) 查看一下,贴图看看。
回复

使用道具 举报

1712#
发表于 2010-3-15 12:34:37 | 只看该作者
yyjdelete,你的情况可不能算是糟糕的。相反,我认为你的机器对 grub4dos 的支持是比较好的。

不要太过于强求完美,完美是达不到的。有很多机器在 BIOS 中都不能识别大硬盘。137G是一个界限,有很多机器的 BIOS 不能访问位于 137G 以后的扇区。

因此,这个问题是 BIOS 造成的,但又是普通的问题,所以也就不算是问题了。

你的主分区占有 30G,你的第一个逻辑分区是 137G,因此,你的第一个逻辑分区的大部分(107G)都落在 BIOS 可以访问的区域中,这个分区中剩余的 30G 可能无法被 BIOS 访问。而你的第二个逻辑分区就可能完全无法被 BIOS 访问了(因为它完全位于 137G 以后)。

如果是这样的话,这完全在意料之中。
回复

使用道具 举报

1713#
发表于 2010-3-15 13:08:35 | 只看该作者
原帖由 zhaohj 于 2010-3-15 10:25 发表
你用geometry (hd0) 查看一下,贴图看看。

grub> geometry (hd0)
drive 0x80(LBA): C/H/S=1024/255/63,Sector Count/Size=625137345/512
   Partition num: 0, active,  Filesystem type is fat,partition type 0x0C
   Partition num: 4,  Filesystem type is ntfs,partition type 0x07
原帖由 不点 于 2010-3-15 12:34 发表
yyjdelete,你的情况可不能算是糟糕的。相反,我认为你的机器对 grub4dos 的支持是比较好的。不要太过于强求完美,完美是达不到的。有很多机器在 BIOS 中都不能识别大硬盘。137G是一个界限,有很多机器的 B ...

谢谢不点前辈的关心,要注意身体啊,我现在碰到过的机器对G4D兼容性都比较好
回复

使用道具 举报

1714#
发表于 2010-3-23 12:25:38 | 只看该作者
请教chenall:

最近yy一个ISO --> IMG核心NORAM网启
ISO中内置了Firadisk.sys,SETUPLDR.BIN和NTDETECT.COM在“(cd)\wxpe\”
以下菜单启动成功:

title       SP3_PE Noram ISO Boot
pause --wait=0 Loading WinPE Image.
map --mem /SP3_PE Noram .ISO (0xff)
map --hook
root (0xff)
chainloader (0xff)

转为IMG核心后,以下菜单报 ntdetect failed

title        SP3_PE Noram Img Boot
pause --wait=0 Loading WinPE Image.
map --mem /SP3_PE Noram.IMG (hd0)
map --hook
chainloader (hd0,0)/wxpe/setupldr.bin

将SETUPLDR.BIN和NTDETECT.COM放在根下,报:

     INF file txtsetup.sif is corrupt or missing, status 18

后来借用你IMG核心中的setupldr后,启动成功!

请问你setupldr怎么搞的,而且只有153k。想整整明白。

[ 本帖最后由 canmao 于 2010-3-23 12:28 编辑 ]
回复

使用道具 举报

1715#
发表于 2010-3-23 13:12:33 | 只看该作者
发现一个笔误<br />#13<br />title<br />#查找OEM_SCSI.IMG和OEM_SRS.ZIP<br />write 0x60008 1<br />find --set-root --ignore-floppies --ignore-cd /OEM_SRS.ZIP && write 0x60008 2 && map --mem=0xB000 /OEM_SRS.ZIP (rd) ! WENV run find --set-root --ignore-floppies --ignore-cd ${srspath}/OEM_SRS.ZIP && write 0x60008 2 && WENV run map --mem=0xB000$ {srspath}/OEM_SRS.ZIP /OEM_SRS.ZIP (rd)
回复

使用道具 举报

1716#
发表于 2010-3-23 13:18:09 | 只看该作者
请问你setupldr怎么搞的,而且只有153k。想整整明白。
<br />

XP的本来就很小。
你用WINHEX查看一下setupldr.bin里面的路径是否正确。
回复

使用道具 举报

1717#
发表于 2010-3-23 13:52:05 | 只看该作者
回楼上:
刚查了一下2001年的xp光盘,ntldr也有225k。
回复

使用道具 举报

1718#
发表于 2010-3-23 23:38:21 | 只看该作者
如果RAM方式,跟RAMDISK.SYS有关。你可以用2003-SP1的RAMDISK代替。最好SETUPLDR.BIN也用03SP1的。
回复

使用道具 举报

1719#
 楼主| 发表于 2010-3-24 14:57:38 | 只看该作者
那个SETUPLDR.BIN是经过GZ压缩过的,所以才会那么小。。

至少修改的方法,记得我很早的时候在论坛上有介绍的,忘了在哪里了。你可以自己搜一下论坛。。

另外也可以看一下我搏客的相关文章,也许会有所启发。
http://www.chenall.com/blog/2009/11/SETUPLDR.html
回复

使用道具 举报

1720#
发表于 2010-3-24 15:05:40 | 只看该作者
学习了,谢谢chenall。
回复

使用道具 举报

1721#
发表于 2010-4-8 09:59:55 | 只看该作者
现在新机器,XP的驱动支持越来越少了。C大能不能考虑一下把内核改成03的呢?
回复

使用道具 举报

1722#
 楼主| 发表于 2010-4-8 10:22:26 | 只看该作者
嘻嘻,一段时间没有接触,已经冷下来了。
没有XP的驱动可以用03的啊,一般情况下都可以使用的。
回复

使用道具 举报

1723#
发表于 2010-4-10 19:21:48 | 只看该作者
独产网络包有没有!????????????
回复

使用道具 举报

1724#
发表于 2010-4-15 15:22:03 | 只看该作者

怎么用呀

能不能说说怎么用,还有安装方法,我是新手,别见笑
回复

使用道具 举报

1725#
发表于 2010-4-18 10:34:20 | 只看该作者
学习一下,使用看看了
回复

使用道具 举报

1726#
发表于 2010-4-23 12:38:20 | 只看该作者
使用CSPE,PXE启动:
这几天有几台机器找不到网卡,就把网卡驱动打包成_NET.CAB,放在DRIVERS\_NET.CAB (文件大小5.6M)

问题1:tftp get %DRV_R%\Drivers\_NET.CAB %Tftp_SERVER%
          IF ERRORLEVEL 1 tftp get %DRV_R%\Drivers\_NET.ZIP %Tftp_SERVER%
          IF ERRORLEVEL 1 tftp get %DRV_R%\Drivers\_NET.7Z %Tftp_SERVER%
          copy %DRV_R%\Drivers\_NET.* c:\Drivers
     DOS下传输太慢,花费了2分多钟时间,效率太低。现在反正有FAT命令,干脆提前copy.
问题2:虚拟机测试,网卡是E1000,驱动肯定在包中,但失败。

[ 本帖最后由 zhaohj 于 2010-4-23 12:39 编辑 ]

Snap1.jpg (80.97 KB, 下载次数: 186)

Snap1.jpg
回复

使用道具 举报

1727#
发表于 2010-4-23 12:55:37 | 只看该作者
PXE启动处理方式要不改动一下,PXE启动网络是关键,NETID.TXT方式虽好,但网卡种类太多,不容易从其他地方移值;
而打包方式移值容易,但程序要做改动,先拷贝好驱动(可能内核要扩大几M),干脆到桌面后自动处理。
回复

使用道具 举报

1728#
发表于 2010-4-23 16:18:38 | 只看该作者
下面是Python做的生成NETID.TXT,系统需要安装Python2.5版本以上。
程序有点缺点,NVIDIA的 %nvnetbus.DeviceDesc%=nvnetBus_Device, PCI\VEN_10DE&DEV_03E6不会生成
网友jamesdai2002对RIS比较熟悉,以下是他写的程序。在此表示感谢!

#coding:gb2312
#!/usr/bin/env python
# -*- Mode: Python; tab-width: 4 -*-
# 在网卡驱动文件夹内生成.cab文件, 并且生成NETID.TXT
# Inf Driver parser
#
# ======================================================================

from codecs import utf_16_le_decode, BOM_LE, BOM_BE
from sys import argv, exit as sys_exit
from os.path import isfile
from glob import glob
from cPickle import dump
from traceback import format_exc
import os


__version__ = '1.0'

### Compatibility with python 2.1
if getattr(__builtins__, 'True', None) is None:
    True=1
    False=0

class_guids = ['{4d36e972-e325-11ce-bfc1-08002be10318}']
classes = ['net']

exclude = ['layout.inf', 'drvindex.inf', 'netclass.inf']

debug = 0
dumpdev = 0

bustype = { 'USB'   :  1,
            'PCI'   :  5,
            'PCMCIA':  8,
            'ISAPNP': 14
            }

def csv2list(value):
    values = value.strip().split(',')
    for i in range(len(values)):
        values = values.strip()
    return values

def str_lookup(dc, c_key):
    for key in dc.keys():
        if key.lower() == c_key.lower():
            if len(dc[key])>0:
                return dc[key].pop()
    return 'NoDesc'

def item_lookup(dc, c_key):
    for key in dc.keys():
        if key.lower() == c_key.lower():
            return dc[key]
    return None

def fuzzy_lookup(strlist, pattern, ends=None):
    for s in strlist:
        if ends is not None and not s.endswith('services'): continue
        if s.startswith(pattern): return s
    return None


def unquote(text):
    return ''.join(text.split('"'))

def skip_inf(line):
    ## Check if driver is requested
    if line.find('=') == -1: return False
    key, value = line.split('=', 1)
    key = key.strip().lower()
    value = value.strip().lower()
    if key == 'class' and value not in classes: return True
    if key == 'classguid' and value not in class_guids: return True
    return False

def parse_line(sections, secname, lineno, line):
    equal = line.find('=')
    comma = line.find(',')
    if equal + comma != -2:
        if equal == -1:
            equal = comma+1
        if comma == -1:
            comma = equal+1

    if debug > 2: print '[%d] [%s] equal = %d - comma = %d' % (lineno, secname, equal, comma)

    if len(line) + equal + comma == -1:
        if debug: print '[%d] [%s] Invalid line' % (lineno, secname)
        return True

    ### Values
    if equal < comma:
        if type(sections[secname]) != type({}):
            sections[secname] = {}
        section = sections[secname]
        key, value = line.split('=', 1)
        key = key.strip()

        ### SkipList
        if key == '0':return True

        if section.has_key(key):
            values = csv2list(value)
            ### SkipList
            if (len(values) < 2) or (value.find('VEN_') == -1) or (value.find('DEV_') == -1):
                return True
            oldkey = key
            key = key + '_dev_' + values[1]

            if debug > 1: print '[%d] [%s] Duplicate key %s will be renamed to %s' % \
               (lineno, secname, oldkey, key)

        if secname == 'manufacturer':
            mlist = value.strip().split(',')
            mf = mlist[0].strip().lower()
            if len(mlist) > 1:
                ml = []
                for m in mlist[1:]:
                    ml.append('.'.join([mf, m.strip().lower()]))
                mlist = [mf] + ml
            else:
                mlist = [mf]

            if debug > 0: print 'Preprocessing Manifacturers:', ', '.join(mlist)
            section[key] = mlist
            if debug > 0: print 'Manifacturer %s=%s' % (key, section[key])
            return True

        section[key] = csv2list(value)
        if debug > 1: print '[K] [%d] [%s] %s=%s' % (lineno, secname, key, section[key])
        return True

    values = csv2list(line)
    if debug > 1: print '[V] [%d] [%s] Values = %s' % (lineno, secname, ','.join(values))
    sections[secname] = values
    return True

def parse_inf(filename):
    lineno = 0
    name = ''
    sections = {}
    section = None
    data = open(filename).read()

    ## Cheap Unicode to ascii
    if data[:2] == BOM_LE or data[:2] == BOM_BE:
        data = utf_16_le_decode(data)[0]
        data = data.encode('ascii', 'ignore')

    ## De-inf fixer ;)
    data = 'Copy'.join(data.split(';Cpy'))
    data = '\n'.join(data.split('\r\n'))
    data = ''.join(data.split('\\\n'))

    for line in data.split('\n'):
        lineno = lineno + 1
        line = line.strip()
        line = line.split(';', 1)[0]
        line = line.strip()

        if len(line) < 1: continue # empty lines

        if line[0] == ';': continue # comment

        ## We only need network drivers
        if name == 'version' and skip_inf(line):
            if debug > 0: print 'Skipped %s not a network inf' % filename
            return None

        ## Section start
        if line.startswith('[') and line.endswith(']'):
            name = line[1:-1].lower()
            sections[name] = {}
            section = sections[name]
        else:
            if section is None: continue
            if not parse_line(sections, name, lineno, line):
                break
    return sections

def scan_inf(filename):
    if debug > 0: print 'Parsing ', filename
    inf = parse_inf(filename)
    if inf is None: return {}

    devices = {}
    if inf and inf.has_key('manufacturer'):
        devlist = []
        for sections in inf['manufacturer'].values():
            devlist = devlist + sections
        if debug > 0: print 'Devlist:', ', '.join(devlist)
        for devmap in devlist:
            devmap_k = unquote(devmap.lower())
            if not inf.has_key(devmap_k):
                if debug > 0: print 'Warning: missing [%s] driver section in %s, ignored' % (devmap, filename)
                continue
            devmap = devmap_k
            for dev in inf[devmap].keys():
                if dev.find('%') == -1: continue # bad infs

                device = dev.split('%')[1]
                desc = unquote(str_lookup(inf['strings'], device))

                sec = inf[devmap][dev][0]
                hid = inf[devmap][dev][1]
                sec = sec.lower()

                hid = hid.upper()

                if inf.has_key(sec):
                    mainsec = sec
                else:
                    mainsec = fuzzy_lookup(inf.keys(), sec)
                    if mainsec is None: continue

                if mainsec.endswith('.services') and inf.has_key(mainsec):
                    serv_sec = mainsec
                elif inf.has_key(mainsec + '.services'):
                    serv_sec = mainsec + '.services'
                else:
                    serv_sec = fuzzy_lookup(inf.keys(), mainsec.split('.')[0], '.services')
                    if serv_sec is None:
                        if debug > 0: print 'Service section for %s not found, skipping...' % mainsec
                        continue

                if devices.has_key(hid): continue # Multiple sections define same devices

                if dumpdev: print 'Desc:', desc
                if dumpdev: print 'hid:', hid

                tmp = item_lookup(inf[serv_sec], 'addservice')
                if tmp is None:
                    if debug > 0: print 'Warning: addservice not found %s' % serv_sec
                    continue
                service = tmp[0]
                sec_service = tmp[2]

                driver = None
                if (type(inf[mainsec]) == type({})
                    and inf[mainsec].has_key('copyfiles')):
                    sec_files = inf[mainsec]['copyfiles'][0].lower()
                    if type(inf[sec_files]) == type([]):
                        driver = inf[sec_files][0]

                if driver is None:
                    if not inf.has_key(sec_service.lower()):
                        print 'Warning missing ServiceBinary for %s' % sec_service
                        print 'Please report including this file: %s\n' % filename
                        continue
                    driver = inf[sec_service.lower()]['ServiceBinary'][0].split('\\').pop()

                if dumpdev: print 'Driver', driver

                try:
                    char = eval(inf[mainsec]['Characteristics'][0])
                except:
                    char = 132

                if dumpdev: print 'Characteristics', char
                try:
                    btype = int(inf[mainsec]['BusType'][0])
                except:
                    try:
                        btype = bustype[hid.split('\\')[0]]
                    except:
                        btype = 0

                if dumpdev: print 'BusType', btype
                if dumpdev: print 'Service', service
                if dumpdev: print '-'*78


                devices[hid] = { 'desc' : desc,
                                 'char' : str(char),
                                 'btype': str(btype),
                                 'drv'  : driver,
                                 'svc'  : service,
                                 'inf'  : filename.split('/').pop() }
    return devices


if __name__ == '__main__':                  #主模块
    if len(argv) != 2:
        print 'Usage %s: directory_with_infs' % argv[0]
        sys_exit(-1)

    if not os.path.isdir(argv[1]):         #命令行参数必须是一个驱动文件夹
        print 'Usage %s: directory_with_infs' % argv[0]
        sys_exit(-1)
    else:
        rootpath = argv[1]

    devlist = {}
   
    for root,dirs,files in os.walk(rootpath):
        if len(glob(root + '/*.inf')) >= 1:                #目录内inf文件个数>=1个则进行处理
            entry =os.path.split(root)                     #分割全路径
            cabfilename=entry[len(entry)-1]                #使用分割后的最后一项作为压缩包名词
            if os.path.isfile(root + '\\' + cabfilename +'.CAB'):
                 os.remove(root + '\\' + cabfilename +'.CAB')
            
            cab_arch_cmd = 'cabarc -m lzx:21 n ' + cabfilename.upper() + '.CAB ' + root +'\\*  '
            print cab_arch_cmd
            os.system(cab_arch_cmd)
            os.rename( cabfilename.upper()+ '.CAB', root+'\\'+cabfilename.upper()+ '.CAB')
            for inffile in glob(root + '/*.inf'):  #获取当前路径下面所有的inf文件
                print "Get nic hardware id ---> "+ inffile
                if inffile.split('/').pop() not in exclude:
                    try:
                        devlist.update(scan_inf(inffile))
                    except:
                        print '--'
                        print 'Error parsing %s' % inffile
                        print 'Please report sending the inf file and this message:'
                        print '---- CUT HERE ----'
                        print '%s Version %s\n' % (argv[0], __version__)
                        print format_exc()
                        print '---- CUT HERE ----'

    print 'Compiled %d drivers' % len(devlist)

#    fd = open('devlist.cache', 'wb')
#    dump(devlist, fd)
#    fd.close()
#    print 'generated devlist.cache'

    fd = open('NETID.TXT', 'w')
    drvhash = {}
    for nic in devlist.items():
        entry = nic[0].split('&')
        if len(entry) < 2: continue # just to be sure
        if not entry[0].startswith('PCI'): continue # skip usb
        vid = entry[0].split('VEN_').pop().lower()
        pid = entry[1].split('DEV_').pop().lower()
        key = (vid, pid)
        entry = os.path.split(nic[1]['inf'])      #分割inf文件全路径变成路径和文件名称
        cabpath = entry[0]                        #取分割后的路径
        entry = os.path.split(cabpath)
        cabfilename= entry[1]
        line = 'PCI\\VEN_%4s&DEV_%4s="%s"\n' % (vid, pid, cabpath + '\\' + cabfilename)
        drvhash[key] = line.upper()

    drvlist = drvhash.values()
    drvlist.sort()
    fd.writelines(drvlist)
    fd.close()


    print 'generated NETID.TXT'


[ 本帖最后由 zhaohj 于 2010-4-23 16:25 编辑 ]
回复

使用道具 举报

1729#
 楼主| 发表于 2010-4-23 16:31:45 | 只看该作者
在GRUB4DOS菜单中直接用FAT复制过去应该可以用吧。最好不要用_NET.CAB文件名(会和DOS批处理的冲突)。
试试_def.cab等。应该就没关系了。
回复

使用道具 举报

1730#
发表于 2010-4-23 17:00:57 | 只看该作者
原帖由 chenall 于 2010-4-23 16:31 发表
在GRUB4DOS菜单中直接用FAT复制过去应该可以用吧。最好不要用_NET.CAB文件名(会和DOS批处理的冲突)。
试试_def.cab等。应该就没关系了。


目前的版本好像不会处理_def.cab吧。
两难的选择,目前的网卡驱动包也很大,CAB都达到6m,zip就达到10多M。
NETID.TXT方式速度快,但网卡驱动找不到时很麻烦,这个时候已经退出grldr了。
那现在只有先拷贝_def.cab,DOS下先判断NETID.TXT及驱动是否有效,有效就老方式处理,无效的话,应该写个标志,进PE桌面后再处理网卡驱动等操作。

原来的DOS下处理_NET.CAB干脆取消,成功率很低。我没有成功过。

img镜像看来要增大了。

[ 本帖最后由 zhaohj 于 2010-4-23 17:03 编辑 ]
回复

使用道具 举报

1731#
 楼主| 发表于 2010-4-23 17:53:46 | 只看该作者
是没有处理啊。所以才要你在GRUB4DOS菜单中添加,直接添加应该就可以了。
回复

使用道具 举报

1732#
发表于 2010-4-24 19:17:57 | 只看该作者
测试了一下,在MICROPE.LST中添加:FAT file copy (bd)/CSPE/DRIVERS/_DEF.CAB (hd0,0)/_DEF.CAB
显示过程成功,但启动到桌面后看不到这个文件存在。
是不是开启FBWF的原因?
回复

使用道具 举报

1733#
发表于 2010-4-26 16:03:38 | 只看该作者
这几天没事做了个外置网卡驱动,就不管它了。现在的结构也比较紧凑。
SRS也做了更新。
上传到FTP/CHENALL/CSPE
回复

使用道具 举报

1734#
 楼主| 发表于 2010-4-26 16:07:21 | 只看该作者
忘了一点.

放到根目录下的文件启动后会自动删除...
回复

使用道具 举报

1735#
发表于 2010-4-26 16:09:46 | 只看该作者
原帖由 chenall 于 2010-4-26 16:07 发表
忘了一点.

放到根目录下的文件启动后会自动删除...


是啊,FAT也不能放到目录。这个要NET.WIM处理一下了。
回复

使用道具 举报

1736#
发表于 2010-4-26 16:16:33 | 只看该作者
SRS驱动及NET驱动做成选择呢?经典的作品,现在太全自动化了。
SRS目前比较成熟,NET部分再强化点那再好。我的想法是当NET目录下面的驱动失败的时候,做个标记,在进入桌面后能处理DRIVERS\_DEF.CAB.
在DOS下处理DRIVERS\_NET.CAB往往失败。同样的驱动做成NETID的方式是成功的。
回复

使用道具 举报

1737#
 楼主| 发表于 2010-4-26 16:18:29 | 只看该作者
原帖由 zhaohj 于 2010-4-26 16:03 发表
这几天没事做了个外置网卡驱动,就不管它了。现在的结构也比较紧凑。
SRS也做了更新。
上传到FTP/CHENALL/CSPE



呵呵,我好久没有弄了.也没有什么可改的了.无除就是驱动,工具的更新.
回复

使用道具 举报

1738#
发表于 2010-4-26 16:47:50 | 只看该作者
也许某一天网卡驱动的ID也能自动检测。
回复

使用道具 举报

1739#
 楼主| 发表于 2010-4-27 00:07:22 | 只看该作者
原帖由 zhaohj 于 2010-4-26 16:47 发表
也许某一天网卡驱动的ID也能自动检测。


目前就是自动检测的吧,只要有提供NETID.TXT。

有空再调整一下。麻烦给整些修改思路。好久没有整了,有些生了。
回复

使用道具 举报

1740#
发表于 2010-4-27 10:49:28 | 只看该作者
我的想法是这样(针对PXE):
1)保留NETID.TXT的方法,取消DOS下传递_NET.CAB等驱动。因为经过实机使用,DOS下处理_NET.CAB基本没成功驱动网卡。
2)如果存在DRIVERS\_NET.CAB,FAT COPY FILE到(hd0,0)。这个因为驱动比较大,DOS下传递太慢。
3)NETID.TXT的方法驱动加载失败,传递一个标志,PE到桌面过程根据这个标志同时处理网卡驱动
上面是自动处理的方法
还有一种方式就是做成选择式的加载网卡驱动,可以手动输入。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-6-20 23:01

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表