If, on top of this, you also need accurate color reproduction, an alternative approach would be to construct a DNG from your raw bytestream, e.g. in 2 steps:
1) see e.g. rawtopgm from netpbm tools, or use ImageMagick/GraphicsMagick raw 'GRAY' format to convert to a widely known and simple PGM
2) use http://a1ex.magiclantern.fm/bleeding-edge/pgm2dng.c (adjust metadata accordingly in the source or using e.g. exiftool afterwards); see also https://github.com/fastvideo/pgm2dng
However, you'd need some (not so trivial) sensor characterization work to be able to fill the DNG metadata (basically build your own DCP). LibRaw would need this information anyway even if you went with the open_bayer() route and want more accurate color reproduction. The upside of the DNG route is that you can use many more processors/libraries in the future.
If, on top of this, you also need accurate color reproduction, an alternative approach would be to construct a DNG from your raw bytestream, e.g. in 2 steps:
1) see e.g. rawtopgm from netpbm tools, or use ImageMagick/GraphicsMagick raw 'GRAY' format to convert to a widely known and simple PGM
2) use http://a1ex.magiclantern.fm/bleeding-edge/pgm2dng.c (adjust metadata accordingly in the source or using e.g. exiftool afterwards); see also https://github.com/fastvideo/pgm2dng
However, you'd need some (not so trivial) sensor characterization work to be able to fill the DNG metadata (basically build your own DCP). LibRaw would need this information anyway even if you went with the open_bayer() route and want more accurate color reproduction. The upside of the DNG route is that you can use many more processors/libraries in the future.