- Read the specification so you understand what this code is for and have an idea about how to use it.
- Clone the default repository.
git clone https://code.google.com/p/kbus/
- Build the kernel module. You will need to have the kernel-headers package for your current running kernel installed.
make -C kbus
- Ensure that the kbus device nodes get reasonable permissions.
- If your system runs udev (most Debian and Ubuntu do) you can do this by installing the generated udev rules file.
sudo cp kbus/45-kbus.rules /etc/udev/rules.d/or
sudo make rules
cd ..On non-udev systems, we recommend file mode 666 for /dev/kbus[0-9]*. Note that device nodes may be created on the fly via an ioctl! For this reason we recommend a udev rule along the lines of the one created by the kernel module makefile. Build the C library and utilities.
makeOptionally, run the tests. You will need to have the python-nose package installed.
nosetests -d kbus
Choose your language and, if necessary, build its interface.
- Note that the test will attempt to use sudo to insert and remove the module from the running kernel several times, and will complain if it cannot.
- Note that the tests deliberately behave badly to test error conditions. Do not be alarmed by complaints appearing in your kernel log.
make -C cppkbus # C++
# OR #
make -C jkbus # Java
Go and use kbus in your software...
- The C library can be found in libkbus.
- The C++ library in cppkbus does not depend on libkbus.
- The Java library "jkbus" builds libkbus into a JNI shared library. It requires a full JDK in order to build.
- The Python bindings in do not need to be built; just add the python directory to your PYTHONPATH.
Unfortunately there aren't many good examples at the moment. While python/kbus/test/test_kbus.py gives the kernel module a good shake-down, it's not really didactic as it deliberately behaves badly in order to confirm the correct error behaviour...!
Note: If you plan to hack on the kernel module, we strongly recommend you create a virtual machine so you can play with it without having to reboot your entire machine if something goes wrong. (Trust us on this one, we've had to do it a lot.)