Configure TinyVMI with Target Info

1. Compile libvmi.conf

run

xxd -i ~/etc/libvmi.conf > ~/etc/target_libvmi_conf_file.c

2. Compile system map

run

xxd -i ~/etc/System.map-\<kernel_version> > ~/etc/target_libvmi_sym.c

Then, copy the following code to new file ~/etc/target_libvmi_sym.h:

#ifndef TARGET_LIBVMI_CONF_SYM_H
#define TARGET_LIBVMI_CONF_SYM_H


/**
* define system_map_string for Linux
* change this if use another system map
* all the System_map_* variables are declared here, and
* defined at file /tiny-vmi/config/target_conf/target_libvmi_sym.c
* the definition is generated by xxd command which coverts a file
* to ASCII string codes: xxd -i System_map_*

*/


#define linux_system_map_string System_map_4_4_0_101_generic
#define linux_system_map_string_len System_map_4_4_0_101_generic_len

extern unsigned char System_map_4_4_0_101_generic[];
extern unsigned int System_map_4_4_0_101_generic_len;


#define linux_system_map_string_SRC_FILE "string"

#endif // TARGET_LIBVMI_CONF_SYM_H

In the above file, replace variable System_map_4_4_0_101_generic and System_map_4_4_0_101_generic_len with your own variable names generated in the last step. You can run head ~/etc/target_libvmi_sym.c or tail ~/etc/target_libvmi_sym.c to find the names.

3. Compile with TinyVMI

Then, create a new directory in tinyvmi/tiny-vmi/config/target_conf_examples/, say my_conf_dir/, and run:

cd xen-src/stubdom/tinyvmi/tiny-vmi/config/target_conf_examples/my_conf_dir/

cp ~/etc/libvmi.conf \
    ~/etc/System.map* \
    ~/etc/target_* \
    .

cd ../../target_conf/
rm *
ln -s ../target_conf_examples/my_conf_dir/* .

4. Update domain_id.h

Currently, TinyVMI cannot convert domain string name to domain ID by querying Xenstore. Therefore, a hardcoded domain ID is required. To do so, change DOMAIN_ID and DOMAIN_NAME macro definition in file tinyvmi/include/domain_id.h. For example:

#ifndef DOMAIN_ID_H
#define DOMAIN_ID_H

#define DOMAIN_ID  1

#define DOMAIN_NAME "xen16a"

#endif // DOMAIN_ID_H