XEN 4.2.4 前后端驱动开发

来源:互联网 发布:凡茜卸妆油怎么样知乎 编辑:程序博客网 时间:2024/06/05 16:07

1.分别 编写后前端驱动,分别在dom0和domU中加载,可以采用 insmod 方式


2.通过在dom0中运行如下脚本,来触发后前端驱动的probe,以及changed函数例程

#!/bin/bash if [ $# != 2 ] then         echo "Usage: $0 <device name> <frontend-id>" else         # Write backend information into the location the frontend will look         # for it.         xenstore-write /local/domain/${2}/device/${1}/0/backend-id 0         xenstore-write /local/domain/${2}/device/${1}/0/backend \                        /local/domain/0/backend/${1}/${2}/0         # Write frontend information into the location the backend will look         # for it.         xenstore-write /local/domain/0/backend/${1}/${2}/0/frontend-id ${2}         xenstore-write /local/domain/0/backend/${1}/${2}/0/frontend \                        /local/domain/${2}/device/${1}/0         # Set the permissions on the backend so that the frontend can         # actually read it.         xenstore-chmod /local/domain/0/backend/${1}/${2}/0 r         # Write the states.  Note that the backend state must be written         # last because it requires a valid frontend state to already be         # written.         xenstore-write /local/domain/${2}/device/${1}/0/state 1         xenstore-write /local/domain/0/backend/${1}/${2}/0/state 1 fi 

3. 可以通过printk(KERN_INFO ...)简单地观察前后端驱动的执行情况

0 0
原创粉丝点击