歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> linux設備驅動模塊引用和依賴

linux設備驅動模塊引用和依賴

日期:2017/3/3 12:54:44   编辑:Linux技術
/modules/04 # lsmod 
	test 787 0 - Live 0xbf010000 (PO)
	func 633 1 test, Live 0xbf00c000 (PO)		test -> func
			 ^ 引用計數
	/modules/04 # rmmod func					引用計數>0 不能卸載
	rmmod: remove 'func': Resource temporarily unavailable	

 	modprobe自動解決依賴:
	/ # modprobe test
	[  307.800000] test: Unknown symbol print (err 0)
	[  307.850000] hello kernel		<-- insmod func.ko ; insmod test.ko
	/ # lsmod 
	test 787 0 - Live 0xbf01c000 (PO)
	func 633 1 test, Live 0xbf018000 (PO)
	
	/ # modprobe -r func			<-- 引用計數>0 不能卸載
	modprobe: remove 'func': Resource temporarily unavailable
	/ # modprobe -r test			<-- rmmod test.ko ; rmmod func.ko
	[  363.130000] cleanup module
Copyright © Linux教程網 All Rights Reserved