LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 714|回复: 0

Solaris引导管理器(全)-转自CU!

[复制链接]
发表于 2005-3-19 11:01:49 | 显示全部楼层 |阅读模式
呵,可能很多地方错误百出,请多多指证。上次只译了一半,补全!

III.1  Solaris boot manager
III.1  Solaris引导管理
Primary boot
主引导
Solaris boot process consists of two conceptually distinct phases, primary boot and secondary boot. The primary boot is implemented in the BIOS ROM on the system board and in BIOS extensions in ROMs on peripheral boards. The code is x86 real-mode code. This part of the boot process is common for all PC-compatible systems.
Solaris引导进程由二个概念明确的阶断组成,主引导和次引导。主引导被执行在系统板BIOS ROM和位于外围板上的ROM中的扩充BIOS。这些代码是X86实模式代码。这部分关于引导过程的说明对所有PC兼容系统都是一样(共同)的。
A Solaris boot partition is a primary partition, and must be active in order to boot Solaris. It begins with one-cylinder boot slice, which contains the partition boot program pboot in the first sector, the standard Solaris disk label and the VTOC in the second and third sectors, and the bootblk program in the fourth and subsequent sectors (VTOC is discussed later).
一个Solaris引导分区是一个基本分区,并且必须是被激活的用来引导Solaris.起始于第一柱面的引导区,包含有:存在于第一个扇区的分区引导程序PBOOT,在第二和第三扇区的标准的Solaris放在盘标签和VTOC以及从第四扇区起的BOOTBLK程序。
When a system is booted from a hard disk drive, MBR of that disk is read into memory. If Solaris was the last operating system installed to this disk, its MBR contains mboot - master boot program. The program, though specific for Solaris, works as usual Master Boot Code, that is, it reads the first sector of the first active primary partition on the boot disk, and jumps to its first byte. If the active partition is Solaris boot partition, its VBS is read and pboot - partition boot program contained there is invoked. Then pboot in turn loads and runs bootblk program.
当一个系统由一个硬盘引导时,这个盘的MBR(主引导)被读入内存。如果SOLARIS是这个硬盘最后安装的操作系统,它的MBR包含MBOOT(主引导程序)。虽然这个program是针对solaris的,但是和通常的主引导代码的工作方式是一样的,准确的说,它读这个硬盘的活动基本分区的第一个扇区并且跳转到它的第一位。如果活动分区是SOLARIS引导分区,它的VBS被读取和调用PBOOT(分区引导程序)。然后PBOOT转去加载和运行BOOTBLK程序。
In case Solaris is boot from floppy or CD-ROM, the first physical sector of the media read by BIOS, is a VBS not MBR. The pboot program contained there is responsible for loading the image of the boot manager strap.com.
  在SOLARIS是通过软盘或光盘来引导的情况下,被BIOS读取的媒介的第一个物理块是VBS而不是MBR。Pboot程序负责加载引导管理STRAP.com的映像。
Note: From version 8 up, Solaris x86 installation CDs are boot-able.
注:从SOLARIS8起,SOLARIS X86安装CD带启动功能。

Note: Some releases of Solaris 8 are affected by a bug which causes that Solaris Master Boot Code always loads Solaris VBS (PBR) from the first physical hard disk drive in the system. If Solaris is on second drive the error message "Bad PBR" is reported. See IV.4 Troubleshooting.
注:一些版本的SOLARIS8因一个BUG:solaris 主引导代码总是从系统的第一个物理硬盘设备加载Solaris VBS(PBR)而受到影响。如果SOLARIS在第二个设备以及报告错误信息:”bad pbr”,请查阅IV.4 Troubleshooting.

Boot manager
引导管理器
Programs bootblk and strap.com, loaded in result of primary boot, are very similar. Both contain Solaris boot manager code, which reads current disk partition information, and in case there is more than one primary partition, displays the table with all available partitions. It gives an opportunity to reboot another partition, in other words, another operating system. The default one is Solaris. The default timeout to make selection is 30 seconds. The difference between bootblk and strap.com is that, the first one is placed on UFS file systems and can not be configured, while the second is placed on FAT file systems (floppy disk or x86 Boot partition) and the timeout may be set in /solaris/strap.rc file.
Bootblk和Strap.com程序加载到返回主引导是非常相似的。二者包含SOLARIS引导管理代码,读当前盘分区信息,当有多于一个基本分区和情况,显示出所有可用的分区表。它给一个机会来重引导其它的分区,换句话说,就是另的操作系统。SOLARIS默认一个。默认选择时间为30秒。Bootblk和strap.com的差别在于:第一个是放置在UFS文件系统中并且不能被设置,第二是放置在FAT文件系统(软盘或X86引导区)并且可在/solaris/strap.rc文件中修改选择时间长。
Secondary boot
二级引导
If Solaris partition is selected to boot off, the secondary boot - boot.bin - is loaded by the boot manager. The secondary boot is capable of reading and booting from a UFS file system on a hard disk or CD, or by way of LAN using NFS protocol. It switches the processor to 32-bit, paged, protected mode and performs some limited machine initialization. Then, it runs Device Configuration Assistant, which either, boots the system automatically, or let the user select boot device, depending on the state of auto-boot eeprom variable (see eeprom man page). After that, root file system specified in bootpath eeprom variable is mounted.
如果solaris分区被选择引导完,二级引导-boot.bin-被引导管理器加载。二级引导能够从UFS文件系统、硬盘、光盘或其它方法如局域网中使用NFS协议中读取和导入。
Secondary boot is programmable, which makes it very flexible. If the root file system is successfully mounted, boot.bin invokes a command interpreter, that interprets /etc/bootrc script. The /etc/bootrc script lets the user to specify additional options for booting kernel, e.g. -r to reconfigure devices automatically.
二级引导是可以编辑的而构成很大的灵活性。如果根文件系统成功装上,boot.bin调用一个命令解释器来解释/etc/bootrc脚本。/etc/bootrc脚本使用户为导入内核指定额外选项。比方:-r 自动重新装配设备。
Device Configuration Assistant
设备配置助手
Device Configuration Assistant, or shortly DCA, is used to add, remove and configure device drivers necessary to boot a machine up. Note that keyboard, display and mouse are configured with kdmconfig (see kdmconfig man page). DCA is run at the beginning of Solaris setup to determine what device drivers need to be load, and to select the device from which the installation software will be loaded. DCA is shipped with Solaris media kit on a floppy disk. Solaris 8 installation CD (Installation as well as Software 1 CD) is boot-able and contains DCA.
设备配置助手,简写为DCA,用来增加、删除和配置必要的设备驱动来引导一台机器。注意键盘、显示器和鼠标由kdmconfig(参照KDMCONFIG操作页)配置。
DCA运行在安装SOLARIS开始确定那些设备驱动是必须加载的以及选择的设备的安装程序将被加载。DCA以SOLARIS存贮包装载在一张软盘上。SOLARIS8安装CD(安装CD之软件一)是能引导和包含了DCA。

DCA is invoked by the secondary boot every time Solaris is boot up. In this situation DCA behavior is determined by the state of two eeprom variables: auto-boot and auto-boot-timeout. The first one, if true, causes DCA to boot Solaris kernel off the device and partition specified in bootpath variable, otherwise presents a list of all devices capable of doing that and waits for a user selection. The list usually contains all hard disk drives, CD-ROMs, and LAN adapters. The second variable auto-boot-timeout determines the amount of time DCA waits for pressing Esc (escape) key to enter into DCA utility.
在每次SOLARIS引导到二级引导时调用DCA。在二个EEPROM参数:auto-boot和auto-boot-timeout的状况下,DCA的行为被中止。如果第一个参数为真,则使DCA脱离在BOOTPATH中定议的设备和分区参数引导SOLARIS内核,并列出所有可能工作的设备来等待用户选择。列表通常包括所有的硬盘、光驱、网络适配器。第二个参数auto-boot-timeout确定DCA等待按ESC键进入DCA应用程序的总时间长。
By default auto-boot is set to true, and auto-boot-timeout to 5 seconds. With these settings DCA displays information that it waits for pressing Esc and delays boot process for 5 seconds. Both variables may be modified using either, DCA itself, or eeprom utility. To modify variables with DCA one needs to enter DCA utility pressing Esc key during Solaris boot time. First, DCA probes hardware, then presents the list of possible boot devices. New values may be assigned to variables under Boot Tasks option. If Solaris is already running, type as root:
根据默认值:Auto-boot为真,auto-boot-timeout等于5秒,DCA显示等待按ESC信息和延迟引导过程5秒。二个参数都可以通过DCA或EEPROM来修改。当用DCA来修改参数时,需要在SOLARIS引导时按ESC进入DCA应用程序。首先,DCA探测硬件,再显示可能的引导设备列表。引导任务参数变量可能赋与新的值。如果solairs已经在运行,以ROOT身分输入:

eeprom auto-boot?=true

to set auto-boot to true, or
设suto-boot为真。
eeprom auto-boot-timeout=0

to make DCA not to wait for Esc key.
使DCA不等待ESC键
Restoring Solaris boot manager
恢复SOLARIS引导管理器
Solaris Master Boot Code of the MBR might be overwritten during installation of other operating system or a third party boot manager after Solaris was installed. Solaris Master Boot Code is stored in the file /usr/lib/fs/ufs/mboot. It can be restored using Solaris fdisk utility (see fdisk man page) as follows:
在SOLARIS安装后安装其它操作系统或第三方引导管理器时MBR的Solaris 主引导代码能被覆盖。Solaris 主引导代码存贮在文件:/usr/lib/fs/mboot中,它能够用SOLARIS FDISK应用程序来恢复。

fdisk -b /usr/lib/fs/ufs/mboot -n /dev/rdsk/c0d0p0

where /dev/rdsk/c0d0p0 stands for the raw device associated with the first (usually primary master) IDE/ATA hard disk drive on the system.
这里/dev/rdsk/c0d0p0代表原始设备所关联的在这个系统中的第一个(通常是主控)IDE/ATA硬盘
Sometimes it is necessary to recover VBS of a Solaris boot partition or Solaris boot manager program. installboot utility is capable of doing that (see installboot man page). To refresh VBS of Solaris partition located on the first IDE/ATA drive type as root:
  有时,它是必须恢复一个SOLARIS引导或SOLARIS引导管理程序的VBS。INSTALLBOOT功能能够实现。刷新位于第一个IDE/ATA驱动器的solaris分区VBS,在ROOT用户下输入:
installboot /usr/platform/i86pc/lib/fs/ufs/pboot \
/usr/platform/i86pc/lib/fs/ufs/bootblk /dev/rdsk/c0d0s2

Since installboot can not verify the partition specified as its argument, it may write Solaris boot manager into any partition. Therefore care must be taken not to destroy other partitions. The same operation may be also done with fmthard utility discussed later.
因为installboot不检验分区指定的变量,它可能写SOLARIS引导管理任何分区。因此,必须小心破坏另的分区。在后面讨论FATHARD功能可以实现同样的应用。
The following files contain critical executable code for boot process:
接下来的文件包含引导过程的临界[极限]试验代码。
 /usr/lib/fs/ufs/mboot - Master Boot Code, 主引导代码
 /usr/platform/i86pc/lib/fs/ufs/pboot - Volume Boot Code, 巻引导代码
 /usr/platform/i86pc/lib/fs/ufs/bootblk - Solaris boot manager. SOLARIS引导管理器。
x86 Boot partition
X86引导分区
x86 Boot partition was introduced in Solaris 8. Normally, it is a small primary partition, with FAT file system and DCA installed. It is necessary when Webstart installation is used in order to boot Solaris kernel from miniroot (temporary) file system. It provides also a user the way to load Solaris kernel from non-boot hard disk drive, select one of multiple Solaris installations, or boot Solaris across a network - all that DCA booted from floppy can do.
X86引导分区在SOLARIS8中提出。通常,它是一个小的主分区,FAT文件系统和安装有DCA。在WEB开始安装用来为了从MINIROOT(临时的)文件系统引导SOLARIS内核时它是必须的。它也同样提供一个使用途径去引导SOLARIS内核从无引导的硬盘设备,从多种SOLARIS安装中选择一种,或通过网络引导SOLARIS――从软盘引导DCA能实现。
It is created by default during Solaris 8 installation. Practice shows, however, that x86 Boot partition is not necessary to run Solaris 8. DCA is still below /boot directory and can be run during boot time.
它在默认安装SOLARIS8期间创建。可是实际上,X86引导分区不是运行SOLARIS8所必要。DCA一直存在/boot目录下和在引导的时候运行。
x86 Boot partition can be created with Solaris fdisk program. At this stage it is simply a reserved portion of a hard disk with partition ID set to 0xBE. To make it functional FAT file system must be constructed, and Solaris boot manager installed. If x86 Boot partition is created and set active, on c0d0 (the first IDE drive), then command:
X86引导分区能被SOLARIS FDISK程序创建。在这个过程它只不过是一个分区ID为0xBE的硬盘的一个保留部分。要构造它,FAT文件系统功能必须被建立和安装SOLARIS引导管理器
。如果在C0D0(第一个IDE设备)上已创建X86引导分区并且设置为活动的,那么使用下面的命令:
mkfs -F pcfs -o b=BOOT,B=/boot/mdbootbp,s,i=/boot/strap.com /dev/rdsk/c0d0p0:boot

will do the job. To install DCA mount the partition and copy necessary files:
来做这个工作。安装DCA来挂接分区和拷贝必要的文件。

mount -F pcfs /dev/dsk/c0d0p0:boot /mnt
cp -r /boot/* /mnt
echo "/boot/ / p"> /mnt/solaris.map

/dev/dsk/c0d0p0:boot is always the right address for x86 Boot partition on c0d0 drive. solaris.map file is required when DCA is installed on a FAT file system to remap default UFS paths to FAT ones. It is present on DCA floppy disk, but redundant on UFS variant of DCA.
在C0D0设备上的X86引导分区的正确地址永远是/dev/dsk/c0d0p0:boot。SOLARIS.MAP文件是必要的当DCA被安装在一个FAT文件系统来重绘默认的UFS对应的FAT路径。它出现在DCA软盘,但是在DCA的UFS变量是多余的。
Reconfiguring boot device
重新配置引导设备
Solaris requires details on physical connection of all devices to function properly. It saves these data during installation. When disk controller or cables are changed the data gets outdated. The following needs to be updated to boot Solaris:
Solaris命令详细说明了在物理连接到所有设备直到适当的功能。它在安装期间保存这些数据。当磁盘控制器或数据线被改变时,这此数据变成过时的了。接下来需要更新来引导SOLARIS:
 bootpath in /boot/solaris/bootenv.rc,
 /etc/path_to_inst.save,
 device nodes in /devices,
 either, /etc/vfstab, or device links under /dev/dsk and /dev/rdsk.
The first and the last must be done manually while the rest can be fixed with devfsadm utility (Solaris 8 or later). This is how to achieve that:
最先和最后必须手工来做当重设时用devfsadm功能(Solaris8及其后)来确定。这是如何完成那样的:
Assume that the old boot path was:
假设旧的引导路径是:
/pci@0,0/pci9004,7881@13/sd@0,0:a,
where:
在这里:
 pci@0,0 is the architecture of the disk controller and its address,
 PCI@0,0表明磁盘控制器结构及它的地址
 pci9004,7881 is a device PNP identification, consists of a vendor and part number,
 PCI9004,7881表明一个即插即用设备标识,包括一个所有者和局部编号
 13 is an IRQ level,
 13是一个IRQ(中断请求)级别
 sd means SCSI driver (you may have ata, cmdk or eisa here),
 SD意味着SCSI驱动器(在这你可能有ATA、CMDK或EISA驱动器)
 0,0:a is the address of the Solaris root file system (slice) on the Solaris fdisk partition.
 0,0:A是在SOLARIS分区上的SOLARIS根文件系统(片)的地址
The boot path represents a subdirectory in /devices, Particular parts of the boot path change depending on what has changed in physical connection. For instance, when the controller is moved from one slot to another on the same motherboard the IRQ may change only.
引导路径描述这一个子目录在/devices, 引导路径的详细部分的改变依靠在物理连接的改变。比方说:当控制器在同一块主板上从一个通道(接口、插槽)移到另一个,也公仅仅IRQ可能改变。
The first question that arises here is what is the current boot path? It can be found with DCA. When the boot device is selected, the suitable boot path is displayed. Yet better method is to mount the root slice and check the full path associated to the disk device node used (the one under /dev/dsk).
第一个问题发生在这里:什么是当前引导路径?它能被DCA发现。当引导设备被选择,显示出适当的引导路径。然而更好的方法是挂接根片和核对完全(绝对)路径所关联的使用了的磁盘设备节点(在/dev/dsk下)
The step by step procedure would look as follows:
一步一步的过程将在接下来的表示出来:
1. Boot the system from the Solaris installation disk (in case of Solaris 8 use "Software 1 CD") to single user mode, that is, at the prompt to select between Interactive and J installation enter b -s. A shell will follow after this.
 从SOLARIS安装盘引导系统(假设SOLARIS8使用软件光盘1)到单用户模式,更确切地说,在提示符下在交互方式和ump Start安装之间选择,输入 B -S。在这之后跟随一个SHELL。
2. Set terminal type to AT386 to avoid problems with vi editor. Type in:
设置终端类型为AT386来避免VI编辑器的问题,输入:
TERM=AT386; export TERM

3. Mount root / file system:
   挂接根/文件系统

mount /dev/dsk/c0t0d0s0 /a

The command is for the first disk on the first SCSI controller. It varies from system to system. Consult Disks, partitions and slices under Solaris for details.
命令对应于第一个SCSI控制器的第一个磁盘。它随系统的不同而不同,详细资料请参考Disks, partitions and slices under Solaris
4. Determine the slice number of /usr file system:
 确定/usr文件系统的片编码
grep /usr /a/etc/vfstab

You will see a line:
你将看到一行:
/dev/dsk/c0t0d0s4   /dev/rdsk/c0t0d0s4    /usr   ufs   1   no   logging
which means that the number of the /usr slice is 4.
表明/usr片编码是4。
5. Mount /usr file system:
  挂接/usr文件系统

mount /dev/dsk/c0t0d0s4 /a/usr

6. Rebuild /a/devices and /a/dev:
   重建 /a/devices和/a/dev

/usr/sbin/chroot /a /usr/sbin/devfsadm -C -v
/usr/sbin/chroot /a /usr/sbin/devfsadm -v

The first command cleans up invalid entries, the second creates new ones. -v stands for verbose mode. If you prefer to see first what is going to be changed without actually changing anything add -s option.
第一个命令行消除有问题的条目,第二个命令建立一个新的条目。-V参数对应于详细模式。如果你宁愿看第一个被改变的是什么没有实际任何改变请加-s选项。
7. Either, modify /a/etc/vfstab, or recreate soft links under /a/dev/dsk and /a/dev/rdsk, so that vfstab entries match appropriate slices on appropriate disks on the system. The second is more risky, but all customizations that involve disk device names are retained. Make sure that /a/dev/dsk links match /a/dev/rdsk links. Note that all those soft links can be removed and recreate with devfsadm as above safely.
 在更改/a/etc/vfstab,或在/a/dev/dsk和/a/dev/rdsk下重建软件连接之一,所以vfstab条目匹配在系统中适当的磁盘上的适当的片。第二个是相当危险的,但是所有的定制包括保留的磁盘设备名。确信/a/dev/dsk连接匹配/a/dev/rdsk连接。注意那些所有的软件连接能被devfsadm安全地删除和重建。
8. Unmount the hard disk
   卸载硬盘
      

sync
umount /a/usr
umount /a

9. Try to reboot from hard disk.
      从硬盘重启:

init 6

Note: Backup all of your data prior any modification to the system hardware which have direct relation with the hard disk, i.e. motherboard, disk controller including IDE or SCSI adapter.
注:在对直连有硬盘的系统硬件进行任何修改前备份你的所有数据。比方:主板,磁盘控制器(包括IDE或SCSI适配器)。


_________________


原贴地址:
http://bbs.chinaunix.net/forum/v ... =asc&highlight=
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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