1.编译NXP官方的U-Boot并烧写到SD卡运行
tar -vxjf imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"arch/avr32" : true,
"**/*.o":true,
"**/*.su":true,
"**/*.cmd":true,
"arch/arc":true,
"arch/blackfin":true,
"arch/m68k":true,
"arch/microblaze":true,
"arch/mips":true,
"arch/nds32":true,
"arch/nios2":true,
"arch/openrisc":true,
"arch/powerpc":true,
"arch/sandbox":true,
"arch/sh":true,
"arch/sparc":true,
"arch/x86":true,
"arch/arm/mach*":true,
"arch/arm/cpu/arm11*":true,
"arch/arm/cpu/arm720t":true,
"arch/arm/cpu/arm9*":true,
"arch/arm/cpu/armv7m":true,
"arch/arm/cpu/armv8":true,
"arch/arm/cpu/pxa":true,
"arch/arm/cpu/sa1100":true,
"arch/arm/cpu/armv7/am33xx":true,
"arch/arm/cpu/armv7/bcm*":true,
"arch/arm/cpu/armv7/iproc-common":true,
"arch/arm/cpu/armv7/kona-common":true,
"arch/arm/cpu/armv7/ls102xa":true,
"arch/arm/cpu/armv7/omap*":true,
"arch/arm/cpu/armv7/rmobile":true,
"arch/arm/cpu/armv7/vf610":true,
"board/[a-e]*":true,
"board/[g-z]*":true,
"board/[0-9]*":true,
"board/[A-Z]*":true,
"board/fir*":true,
"board/freescale/b*":true,
"board/freescale/l*":true,
"board/freescale/m5*":true,
"board/freescale/mp*":true,
"board/freescale/c29*":true,
"board/freescale/cor*":true,
"board/freescale/mx7*":true,
"board/freescale/mx2*":true,
"board/freescale/mx3*":true,
"board/freescale/mx5*":true,
"board/freescale/p*":true,
"board/freescale/q*":true,
"board/freescale/t*":true,
"board/freescale/v*":true,
"board/freescale/mx6d*":true,
"board/freescale/mx6q*":true,
"board/freescale/mx6s*":true,
"configs/[a-l]*":true,
"configs/[n-z]*":true,
"configs/[A-Z]*":true,
"configs/M[a-z]*":true,
"configs/M[A-Z]*":true,
"configs/M[0-9]*":true,
"configs/m[a-w]*":true,
"configs/m[0-9]*":true,
"configs/[0-9]*":true,
"configs/mx6d*":true,
"configs/mx6q*":true,
"configs/mx6s*":true,
"configs/mx7*":true,
"configs/mx2*":true,
"configs/mx3*":true,
"configs/mx5*":true,
"include/configs/[a-l]*":true,
"include/configs/[n-z]*":true,
"include/configs/[A-Z]*":true,
"include/configs/m[a-w]*": true,
"include/configs/mx6q*": true,
"include/configs/mx6d*": true,
"include/configs/mx6s*": true,
"include/configs/mx2*": true,
"include/configs/mx3*": true,
"include/configs/mx5*": true,
"include/configs/mxs.h": true,
"include/configs/m2*": true,
"include/configs/m5*": true,
"include/configs/mx7*": true,
"include/configs/3c120_devboard.h": true,
"include/configs/10m50_devboard.h": true
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"arch/avr32" : true,
"**/*.o":true,
"**/*.su":true,
"**/*.cmd":true,
"arch/arc":true,
"arch/blackfin":true,
"arch/m68k":true,
"arch/microblaze":true,
"arch/mips":true,
"arch/nds32":true,
"arch/nios2":true,
"arch/openrisc":true,
"arch/powerpc":true,
"arch/sandbox":true,
"arch/sh":true,
"arch/sparc":true,
"arch/x86":true,
"arch/arm/mach*":true,
"arch/arm/cpu/arm11*":true,
"arch/arm/cpu/arm720t":true,
"arch/arm/cpu/arm9*":true,
"arch/arm/cpu/armv7m":true,
"arch/arm/cpu/armv8":true,
"arch/arm/cpu/pxa":true,
"arch/arm/cpu/sa1100":true,
"arch/arm/cpu/armv7/am33xx":true,
"arch/arm/cpu/armv7/bcm*":true,
"arch/arm/cpu/armv7/iproc-common":true,
"arch/arm/cpu/armv7/kona-common":true,
"arch/arm/cpu/armv7/ls102xa":true,
"arch/arm/cpu/armv7/omap*":true,
"arch/arm/cpu/armv7/rmobile":true,
"arch/arm/cpu/armv7/vf610":true,
"board/[a-e]*":true,
"board/[g-z]*":true,
"board/[0-9]*":true,
"board/[A-Z]*":true,
"board/fir*":true,
"board/freescale/b*":true,
"board/freescale/l*":true,
"board/freescale/m5*":true,
"board/freescale/mp*":true,
"board/freescale/c29*":true,
"board/freescale/cor*":true,
"board/freescale/mx7*":true,
"board/freescale/mx2*":true,
"board/freescale/mx3*":true,
"board/freescale/mx5*":true,
"board/freescale/p*":true,
"board/freescale/q*":true,
"board/freescale/t*":true,
"board/freescale/v*":true,
"board/freescale/mx6d*":true,
"board/freescale/mx6q*":true,
"board/freescale/mx6s*":true,
"configs/[a-l]*":true,
"configs/[n-z]*":true,
"configs/[A-Z]*":true,
"configs/M[a-z]*":true,
"configs/M[A-Z]*":true,
"configs/M[0-9]*":true,
"configs/m[a-w]*":true,
"configs/m[0-9]*":true,
"configs/[0-9]*":true,
"configs/mx6d*":true,
"configs/mx6q*":true,
"configs/mx6s*":true,
"configs/mx7*":true,
"configs/mx2*":true,
"configs/mx3*":true,
"configs/mx5*":true,
"include/configs/[a-l]*":true,
"include/configs/[n-z]*":true,
"include/configs/[A-Z]*":true,
"include/configs/m[a-w]*": true,
"include/configs/mx6q*": true,
"include/configs/mx6d*": true,
"include/configs/mx6s*": true,
"include/configs/mx2*": true,
"include/configs/mx3*": true,
"include/configs/mx5*": true,
"include/configs/mxs.h": true,
"include/configs/m2*": true,
"include/configs/m5*": true,
"include/configs/mx7*": true,
"include/configs/3c120_devboard.h": true,
"include/configs/10m50_devboard.h": true
}
}
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_evk_emmc_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
编译命令第一行的意思是清理一下工程,使用这个命令特别需要注意,它会清理掉自己的配置文件,以_defconfig结尾的,所以后面讲配置文件的时候,记得一定要记得保存该类型的文件,否则白费劲。
第二行的意思是使用NXP的mx6ull_14x14_evk_emmc_defconfig文件进行配置,配置完成后会生成一个.config文件,最后一行是编译U-Boot工程,-j16是指用逻辑16核编译,相对快一些。
但是这样每次编译工程是都需要输入其中2,3行代码,太麻烦,我们可以创建一个shell脚本来执行:
#!/bin/bash
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_evk_emmc_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
可以将这个shell脚本命名为任意名字,要以.sh结尾。比如:imx.sh,使用如下命令给予该文件权限才可执行:
chmod 777 imx.sh //给予权限
./imx.sh //执行
777是最高权限。
编译完成以后如下:
4. 叫编译好的u-boot.bin烧写到SD卡中,启动开发板,在secureCRT看到的输出信息如下:
从以上输出信息中可以看到,unsupported panel A
TK4384,这里其实是有关LCD的参数,Net网络也没有别出来。实际上,使用这个U-Boot,屏幕上会出现NXP的LOGO,但是NXP这个版本的代码并不与我的屏幕匹配,所以接下来,就是移植NXP的U-Boot到我自己的开发板中。
2.移植 NXP官方U-Boot到I.MX6ULL中
cd configs
cp mx6ull_14x14_evk_emmc_defconfig mx6ull_alientek_emmc_defconfig
原mx6ull_14x14_evk_emmc_defconfig 文件中的内容:
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ullevk/imximage.cfg,MX6ULL_EVK_EMMC_REWORK"
CONFIG_ARM=y
CONFIG_ARCH_MX6=y
CONFIG_TARGET_MX6ULL_14X14_EVK=y
CONFIG_CMD_GPIO=y
mx6ull_alientek_emmc_defconfig文件中的内容:
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ull_alientek_emmc/imximage.cfg,MX6ULL_EVK_EMMC_REWORK"
CONFIG_ARM=y
CONFIG_ARCH_MX6=y
CONFIG_TARGET_MX6ULL_ALIENTEK_EMMC=y
CONFIG_CMD_GPIO=y
可以看出我只修改了第一行内容和第四行内容。
cd include/configs/
cp mx6ullevk.h mx6ull_alientek_emmc.h
mx6ull_alientek_emmc.h文件中有许多宏定义,都是用来配置U-Boot的功能的,我们需要修改其中的一些内容。将头文件的一般格式修改为:
#ifndef __MX6ULL_ALIENTEK_EMMC_H
#define __MX6ULL_ALIENTEK_EMMC_H
............
#endif
cd board/freescale/
cp mx6ullevk mx6ull_alientek_emmc
cd mx6ull_alientek_emmc/
cp mx6ullevk.v mx6ull_alientek_emmc.c
修改该目录下的Makefile文件内容
vi Makefile
其实就是修改目标依赖文件名字为:mx6ull_alientek_emmc.o,这样才会编译mx6ull_alientek_emmc.c,修改后如下:
# (C) Copyright 2015 Freescale Semiconductor, Inc.
#
# SPDX-License-Identifier: GPL-2.0+
#
obj-y := mx6ull_alientek_emmc.o
extra-$(CONFIG_USE_PLUGIN) := plugin.bin
$(obj)/plugin.bin: $(obj)/plugin.o
$(OBJCOPY) -O binary --gap-fill 0xff $< $@
修改该目录下imximage.cfg文件中的34行内容。修改后如下:
/*PLUGIN plugin-binary-file IRAM_FREE_START_ADDR*/
PLUGIN board/freescale/mx6ull_alientek_emmc/plugin.bin 0x00907000
修改该目录下的Kconfig文件,修改后如下:
if TARGET_MX6ULL_ALIENTEK_EMMC
config SYS_BOARD
default "mx6ull_alientek_emmc"
config SYS_VENDOR
default "freescale"
config SYS_CONFIG_NAME
default "mx6ull_alientek_emmc"
endif
修改该目录下MAINTAINERS文件,修改后如下:
MX6ULL_ALIENTEK_EMMC BOARD
M: Peng Fan
S: Maintained
F: board/freescale/mx6ull_alientek_emmc/
F: include/configs/mx6ull_alientek_emmc.h
F: configs/mx6ull_alientek_emmc_defconfig
修改U-Boot图形配置界面,图形配置我会在下一篇说明。修改文件arch/arm/cpu/armv7/mx6/Kconfig文件,在207行添加以下内容:
config TARGET_MX6ULL_ALIENTEK_EMMC
bool "Support mx6ull_alientek_emmc"
select MX6ULL
select DM
select DM_THERMAL
在endif的前一行添加如下内容:
source "board/freescale/mx6ull_alientek_emmc/Kconfig"
到此为止,U-Boot已经初步移植到I.MX6ULL开发板上了。编译并烧写到SD卡后启动,此次启动secureCRT显示的内容跟上一次的基本一致,LCD屏幕还不能显示NXP的LOGO, 网络还不能用。