Refactoring build_kernel.sh