| 
 | 
成品就算了。首先,大家的U盘尺寸不一样,我发上来的不一定适合大家,其次,授人以鱼不如授人以渔,再次,这里发送大文件实在不方便。这样,我把方法三详细介绍一下。 
必备条件: 
Vmware WorkStation 或Server 
CentOS 5.1或Redhat Enterpeise AS 5 U1 
Grub 0.97 中文版 
准备以之启动的PE,比如深山红叶v28。 
一个足以容纳下深山红叶v28的U盘(>=256M),工作在USB-HDD方式下,特征是在windows XP下能给它分区,如果不是USB-HDD方式就用量产工具把它转回来,高速SD卡+读卡器更佳。 
具体步骤: 
1、在Vmware中创建虚拟机,模版选择Redhat Enterprise AS 4,guest系统中添加USB控制器。 
2、把CentOS 5.1或Redhat Enterprise AS 5 U1完整安装到虚拟机中。 
3、插入U盘并分配给虚拟机guest系统,U盘上如有数据请自行备份。 
下面操作在虚拟机guest系统内 
4、guest系统中使用fdisk -l 命令确定U盘设备名,大多数情况下应该是/dev/sdb。 
[root@test ~]# fdisk -l 
Disk /dev/sda: 12.8 GB, 12884901888 bytes 
255 heads, 63 sectors/track, 1566 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes 
   Device Boot      Start         End      Blocks   Id  System 
/dev/sda1   *           1          13      104391   83  Linux 
/dev/sda2              14        1566    12474472+  8e  Linux LVM 
Disk /dev/sdb: 65 MB, 65536000 bytes 
3 heads, 42 sectors/track, 1015 cylinders 
Units = cylinders of 126 * 512 = 64512 bytes 
   Device Boot      Start         End      Blocks   Id  System 
/dev/sdb1   *           1        1015       63924    e  W95 FAT16 (LBA 
[root@test ~]#  
 
 |  
  
5、guest系统中使用fdisk /dev/sdb命令分配一个不大于511M的主分区,分区号为1,分区类型为0xe,并设置引导标记。 
[root@test ~]# umount /dev/sdb1 
[root@test ~]# fdisk /dev/sdb 
Command (m for help): p 
Disk /dev/sdb: 65 MB, 65536000 bytes 
3 heads, 42 sectors/track, 1015 cylinders 
Units = cylinders of 126 * 512 = 64512 bytes 
   Device Boot      Start         End      Blocks   Id  System 
/dev/sdb1   *           1        1015       63924    e  W95 FAT16 (LBA) 
Command (m for help): d 
Selected partition 1 
Command (m for help): n   
Command action 
   e   extended 
   p   primary partition (1-4) 
p 
Partition number (1-4): 1    
First cylinder (1-1015, default 1):  
Using default value 1 
Last cylinder or +size or +sizeM or +sizeK (1-1015, default 1015):  
Using default value 1015 
Command (m for help): t 
Selected partition 1 
Hex code (type L to list codes): e 
Changed system type of partition 1 to e (W95 FAT16 (LBA)) 
Command (m for help): a 
Partition number (1-4): 1 
Command (m for help): p 
Disk /dev/sdb: 65 MB, 65536000 bytes 
3 heads, 42 sectors/track, 1015 cylinders 
Units = cylinders of 126 * 512 = 64512 bytes 
   Device Boot      Start         End      Blocks   Id  System 
/dev/sdb1   *           1        1015       63924    e  W95 FAT16 (LBA) 
Command (m for help): w 
The partition table has been altered! 
Calling ioctl() to re-read partition table. 
WARNING: If you have created or modified any DOS 6.x 
partitions, please see the fdisk manual page for additional 
information. 
Syncing disks. 
[root@test ~]#  
 
 |  
  
6、guest系统中使用mkfs.fat /dev/sdb1将U盘格式化为FAT文件系统。 
[root@test ~]# mkdosfs /dev/sdb1 
mkdosfs 2.11 (12 Mar 2005) 
[root@test ~]#  |  
  
7、guest系统中使用mount /dev/sdb1 /mnt命令把U盘mount到/mnt。 
[root@test ~]# mount /dev/sdb1 /mnt 
[root@test ~]#  |  
  
8、guest系统中使用grub-install --root-directory=/mnt --forcelba --no-floppy /dev/sdb命令把GNU GRUB安装到U盘MBR中。 
[root@test ~]# grub-install --root-directory=/mnt --force-lba --no-floppy /dev/sdb 
Probing devices to guess BIOS drives. This may take a long time. 
Installation finished. No error reported. 
This is the contents of the device map /mnt/boot/grub/device.map. 
Check if this is correct or not. If any of the lines is incorrect, 
fix it and re-run the script `grub-install'. 
(hd0)   /dev/sda 
(hd1)   /dev/sdb 
[root@test ~]#  
 |  
  
9、guest系统中使用umount /mnt命令后拔掉U盘。 
[root@test ~]# umount /mnt 
[root@test ~]#  |  
  
至此,U盘已具备引导至GNU GRUB能力。 
 
下面操作在Windows XP内 
10、把Grub 0.97 中文版中boot\grub\stage2覆盖至U盘\boot\grub\stage2,同时把boot\grub\fonts、boot\grub\xp2008.xpm.gz和boot\grub\grub_chs.msg复制到U盘\boot\grub\下(这些文件均在附件内)。 
至此,U盘已具备引导至GRUB 0.97中文版能力。可支持中文菜单、直接chainloader启动NTLDR、KERNEL.SYS和IO.SYS。 
11、把要启动的PE---本例中是深山红叶V28光盘版内容复制到U盘里。我这个U盘过小就不演示了。 
12、在U盘根目录或\boot\grub目录中创建menu.lst文件,内容如下: 
# 
# Grub 0.95 中文版配置文件样例, by Gandalf(f22_storm@163.com) 
#  2004 -  07 - 15 (midified 13:13 2004-11-13) 
# 
# 默认延迟时间(秒) 
timeout 30 
color black/cyan yellow/cyan 
# 第一项为默认值 
default 0 
# Fallback to the second entry. 
fallback 1 
# 设置动画图形菜单文件 
gfxmenu (hd0,0)/boot/grub/grub_chs.msg 
# 设置图形背景文件 
splashimage (hd0,0)/boot/grub/xp2008.xpm.gz 
# 设置中文支持的字体文件 
fontfile (hd0,0)/boot/grub/fonts 
 
title 深山红叶微型 PE 工具箱V28 
chainloader /wins/setupldr.bin 
title floppy (fd0) 软盘引导 
chainloader (fd0)+1 
rootnoverify (fd0) 
title Command Line 命令行 
#savedefault --wait=2 
commandline 
 |  
  
即可U盘启动深山红叶V28,启动时注意需在BIOS设置USB-HDD方式。 
实验: 
1、在不同的机器上启动GRUB选择菜单中的“Command Line 命令行”,然后键入geometry (hd0)命令,记录识别的CHS参数 
2、比较不同机器的CHS参数,会发现有所不同。但是在这样的条件下启动U盘上的深山红叶v28均无问题。 
也许在下视野狭隘,目前为止,只要机器支持USB-HDD模式启动,还没发现这种方法不能启动的机器。 
 
[ 本帖最后由 wangjg 于 2008-1-2 10:14 PM 编辑 ] |   
 
 
 
 |