Linux kernel make 常用选项介绍
2016-12-14 15:37
495 查看
Linux kernel 编译方法大全记录
一、这是一个我自己写的自动make脚本:
#!/bin/sh export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- export CHEN_DTB="chenfl.dtb" if [ 1 -eq $# ]; then if [ $1 = "dtb" ]; then make -j2 $CHEN_DTB O=out cp ~/am335x/kernel4.4.12/out/arch/arm/boot/dts/am335x-chenfl.dtb $CHEN_PATH -rf # cp ~/am335x/kernel4.4.12/out/arch/arm/boot/dts/am335x-sbc7109.dtb $CHEN_PATH -rf sync echo "Copy dts over ...\n" elif [ $1 = "defconfig" ]; then make -j2 aplex_sbc7109_defconfig O=out echo "Use aplex_sbc7109_defconfig over ...\n" elif [ $1 = "menuconfig" ]; then make -j2 $1 O=out elif [ $1 = "zImage" ]; then make -j2 $1 O=out cp ~/am335x/kernel4.4.12/out/arch/arm/boot/zImage $CHEN_PATH -rf sync echo "Copy kernel zImage to myself file over ... \n" elif [ $1 = "all" ]; then make -j2 $1 O=out cp ~/am335x/kernel4.4.12/out/arch/arm/boot/zImage $CHEN_PATH -rf cp ~/am335x/kernel4.4.12/out/arch/arm/boot/dts/am335x-sbc7109.dtb $CHEN_PATH -rf sync echo "Copy kernel image and dts over ... \n" elif [ $1 = "savedefconfig" ]; then make $1 O=out echo "Save .config to defconfig over ... \n" elif [ $1 = "clean" ]; then make $1 O=out echo "Clean out over ...\n" elif [ $1 = "distclean" ]; then make $1 O=out echo "Distclean over ...\n" elif [ $1 = "help" ]; then make $1 else echo " " echo "You can following command to do the thing you want to do..." echo "./remake dtb -- Only cross-complie your device tree table" echo "./remake defconfig -- Only configure your defconfig" echo "./remake menuconfig -- Only configure your configuration" echo "./remake zImage -- Only cross-complie your Linux kernel zImage " echo "./remake all -- Cross-complie kernel and dts" echo "./remake savedefconfig -- Save your .config as defconfig " echo "./remake clean -- Clean your output file" echo "./remake distclean -- Deep clean your output file" echo "./remake help -- Check help infomation " fi else echo " " echo "You can following command to do the thing you want to do..." echo "./remake dtb -- Only cross-complie your device tree table" echo "./remake defconfig -- Only configure your defconfig" echo "./remake menuconfig -- Only configure your configuration" echo "./remake zImage -- Only cross-complie your Linux kernel zImage " echo "./remake all -- Cross-complie kernel and dts" echo "./remake savedefconfig -- Save your .config as defconfig " echo "./remake clean -- Clean your output file" echo "./remake distclean -- Deep clean your output file" echo "./remake help -- Check help infomation " fi
二、当你指定ARCH=arm 之后,如下命令运行,则会出现arm相关kernel的help信息。
make ARCH=arm help 这里面完全介绍了有关arm kernel make的帮助信息。
三、挑几个重点的讲解一下。
编译的时候,首先, 指定芯片的架构以及交叉编译器前缀。 export ARCH=arm export CROSS_COMPILE=arm-linux-gnueabihf- make clean 除了保存config文件以及构建外围模块必要的文件其他的全部清除。 make mrproper 清理全部生成的文件+config文件+不同的备份文件 make distclean clean + mrproper , 彻底的清理 执行完上面的步骤之后。 选择一个自己的产品参考的defconfig 文件在arch/arm/configs/ 里面,这里面全部都是你可以选择的defconfig 例如: make omap2plus_defconfig O=out O 的指定是指output file 的意思,此时会在out文件夹下生成.config 文件。 当然,你应该还有一些想要添加的,我这里直接使用menuconfig进行配置 make menuconfig O=out 配置好了,你想要保存.config文件为自己的配置的一个备份。 make savedefconfig O=out 这时在out文件夹下就会有一个defconfig文件 当所有的都配置好了,现在,你想编译自己的设备树chenfl.dts make -j2 chenfl.dtb O=out 你想编译自己的镜像zImage make -j2 zImage O=out 你想编译自己的模块 make -j2 modules O=out 你想编译所有的东西 make -j2 all O=out 好了,所有常用的make功能介绍完毕。 zImage 在out/arch/arm/boot/zImage chenfl.dtb 在out/arch/arm/boot/dts/chenfl.dtb defconfig 你可以复制到arm/arch/configs/ 里面,后缀必须是defconfig
不正望指出谢谢。
相关文章推荐
- make -C $(LINUX_KERNEL_PATH) M=$(PWD) modules中的M选项
- linux的rsync工具的常用选项及ssh同步介绍
- make -C $(LINUX_KERNEL_PATH) M=$(PWD) modules中的M选项
- linux学习第三十三篇:rsync工具介绍,rsync常用选项,rsync通过ssh同步
- linux日常维护(rsync介绍,常用选项,rsync六种模式)
- linux的rsync工具的常用选项及ssh同步介绍
- Linux常用命令介绍
- linux下常用命令介绍
- linux下常用软件介绍
- LINUX常用网络配置文件的介绍
- RedHat Linux操作系统下常用服务介绍
- Linux下常用配置文件及常用命令的介绍
- Redhat Linux操作系统下常用服务介绍
- Linux常用命令介绍
- 资料搜集-LINUX常用服务介绍
- 详细介绍Visual C++编译器常用的选项设置
- 常用linux网站介绍
- 常用的Linux网络安全工具介绍
- Linux下常用网络配置文件及常用命令的介绍
- Linux2.6.x Kernel Makefiles(转载)