Make cube driver a c++ class.

Signed-off-by: Paul Brook <paul@nowt.org>
Move cube driver into a library.

Signed-off-by: Paul Brook <paul@nowt.org>