(Instructions assume you're running a Linux for Tegra kernel, but will probably work for other stuff)
Check your kernel version: uname -r
Download the kernel sources from NVIDIA's website that match your L4T/JetPack version.
Install necessary packages: sudo apt-get update sudo apt-get install build-essential libncurses5-dev bc libssl-dev