sun OBP命令总结(精简) |
||
---|---|---|
中级会员
注册日期:
2005/2/3 1:11 所属群组:
注册会员 帖子:
53
等级: 6; EXP: 12
HP : 0 / 128 MP : 17 / 460 |
参考:OpenBoot3.x命令参考
说明:有部分实在无法用中文表达得或者说没有必要用中文表达的,保留使用了英文。里边有些是个人对OpenBoot3.x的理解,可能存在错误。 期望指正,QQ:33033777,MSN:[email protected] OpenBootPROM的介绍 简称OBP,可以理解为普通pc的BIOS的增强版,它是控制sun服务器的引导过程、初始化配置某些硬件和提供了某些诊断的工具。其配置保存在主板的prom固件中,配置的方式是通过在OBP命令行下进行配置。 我们可以通过它来: 调整启动设备和启动参数,如从光盘引导。 检测硬件故障 完成某些必须在操作系统启动之前完成的配置,如某些硬件设备的配置。 等等功能。 显然x86系统不会有OBP 1.Overview 用户界面 可以通过下面的方式进入OBP界面 • halt你的系统,init 1,等等 • 使用组合键 Stop-A • 没有设定auto-boot?为ture的话每次开机自动进入 • 系统硬件检测到错误,并且不能跳过的话会进入OBP界面 (This is known as a Watchdog Reset.) 设备树 跟solaris操作系统的设备的物理命名方式相同。 设备别名 设备名通常是类似下面的格式 /sbus@1f,0/esp@0,40000/sd@3,0:a 在我们的使用中很不方便,使用设备别名却是我们的操作相当的方便 devalias 显示当前的别名设置 devalias alias 显示特定设备别名对应的物理设备名 devalias alias device-path 设置别名,如果alias有重复则覆盖掉旧值 注意:这样定义的别名重启不会保存,如果想永久的修改可以考虑nvalias,nvunalias命令,稍后会说到 显示设备树 可用的命令和功能描述 Command Description .properties 显示当前所在设备节点的属性 dev device-path 选择某个设备节点 dev node-name 在当前设备节点的下级树查找某个设备节点,并且切换到第一个 dev .. 选择当前设备节点的上一级设备 dev / 选择设备的根节点 device-end 离开设备树 " device-path" find-device Choose device node, similar to dev. ls 显示当前设备的下级设备 pwd 显示当前设备的物理连接路径 see wordname Decompile the specified word. show-devs [device-path] 显示设备树,单纯show-devs显示整个机器的设备树 words 显示当前设备的名字 example: ok dev /zs@1,f0000000 ok .properties address ffee9000 port-b-ignore-cd port-a-ignore-cd keyboard device_type serial slave 00000001 intr 0000000c 00000000 interrupts 0000000c reg 00000001 f0000000 00000008 name zs ok dev /sbus/ACME,widget ok show-devs /SUNW,UltraSPARC@0,0 /sbus@1f,0 /counter-timer@1f,3c00 /virtual-memory /memory@0,0 . . . 获取在线帮助 在ok提示符下可以使用下面的命令获取帮助 help 显示帮助的分类 help category 显示特定分类的可用命令,category使用提示的第一个单词 help command 显示特定命令的帮助 example: ok help dump Category: Memory access dump ( addr length -- ) display memory at addr for length bytes ok 警告:在操作系统已经开始使用后,STOP-A进入OBP执行命令可能会失败,并且某些命令可能会使系统不可用需要重新启动。如:probe-scsi 2.Booting and Testing Your System • Boot your system • Run diagnostics • Display system information • Reset the system Booting Your System 可用参数 • auto-boot? 确定系统加点后是否自动启动,默认一般是true,如果为false则自动进入OBP配置 即ok状态 • boot-command 这个参数用来设置当auto-boot?为true是启动系统使用的命令,默认为boot。你可以使用其他启动命令如:boot –s等。 • diag-switch? 如果为true则使用最大化自检启动系统。默认为false • boot-device 设定自动启动时的启动设备,一般是你的安装操作系统的硬盘作为启动盘。 • boot-file This variable contains the default boot arguments that are used when OpenBoot is not in diagnostic mode. • diag-device This variable contains the name of the default diagnostic mode boot device. • diag-file This variable contains the default diagnostic mode boot arguments. 这些参数的修改会在下面的Setting Configuration Variables中讲到. 对于普通用户来说 通常的如果auto-boot?参数设定为true,boot命令会自动启动操作系统,并且会自动执行boot-file参数指定的程序或设定。如果想在auto-boot?为false或者在ok模式下启动操作系统,使用boot命令。 Boot命令的使用: 格式:ok boot [device-specifier] [arguments] Parameter Description [device-specifier] 指定启动系统使用的设备,可以是物理设备名或者别名,通常使用的是别名 cdrom (CD-ROM drive) disk (hard disk) floppy (3-1/2” diskette drive) net (Ethernet) tape (SCSI tape) 单纯boot命令没有指定device-specifier,系统会使用boot-device指定的设备启动系统 [arguments] 启动时执行的命令或者参数,如果没有指定则执行boot-file参数设定的指令通常也为空 通常的用法 ok boot 从默认设备启动 ok boot –s 从默认设备启动到单用户(可以指定其他运行等级) ok boot cdrom 从光盘引导安装 ok boot cdrom –s 从光盘启动一个可运行的系统 Running Diagnostics OBP中提供了一些诊断工具可以让我们来测试系统中安装的硬件例如:scsi控制器等。 可以使用 ok help diag命令查看可用的test命令,下面列出的命令并不是全部。 Command Description probe-scsi Identify devices attached to a SCSI bus. test device-specifier Execute the specified device’s selftest method. For example: test net test the network connection watch-clock Test a clock function. watch-net Monitor a network connection. 几个简单的例子 ok probe-scsi Target 1 Unit 0 Disk SEAGATE ST1480 SUN04246266 Copyright (C) 1991 Seagate All rights reserved Target 3 Unit 0 Disk SEAGATE ST1480 SUN04245826 Copyright (C) 1991 Seagate All rights reserved ok ok test net Internal Loopback test - (result) External Loopback test - (result) ok ok watch-net Internal Loopback test - succeeded External Loopback test - succeeded Looking for Ethernet packets. ’.’ is a good packet. ’X’ is a bad packet. Type any key to stop ....................X.....X............... ok Displaying System Information OBP中提供了几个命令来现实系统的信息,通过这些命令就可以大体的了解系统的配置信息 Command Description banner Display power-on banner. show-sbus Display list of installed and probed SBus devices. .enet-addr Display current Ethernet address. .idprom isplay ID PROM contents, formatted. .traps Display a list of processor-dependent trap types. .version Display version and date of the boot PROM. .speed Display processor and bus speeds. Resetting the System ok reset-all 3.Setting Configuration Variables 介绍怎样访问和修改NVRAM中的参数配置 显示和改变参数配置 Command Description printenv 显示参数的当前值和默认值 setenv variable value 设定参数variable的值为value,永久修改,但是通常需要重启才会发挥作用 set-default variable 某个参数设为出厂值 set-defaults 所有参数设定为出厂值 password 设置密码(小心你的密码,如果设置需要密码并且忘记了就的找SUN换件了) 设置安全参数 可用的参数 • security-mode • security-password • security-#badlogins security-mode参数可选择的值: full 除了go命令,其他所有的命令都需要密码 command 除了boot(不带参数)和go命令,其他的命令都需要密码 none 不需要密码 (default) example: ok password ok New password (only first 8 chars are used): ok Retype new password: ok setenv security-mode full ok go (no password required) ok boot (password required) Password: (password is not echoed as it is typed) ok boot filename (password required) Password: (password is not echoed as it is typed) ok reset-all (password required) Password: (password is not echoed as it is typed) Changing the Power-on Banner 设定机器刚刚加电时的banner信息,感觉出了最基本的,其他用处不大。 可用的设置banner的参数: • oem-banner • oem-banner? • oem-logo • oem-logo? ok setenv oem-banner Hello World ok setenv oem-banner? true ok banner Hello World 输入输出控制 可用的定义控制台的参数: • input-device • output-device • screen-#columns • screen-#rows 下次重启才会生效 默认情况下 input-device是keyboard,output-device是screen. 要讲默认的输入设备改为ttya: ok setenv input-device ttya 假如输入设备是keyboard,输出设备为screen,而设备并没有连接的话系统在下次启动的时候会使用ttya做为输入输出设备. example设定ttya做为默认的输入设备: ok setenv input-device ttya • screen-#columns 设定屏幕列 • screen-#rows 设定行 setenv的使用范例: 设定默认启动设备 ok setenv boot-device net 设置最大化自检 ok setenv diag-switch? True 取消最大化自检 ok setenv diag-switch? false 使用 nvramrc 在nvram中编辑一个脚本在系统启动时执行,这个报存在NVRAM中 通常是为了某些设备驱动定义某些参数使用,或者为某些可能必须在系统加载之前需要执行的操作所准备。 定义的脚本在什么时候执行呢? 下面是OBP启动的顺序: • 加电自检 (POST) • 执行系统初始化 • 执行nvramrc定义的脚本 (if use-nvramrc? is true) • 执行 probe-all (evaluate FCode) • Execute install-console • 显示banner • Execute secondary diagnostics • 启动操作系统 (if auto-boot? is true) 需要注意的某些命令可能需要在执行了 probe-all之后才能够运行,也就是说我们要充分考虑我们执行的命令本身运行所需要的环境。 It is sometimes desirable to modify the sequence probe-all installconsole banner. For example, commands that modify the characteristics of plug-in display devices may need to be executed after the plug-in devices have been probed, but before the console device has been selected. Such commands would need to be executed between probe-all and install-console. Commands that display output on the console would need to be placed after install-console or banner. This is accomplished by creating a custom script which contains either banner or suppress-banner since the sequence probe-all install-console banner is not executed if either banner or suppress-banner is executed from the script. This allows the use of probe-all, install-console and banner inside the script, possibly interspersed with other commands, without having those commands re-executed after the script finishes. 在脚本中可以使用大部分的OBP的命令,但是也有例外 下面的命令不能在脚本中使用: • boot • go • nvedit • password • reset-all • setenv security-mode 常用的nvramrc命令 nvedit 进入脚本编辑模式,如果存在以前保存的脚本,则打开并编辑 nvquit 不保存退出 nvrun 执行当前编辑的脚本,不会保存 nvstore 保存当前的脚本 下面来看看怎么编辑一个script 1. 在ok提示符下键入nvedit,进入script的编辑。 2. Control-C 退出编辑模式重新回到ok提示符。 假如没有使用nvstore命令保存你的编辑,你可以使用nvrun临时执行你写的脚本。 3. 使用nvstore进行保存。 4. 为了能够执行脚本,需要设定下面的参数 setenv use-nvramrc? true 5. 重新启动机器或者使用下面的命令来执行脚本 nvramrc evaluate 或许你已经注意到了,这里没有涉及到给脚本命名或者执行某个脚本的问题需要考虑 下面是在编辑模式可用的编辑操作,因为太多所以只捡了最常用的几个。 Keystroke Description Control-B 向后移动一个字符 Control-F 先前移动一个字符 Control-N 移动到下一行 Control-P 移动到前一行 Return (Enter) 在光标位置插入一行 Control-C 退出编辑模式,编辑的内容在机器重启前会保留,但是不会写入NVRAM,这时可以使用nvstore命令保存编辑的内容。 Backspace 向前删除一个字符 下面是一个参考中提供的例子,其实在平时的使用中我们用得最多的可能是在脚本中保存我们想让系统刚启动的时候要执行的命令或者设定参数的操作。 下面是忘了在哪位老大的solaris双机的配置中的一段,作用就是改系统的scsi ID ok nvedit 0: probe-all 1: cd /pci@1f,4000/pci@4/SUNW,isptwo@4 2: 6 " scsi-initiator-id" integer-property 3: device-end (上面可以使用setenv scsi-initiator-id 6来完成) 4: install-console 5: banner <Control C> 退出 ---------------------------------- 也可以这样 ok nvedit 0: setenv scsi-initiator-id 6 <Control C> ok nvstore 或者干脆 ok setenv scsi-initiator-id 6 ---------------------------------- 然后保存该设置 ok nvstore ok setenv use-nvramrc? True ok reset-all 重启或者可以使用,nvrun命令执行 校验SCSI卡id更改的正确: ok cd /pci@1f,4000/pci@4/SUNW,isptwo@4 ok .properities 或者上面不使用reset-all命令,而使用nvramrc evaluate,则会直接执行。 注意:nvedit模式的提示符是0:1:等数字,表示不同的行。 Nvramrc总体感觉就像是操作系统的rc.local,只不过执行的位置和做用不同。
2005/9/6 19:06
|
|
工具箱 |