Copied code from raspberrypi repo

Copied the essential code from raspberrypi repository that will be used in the final application. Also made the directory structure a bit more organized, and modified the Makefiles respectively.