linux系统主机通过二维码与手机传递简单信息的操作方法。
1:在linux系统下安装二维码生成工具qrencode
2:使用工具生成二维码 qrencode -o t1006.png 12345678
3:在linux系统下,在图形系统下打开文件t1006.png
4: 使用手机对主机二维码进行扫码,并设别为文字。
通过这种方法,文字从主机被传递复制到了手机上面。
%d--> for int
%u--> for unsigned int
%ld--> for long int or long
%lu--> for unsigned long int or long unsigned int or unsigned long
%lld--> for long long int or long long
%llu--> for unsigned long long int or unsigned long long
SGPIO(Serial GPIO)要从关键字上理解,分成两个关键字Serial和GPIO。
Serial是一组GPIO串联在一起。
GPIO,是单个BIT表示GPIO的拉高拉低,GPIO不只是拉高拉低两种形态,
可能是一会拉高一会拉低,以一定的闪烁,即为SGPIO的pattern。
1- 在启动grub菜单,选择编辑选项启动
2 - 按键盘e键,来进入编辑界面
3 - 找到Linux 16的那一行,将ro改为rw init=/sysroot/bin/sh
4 - 现在按下 Control+x ,使用单用户模式启动
5 - 现在,可以使用下面的命令访问系统 chroot /sysroot
6 - 重置密码 passwd root
7 - 更新系统信息 touch /.autorelabel
8 - 退出chroot exit
9 - 重启你的系统 reboot
The STR operands of the --clear=STR, --get=STR and --set=STR options all have the same structure. There are two forms:
<acronym>[=<value>]
<start_byte>:<start_bit>[:<num_bits>][=<value>]
The <acronym> is one of a list of common fields (e.g. "ident" and "fault") that the utility converts internally into the second form. The <start_byte> is usually in the range 0 to 3, the <start_bit> must be in the range 0 to 7 and the <num_bits> must be in the range 1 to 64 (default 1). The number of bits are read in the left to right sense of the element tables shown in the various SES draft documents. For example the 8 bits of byte 2 would be represented as 2:7:8 with the most significant bit being 2:7 and the least sugnificant bit being 2:0 .
The <value> is optional but is ignored if provided to --get=STR. For --set=STR the default <value> is 1 while for --clear=STR the default value is 0 .
The supported list of <acronym>s can be viewed by using the --enumerate option twice (or "-ee").
#sg_ses -ee
--clear, --get, --set acronyms for Enclosure Status/Control ['es' or 'ec'] page:
ac_fail [Uninterruptible power supply] [2:4:1]
ac_hi [Uninterruptible power supply] [2:6:1]
ac_lo [Uninterruptible power supply] [2:7:1]
ac_qual [Uninterruptible power supply] [2:5:1]
active [Device slot] [2:7:1]
active [Array device slot] [2:7:1]
batt_fail [Uninterruptible power supply] [3:1:1]
bpf [Uninterruptible power supply] [3:0:1]
bypa [Device slot] [3:3:1] bypass port A
bypa [Array device slot] [3:3:1] bypass port A
bypb [Device slot] [3:2:1] bypass port B
bypb [Array device slot] [3:2:1] bypass port B
conscheck [Array device slot] [1:4:1] consistency check
ctr_link [SAS connector] [2:7:8] connector physical link
ctr_type [SAS connector] [1:6:7] connector type
current [Current sensor] [2:7:16] current in centiamps
dc_fail [Uninterruptible power supply] [2:3:1]
disable [*] [0:5:1]
disable_elm [SCSI port/transceiver] [3:4:1] disable port/transceiver
disable_elm [Communication port] [3:0:1] disable communication port
devoff [Device slot] [3:4:1]
devoff [Array device slot] [3:4:1]
disp_mode [Display] [1:1:2]
disp_char [Display] [2:7:16]
dnr [Array device slot] [2:6:1] do not remove
dnr [Cooling] [1:6:1] do not remove
dnr [Device slot] [2:6:1] do not remove
dnr [Enclosure services controller electronics] [1:5:1] do not remove
dnr [Power supply] [1:6:1] do not remove
dnr [Uninterruptible power supply] [3:3:1] do not remove
enable [SCSI initiator port] [3:0:1]
enable [SCSI target port] [3:0:1]
fail [Audible alarm] [1:6:1]
fail [Communication port] [1:7:1]
fail [Cooling] [3:6:1]
fail [Current sensor] [3:6:1]
fail [Display] [1:6:1]
fail [Door] [1:6:1]
fail [Enclosure services controller electronics] [1:6:1]
fail [Key pad entry] [1:6:1]
fail [Nonvolatile cache] [3:6:1]
fail [Power supply] [3:6:1]
fail [SAS connector] [3:6:1]
fail [SAS expander] [1:6:1]
fail [SCC controller electronics] [3:6:1]
fail [SCSI initiator port] [1:6:1]
fail [SCSI port/transceiver] [1:6:1]
fail [SCSI target port] [1:6:1]
fail [Simple subenclosure] [1:6:1]
fail [Temperature sensor] [3:6:1]
fail [Uninterruptible power supply] [3:6:1]
fail [Voltage sensor] [1:6:1]
failure_ind [Enclosure] [2:1:1]
failure [Enclosure] [3:1:1]
fault [Device slot] [3:5:1]
fault [Array device slot] [3:5:1]
hotspare [Array device slot] [1:5:1]
hotswap [Cooling] [3:7:1]
hotswap [Enclosure services controller electronics] [3:7:1]
hw_reset [Enclosure services controller electronics] [1:2:1] hardware reset
ident [Device slot] [2:1:1] flash LED
ident [Array device slot] [2:1:1] flash LED
ident [Power supply] [1:7:1] flash LED
ident [Communication port] [1:7:1] flash LED
ident [Cooling] [1:7:1] flash LED
ident [Current sensor] [1:7:1] flash LED
ident [Display] [1:7:1] flash LED
ident [Door] [1:7:1] flash LED
ident [Enclosure services controller electronics] [1:7:1] flash LED
ident [Enclosure] [1:7:1] flash LED
ident [Key pad entry] [1:7:1] flash LED
ident [Language] [1:7:1] flash LED
ident [Audible alarm] [1:7:1]
ident [Nonvolatile cache] [1:7:1] flash LED
ident [SAS connector] [1:7:1] flash LED
ident [SAS expander] [1:7:1] flash LED
ident [SCC controller electronics] [1:7:1] flash LED
ident [SCSI initiator port] [1:7:1] flash LED
ident [SCSI port/transceiver] [1:7:1] flash LED
ident [SCSI target port] [1:7:1] flash LED
ident [Simple subenclosure] [1:7:1] flash LED
ident [Temperature sensor] [1:7:1] flash LED
ident [Uninterruptible power supply] [3:7:1] flash LED
ident [Voltage sensor] [1:7:1] flash LED
incritarray [Array device slot] [1:3:1]
infailedarray [Array device slot] [1:2:1]
info [Audible alarm] [3:3:1] emits warning tone when set
insert [Device slot] [2:3:1]
insert [Array device slot] [2:3:1]
intf_fail [Uninterruptible power supply] [2:0:1]
language [Language] [2:7:16] language code
locate [Device slot] [2:1:1] flash LED
locate [Array device slot] [2:1:1] flash LED
locate [Power supply] [1:7:1] flash LED
locate [Communication port] [1:7:1] flash LED
locate [Cooling] [1:7:1] flash LED
locate [Current sensor] [1:7:1] flash LED
locate [Display] [1:7:1] flash LED
locate [Door] [1:7:1] flash LED
locate [Enclosure services controller electronics] [1:7:1] flash LED
locate [Enclosure] [1:7:1] flash LED
locate [Key pad entry] [1:7:1] flash LED
locate [Language] [1:7:1] flash LED
locate [Audible alarm] [1:7:1]
locate [Nonvolatile cache] [1:7:1] flash LED
locate [SAS connector] [1:7:1] flash LED
locate [SAS expander] [1:7:1] flash LED
locate [SCC controller electronics] [1:7:1] flash LED
locate [SCSI initiator port] [1:7:1] flash LED
locate [SCSI port/transceiver] [1:7:1] flash LED
locate [SCSI target port] [1:7:1] flash LED
locate [Simple subenclosure] [1:7:1] flash LED
locate [Temperature sensor] [1:7:1] flash LED
locate [Uninterruptible power supply] [3:7:1] flash LED
locate [Voltage sensor] [1:7:1] flash LED
lol [SCSI port/transceiver] [3:1:1] Loss of Link
mated [SAS connector] [3:7:1]
missing [Device slot] [2:4:1]
missing [Array device slot] [2:4:1]
mute [Audible alarm] [3:6:1] control only: mute the alarm
muted [Audible alarm] [3:6:1] status only: alarm is muted
off [Power supply] [3:4:1] Not providing power
off [Cooling] [3:4:1] Not providing cooling
offset_temp [Temperature sensor] [1:5:6] Offset for reference temperature
ok [Array device slot] [1:7:1]
on [Cooling] [3:5:1]
on [Power supply] [3:5:1] 0: turn (remain) off; 1: turn on
open [Door] [3:1:1]
overcurrent [Current sensor] [1:1:1] overcurrent
overcurrent [Power supply] [2:1:1] DC overcurrent
overcurrent [SAS connector] [3:5:1]
overcurrent_warn [Current sensor] [1:3:1] overcurrent warning
overtemp_fail [Temperature sensor] [3:3:1] Overtemperature failure
overtemp_warn [Temperature sensor] [3:2:1] Overtemperature warning
overvoltage [Power supply] [2:3:1] DC overvoltage
overvoltage [Voltage sensor] [1:1:1] overvoltage
overvoltage_warn [Power supply] [1:3:1] DC overvoltage warning
pow_cycle [Enclosure] [2:7:2] 0: no; 1: start in pow_c_delay minutes; 2: cancel
pow_c_delay [Enclosure] [2:5:6] delay in minutes before starting power cycle (max: 60)
pow_c_duration [Enclosure] [3:7:6] 0: power off, restore within 1 minute; <=60: restore within that many minutes; 63: power off, wait for manual power on
pow_c_time [Enclosure] [2:7:6] time in minutes remaining until starting power cycle; 0: not scheduled; <=60: scheduled in that many minutes; 63: in zero minutes
prdfail [*] [0:6:1] predict failure
rebuildremap [Array device slot] [1:1:1]
remove [Device slot] [2:2:1]
remove [Array device slot] [2:2:1]
remind [Audible alarm] [3:4:1]
report [Enclosure services controller electronics] [2:0:1]
report [SCC controller electronics] [2:0:1]
report [SCSI initiator port] [2:0:1]
report [SCSI target port] [2:0:1]
rqst_mute [Audible alarm] [3:7:1] status only: alarm was manually muted
rqst_override [Temperature sensor] [3:7:1] Request(ed) override
rrabort [Array device slot] [1:0:1] rebuild/remap abort
rsvddevice [Array device slot] [1:6:1] reserved device
select_element [Enclosure services controller electronics] [2:0:1]
short_stat [Simple subenclosure] [3:7:8] short enclosure status
size [Nonvolatile cache] [2:7:16]
speed_act [Cooling] [1:2:11] actual speed (rpm / 10)
speed_code [Cooling] [3:2:3] 0: leave; 1: lowest... 7: highest
size_mult [Nonvolatile cache] [1:1:2]
swap [*] [0:4:1]
sw_reset [Enclosure services controller electronics] [1:3:1] software reset
temp [Temperature sensor] [2:7:8] (Requested) temperature
unlock [Door] [3:0:1]
undertemp_fail [Temperature sensor] [3:1:1] Undertemperature failure
undertemp_warn [Temperature sensor] [3:0:1] Undertemperature warning
undervoltage [Power supply] [2:2:1] DC undervoltage
undervoltage [Voltage sensor] [1:0:1] undervoltage
undervoltage_warn [Power supply] [1:2:1] DC undervoltage warning
ups_fail [Uninterruptible power supply] [2:2:1]
urgency [Audible alarm] [3:3:4]
voltage [Voltage sensor] [2:7:16] voltage in centivolts
warning [Uninterruptible power supply] [2:1:1]
warning [Enclosure] [3:0:1]
warning_ind [Enclosure] [2:0:1]
xmit_fail [SCSI port/transceiver] [3:0:1] Transmitter failure
--clear, --get, --set acronyms for Threshold In/Out ['th'] page:
high_crit [*] [0:7:8]
high_warn [*] [1:7:8]
low_crit [*] [2:7:8]
low_warn [*] [3:7:8]
--get acronyms for Additional Element Status ['aes'] page (SAS EIP=1):
at_sas_addr [*] [12:7:64]
dev_type [*] [8:6:3] 1: SAS/SATA dev, 2: expander
dsn [*] [7:7:8] device slot number (255: none)
num_phys [*] [4:7:8] number of phys
phy_id [*] [28:7:8]
sas_addr [*] [20:7:64]
sata_dev [*] [11:0:1]
sata_port_sel [*] [11:7:1]
smp_init [*] [10:1:1]
smp_targ [*] [11:1:1]
ssp_init [*] [10:3:1]
ssp_targ [*] [11:3:1]
stp_init [*] [10:2:1]
stp_targ [*] [11:2:1]
linux下有各种ls命令,都是list出某些内容。
ls | |
lsmod | |
lsblk | |
lscpu | |
lsof | |
lspci | |
lsusb | |
lsscsi |
AMI BMC 串口下通过查看文件确定FW版本和产品型号的方法。
在BMC下,登录串口,然后查找两个文件,一个是FwInfo文件,另外一个是FRU.bin文件。
文件名称比较容易记住,但路径比较难记。可以进行查找,然后进行cat查看文件。
#cd /
#find | grep -i FwInfo
./proc/ractrends/Helper/FwInfo2
./proc/ractrends/Helper/FwInfo1
./proc/ractrends/Helper/FwInfo
#cat ./proc/ractrends/Helper/FwInfo
FW_VERSION=*.*.*
FW_DATE=*** ** ****
FW_BUILDTIME=16:47:49 CST
FW_DESC=RR11-5 AST2500 EMMC KERN3 UPDATE BUILD 1
FW_PRODUCTID=1
FW_RELEASEID=RR9
FW_CODEBASEVERSION=X.X
#find | grep -i FRU
./etc/defconfig/BMC1/ast2500evb_ami/BMC1/ast2500evb_ami/FRU.bin
./etc/defconfig/BMC1/ast2500evb_ami/BMC1/ast2500evb_ami/FRU_BAK.bin
# cat FRU.bin
COMPANY PRODUCT defconfig/BMC1/ast2500evb_ami
1:strlen函数是不安全的。
2:strnlen不是strlen的安全函数,
3:可以使用以下的函数作为strlen的安全函数
size_t safe_strlen(const char *str, size_t max_len)
{
const char * end = (const char *)memchr(str, '\0', max_len);
if (end == NULL)
return max_len;
else
return end - str;
}