Skip to content

Commit

Permalink
Initial support for rump kernel pci drivers in Linux userspace
Browse files Browse the repository at this point in the history
  • Loading branch information
anttikantee committed Apr 15, 2014
0 parents commit b0bf7b0
Show file tree
Hide file tree
Showing 8 changed files with 456 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This repository contains support for running NetBSD PCI device drivers
in rump kernels in Linux userspace. Access to the devices is provided
by the _uio_pci_generic_ Linux kernel module.

See [the wiki](http://wiki.rumpkernel.org/Repo:-pci-userspace-linux)
for information on building and using.
3 changes: 3 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SUBDIR+= if_iwn if_wm

.include <bsd.subdir.mk>
8 changes: 8 additions & 0 deletions examples/if_iwn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PROG= example
NOMAN= man, no man

# components we need
LDADD+= -lrumpdev_pci_if_iwn -lrumpnet_net80211 -lrumpdev_pci -lrumpdev
LDADD+= -lrumpvfs -lrumpnet_netinet -lrumpnet_net -lrumpnet -lrump

.include <bsd.prog.mk>
47 changes: 47 additions & 0 deletions examples/if_iwn/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <sys/types.h>
#include <sys/stat.h>

#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>

#include <rump/rump.h>

int
main()
{

/* make sure we see dmesg */
setenv("RUMP_VERBOSE", "1", 1);

/* bootstrap rump kernel */
rump_init();

/*
* The iwn driver needs to load a firmware before anything
* can happen with the device. We assume that the user will
* copy the correct file into this directory, and we will
* expose it under the firmware directory to the rump kernel.
*/
if (rump_pub_etfs_register(
"/libdata/firmware/if_iwn/iwlwifi-5000-2.ucode",
"./iwlwifi-5000-2.ucode", RUMP_ETFS_REG) != 0)
err(1, "etfs");

/* make sure old control suckets are not there */
unlink("/tmp/wmtest");

/* start listening to remote requests */
rump_init_server("unix:///tmp/wmtest");

/*
* we are (most likely) running as root, just make sure
* non-root clients can access us.
*/
chmod("/tmp/wmtest", 0666);

/* wait for remote clients commands until the bitter end */
pause();
}
8 changes: 8 additions & 0 deletions examples/if_wm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PROG= example
NOMAN= man, no man

# components we need
LDADD+= -lrumpdev_pci_if_wm -lrumpdev_miiphy -lrumpdev_pci -lrumpdev
LDADD+= -lrumpvfs -lrumpnet_netinet -lrumpnet_net -lrumpnet -lrump

.include <bsd.prog.mk>
36 changes: 36 additions & 0 deletions examples/if_wm/example.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <sys/types.h>
#include <sys/stat.h>

#include <err.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>

#include <rump/rump.h>

int
main()
{

/* make sure we see dmesg */
setenv("RUMP_VERBOSE", "1", 1);

/* bootstrap rump kernel */
rump_init();

/* make sure old control suckets are not there */
unlink("/tmp/wmtest");

/* start listening to remote requests */
rump_init_server("unix:///tmp/wmtest");

/*
* we are (most likely) running as root, just make sure
* non-root clients can access us.
*/
chmod("/tmp/wmtest", 0666);

/* wait for remote clients commands until the bitter end */
pause();
}
12 changes: 12 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
RUMPTOP= ${TOPRUMP}

RUMP_PCI_USER:= ${.PARSEDIR}/pci_user-uio_linux.c
.export RUMP_PCI_USER

.include "${RUMPTOP}/dev/Makefile.rumpdevcomp"

.for pcidev in ${RUMPPCIDEVS}
SUBDIR+= ${RUMPTOP}/dev/lib/lib${pcidev}
.endfor

.include <bsd.subdir.mk>
Loading

0 comments on commit b0bf7b0

Please sign in to comment.