OpenSolaris, OpenIndiana, Nexenta Forum
Kirov OpenSolaris User Group => Разработки Kirov OSUG => Тема начата: keremet от Август 28, 2012, 06:53:00 pm
-
Начну с переноса в Illumos того,что сделано в OpenSolaris
Надо скомплировать
драйвер ubt: /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/io/bluetooth/ubt
модуль netbt : /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/io/bluetooth/netbt
keremet@openindiana:~/work/gsoc2012/bluetooth-gate/usr/src$ find ./ -name "Makefile*"|xargs grep netbt
./uts/common/Makefile.files:NETBT_OBJS += netbtcore.o hci_event.o hci_link.o hci_misc.o hci_socket.o hci_unit.o \
./uts/common/Makefile.rules:$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/bluetooth/netbt/%.c
./uts/common/Makefile.rules:$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/bluetooth/netbt/%.c
./uts/sparc/Makefile.sparc.shared:MISC_KMODS += netbt
./uts/sparc/netbt/Makefile:MODULE = netbt
./uts/sparc/ubt/Makefile:LDFLAGS += -dy -Nmisc/usba -Nmisc/netbt
./uts/intel/Makefile.intel.shared:MISC_KMODS += netbt
./uts/intel/sockl2cap/Makefile:LDFLAGS += -dy -Nfs/sockfs -Nmisc/netbt
./uts/intel/netbt/Makefile:MODULE = netbt
./uts/intel/ubt/Makefile:LDFLAGS += -dy -Nmisc/usba -Nmisc/netbt
./uts/intel/sockrawhci/Makefile:LDFLAGS += -dy -Nfs/sockfs -Nmisc/netbt
Попробовать написать makefile для компляции в дереве исходников OpenSolaris. Лучше даже на основе его компиляции стандартным способом.
Копирование файлов в дерево исходников illumos
cp -r /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/io/bluetooth /export/home/illumos-dev/code/illumos-gate/usr/src/uts/common/io/bluetooth
cp /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/sys/bluetooth.h /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/sys/hci.h /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/sys/l2cap.h /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/sys/sco.h /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/common/sys/rfcomm.h /export/home/illumos-dev/code/illumos-gate/usr/src/uts/common/sys
cp -r /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/intel/netbt /export/home/illumos-dev/code/illumos-gate/usr/src/uts/intel/netbt
Ошибка линковки netbt:
/export/home/illumos-dev/code/illumos-gate/usr/src/uts/intel/netbt$ /usr/ccs/bin/ld -r -dy -o debug32/netbt debug32/netbtcore.o debug32/hci_event.o debug32/hci_link.o debug32/hci_misc.o debug32/hci_socket.o debug32/hci_unit.o debug32/l2cap_lower.o debug32/l2cap_misc.o debug32/l2cap_signal.o debug32/l2cap_upper.o debug32/rfcomm_dlc.o debug32/rfcomm_session.o debug32/rfcomm_upper.o debug32/sco_upper.o
ld: fatal: symbol 'm_copydata' is multiply-defined:
(file debug32/netbtcore.o type=FUNC; file debug32/hci_event.o type=FUNC);
ld: fatal: symbol 'm_copyback' is multiply-defined:
(file debug32/netbtcore.o type=FUNC; file debug32/hci_event.o type=FUNC);
ld: fatal: symbol 'm_cat' is multiply-defined:
(file debug32/netbtcore.o type=FUNC; file debug32/hci_event.o type=FUNC);
Решение поставить static перед inline:
В /export/home/illumos-dev/code/illumos-gate/usr/src/uts/common/sys/hci.h
static inline void wakeup(struct hci_unit *unit)
{
mutex_enter(&unit->hci_devlock);
cv_signal(&unit->ucv);
mutex_exit(&unit->hci_devlock);
}
static inline unsigned char *
device_xname(struct hci_unit *dev)
{
return (dev->dv_xname);
}
В /export/home/illumos-dev/code/illumos-gate/usr/src/uts/common/sys/bluetooth.h
static inline void m_copydata(mblk_t *m, uint32_t off, uint32_t len, void *p)
{
bcopy((uint8_t *)(m->b_rptr + off), (uint8_t *)p, len);
}
static inline void m_copyback(struct mbuf *m0,int off,int len, void *cp)
{
bcopy((uint8_t *)cp, (uint8_t *)(m0->b_rptr + off), len);
m0->b_wptr = m0->b_rptr + len + off;
}
static inline void m_cat(struct mbuf *dist, struct mbuf *src)
{
while (dist->b_cont)
dist = dist->b_cont;
if (src)
dist->b_cont = src;
}
static inline struct mbuf *
m_split(struct mbuf *m, int len0, uint32_t wait)
{
struct mbuf *n=NULL;
int plen;
plen = MBLKL(m);
if(plen <= len0)
return (NULL);
n = allocb(plen - len0, wait);
if(n == NULL)
return (0);
bcopy(m->b_rptr+len0, n->b_rptr, plen - len0);
n->b_wptr += (plen - len0);
m->b_wptr -= (plen - len0) ;
return (n);
}
static inline void
m_prepend(struct mbuf *m, int len, int how)
{
struct mbuf *n = NULL;
n = allocb(len+MBLKL(m), how);
if(n == NULL){
cmn_err(CE_WARN,"die!\n");
return;
}
n->b_wptr += len;
bcopy(m->b_rptr, n->b_wptr, MBLKL(m));
n->b_wptr += MBLKL(m);
freemsg(m);
m = n;
}
static inline void wakeup(struct hci_unit *unit)
{
mutex_enter(&unit->hci_devlock);
cv_signal(&unit->ucv);
mutex_exit(&unit->hci_devlock);
}
-
keremet@openindiana:~/work/gsoc2012/bluetooth-gate/usr/src$ find ./ -name "Makefile*"|xargs grep ubt
./tools/ctf/Makefile.ctf:# to find the ctf specific headers located outside the tools subtree. We also
./uts/common/Makefile.files:UBT_OBJS += ubt.o
./uts/common/Makefile.rules:$(OBJS_DIR)/%.o: $(UTSBASE)/common/io/bluetooth/ubt/%.c
./uts/common/Makefile.rules:$(LINTS_DIR)/%.ln: $(UTSBASE)/common/io/bluetooth/ubt/%.c
./uts/sparc/Makefile.sparc.shared:DRV_KMODS += ubt
./uts/sparc/ubt/Makefile:MODULE = ubt
./uts/sparc/ubt/Makefile:CONF_SRCDIR = $(UTSBASE)/common/io/bluetooth/ubt
./uts/intel/Makefile.intel.shared:DRV_KMODS += ubt
./uts/intel/ubt/Makefile:MODULE = ubt
./uts/intel/ubt/Makefile:CONF_SRCDIR = $(UTSBASE)/common/io/bluetooth/ubt
./cmd/ksh/Makefile.testshell:# - "io.sh" may fail due a subtle bug in ksh93 or the test suite which
./cmd/agents/snmp/snmprelayd/Makefile: subtree.c\
./cmd/agents/snmp/snmprelayd/Makefile: subtree.h\
./cmd/agents/snmp/agent/Makefile.com:SRCOBJS = node.o access.o agent.o snmpd.o pagent.o subtree.o reg_subtree.o
./cmd/terminfo/Makefile:# entire subtree to ownership root/bin.
./cmd/tcpd/Makefile.dist:# If in doubt leave it in, it won't harm.
./cmd/tcpd/Makefile.sfwsrc:# If in doubt leave it in, it won't harm.
./cmd/tcpd/Makefile.org:# If in doubt leave it in, it won't harm.
cp -r /home/keremet/work/gsoc2012/bluetooth-gate/usr/src/uts/intel/ubt /export/home/illumos-dev/code/illumos-gate/usr/src/uts/intel/ubt
-
Сделать RFCOMM-сокет, скомпилить библиотеку openobex, чтобы заработало приложение obexftp.