#!/bin/sh

source `dirname $0`/__bt_common_env

module_dir=$MODDIR/btrax

#------------------------------------------------------------------------------
# Check kernel symbols
#
addr0=
if [ `kver_chk 2.6.19` -ge 0 ]; then
	get_ksym_addr kallsyms_lookup_name
	addr0=$RET_STR
	# These two symbols are used in bt_mod.ko, so we check these.
	get_ksym_addr set_irq_chip_and_handler
	get_ksym_addr handle_edge_irq
fi
get_ksym_addr irq_desc
addr1=$RET_STR
get_ksym_addr no_irq_type,no_irq_chip
addr2=$RET_STR
get_ksym_addr idt_table
addr3=$RET_STR
get_djprobe_addr_and_size switch_to __switch_to
switch_to_param=$RET_STR

if [ ! -f $module_dir/bt_mod.ko ]; then
	echo "Btrax kernel module($module_dir/bt_mod.ko) not found."
	exit 1
fi
do_insmod $module_dir/bt_mod.ko kallsyms_lookup_name_addr=0x${addr0} \
	irq_desc_p=0x${addr1} no_irq_type_p=0x${addr2} \
	idt_table_p=0x${addr3} ${switch_to_param} $*

