Building a kernel is relatively easy (download the source, make menuconfig && make bzImage modules && make modules_install
, and then copying the new kernel image to right place - or some of the other ways to do it as per your distribution), writing kernel code is not as easy and writing a kernel, well, discuss mr. Torvalds with that ;)
There are plenty of resources on kernel programming, just google around for "linux kernel programming" (e.g. The Linux Kernel Module Programming Guide sounds like a good hit for you even though it's on the 2.6 version which is starting to age now).
If you are also concerned about the (G)UI, it is probably worth also diving in the LFS site (besides, it does containg the info on compiling the kernel ;) ) as the kernel doesn't have any UI itself, all that is just applications around it.