A high-throughput, unpredictable random number generator...
In order to build and run hrandom, the HAVEGE Linux kernel module, you should have a configured kernel source tree.
If this is not the case, please install the kernel sources version 2.6.15 at a minimum, as we moved to udev. Else, if you are using a prebuilt kernel, consider installing the Linux kernel headers that match your kernel version.
Visit http://www.kernel.org to learn more about compiling and installing a Linux kernel or consult the website of your Linux distribution.
Make sure that you have the loadable module support enabled.
You can check if your kernel supports this feature by running the following command:
$ cat /boot/.config
Then check if the following lines match:
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_KMOD=y
It is also recommended to enable kernel preemption.
You should opt either for Voluntary Kernel Preemption (Desktop) or for Preemptible Kernel (Low-latency Desktop); depending on your system performance.
Debian users should follow this guideline instead.
Step 1: download the source code of HAVEGE Linux kernel module (hrandom-x.y.orig.tar.gz).
Step 2: unpack the archive with:
$ gunzip hrandom-x.y.orig.tar.gz | tar xvf -
Step 3: move into hrandom-x.y directory
$ cd hrandom-x.y
Step 4: configuring and building hrandom
$ ./configure
$ make
Upon success, the source directory (./src/) should now contain the following kernel object: hrandom.ko
Step 5: installing hrandom requires root privileges.
$ make install
hrandom.ko should now have been copied to a path similar to: /lib/modules/KVER/misc ; where KVER is the kernel version you are running (uname -r).
Specify the L1 data-cache size, SIZE is the size in Kbytes.
$ ./configure --with-l1-dcache=SIZE
You must create a few device nodes to be able to use hrandom.
This can be done in the following ways:
hrandom provides the necessary support for udev. udev is targeted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. More information can be found here.
In order to make udev recognize hrandom, you need to install the following rules into the proper directory.
Note that you can limit the usage of hrandom to a particular group or user. Please consult udev documentation.
Please refer to your Linux distribution documentation to learn more about installing a udev rule. For instance, on Debian systems, this can be done by creating a "hrandom.rules" file into /etc/udev/.
Installing the hrandom-data package should have copied "hrandom.rules" into the proper directory. Aside restarting the udev daemon (/etc/init.d/udev restart), debian users should have nothing else to care about.
mknod allows to create a device node from the major and minor numbers of your driver. As hrandom relies on dynamic allocation of major numbers, a feature introduced in kernels 2.6, you will need to get the major number from a special file: /proc/devices.
Once the hrandom major number identified (refered as hrandom_major), type the following in a root shell:
$ mknod /dev/hrandom0 c hrandom_major 0
$ mknod /dev/hrandom1 c hrandom_major 1
In a root shell, type the following to load hrandom:
$ modprobe hrandom
Make sure that your module path is correctly set else modprobe would fail loading hrandom. On Debian systems, you have to update your modules list with: update-modules.
You can also use the following, assuming that you are in the folder containing hrandom.ko
$ insmod hrandom.ko
To check out if hrandom is loaded, type the following:
$ lsmod | grep hrandom
In order to unload hrandom, type the following command into a root shell:
$ rmmod hrandom
Learn how to make use of hrandom here.