复杂度3/5
机密度4/5
最后更新2021/05/14
AIX提供了两个帮助分析启动的工具或者模式:
- kernel debug
- boot verbose mode
前者适合单独分析某个特定的功能、模块,而后者则能帮助你全面地过一遍AIX启动的全过程,很类似在脚本中设置了set -x
kernel debug以后找时间专题讲,可能要讲很久,今天先介绍verbose mode。启动进入verbose mode的方法很简单,需要在SMS(OK mode)至于如何在启动时进SMSd的ok模式,参考进入SMS
在ok>提示符下,直接敲命令:
ok>boot disk: -s verbose
............
-------------------------------------------------------------------------------
StarLED{814}
AIX Version 7.2
Starting NODE#000 physical CPU#001 as logical CPU#001... done.
exec(/etc/init){1,0} <--------首先执行/etc/init
INIT: EXECUTING /sbin/rc.boot 1 <------执行/sbin/rc.boot,带参数1,表明这是首次执行。下面是执行rc.boot的屏显
exec(/usr/bin/sh,-c,/sbin/rc.boot 1){1048868,1}
exec(/sbin/rc.boot,/sbin/rc.boot,1){1048868,1}
+ PHASE=1
+ + bootinfo -p <---------获得当前机器的架构
exec(/usr/sbin/bootinfo,-p){1114406,1048868}
PLATFORM=chrp <-------当前机器架构是chrp,既Common Hardware Reference Platform,这是IBM和motorola,apple共同制定的标准。后来还有一种PReP(PowerPC Reference Platform),是IBM自己单独发布的。
+ [ ! -x /usr/lib/boot/bin/bootinfo_chrp ] <------执行所有为chrp架构特定准备的boot程序
+ [ 1 -eq 1 ]
+ init -c unlink /usr/lib/boot/bin/!(*_chrp)
exec(/etc/init,-c,unlink /usr/lib/boot/bin/!(*_chrp)){1114408,1048868}
+ chramfs -t
exec(/usr/sbin/chramfs,-t){1114410,1048868} <------准备ramfs。其实我们现在执行的是bootimage里被压缩的ramfs的内容,并不是真正的磁盘里的文件系统
+ init -c unlink /usr/sbin/chramfs
+ 1> /dev/null
exec(/etc/init,-c,unlink /usr/sbin/chramfs){1114412,1048868}
+ + bootinfo -t <---------获得启动设备,返回值1是磁盘,3是cd,4是磁带,5是网络
exec(/usr/sbin/bootinfo,-t){1114414,1048868}
BOOTYPE=1
+ [ 0 -ne 0 ]
+ [ -z 1 ]
+ unset pdev_to_ldev native_netboot_cfg
+ unset disknet_odm_init config_ATM
+ echo \n\n_______________________________________ _____________________________________ \nrc.boot: starting disk boot process
+ 1> /tmp/boot_log
+ echo B1 Starting Disk Boot
+ 1> /tmp/cfg_log
+ ln /usr/lib/libbind.a /usr/lib/libc.a /usr/lib/libcfg.a /usr/lib/libcfgiscsi.a /usr/lib/libcfgscsi.a /usr/lib/libcrypt.a /usr/lib/libefs.a /usr/lib/libisns.a /usr/lib/liblvm.a /usr/lib/libodm.a /usr/lib/libs.a /usr/lib/libslp.a /lib
exec(/usr/bin/ln,/usr/lib/libbind.a,/usr/lib/libc.a,/usr/lib/libcfg.a,/usr/lib/libcfgiscsi.a,/usr/lib/libcfgscsi.a,/usr/lib/libcrypt.a,/usr/lib/libefs.a,/usr/lib/libisns.a,/usr/lib/liblvm.a,/usr/lib/libodm.a,/usr/lib/libs.a,/usr/lib/libslp.a,/lib){1114416,1048868} <--------设定库函数路径
+ echo rc.boot: executing "restbase" <----------把bootimage里压缩的odm解压出来
+ 1>> /tmp/boot_log
+ restbase
exec(/etc/restbase){1114418,1048868}
exec(/bin/sh,-c,uncompress /tmp/restbase.Z){327952,1114418}
exec(/usr/bin/uncompress,/tmp/restbase.Z){327952,1114418}
+ rc=0
+ [ 0 -eq 1 ]
+ [ 0 -eq 2 ]
+ /usr/lib/methods/showled 0x510 DEV CFG 1 START <--------点个led信息,液晶面板会显示AIX starting...
exec(/usr/lib/methods/showled,0x510,DEV CFG 1 START){1114420,1048868}
+ echo rc.boot: executing "cfgmgr -f -v" <--------开始从最根配置设备
+ 1>> /tmp/boot_log
+ cfgmgr -f -v
exec(/usr/sbin/cfgmgr,-f,-v){1114422,1048868}
cfgmgr is running in phase 1
----------------
Time: 0 LEDS: 0x538
Invoking top level program -- "/usr/lib/methods/cfgrule_vrtcore"
exec(/bin/sh,-c,/usr/lib/methods/cfgrule_vrtcore ){327954,1114422}
exec(/usr/lib/methods/cfgrule_vrtcore){327954,1114422} <---------第一个基础设备virtual runtime core
Time: 0 LEDS: 0x539
Return code = 0
***** stdout *****
。。。。。
----------------
Time: 0 LEDS: 0x539
Number of running methods: 0
----------------
Time: 0 LEDS: 0x538
Invoking top level program -- "/etc/methods/defsys"
exec(/bin/sh,-c,/etc/methods/defsys ){327958,1114422}
exec(/etc/methods/defsys){327958,1114422}
Time: 1 LEDS: 0x539
Return code = 0
***** stdout *****
sys0
*** no stderr ****
----------------
Attempting to configure device 'sys0'
Time: 1 LEDS: 0x811
Invoking /usr/lib/methods/cfgsys_chrp -1 -l sys0
Number of running methods: 1
exec(/bin/sh,-c,/usr/lib/methods/cfgsys_chrp -1 -l sys0){1179944,1114422}
exec(/usr/lib/methods/cfgsys_chrp,-1,-l,sys0){1179944,1114422}
----------------
Completed method for: sys0, Elapsed time = 1620981103
Return code = 0
***** stdout *****
sysplanar0 <------------发现主板,配置主板
***** stderr *****
MS 1179944 1114422 /usr/lib/methods/cfgsys_chrp -1 -l sys0
M4 1179944 Parallel mode = 0
M4 1179944 Get CuDv for sys0
M4 1179944 Get device PdDv, uniquetype=sys/node/chrp
M4 1179944 ..make_dvc_available()
M4 1179944 In configure_device()
M4 1179944 mdd_get: offset=00000080, size=00000158
M4 1179944 Calling mdd ioctl
M4 1179944 mdd_get: offset=00000244, size=000000c4
M4 1179944 Calling mdd ioctl
M4 1179944 mdd_get: offset=00000080, size=00000158
M4 1179944 Calling mdd ioctl
M4 1179944 mdd_get: offset=00000244, size=000000c4
M4 1179944 Calling mdd ioctl
M4 1179944 Invoking set_attrs
M4 1179944 get alist(sys0,sys/node/chrp,)
M4 1179944 ..get_attr_list()
M4 1179944 Get PdAts for 'uniquetype = sys/node/chrp'
M4 1179944 Get CuAts for 'name = sys0'
M4 1179944 Attr live_update found
M4 1179944 mdd_get: offset=00000080, size=00000158
M4 1179944 Calling mdd ioctl
M4 1179944 mdd_get: offset=000001d8, size=00000024
M4 1179944 Calling mdd ioctl
M4 1179944 Setting system attributes
M4 1179944 part_id_value=0x1D46B821F7B7EEA5 id_to_partition=0X1D46B821F7B7EEA5
M4 1179944 setattrval(sys0,id_to_partition,0X1D46B821F7B7EEA5)
M4 1179944 Attr id_to_partition found
M4 1179944 Value received from getatt: 0X0000000000000000
M4 1179944 mdd_get: offset=00000244, size=000000c4
。。。。
----------------
Completed method for: sysplanar0, Elapsed time = 1
Return code = 0
***** stdout *****
mem0 <-----------发现一堆子设备,准备分别初始化
L2cache0
proc0
proc1
pci0
vio0
。。。。
0539 cfgmgr
0538 ***********
----------------
Time: 6 LEDS: 0x25b6 for vio0
Number of running methods: 3
----------------
Completed method for: proc1, Elapsed time = 1
return code = 0
****************** no stdout **exec(/bin/sh,-c,/usr/sbin/lsdev -C -c management -s infiniband -t icm -F name ){2425176,1835396}
*********
****************** no stderr ***********
----------------
Time: 6 LEDS: 0x25b6 for vio0
Number of running methods: 2
----------------
Completed method for: vio0, Elapsed time = 1
return code = 0
****************** stdout ***********
vsa0
。。。。
AIX Version 7
Copyright IBM Corporation, 1982, 2018.
Console login:
后续依次配置所有的设备,遍历设备树,直到最后提示AIX login:
通过详细阅读启动log信息,可以更清楚地了解AIX启动的每一步骤,调用依存关系和显示信息,今天就先介绍到这里。