imx6 板卡移植官方yocto版本(2_定制系统)
2016-04-05 18:56
363 查看
上一节中已经讲述了如何去构建编译环境,这一节讲一下如何定制专属于自己板卡的系统。
1. 配置linux内核
官方repo下来的yocto项目里配置了多个内核可选,我们可以在yocto目录下/source/meta-fsl-arm/recipes-kernel/linux 中找到,配置的三个内核如下:
linux-fslc_3.8.bb --> kernel mainline (from kernel.org)
linux-imx_2.6.35.3.bb --> kernel from FSL, for imx5x and imx28
linux-imx_3.0.35.bb --> kernel from FSL for imx6
我的板子是imx6的,因此我选的是linux-imx6,如果你用的是高版本的yocto,那内核可能跟我的不一样,不过配置没有什么大的变化。
内核的arch/arm/configs目录下有一些默认的配置可选,yocto也有自己的配置可用,现在讲一下自定义配置内核。
//首先创建一个配置xxxx_defconfig
$ cp xxx_defconfig meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6 //这里要对应你yocto版本的目录
$ bitbake -c cleansstate linux-imx//清理一下之前编译的状态
$ bitbake linux-imx //编译内核
$ bitbake fsl-image-gui //编译整个工程,不是必须的
2. 使用menuconfig配置具体项
$ bitbake -c menuconfig linux-imx
$ cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.0.35-r33.10/git/.config ../sources/meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6/defconfig
$ bitbake -c cleansstate linux-imx
$ bitbake fsl-image-gui
3. 如果想用linux主线版本的最新内核,可以通过改配置conf/local.conf,不一定支持,而且有危险(主要是BUG没人测试)
PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"
4. 用yocto不太适合开发(主要是脚本啥的太智能,找半天麻烦),此时我们编译的工具链就有作用了。当执行完bitbake meta-toolchain后
工具链就生成脚本了,看下面:
$ ls tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh
tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh //前提你编译没出错,版本不一定跟我的一样
现在安装一下:
$ source poky-eglibc-x86_64-arm-toolchain-1.4.1.sh
[sudo] password for daiane:
Enter target directory for SDK (default: /opt/poky/1.4.1):
You are about to install the SDK to "/opt/poky/1.4.1". Proceed[Y/n]?y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.
测试一下,随便写一个helloworld程序:
$ arm-poky-linux-gnueabi-gcc helloworld.c -o hello
$ ls
hello helloworld.c
$ ./hello
-bash: ./hello: cannot execute binary file//肯定报错
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
5. 用导出的工具链编译导出的内核
$ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi//导出环境变量,也可以写入/etc/bash.bashrc文件
$ cd linux-imx
$ export ARCH=arm
$ export CROSS_COMPILE=$TARGET_PREFIX
$ unset LDFLAGS
$ make imx6_defconfig
$ make uImage
//也可以使用zImage,路径在/arch/arm/boot目录下
6. 编译busybox,制作文件系统
$ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi//导出环境变量,也可以写入/etc/bash.bashrc文件
$ cd busybox1.2 //busybox我是从官网下载的,版本自己决定
$ export ARCH=arm
$ export CROSS_COMPILE=$TARGET_PREFIX
$ unset LDFLAGS
$ make menuconfig//定义自己需要的命令,不懂的请参考busybox配置
$ make&&make install
7. 将制作好的内核与文件系统通过网口或者U盘测试一下是否可用。
转载:http://blog.csdn.net/fei534358549/article/details/50284277
1. 配置linux内核
官方repo下来的yocto项目里配置了多个内核可选,我们可以在yocto目录下/source/meta-fsl-arm/recipes-kernel/linux 中找到,配置的三个内核如下:
linux-fslc_3.8.bb --> kernel mainline (from kernel.org)
linux-imx_2.6.35.3.bb --> kernel from FSL, for imx5x and imx28
linux-imx_3.0.35.bb --> kernel from FSL for imx6
我的板子是imx6的,因此我选的是linux-imx6,如果你用的是高版本的yocto,那内核可能跟我的不一样,不过配置没有什么大的变化。
内核的arch/arm/configs目录下有一些默认的配置可选,yocto也有自己的配置可用,现在讲一下自定义配置内核。
//首先创建一个配置xxxx_defconfig
$ cp xxx_defconfig meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6 //这里要对应你yocto版本的目录
$ bitbake -c cleansstate linux-imx//清理一下之前编译的状态
$ bitbake linux-imx //编译内核
$ bitbake fsl-image-gui //编译整个工程,不是必须的
2. 使用menuconfig配置具体项
$ bitbake -c menuconfig linux-imx
$ cp tmp/work/imx6qsabresd-poky-linux-gnueabi/linux-imx/3.0.35-r33.10/git/.config ../sources/meta-fsl-arm/recipes-kernel/linux/linux-imx-3.0.35/mx6/defconfig
$ bitbake -c cleansstate linux-imx
$ bitbake fsl-image-gui
3. 如果想用linux主线版本的最新内核,可以通过改配置conf/local.conf,不一定支持,而且有危险(主要是BUG没人测试)
PREFERRED_PROVIDER_virtual/kernel = "linux-fslc"
4. 用yocto不太适合开发(主要是脚本啥的太智能,找半天麻烦),此时我们编译的工具链就有作用了。当执行完bitbake meta-toolchain后
工具链就生成脚本了,看下面:
$ ls tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh
tmp/deploy/sdk/poky-eglibc-x86_64-arm-toolchain-1.4.1.sh //前提你编译没出错,版本不一定跟我的一样
现在安装一下:
$ source poky-eglibc-x86_64-arm-toolchain-1.4.1.sh
[sudo] password for daiane:
Enter target directory for SDK (default: /opt/poky/1.4.1):
You are about to install the SDK to "/opt/poky/1.4.1". Proceed[Y/n]?y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.
测试一下,随便写一个helloworld程序:
$ arm-poky-linux-gnueabi-gcc helloworld.c -o hello
$ ls
hello helloworld.c
$ ./hello
-bash: ./hello: cannot execute binary file//肯定报错
$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
5. 用导出的工具链编译导出的内核
$ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi//导出环境变量,也可以写入/etc/bash.bashrc文件
$ cd linux-imx
$ export ARCH=arm
$ export CROSS_COMPILE=$TARGET_PREFIX
$ unset LDFLAGS
$ make imx6_defconfig
$ make uImage
//也可以使用zImage,路径在/arch/arm/boot目录下
6. 编译busybox,制作文件系统
$ source /opt/poky/1.4.1/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi//导出环境变量,也可以写入/etc/bash.bashrc文件
$ cd busybox1.2 //busybox我是从官网下载的,版本自己决定
$ export ARCH=arm
$ export CROSS_COMPILE=$TARGET_PREFIX
$ unset LDFLAGS
$ make menuconfig//定义自己需要的命令,不懂的请参考busybox配置
$ make&&make install
7. 将制作好的内核与文件系统通过网口或者U盘测试一下是否可用。
转载:http://blog.csdn.net/fei534358549/article/details/50284277
相关文章推荐
- linux文件系统介绍
- 构建之法:第四章读后感
- 求长方柱的体积和表面积
- imx6 板卡移植官方yocto版本(1_安装环境)
- 20160405_整理
- nginx字体文件配置
- 四个输出消息的 NASM 汇编函数
- 第五周作业。
- 《构建之法》第四章读后感
- 顺时针打印矩阵
- 读《构建之法》第四章有感
- 成员变量与局部变量
- opencv之Mat图像左右移
- Codeforces Round #251(Div. 2) 439A. Devu, the Singer and Churu, the Joker 水题
- jquery 1.11 attr("disabled" 无效
- String类
- 多线程使用总结
- 第五周 项目1 三角形类雏形(1)
- openwrt开发<1>内核编译
- 第6周项目2(2)画出变量占用的内存及值得变化