分类:
2008-07-14 14:55:01
Solaris OBP学习笔记
查看当前的OpenBoot PROM版本使用以下命令:
# /usr/platform/‘uname -m‘/sbin/prtdiag -v 或者
# prtconf -V
Basic Boot PROM Commands
Command |
Description |
banner |
Displays the power-on banner |
boot |
Boots the system |
help |
Lists the main help categories |
printenv |
Displays all parameters’ current and default values |
setenv |
Sets the specified NVRAM parameter to some value |
reset-all |
Resets the entire system; similar to a power cycle |
set-defaults |
Resets all parameter values to the factory defaults |
sifting text |
Displays the FORTH commands containing text |
.registers |
Displays the contents of the registers |
probe-scsi |
Identifies the devices on the internal Small Computer System Interface (SCSI) bus |
probe-scsi-all |
Identifies the devices on all SCSI buses |
probe-ide |
Identifies devices on the internal integrated device electronics (IDE) bus |
probe-fcal-all |
Identifies devices on all Fibre Channel loops |
show-devs |
Displays the entire device tree |
devalias |
Identifies the current boot device alias for the system |
nvalias |
Creates a new device alias name |
nvunalias |
Removes a device alias name |
show-disks |
Displays and allows a selection of device paths for the disks to be used for nvalias |
sync |
Manually attempts to flush memory and synchronize file systems |
test |
Runs self-tests on specified devices |
1. banner命令示例:
ok banner
Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 360MHz), Keyboard Present OpenBoot 3.31, 128 MB (50 ns) memory installed, Serial #11888271.Ethernet address 8:0:20:b5:66:8f, Host ID: 80b5668f.
2. 引导系统boot命令:
参数如下:
boot device_name -options
ok boot 默认进入多用户模式,从默认的引导设备引导。
ok boot -s 进入单用户模式
ok boot cdrom 从光盘引导
ok boot cdrom -s从光盘引导进入单用户模式
ok boot -a引导系统进入交互式模式
ok boot -a
Enter filename [kernel/sparcv9/unix]:
Enter default directory for modules [/platform/SUNW,UltraAX-i2/kernel
/platform/sun4u/kernel /kernel /usr/kernel]:
Name of system file [etc/system]:
SunOS Release 5.10 Version s10 64-bit
Copyright 1983-2004 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
root filesystem type [ufs]:
Enter physical name of root device
[/pci@1f,0/pci@1/scsi@8/disk@0,0:a]:
ok boot -r 当系统增加或删除硬件时,进行重组引导。
ok boot -v 显示当前系统的硬件信息
ok boot -rv
ok boot -sv
3.help命令示例:
ok help
Enter ’help command-name’ or ’help category-name’ for more help
(Use ONLY the first word of a category description)
Examples: help system -or- help nvramrc
Categories:
boot (Load and execute a program)
nvramrc (Store user defined commands)
system configuration variables (NVRAM variables)
command line editing
editor (nvramrc editor)
resume execution
devaliases (Device aliases)
diag (Diagnostics commands)
ioredirect (I/O redirection commands)
misc (Miscellaneous commands)
ok
ok help boot
ok help nvramrc
ok help diag
ok help misc
4.显示NVRAM参数:
ok printenv
Variable Name Value Default Value
tpe-link-test? true true
scsi-initiator-id 7 7
keyboard-click? false false
keymap
ttyb-rts-dtr-off false false
ttyb-ignore-cd true true
ttya-rts-dtr-off false false
ttya-ignore-cd true true
ttyb-mode 9600,8,n,1,- 9600,8,n,1,-
ttya-mode 9600,8,n,1,- 9600,8,n,1,-
pcia-probe-list 1,2,3,4 1,2,3,4
pcib-probe-list 1,2,3 1,2,3
mfg-mode off off
diag-level max max
#power-cycles 273
output-device screen screen
input-device keyboard keyboard
boot-command boot boot
auto-boot? true true
diag-device net net
boot-device disk net disk net
local-mac-address? false false
screen-#columns 80 80
screen-#rows 34 34
use-nvramrc? false false
nvramrc devalias pgx24 /pci1f,0 ...
security-mode none
security-password
security-#badlogins 0
diag-switch? false false
ok
也可以使用printenv显示单个参数的值:
ok printenv boot-device
boot-device = disk net
boot-device参数的值有三个,disk、net和cdrom
5.更改NVRAM参数的值:
ok printenv auto-boot?
auto-boot? = true
ok
ok setenv auto-boot? false
auto-boot? = false
ok reset-all
Resetting ...
6.恢复默认的NVRAM参数的值:
ok set-defaults
Setting NVRAM parameters to default values.
Ok
ok set-default parameter-name
ok set-default diag-level
7. Displaying Devices Connected to the Bus
要鉴别当前已经连接到系统的外围设备,就要使用probe命令。如果想查找可用的probe命令,就使用sifting命令,如下所示:
ok sifting probe
(f006c954) probe-all (f006c5a0) probe-all (f006c378) probe-ide
(f006c1e8) probe-pci-slot (f006bc8c) probe-scsi
(f006bd78) probe-scsi-all (f0060fe8) probe-pci
(output truncated)
经常用到的probe命令只有三个,probe-scsi、probe-scsi-all和probe-ide.
示例如下:
ok probe-scsi
Target 1
Unit 0 Disk FUJITSU MAB3045S SUN4.2G17059825M62990
Target 3
Unit 0 Disk IBM DDRS34560SUN4.2GS98E99255C5917
(C) Copyright IBM Corp.
1997. All rights reserved.
Target 6
Unit 0 Removable Read Only device SONY CDROM
ok probe-scsi-all
/pci@1f,0/pci@1/pci@1/SUNW,isptwo@4
Target 3
Unit 0 Disk FUJITSU MAB3045S SUN4.2G1907
Target 4
Unit 0 Removable Tape EXABYTE EXB-8505SMBANSH20090
ok probe-ide
Device 0 ( Primary Master )
ATA Model : ST 38420A (DISK)
Device 1 ( Primary Slave )
Not Present
Device 2 ( Secondary Master )
Removable ATAPI Model : CRD-8322B (CD-ROM)
Device 3 ( Secondary Slave )
Not Present
8. show-devs命令示例:
Show-devs显示系统中整个设备树:
ok show-devs
/SUNW,UltraSPARC-IIi@0,0
/pci@1f,0
/virtual-memory
/memory@0,10000000
/pci@1f,0/pci@1
/pci@1f,0/pci@1,1
/pci@1f,0/pci@1,1/ide@3
/pci@1f,0/pci@1,1/SUNW,m64B@2
/pci@1f,0/pci@1,1/network@1,1
/pci@1f,0/pci@1,1/ebus@1
/pci@1f,0/pci@1,1/ide@3/cdrom
/pci@1f,0/pci@1,1/ide@3/disk
/pci@1f,0/pci@1,1/ebus@1/SUNW,CS4231@14,200000
/pci@1f,0/pci@1,1/ebus@1/flashprom@10,0
/pci@1f,0/pci@1,1/ebus@1/eeprom@14,0
/pci@1f,0/pci@1/pci@1
/pci@1f,0/pci@1/pci@1/SUNW,isptwo@4
(output truncated)
Ok
还有好多类似的show-命令:show-ttys, show-displays, show-nets, show-disks, and show-tapes.
9.devalias命令示例:
ok devalias
screen /pci@1f,0/pci@1,1/SUNW,m64B@2
net /pci@1f,0/pci@1,1/network@1,1
cdrom /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f
disk /pci@1f,0/pci@1,1/ide@3/disk@0,0
disk3 /pci@1f,0/pci@1,1/ide@3/disk@3,0
disk2 /pci@1f,0/pci@1,1/ide@3/disk@2,0
disk1 /pci@1f,0/pci@1,1/ide@3/disk@1,0
disk0 /pci@1f,0/pci@1,1/ide@3/disk@0,0
ide /pci@1f,0/pci@1,1/ide@3
floppy /pci@1f,0/pci@1,1/ebus@1/fdthree
ttyb /pci@1f,0/pci@1,1/ebus@1/se:b
ttya /pci@1f,0/pci@1,1/ebus@1/se:a
keyboard! /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8:forcemode
keyboard /pci@1f,0/pci@1,1/ebus@1/su@14,3083f8
mouse /pci@1f,0/pci@1,1/ebus@1/su@14,3062f8
name aliases
左边显示的设备别名,右边显示的物理地址;
10.定制设备别名(nvalias和nvunalias):
语法如下:nvalias aliasname device_path
示例如何定制设备别名:
ok show-disks
a) /pci@1f,0/pci@1/scsi@1,1/disk
b) /pci@1f,0/pci@1/scsi@1/disk
c) /pci@1f,0/pci@1,1/ide@3/cdrom
d) /pci@1f,0/pci@1,1/ide@3/disk
e) /pci@1f,0/pci@1,1/ebus@1/fdthree@14,3023f0
q) NO SELECTION
Enter Selection, q to quit: d
/pci@1f,0/pci@1,1/ide@3/disk has been selected.
Type ^Y (Control-Y) to insert it in the command line.
e.g. ok nvalias mydev ^Y
for creating devalias mydev for /pci@1f,0/pci@1,1/ide@3/disk
ok nvalias mydisk ^y
ok nvalias mydisk /pci@1f,0/pci@1,1/ide@3/disk
ok setenv boot-device mydisk
boot-device = mydisk
ok boot
取消刚才定制的别名(nvunalias):
语法:ok nvunalias aliasname
示例如下:
ok nvunalias mydisk
ok setenv boot-device disk
boot-device = disk
ok reset-all
Resetting ...
11.从操作系统中更改NVRAM参数:
这里用到的是/usr/sbin/eeprom命令.只有root可以使用改命令更改NVRAM参数。
# eeprom 不加任何参数,则显示的是当前所有参数的值;
# eeprom boot-device
boot-device=disk
# eeprom boot-device=disk2更改系统默认的引导设备,这里更改为disk2.
# eeprom auto-boot?=true 更改auto-boot?的值.