Linux内核编译配置脚本

环境

宿主机平台:Ubuntu 16.04.6

目标机:iMX6ULL

Linux内核编译配置脚本

在linux开发过程中熟练使用脚本可以大大简化命令行操作,同时对于需要经常重复操作的指令也是一种备忘;

在linux内核源码根目录添加 config-kernel 文件

#!/bin/sh

echo "config menu"
echo " 1 make clean"
echo " 2 make distclean"
echo " 3 config for mys_imx6"
echo " 4 config for myd_y6ulx"
echo " 5 config for mxs" echo " a make menuconfig"
echo " b make uImage"
echo " c make zImage"
echo " d make modules"
echo " e make dtbs" echo " q exit" prompt_make() {
echo "*** Configure done,execute 'make uImage' to build kernel or try 'make menuconfig' for more customization. Or use a-e***"
echo
} make_distclean() {
echo "make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean"
make distclean
} make_clean() {
echo "make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean"
make clean
} config_mys_imx6() {
echo "mys_imx6"
cp .config .config.bk
cp arch/arm/configs/mys_imx6_defconfig .config
prompt_make
}
config_myd_y6ulx() {
echo "myd_y6ulx"
cp .config .config.bk
cp arch/arm/configs/myd_y6ulx_defconfig .config
prompt_make
}
config_mxs() {
echo "mxs"
cp .config .config.bk
cp arch/arm/configs/mxs_defconfig .config
prompt_make
} make_menuconfig() {
make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
} make_uImage() {
make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage
} make_zImage() {
make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage
} make_modules() {
make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
} make_dtbs() {
make make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- dtbs
} echo -n "please select your choice: " while true
do
read sel
echo "select $sel" case $sel in
"1") make_clean;;
"2") make_distclean;;
"3") config_mys_imx6;;
"4") config_myd_y6ulx;;
"5") config_mxs;;
"a") make_menuconfig;;
"b") make_uImage;;
"c") make_zImage;;
"d") make_modules;;
"e") make_dtbs;;
[q] | [Q]) exit 0;;
*) echo "ONLY accept 1~5,a~e/q/Q"
esac
done

运行效果如下

Linux内核编译配置脚本

初次内核编译流程一次选择:2 3 c d e

上一篇:全选Form > Grid 的所有行


下一篇:easyui datebox时间控件如何只显示年月