天天看點

【XEN學習筆記】XEN中ACM子產品編譯注意事項

在預設設定下,ACM子產品是不被編譯和加載到核心中的。如果需要編譯該子產品,需要手動修改根目錄下的Config.mk檔案

# Enable XSM security module.  Enabling XSM requires selection of an 
# XSM security module (FLASK_ENABLE or ACM_SECURITY).
XSM_ENABLE ?= n
FLASK_ENABLE ?= n
ACM_SECURITY ?= n
           

注意事項1:此處除需要更改ACM_SECURITY項外,XSM_ENABLE也需要打開

注釋寫的不大負責任啊。邏輯上來講XSM是個統稱,ACM是屬于XSM的,是以要使用ACM必須打開XSM

# Enable XSM security module.  Enabling XSM requires selection of an 
# XSM security module (FLASK_ENABLE or ACM_SECURITY).
XSM_ENABLE ?= y
FLASK_ENABLE ?= n
ACM_SECURITY ?= y
           

否則,将出現錯誤:

acm_core.c: In function ‘acm_init’:
acm_core.c:283: error: ‘policy_buffer’ undeclared (first use in this function)
acm_core.c:283: error: (Each undeclared identifier is reported only once
acm_core.c:283: error: for each function it appears in.)
acm_core.c:283: error: ‘policy_size’ undeclared (first use in this function)
cc1: warnings being treated as errors
acm_core.c:319: warning: implicit declaration of function ‘register_xsm’
acm_core.c: At top level:
acm_core.c:325: warning: data definition has no type or storage class
acm_core.c:325: warning: type defaults to ‘int’ in declaration of ‘xsm_initcall’
acm_core.c:325: warning: parameter names (without types) in function declaration
make[4]: *** [acm_core.o] Error 1
make[4]: Leaving directory `/xen/xen-3.4.2/xen/xsm/acm'
make[3]: *** [acm/built_in.o] Error 2
make[3]: Leaving directory `/xen/xen-3.4.2/xen/xsm'
make[2]: *** [/xen/xen-3.4.2/xen/xsm/built_in.o] Error 2
make[2]: Leaving directory `/xen/xen-3.4.2/xen/arch/x86'
make[1]: *** [/xen/xen-3.4.2/xen/xen] Error 2
make[1]: Leaving directory `/xen/xen-3.4.2/xen'
make: *** [build] Error 2
           

此錯誤是因為/xen/include/xsm/xsm.h中定義了如下内容:

#ifdef XSM_ENABLE

extern char *policy_buffer;
extern u32 policy_size;
……
           

 注意事項2:xend-config.sxp

增加如下内容

(xsm_module_name acm)
           

否則,ACM政策類型将被認為不支援(未指定使用的xsm類型)

繼續閱讀