Add kernel menuconfig and clean some code