Commit e34ca44e authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

test-v2: Simple example builds.

A few things -

   1 - Needed to add export symbols for kliblcd.

   2 - Auto generate path to liblcd.a and paste the path in each Kbuild
       example file

   3 - Set up CC flags for examples, non-isolated and isolated

   4 - Need to point to kliblcd's Module.symvers so that kernel doesn't
       complain when we build non-isolated .ko's.
parent 0dad2249
......@@ -38,8 +38,8 @@
LCD_DOMAINS_TOP_SRC_DIR=$(PWD)
export LCD_DOMAINS_TOP_SRC_DIR
export LCD_DOMAINS_CFLAGS=-Werror \
-DLCD_DOMAINS
-DLCD_TEST_MODS_PATH="$(PWD)/build/test_mods"
-DLCD_DOMAINS \
-DLCD_TEST_MODS_PATH="\"$(PWD)/build/test_mods\""
# Don't print "Entering directory..." etc.
MAKEFLAGS += --no-print-directory
......@@ -184,16 +184,19 @@ TEST_MODULES_BUILD_DIRS=$(foreach dir,$(TEST_MODULES_DIRS), \
TEST_MODULES_BUILD_KBUILDS=$(foreach kb,$(TEST_MODULES_KBUILDS), \
$(LCD_TEST_MODULES_BUILD_DIR)/$(kb))
KLIBLCD_SYMBOLS=$(MICROKERNEL_BUILD_DIR)/Module.symvers
test_mods: $(TEST_MODULES_BUILD_KBUILDS) $(TEST_MODULES_BUILD_DIRS) | \
$(LIBLCD_BUILD_DIR)/liblcd.a
$(MAKE) -C .. M=$(LCD_TEST_MODULES_BUILD_DIR) $(MAKEFLAGS)
$(MAKE) -C .. M=$(LCD_TEST_MODULES_BUILD_DIR) \
KBUILD_EXTRA_SYMBOLS=$(KLIBLCD_SYMBOLS) $(MAKEFLAGS)
# This rule does the external source hack (define "src" in Kbuild file)
$(LCD_TEST_MODULES_BUILD_DIR)/%/Kbuild: $(LCD_TEST_MODULES_DIR)/%/Kbuild | \
$(TEST_MODULES_BUILD_DIRS)
@echo " KBUILD $^"
@printf "#\n# BEGIN: Auto-generated part.\n#\n\n" > $@ && \
printf "LIBLCD =
printf "LIBLCD = $(shell scripts/relpath.py $(LIBLCD_BUILD_DIR)/liblcd.a $(shell dirname $(shell readlink -f $@)))\n\n" >> $@ && \
printf "src = $(shell dirname `readlink -f $^`)\n\n" >> $@ && \
printf "#\n# END: Auto-generated part.\n#\n\n" >> $@ && \
cat $^ >> $@
......
......@@ -13,6 +13,11 @@
#include <liblcd/resource_tree.h>
#include <liblcd/address_spaces.h>
/* LIBCAP DEBUG -------------------------------------------------- */
/* Controls debug msg output for liblcd's libcap */
#define LIBLCD_LIBCAP_DEBUG_LVL 0
/* GLOBAL MEMORY TREE -------------------------------------------------- */
#define LCD_NR_BOOT_RESOURCE_NODES 16
......
......@@ -166,7 +166,7 @@ struct lcd {
/*
* Console
*/
char console_buff[LCD_CONSOLE_BUFF_SIZE];
char console_buff[LCD_PRINTK_BUFF_SIZE];
unsigned console_cursor;
/*
* KLCD specifics
......
......@@ -10,3 +10,7 @@ struct lcd_boot_info * lcd_get_boot_info(void)
{
return NULL;
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_get_boot_info);
......@@ -27,3 +27,10 @@ void lcd_cptr_free(cptr_t slot)
{
cptr_free(current->cptr_cache, slot);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_cap_delete);
EXPORT_SYMBOL(lcd_cap_revoke);
EXPORT_SYMBOL(lcd_cptr_alloc);
EXPORT_SYMBOL(lcd_cptr_free);
......@@ -14,3 +14,7 @@ void lcd_printk(char *fmt, ...)
vprintk(fmt, args);
va_end(args);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_printk);
......@@ -1138,3 +1138,12 @@ int lcd_run(cptr_t lcd)
{
return __lcd_run(current->lcd, lcd);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_create);
EXPORT_SYMBOL(lcd_create_klcd);
EXPORT_SYMBOL(lcd_config_registers);
EXPORT_SYMBOL(lcd_memory_grant_and_map);
EXPORT_SYMBOL(lcd_cap_grant);
EXPORT_SYMBOL(lcd_run);
......@@ -149,3 +149,9 @@ void lcd_abort(void)
{
lcd_exit(-EIO);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_enter);
EXPORT_SYMBOL(lcd_exit);
EXPORT_SYMBOL(lcd_abort);
......@@ -960,3 +960,35 @@ gva_t lcd_gpa2gva(gpa_t gpa)
{
return __gva((unsigned long)__va(gpa_val(gpa)));
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_alloc_init_resource_tree);
EXPORT_SYMBOL(lcd_destroy_free_resource_tree);
EXPORT_SYMBOL(_lcd_alloc_pages_exact_node);
EXPORT_SYMBOL(_lcd_alloc_pages);
EXPORT_SYMBOL(_lcd_vmalloc);
EXPORT_SYMBOL(_lcd_mmap);
EXPORT_SYMBOL(_lcd_munmap);
EXPORT_SYMBOL(lcd_alloc_pages_exact_node);
EXPORT_SYMBOL(lcd_alloc_pages);
EXPORT_SYMBOL(lcd_free_pages);
EXPORT_SYMBOL(lcd_vmalloc);
EXPORT_SYMBOL(lcd_vfree);
EXPORT_SYMBOL(lcd_map_phys);
EXPORT_SYMBOL(lcd_map_virt);
EXPORT_SYMBOL(lcd_unmap_phys);
EXPORT_SYMBOL(lcd_unmap_virt);
EXPORT_SYMBOL(lcd_volunteer_pages);
EXPORT_SYMBOL(lcd_unvolunteer_pages);
EXPORT_SYMBOL(lcd_volunteer_dev_mem);
EXPORT_SYMBOL(lcd_unvolunteer_dev_mem);
EXPORT_SYMBOL(lcd_volunteer_vmalloc_mem);
EXPORT_SYMBOL(lcd_unvolunteer_vmalloc_mem);
EXPORT_SYMBOL(lcd_phys_to_cptr);
EXPORT_SYMBOL(lcd_virt_to_cptr);
EXPORT_SYMBOL(lcd_virt_to_head_page);
EXPORT_SYMBOL(lcd_page_address);
EXPORT_SYMBOL(lcd_free_memcg_kmem_pages);
EXPORT_SYMBOL(lcd_gva2gpa);
EXPORT_SYMBOL(lcd_gpa2gva);
......@@ -232,3 +232,8 @@ void lcd_release_module(void *m_init_bits, void *m_core_bits)
dedup_module_pages(m_init_bits);
dedup_module_pages(m_core_bits);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_load_module);
EXPORT_SYMBOL(lcd_release_module);
......@@ -66,3 +66,12 @@ int lcd_sync_reply(void)
return __lcd_reply(current->lcd);
}
/* EXPORTS -------------------------------------------------- */
EXPORT_SYMBOL(lcd_get_utcb);
EXPORT_SYMBOL(_lcd_create_sync_endpoint);
EXPORT_SYMBOL(lcd_create_sync_endpoint);
EXPORT_SYMBOL(lcd_sync_send);
EXPORT_SYMBOL(lcd_sync_recv);
EXPORT_SYMBOL(lcd_sync_call);
EXPORT_SYMBOL(lcd_sync_reply);
......@@ -7,10 +7,17 @@
#include <lcd_config/pre_hook.h>
#include <asm/lcd_domains/liblcd.h>
#include <lcd_domains/liblcd.h>
#include <liblcd/cap.h>
#include <lcd_config/post_hook.h>
/* CAP DEBUGGING -------------------------------------------------- */
int cap_debug_level = LIBLCD_LIBCAP_DEBUG_LVL;
/* FUNCTIONS -------------------------------------------------- */
void lcd_cap_delete(cptr_t slot)
{
lcd_syscall_cap_delete(slot);
......
......@@ -15,6 +15,7 @@ struct cap_type_system *lcd_libcap_type_system;
/* CAP DEBUGGING -------------------------------------------------- */
int cap_debug_level = LCD_LIBCAP_DEBUG_LVL;
EXPORT_SYMBOL(cap_debug_level);
/* ------------------------------------------------------------ */
......
#! /usr/bin/env python
import os
import sys
print os.path.relpath(sys.argv[1], sys.argv[2])
#
# Top-level test mods Kbuild file
#
# Some of these variables are exported from the top-level Makefile.
#
COMMON_CC_FLAGS= \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include
export ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DLCD_ISOLATE
export NON_ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated
export ISOLATED_CC_FLAGS=-I$(LCD_DOMAINS_TOP_SRC_DIR)/lcd_config/isolated
export NON_ISOLATED_CC_FLAGS= # empty for now
# Examples
obj-m += liblcd_test/
obj-m += boot/
obj-m += lcd/
\ No newline at end of file
......@@ -3,4 +3,4 @@ obj-m += lcd_test_mod_liblcd_tests_boot.o
lcd_test_mod_liblcd_tests_boot-y += boot.o
ccflags-y += $(NON_ISOLATED_CC_FLAGS)
\ No newline at end of file
ccflags-y += $(NON_ISOLATED_CC_FLAGS)
......@@ -23,9 +23,9 @@ static int boot_main(void)
/*
* Create lcd
*/
ret = lcd_create_module_lcd(&lcd,
LCD_DIR("liblcd_tests/lcd"),
ret = lcd_create_module_lcd(LCD_DIR("liblcd_tests/lcd"),
"lcd_test_mod_liblcd_tests_lcd",
&lcd,
&ctx);
if (ret) {
LIBLCD_ERR("failed to create lcd");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment