pci设备更新硬件设备详细厂商信息
修改lspci显示内容,说白了就是pcie设备在系统有一个配置文件,然后去修改配置文件。
cenOS该文件为/usr/share/hwdata/pci.ids ,
Ubuntu为 /usr/share/misc/pci.ids
make install
#Makefile
SRC_DIR=$(shell pwd)install:@$(SRC_DIR)pci.update $(SRC_DIR)/pci.ids
pci.ids
#这里厂商号自己随便写的,如果雷同,请见谅 1fff
1fff MY_COMPANY0001 first dev0002 second dev0003 third dev
pci.update
#! /bin/bash
# Copyright (C) 2017 Inter Corporation
# For licensing information, see the file 'LICENSE' in the root folder
# $1 = system pci.ids file to update
# $2 = system pcitable file to update
# $3 = file with new entries in pci.ids file format
# $4 = pci.ids output file
# $5 = pcitable output file
# $6 = driver name for use in pcitable fileif [ -e "/etc/yum" ];thenpci_ids_path=/usr/share/hwdata/pci.ids pci_ids_path_tmp=/usr/share/hwdata/pci.ids.tmp
elsepci_ids_path=/usr/share/misc/pci.ids pci_ids_path_tmp=/usr/share/misc/pci.ids.tmp
fiexec 3<$pci_ids_path
exec 4<$1
exec 5>$pci_ids_path_tmpdriver="hello_world"# pattern matching strings
ID="[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]"
VEN="${ID}*"line=
vendor=
scr_vendor=
arry=()
cnt=0
count=0
notes=
write_flag=1while true
do#pci.updateexec 0<&4while read -r linedoif [[ $line == $VEN ]]thensrc_vendor=0x${line:0:4}#echo $src_vendorfiarry[$count]=$line#echo "${arry[$count]}"count=$(( $count + 1 ))doneexec 0<&3exec 1>&5while read -r linedoif [[ '#' == ${line:0:1} ]]then notes=$lineread -r lineelsenotes=''fi if [[ $line == $VEN ]]thenwrite_flag=1#add pci.updatevendor=0x${line:0:4}if [[ $src_vendor == $vendor ]]then write_flag=0fiif [[ $src_vendor -lt $vendor ]]thenwhile [[ "$cnt" -ne "$count" ]]doecho "${arry[$cnt]}"cnt=$(( $cnt + 1 ))donefifiif [[ '#' == ${notes:0:1} ]]thenecho "$notes"fiif [[ '1' == $write_flag ]]then echo $linefidonebreak
doneexec 3<&-
exec 4<&-
exec 5>&-
mv $pci_ids_path_tmp $pci_ids_path
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
