Build own Device Driver with External interrupt and SPI

I use BB-XM rev C.
I want to make device driver that combine External interrupt and SPI.
It seem i have to make new kernel for my own, right?
I test it from configuration memory mapping for Mux-mode from GPIO to SPI by C code.
I can control GPIO from C code.
Anyway, I get Segmentation fault when run C code that have memory mapping with SPI register.

Does anyone know where is some guidline for build own kernel for BB-XM?

Thank in advance.

Pakorn

For Debian . . .

http://eewiki.net/display/linuxonarm/BeagleBoard