“MY-IMX6-A9 Linux-3.0.35 编译参考手册”的版本间的差异
来自明远智睿的wiki
第18行: | 第18行: | ||
* 解压交叉编译工具链 | * 解压交叉编译工具链 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | tar xf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2 -C /opt/ | ||
</pre> | </pre> | ||
* 复制工具链配置文件 | * 复制工具链配置文件 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | cp environment-setup-cortexa9hf-neon-fsl-linux-gnueabi /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/ | ||
</pre> | </pre> | ||
− | * | + | * source 工具链配置文件 |
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | source /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/environment-setup-cortexa9hf-neon-fsl-linux-gnueabi | ||
</pre> | </pre> | ||
* 检验交叉编译工具安装 | * 检验交叉编译工具安装 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | $CC -v | ||
− | =====> | + | =====> Output: |
Using built-in specs. | Using built-in specs. | ||
COLLECT_GCC=arm-fsl-linux-gnueabi-gcc | COLLECT_GCC=arm-fsl-linux-gnueabi-gcc | ||
第47行: | 第51行: | ||
* 创建编译工作目录 | * 创建编译工作目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | mkdir ~/my-work/02_source/ -p | ||
</pre> | </pre> | ||
* 解压源码包到工作目录 | * 解压源码包到工作目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | tar xf u-boot-2016.03-svn*.tar.bz2 -C ~/my-work/02_source/ | ||
</pre> | </pre> | ||
### 编译u-boot目标文件 | ### 编译u-boot目标文件 | ||
* 进入源码目录 | * 进入源码目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | cd ~/my-work/02_source/u-boot-2016.03 | ||
</pre> | </pre> | ||
− | * | + | * 生成目标开发板的 .config 文件 |
<pre> | <pre> | ||
− | + | =====> Input: | |
− | + | make myimx6ek200-6q-1g_defconfig | |
− | |||
− | |||
− | |||
− | =====> | + | =====> Output: |
HOSTCC scripts/basic/fixdep | HOSTCC scripts/basic/fixdep | ||
HOSTCC scripts/kconfig/conf.o | HOSTCC scripts/kconfig/conf.o | ||
第80行: | 第84行: | ||
* 执行编译 | * 执行编译 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | make | ||
− | =====> | + | =====> Output: |
scripts/kconfig/conf --silentoldconfig Kconfig | scripts/kconfig/conf --silentoldconfig Kconfig | ||
CHK include/config.h | CHK include/config.h | ||
第100行: | 第105行: | ||
MKIMAGE u-boot.imx | MKIMAGE u-boot.imx | ||
</pre> | </pre> | ||
+ | **Note: 如果有提示 “cc1: error”,基本是交叉编译工具的配置没生效,可以按前面 “交叉编译工具链安装” 中的 “source 工具链配置文件” 操作一次后再执行此步骤。** | ||
+ | |||
* 目标文件改名 | * 目标文件改名 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | cp u-boot.imx uboot-myimx6ek200-6q-1g.imx | ||
</pre> | </pre> | ||
### 编译u-boot环境变量脚本 | ### 编译u-boot环境变量脚本 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | ./tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "MYZR script" -d my_env_src/myimx6a9_3035_script.cmd my_env_script.scr | ||
− | =====> | + | =====> Output: |
Image Name: MYZR script | Image Name: MYZR script | ||
Created: Tue Nov 6 17:24:27 2018 | Created: Tue Nov 6 17:24:27 2018 | ||
第126行: | 第135行: | ||
* 创建编译工作目录 | * 创建编译工作目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | mkdir ~/my-work/02_source/ -p | ||
</pre> | </pre> | ||
* 解压源码包到工作目录 | * 解压源码包到工作目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | tar xf linux-3.0.35-svn*.tar.bz2 -C ~/my-work/02_source/ | ||
</pre> | </pre> | ||
### 编译内核目标文件 | ### 编译内核目标文件 | ||
* 进入源码目录 | * 进入源码目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
− | + | cd ~/my-work/02_source/linux-3.0.35 | |
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | * | + | * 生成目标平台的 .config 文件 |
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | make myimx6a9_defconfig | ||
− | =====> | + | =====> Output: |
HOSTCC scripts/basic/fixdep | HOSTCC scripts/basic/fixdep | ||
HOSTCC scripts/kconfig/conf.o | HOSTCC scripts/kconfig/conf.o | ||
第157行: | 第166行: | ||
# | # | ||
</pre> | </pre> | ||
− | * | + | **Note: 如果有“Can't find default configuration "arch/x86/configs” 的错误,是因为交叉编译工具链的配置没有生效,可以按前面 “交叉编译工具链安装” 中的 “source 工具链配置文件” 操作一次后再执行此步骤** |
+ | |||
+ | * 编译内核目标文件 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | make zImage | ||
− | =====> | + | =====> Output: |
scripts/kconfig/conf --silentoldconfig Kconfig | scripts/kconfig/conf --silentoldconfig Kconfig | ||
CHK include/linux/version.h | CHK include/linux/version.h | ||
第175行: | 第187行: | ||
Kernel: arch/arm/boot/zImage is ready | Kernel: arch/arm/boot/zImage is ready | ||
</pre> | </pre> | ||
− | * | + | * 内核目标文件改名 |
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | cp arch/arm/boot/zImage zImage-myimx6a9 | ||
</pre> | </pre> | ||
### 编译内核模块包 | ### 编译内核模块包 | ||
* 执行编译 | * 执行编译 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | make modules | ||
− | =====> | + | =====> Output: |
CHK include/linux/version.h | CHK include/linux/version.h | ||
CHK include/generated/utsrelease.h | CHK include/generated/utsrelease.h | ||
第198行: | 第212行: | ||
* 创建内核模块的保存目录 | * 创建内核模块的保存目录 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | mkdir modules | ||
</pre> | </pre> | ||
* 安装内核模块到指定目录 | * 安装内核模块到指定目录 | ||
<pre> | <pre> | ||
+ | =====> Input: | ||
make modules_install INSTALL_MOD_PATH=./modules | make modules_install INSTALL_MOD_PATH=./modules | ||
− | =====> | + | =====> Output: |
INSTALL crypto/tcrypt.ko | INSTALL crypto/tcrypt.ko | ||
INSTALL drivers/gpu/drm/drm.ko | INSTALL drivers/gpu/drm/drm.ko | ||
第216行: | 第232行: | ||
* 打包内核模块文件 | * 打包内核模块文件 | ||
<pre> | <pre> | ||
− | + | =====> Input: | |
+ | tar cjf kernel-modules-myimx6a9.tar.bz2 -C modules lib | ||
</pre> | </pre> | ||
### 目标文件 | ### 目标文件 | ||
第227行: | 第244行: | ||
* 珠海明远智睿科技有限公司 | * 珠海明远智睿科技有限公司 | ||
* ZhuHai MYZR Technology CO.,LTD. | * ZhuHai MYZR Technology CO.,LTD. | ||
− | * Latest Update: 2018/11/ | + | * Latest Update: 2018/11/08 |
* Supporter: Tang Bin | * Supporter: Tang Bin | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
</pre> | </pre> |
2018年11月8日 (四) 13:41的最新版本
目录
下载相关文件
交叉编译工具链
网盘位置: 2.1_OS_Linux-3.0.35 -> 03_Toolchain
文件一: gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2
文件二: environment-setup-cortexa9hf-neon-fsl-linux-gnueabi
u-boot 源码
网盘位置: 2.1_OS_Linux-3.0.35 -> 02_Source
文件名: u-boot-2016.03-*.tar.bz2 (源码包版本号需svn315及以上)
Kernel 源码
网盘位置: 2.1_OS_Linux-3.0.35 -> 02_Source
文件名: linux-3.0.35-*.tar.bz2 (源码包版本号需svn31及以上)
安装交叉编译工具链
- 解压交叉编译工具链
=====> Input: tar xf gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12.tar.bz2 -C /opt/
- 复制工具链配置文件
=====> Input: cp environment-setup-cortexa9hf-neon-fsl-linux-gnueabi /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/
- source 工具链配置文件
=====> Input: source /opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/environment-setup-cortexa9hf-neon-fsl-linux-gnueabi
- 检验交叉编译工具安装
=====> Input: $CC -v =====> Output: Using built-in specs. COLLECT_GCC=arm-fsl-linux-gnueabi-gcc COLLECT_LTO_WRAPPER=/opt/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/../libexec/gcc/arm-fsl-linux-gnueabi/4.6.2/lto-wrapper Target: arm-fsl-linux-gnueabi Configured with: /work/build/.build/src/gcc-linaro-4.6-2011.06-0/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-fsl-linux-gnueabi --prefix=/work/fsl-linaro-toolchain-2.13 --with-sysroot=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --enable-languages=c,c++ --with-pkgversion='Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --with-gmp=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpfr=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-mpc=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-ppl=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-cloog=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-libelf=/work/build/.build/arm-fsl-linux-gnueabi/build/static --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm -L/work/build/.build/arm-fsl-linux-gnueabi/build/static/lib -lpwl' --enable-threads=posix --enable-target-optspace --enable-plugin --enable-multilib --with-local-prefix=/work/fsl-linaro-toolchain-2.13/arm-fsl-linux-gnueabi/multi-libs --disable-nls --enable-c99 --enable-long-long --with-system-zlib Thread model: posix gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20)
u-boot编译
编译前的准备
- 创建编译工作目录
=====> Input: mkdir ~/my-work/02_source/ -p
- 解压源码包到工作目录
=====> Input: tar xf u-boot-2016.03-svn*.tar.bz2 -C ~/my-work/02_source/
编译u-boot目标文件
- 进入源码目录
=====> Input: cd ~/my-work/02_source/u-boot-2016.03
- 生成目标开发板的 .config 文件
=====> Input: make myimx6ek200-6q-1g_defconfig =====> Output: HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config #
- 执行编译
=====> Input: make =====> Output: scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h UPD include/config.h GEN include/autoconf.mk GEN include/autoconf.mk.dep CHK include/config/uboot.release UPD include/config/uboot.release CHK include/generated/version_autogenerated.h ...... LD u-boot OBJCOPY u-boot-nodtb.bin OBJCOPY u-boot.srec SYM u-boot.sym COPY u-boot.bin CFGS board/myzr/myimx6/myimx6a9-6q-ddr3.cfg.cfgtmp MKIMAGE u-boot.imx
Note: 如果有提示 “cc1: error”,基本是交叉编译工具的配置没生效,可以按前面 “交叉编译工具链安装” 中的 “source 工具链配置文件” 操作一次后再执行此步骤。
- 目标文件改名
=====> Input: cp u-boot.imx uboot-myimx6ek200-6q-1g.imx
编译u-boot环境变量脚本
=====> Input: ./tools/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "MYZR script" -d my_env_src/myimx6a9_3035_script.cmd my_env_script.scr =====> Output: Image Name: MYZR script Created: Tue Nov 6 17:24:27 2018 Image Type: ARM Linux Script (uncompressed) Data Size: 1900 Bytes = 1.86 kB = 0.00 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 1892 Bytes = 1.85 kB = 0.00 MB
目标文件
uboot-myimx6ek200-6q-1g.imx 和 my_env_script.scr 即编译得到的目标文件,保存这两个文件
内核编译
编译前的准备
- 创建编译工作目录
=====> Input: mkdir ~/my-work/02_source/ -p
- 解压源码包到工作目录
=====> Input: tar xf linux-3.0.35-svn*.tar.bz2 -C ~/my-work/02_source/
编译内核目标文件
- 进入源码目录
=====> Input: cd ~/my-work/02_source/linux-3.0.35
- 生成目标平台的 .config 文件
=====> Input: make myimx6a9_defconfig =====> Output: HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf # # configuration written to .config #
Note: 如果有“Can't find default configuration "arch/x86/configs” 的错误,是因为交叉编译工具链的配置没有生效,可以按前面 “交叉编译工具链安装” 中的 “source 工具链配置文件” 操作一次后再执行此步骤
- 编译内核目标文件
=====> Input: make zImage =====> Output: scripts/kconfig/conf --silentoldconfig Kconfig CHK include/linux/version.h UPD include/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h Generating include/generated/mach-types.h CC kernel/bounds.s ...... AS arch/arm/boot/compressed/piggy.gzip.o LD arch/arm/boot/compressed/vmlinux OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready
- 内核目标文件改名
=====> Input: cp arch/arm/boot/zImage zImage-myimx6a9
编译内核模块包
- 执行编译
=====> Input: make modules =====> Output: CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: “include/generated/mach-types.h”是最新的。 CALL scripts/checksyscalls.sh CC [M] fs/autofs4/init.o ...... LD [M] drivers/usb/gadget/g_serial.ko LD [M] fs/nls/nls_ascii.ko LD [M] fs/autofs4/autofs4.ko LD [M] fs/nls/nls_utf8.ko
- 创建内核模块的保存目录
=====> Input: mkdir modules
- 安装内核模块到指定目录
=====> Input: make modules_install INSTALL_MOD_PATH=./modules =====> Output: INSTALL crypto/tcrypt.ko INSTALL drivers/gpu/drm/drm.ko INSTALL drivers/gpu/drm/vivante/vivante.ko ...... INSTALL fs/autofs4/autofs4.ko INSTALL fs/nls/nls_ascii.ko INSTALL fs/nls/nls_utf8.ko DEPMOD 3.0.35-myimx6a9
- 打包内核模块文件
=====> Input: tar cjf kernel-modules-myimx6a9.tar.bz2 -C modules lib
目标文件
zImage-myimx6a9 和 kernel-modules-myimx6a9.tar.bz2 即编译得到的目标文件,保存这两个文件
-------------------------------------------------------------------------------- * 珠海明远智睿科技有限公司 * ZhuHai MYZR Technology CO.,LTD. * Latest Update: 2018/11/08 * Supporter: Tang Bin --------------------------------------------------------------------------------