欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

i.MX6ULL系统移植:uboot移植2 - 移植NXP官方uboot

程序员文章站 2022-04-28 08:04:17
...

在移植过程中按照NXP官方文档《i.MX BSP Porting Guide》和正点原理提供资料均未移植成功,最后通过一个大佬博客讲解成功移植。以此记录。
原博客地址:https://blog.csdn.net/BBDS1ASD/article/details/108692727

一、解压NXP提供uboot

tar -vxjf uboot-imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2

二、添加开发板配置文件

在uboot/configs/中,把mx6ull_14x14_evk_emmc_defconfig拷贝成自己的mx6ull_14x14_xxx_emmc_defconfig

cp mx6ull_14x14_evk_emmc_defconfig mx6ull_14x14_xxx_emmc_defconfig

修改mx6ull_14x14_xxx_emmc_defconfig内容:

CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ull_xxx_emmc/imximage.cfg,MX6ULL_EVK_EMMC_REWORK"
CONFIG_TARGET_MX6ULL_xxx_EMMC=y

三、添加开发板头文件

有一些需要配置的信息,一般是在一个头文件里面配置,每个板子有一个。对于NXP官方的6ULL EVK板子,这个头文件就是mx6ullevk.h.
uboot/include/configs/中,把mx6ullevk.h 拷贝成自己的 mx6ull_xxx_emmc.h

修改mx6ull_xxx_emmc.h内容:

#ifndef __MX6ULLEVK_CONFIG_H
#define __MX6ULLEVK_CONFIG_H

改为

#ifndef __MX6ULL_XXX_EMMC_CONFIG_H
#define __MX6ULL_XXX_EMMC_CONFIG_H

四、添加开发板的板级文件夹

每个板子都有特有的文件,也叫做板级文件;这里我们将6ULL EVK的板级文件直接拷贝过来。
uboot/board/freescale/ 中,将 mx6ullevk/ 文件夹拷贝成自己的板级文件夹 mx6ull_xxx_emmc/

cp mx6ullevk mx6ull_xxx_emmc

五、调整板级文件夹中文件内容

1、更改C文件名

在新的板级文件夹中,将mx6ullevk.c拷贝成mx6ull_xxx_emmc.c

mv mx6ullevk.c mx6ull_xxx_emmc.c

2、修改Makefile

obj-y := mx6ull_xxx_emmc.o

3、修改imximage.cfg

PLUGIN board/freescale/mx6ullevk/plugin.bin 0x00907000

改为

PLUGIN board/freescale/mx6ull_xxx_emmc/plugin.bin 0x00907000

4、修改Kconfig

if TARGET_MX6ULL_xxx_EMMC

  config SYS_BOARD
	default "mx6ull_xxx_emmc"
  config SYS_VENDOR
	default "freescale"
 config SYS_SOC
	default "mx6"
  config SYS_CONFIG_NAME
	default "mx6ull_xxx_emmc"

endif

5、修改MAINTAINERS

MX6ULL_XXX_EMMC BOARD
M: Peng Fan <[email protected]>
S: Maintained
F: board/freescale/mx6ull_xxx_emmc/
F: include/configs/mx6ull_xxx_emmc.h
F: configs/mx6ull_14x14_xxx_emmc_defconfig

六、修改uboot的配置界面

修改文件arch/arm/cpu/armv7/mx6/Kconfig,添加如下内容:

config TARGET_MX6ULL_xxx_EMMC
 	bool "Support mx6ull_xxx_emmc"
 	select MX6ULL
 	select DM
 	select DM_THERMAL
source "board/freescale/mx6ull_xxx_emmc/Kconfig"

七、编译

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_xxx_emmc_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 

八、测试

1、解压uboot

tar -vxjf uboot-imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2

解压前:

[email protected]:~/linux/uboot/nxp_uboot$ ls
uboot-imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2
[email protected]:~/linux/uboot/nxp_uboot$

解压后;

[email protected]:~/linux/uboot/nxp_uboot$ ls
uboot-imx-rel_imx_4.1.15_2.1.0_ga  uboot-imx-rel_imx_4.1.15_2.1.0_ga.tar.bz2
[email protected]:~/linux/uboot/nxp_uboot$

2、添加开发板配置文件

cd uboot-imx-rel_imx_4.1.15_2.1.0_ga/configs/
cp mx6ull_14x14_evk_emmc_defconfig mx6ull_14x14_lq_emmc_defconfig

命令执行前:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/configs$ ls -l mx6ull*
-rw-rw-r-- 1 onlylove onlylove 165 May  1  2017 mx6ull_14x14_ddr3_arm2_defconfig
-rw-rw-r-- 1 onlylove onlylove 194 May  1  2017 mx6ull_14x14_ddr3_arm2_emmc_defconfig
-rw-rw-r-- 1 onlylove onlylove 175 May  1  2017 mx6ull_14x14_ddr3_arm2_epdc_defconfig
-rw-rw-r-- 1 onlylove onlylove 179 May  1  2017 mx6ull_14x14_ddr3_arm2_nand_defconfig
-rw-rw-r-- 1 onlylove onlylove 179 May  1  2017 mx6ull_14x14_ddr3_arm2_qspi1_defconfig
-rw-rw-r-- 1 onlylove onlylove 181 May  1  2017 mx6ull_14x14_ddr3_arm2_spinor_defconfig
-rw-rw-r-- 1 onlylove onlylove 194 May  1  2017 mx6ull_14x14_ddr3_arm2_tsc_defconfig
-rw-rw-r-- 1 onlylove onlylove 159 May  1  2017 mx6ull_14x14_evk_defconfig
-rw-rw-r-- 1 onlylove onlylove 182 May  1  2017 mx6ull_14x14_evk_emmc_defconfig
-rw-rw-r-- 1 onlylove onlylove 173 May  1  2017 mx6ull_14x14_evk_nand_defconfig
-rw-rw-r-- 1 onlylove onlylove 173 May  1  2017 mx6ull_14x14_evk_qspi1_defconfig
-rw-rw-r-- 1 onlylove onlylove 164 May  1  2017 mx6ull_9x9_evk_defconfig
-rw-rw-r-- 1 onlylove onlylove 178 May  1  2017 mx6ull_9x9_evk_qspi1_defconfig
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/configs$

命令执行后:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/configs$ ls -l mx6ull*
-rw-rw-r-- 1 onlylove onlylove 165 May  1  2017 mx6ull_14x14_ddr3_arm2_defconfig
-rw-rw-r-- 1 onlylove onlylove 194 May  1  2017 mx6ull_14x14_ddr3_arm2_emmc_defconfig
-rw-rw-r-- 1 onlylove onlylove 175 May  1  2017 mx6ull_14x14_ddr3_arm2_epdc_defconfig
-rw-rw-r-- 1 onlylove onlylove 179 May  1  2017 mx6ull_14x14_ddr3_arm2_nand_defconfig
-rw-rw-r-- 1 onlylove onlylove 179 May  1  2017 mx6ull_14x14_ddr3_arm2_qspi1_defconfig
-rw-rw-r-- 1 onlylove onlylove 181 May  1  2017 mx6ull_14x14_ddr3_arm2_spinor_defconfig
-rw-rw-r-- 1 onlylove onlylove 194 May  1  2017 mx6ull_14x14_ddr3_arm2_tsc_defconfig
-rw-rw-r-- 1 onlylove onlylove 159 May  1  2017 mx6ull_14x14_evk_defconfig
-rw-rw-r-- 1 onlylove onlylove 182 May  1  2017 mx6ull_14x14_evk_emmc_defconfig
-rw-rw-r-- 1 onlylove onlylove 173 May  1  2017 mx6ull_14x14_evk_nand_defconfig
-rw-rw-r-- 1 onlylove onlylove 173 May  1  2017 mx6ull_14x14_evk_qspi1_defconfig
-rw-rw-r-- 1 onlylove onlylove 182 Jul 20 06:50 mx6ull_14x14_lq_emmc_defconfig
-rw-rw-r-- 1 onlylove onlylove 164 May  1  2017 mx6ull_9x9_evk_defconfig
-rw-rw-r-- 1 onlylove onlylove 178 May  1  2017 mx6ull_9x9_evk_qspi1_defconfig
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/configs$

修改mx6ull_14x14_xxx_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

修改后:

CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ull_lq_emmc/imximage.cfg,MX6ULL_EVK_EMMC_REWORK"
CONFIG_ARM=y
CONFIG_ARCH_MX6=y
CONFIG_TARGET_MX6ULL_LQ_EMMC=y
CONFIG_CMD_GPIO=y

3、添加开发板头文件

cd include/configs/
cp mx6ullevk.h mx6ull_lq_emmc.h

命令执行前:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/include/configs$ ls -l mx6ull*
-rw-rw-r-- 1 onlylove onlylove  3136 May  1  2017 mx6ull_ddr3_arm2.h
-rw-rw-r-- 1 onlylove onlylove 10386 May  1  2017 mx6ullevk.h
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/include/configs$

命令执行后:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/include/configs$ ls -l mx6ull*
-rw-rw-r-- 1 onlylove onlylove  3136 May  1  2017 mx6ull_ddr3_arm2.h
-rw-rw-r-- 1 onlylove onlylove 10386 May  1  2017 mx6ullevk.h
-rw-rw-r-- 1 onlylove onlylove 10386 Jul 20 06:55 mx6ull_lq_emmc.h
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/include/configs$

修改mx6ull_xxx_emmc.h内容:

vim mx6ull_lq_emmc.h
#ifndef __MX6ULLEVK_CONFIG_H
#define __MX6ULLEVK_CONFIG_H

改为

#ifndef __MX6ULL_LQ_EMMC_CONFIG_H
#define __MX6ULL_LQ_EMMC_CONFIG_H

4、添加开发板板级文件夹

cd board/freescale/
cp -r mx6ullevk mx6ull_lq_emmc

命令执行前:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/board/freescale$ ls -l mx6ull*
mx6ull_ddr3_arm2:
total 48
-rw-rw-r-- 1 onlylove onlylove  2768 May  1  2017 imximage.cfg
-rw-rw-r-- 1 onlylove onlylove   190 May  1  2017 Kconfig
-rw-rw-r-- 1 onlylove onlylove   243 May  1  2017 Makefile
-rw-rw-r-- 1 onlylove onlylove 31432 May  1  2017 mx6ull_ddr3_arm2.c
-rw-rw-r-- 1 onlylove onlylove  2675 May  1  2017 plugin.S

mx6ullevk:
total 64
-rw-rw-r-- 1 onlylove onlylove  2786 May  1  2017 imximage.cfg
-rw-rw-r-- 1 onlylove onlylove  2851 May  1  2017 imximage_lpddr2.cfg
-rw-rw-r-- 1 onlylove onlylove   183 May  1  2017 Kconfig
-rw-rw-r-- 1 onlylove onlylove   196 May  1  2017 MAINTAINERS
-rw-rw-r-- 1 onlylove onlylove   236 May  1  2017 Makefile
-rw-rw-r-- 1 onlylove onlylove 30135 May  1  2017 mx6ullevk.c
-rw-rw-r-- 1 onlylove onlylove  5079 May  1  2017 plugin.S
-rw-rw-r-- 1 onlylove onlylove   716 May  1  2017 README
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/board/freescale$

命令执行后:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/board/freescale$ ls -l mx6ull*
mx6ull_ddr3_arm2:
total 48
-rw-rw-r-- 1 onlylove onlylove  2768 May  1  2017 imximage.cfg
-rw-rw-r-- 1 onlylove onlylove   190 May  1  2017 Kconfig
-rw-rw-r-- 1 onlylove onlylove   243 May  1  2017 Makefile
-rw-rw-r-- 1 onlylove onlylove 31432 May  1  2017 mx6ull_ddr3_arm2.c
-rw-rw-r-- 1 onlylove onlylove  2675 May  1  2017 plugin.S

mx6ullevk:
total 64
-rw-rw-r-- 1 onlylove onlylove  2786 May  1  2017 imximage.cfg
-rw-rw-r-- 1 onlylove onlylove  2851 May  1  2017 imximage_lpddr2.cfg
-rw-rw-r-- 1 onlylove onlylove   183 May  1  2017 Kconfig
-rw-rw-r-- 1 onlylove onlylove   196 May  1  2017 MAINTAINERS
-rw-rw-r-- 1 onlylove onlylove   236 May  1  2017 Makefile
-rw-rw-r-- 1 onlylove onlylove 30135 May  1  2017 mx6ullevk.c
-rw-rw-r-- 1 onlylove onlylove  5079 May  1  2017 plugin.S
-rw-rw-r-- 1 onlylove onlylove   716 May  1  2017 README

mx6ull_lq_emmc:
total 64
-rw-rw-r-- 1 onlylove onlylove  2786 Jul 20 07:04 imximage.cfg
-rw-rw-r-- 1 onlylove onlylove  2851 Jul 20 07:04 imximage_lpddr2.cfg
-rw-rw-r-- 1 onlylove onlylove   183 Jul 20 07:04 Kconfig
-rw-rw-r-- 1 onlylove onlylove   196 Jul 20 07:04 MAINTAINERS
-rw-rw-r-- 1 onlylove onlylove   236 Jul 20 07:04 Makefile
-rw-rw-r-- 1 onlylove onlylove 30135 Jul 20 07:04 mx6ullevk.c
-rw-rw-r-- 1 onlylove onlylove  5079 Jul 20 07:04 plugin.S
-rw-rw-r-- 1 onlylove onlylove   716 Jul 20 07:04 README
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga/board/freescale$

5、调整板级文件夹中内容

1、更改C文件名

mv mx6ullevk.c mx6ull_lq_emmc.c

2、修改Makefile

修改前:

# (C) Copyright 2015 Freescale Semiconductor, Inc.
#
# SPDX-License-Identifier:	GPL-2.0+
#

obj-y  := mx6ullevk.o

extra-$(CONFIG_USE_PLUGIN) :=  plugin.bin
$(obj)/plugin.bin: $(obj)/plugin.o
	$(OBJCOPY) -O binary --gap-fill 0xff $< [email protected]

修改后:

# (C) Copyright 2015 Freescale Semiconductor, Inc.
#
# SPDX-License-Identifier:	GPL-2.0+
#

obj-y  := mx6ull_lq_emmc.o

extra-$(CONFIG_USE_PLUGIN) :=  plugin.bin
$(obj)/plugin.bin: $(obj)/plugin.o
	$(OBJCOPY) -O binary --gap-fill 0xff $< [email protected]

3、修改imximage.cfg

修改前:

/*
 * Copyright (C) 2016 Freescale Semiconductor, Inc.
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 * Refer docs/README.imxmage for more details about how-to configure
 * and create imximage boot image
 *
 * The syntax is taken as close as possible with the kwbimage
 */

#define __ASSEMBLY__
#include <config.h>

/* image version */

IMAGE_VERSION 2

/*
 * Boot Device : one of
 * spi/sd/nand/onenand, qspi/nor
 */

#ifdef CONFIG_SYS_BOOT_QSPI
BOOT_FROM	qspi
#elif defined(CONFIG_SYS_BOOT_EIMNOR)
BOOT_FROM	nor
#else
BOOT_FROM	sd
#endif

#ifdef CONFIG_USE_PLUGIN
/*PLUGIN    plugin-binary-file    IRAM_FREE_START_ADDR*/
PLUGIN	board/freescale/mx6ull_lq_emmc/plugin.bin 0x00907000
#else

#ifdef CONFIG_SECURE_BOOT
CSF CONFIG_CSF_SIZE
#endif

/*
 * Device Configuration Data (DCD)
 *
 * Each entry must have the format:
 * Addr-type           Address        Value
 *
 * where:
 *	Addr-type register length (1,2 or 4 bytes)
 *	Address	  absolute address of the register
 *	value	  value to be stored in the register
 */

/* Enable all clocks */
DATA 4 0x020c4068 0xffffffff
DATA 4 0x020c406c 0xffffffff
DATA 4 0x020c4070 0xffffffff
DATA 4 0x020c4074 0xffffffff
DATA 4 0x020c4078 0xffffffff
DATA 4 0x020c407c 0xffffffff
DATA 4 0x020c4080 0xffffffff

DATA 4 0x020E04B4 0x000C0000
DATA 4 0x020E04AC 0x00000000
DATA 4 0x020E027C 0x00000030
DATA 4 0x020E0250 0x00000030
DATA 4 0x020E024C 0x00000030
DATA 4 0x020E0490 0x00000030
DATA 4 0x020E0288 0x000C0030
DATA 4 0x020E0270 0x00000000
DATA 4 0x020E0260 0x00000030
DATA 4 0x020E0264 0x00000030
DATA 4 0x020E04A0 0x00000030
DATA 4 0x020E0494 0x00020000
DATA 4 0x020E0280 0x00000030
DATA 4 0x020E0284 0x00000030
DATA 4 0x020E04B0 0x00020000
DATA 4 0x020E0498 0x00000030
DATA 4 0x020E04A4 0x00000030
DATA 4 0x020E0244 0x00000030
DATA 4 0x020E0248 0x00000030
DATA 4 0x021B001C 0x00008000
DATA 4 0x021B0800 0xA1390003
DATA 4 0x021B080C 0x00000004
DATA 4 0x021B083C 0x41640158
DATA 4 0x021B0848 0x40403237
DATA 4 0x021B0850 0x40403C33
DATA 4 0x021B081C 0x33333333
DATA 4 0x021B0820 0x33333333
DATA 4 0x021B082C 0xf3333333
DATA 4 0x021B0830 0xf3333333
DATA 4 0x021B08C0 0x00944009
DATA 4 0x021B08b8 0x00000800
DATA 4 0x021B0004 0x0002002D
DATA 4 0x021B0008 0x1B333030
DATA 4 0x021B000C 0x676B52F3
DATA 4 0x021B0010 0xB66D0B63
DATA 4 0x021B0014 0x01FF00DB
DATA 4 0x021B0018 0x00201740
DATA 4 0x021B001C 0x00008000
DATA 4 0x021B002C 0x000026D2
DATA 4 0x021B0030 0x006B1023
DATA 4 0x021B0040 0x0000004F
DATA 4 0x021B0000 0x84180000
DATA 4 0x021B0890 0x00400000
DATA 4 0x021B001C 0x02008032
DATA 4 0x021B001C 0x00008033
DATA 4 0x021B001C 0x00048031
DATA 4 0x021B001C 0x15208030
DATA 4 0x021B001C 0x04008040
DATA 4 0x021B0020 0x00000800
DATA 4 0x021B0818 0x00000227
DATA 4 0x021B0004 0x0002552D
DATA 4 0x021B0404 0x00011006
DATA 4 0x021B001C 0x00000000

#endif

修改后

/*
 * Copyright (C) 2016 Freescale Semiconductor, Inc.
 *
 * SPDX-License-Identifier:	GPL-2.0+
 *
 * Refer docs/README.imxmage for more details about how-to configure
 * and create imximage boot image
 *
 * The syntax is taken as close as possible with the kwbimage
 */

#define __ASSEMBLY__
#include <config.h>

/* image version */

IMAGE_VERSION 2

/*
 * Boot Device : one of
 * spi/sd/nand/onenand, qspi/nor
 */

#ifdef CONFIG_SYS_BOOT_QSPI
BOOT_FROM	qspi
#elif defined(CONFIG_SYS_BOOT_EIMNOR)
BOOT_FROM	nor
#else
BOOT_FROM	sd
#endif

#ifdef CONFIG_USE_PLUGIN
/*PLUGIN    plugin-binary-file    IRAM_FREE_START_ADDR*/
PLUGIN	board/freescale/mx6ullevk/plugin.bin 0x00907000
#else

#ifdef CONFIG_SECURE_BOOT
CSF CONFIG_CSF_SIZE
#endif

/*
 * Device Configuration Data (DCD)
 *
 * Each entry must have the format:
 * Addr-type           Address        Value
 *
 * where:
 *	Addr-type register length (1,2 or 4 bytes)
 *	Address	  absolute address of the register
 *	value	  value to be stored in the register
 */

/* Enable all clocks */
DATA 4 0x020c4068 0xffffffff
DATA 4 0x020c406c 0xffffffff
DATA 4 0x020c4070 0xffffffff
DATA 4 0x020c4074 0xffffffff
DATA 4 0x020c4078 0xffffffff
DATA 4 0x020c407c 0xffffffff
DATA 4 0x020c4080 0xffffffff

DATA 4 0x020E04B4 0x000C0000
DATA 4 0x020E04AC 0x00000000
DATA 4 0x020E027C 0x00000030
DATA 4 0x020E0250 0x00000030
DATA 4 0x020E024C 0x00000030
DATA 4 0x020E0490 0x00000030
DATA 4 0x020E0288 0x000C0030
DATA 4 0x020E0270 0x00000000
DATA 4 0x020E0260 0x00000030
DATA 4 0x020E0264 0x00000030
DATA 4 0x020E04A0 0x00000030
DATA 4 0x020E0494 0x00020000
DATA 4 0x020E0280 0x00000030
DATA 4 0x020E0284 0x00000030
DATA 4 0x020E04B0 0x00020000
DATA 4 0x020E0498 0x00000030
DATA 4 0x020E04A4 0x00000030
DATA 4 0x020E0244 0x00000030
DATA 4 0x020E0248 0x00000030
DATA 4 0x021B001C 0x00008000
DATA 4 0x021B0800 0xA1390003
DATA 4 0x021B080C 0x00000004
DATA 4 0x021B083C 0x41640158
DATA 4 0x021B0848 0x40403237
DATA 4 0x021B0850 0x40403C33
DATA 4 0x021B081C 0x33333333
DATA 4 0x021B0820 0x33333333
DATA 4 0x021B082C 0xf3333333
DATA 4 0x021B0830 0xf3333333
DATA 4 0x021B08C0 0x00944009
DATA 4 0x021B08b8 0x00000800
DATA 4 0x021B0004 0x0002002D
DATA 4 0x021B0008 0x1B333030
DATA 4 0x021B000C 0x676B52F3
DATA 4 0x021B0010 0xB66D0B63
DATA 4 0x021B0014 0x01FF00DB
DATA 4 0x021B0018 0x00201740
DATA 4 0x021B001C 0x00008000
DATA 4 0x021B002C 0x000026D2
DATA 4 0x021B0030 0x006B1023
DATA 4 0x021B0040 0x0000004F
DATA 4 0x021B0000 0x84180000
DATA 4 0x021B0890 0x00400000
DATA 4 0x021B001C 0x02008032
DATA 4 0x021B001C 0x00008033
DATA 4 0x021B001C 0x00048031
DATA 4 0x021B001C 0x15208030
DATA 4 0x021B001C 0x04008040
DATA 4 0x021B0020 0x00000800
DATA 4 0x021B0818 0x00000227
DATA 4 0x021B0004 0x0002552D
DATA 4 0x021B0404 0x00011006
DATA 4 0x021B001C 0x00000000

#endif

4、修改Kconfig

修改前:

if TARGET_MX6ULL_14X14_EVK || TARGET_MX6ULL_9X9_EVK

config SYS_BOARD
	default "mx6ullevk"

config SYS_VENDOR
	default "freescale"

config SYS_CONFIG_NAME
	default "mx6ullevk"

endif

修改后:

if TARGET_MX6ULL_LQ_EMMC

  config SYS_BOARD
	default "mx6ull_lq_emmc"
	
  config SYS_VENDOR
	default "freescale"
	
 config SYS_SOC
	default "mx6"
	
  config SYS_CONFIG_NAME
	default "mx6ull_lq_emmc"

endif

5、修改MAINTAINERS

修改前:

MX6ULLEVK BOARD
M:	Peng Fan <[email protected]>
S:	Maintained
F:	board/freescale/mx6ullevk/
F:	include/configs/mx6ullevk.h
F:	configs/mx6ull_14x14_evk_defconfig
F:	configs/mx6ull_9x9_evk_defconfig

修改后:

MX6ULL_LQ_EMMC BOARD
M: Peng Fan <[email protected]>
S: Maintained
F: board/freescale/mx6ull_lq_emmc/
F: include/configs/mx6ull_lq_emmc.h
F: configs/mx6ull_14x14_lq_emmc_defconfig

6、修改uboot配置界面

cd arch/arm/cpu/armv7/mx6/
vim Kconfig

在 207 行加入如下内容:

config TARGET_MX6ULL_LQ_EMMC
 	bool "Support mx6ull_lq_emmc"
 	select MX6ULL
 	select DM
 	select DM_THERMAL

在最后一行的 endif 的前一行添加如下内容:

source "board/freescale/mx6ull_lq_emmc/Kconfig"

7、编译

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_lq_emmc_defconfig
make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4 

部分编译信息:

Image Type:   Freescale IMX Boot Image
Image Ver:    2 (i.MX53/6/7 compatible)
Mode:         DCD
Data Size:    425984 Bytes = 416.00 kB = 0.41 MB
Load Address: 877ff420
Entry Point:  87800000

8、烧录到SD卡

sudo dd if=u-boot.imx of=/dev/sdb bs=1k seek=1 conv=fsync

烧录结果:

[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga$ sudo dd if=u-boot.imx of=/dev/sdb bs=1k seek=1 conv=fsync
[sudo] password for onlylove: 
415+0 records in
415+0 records out
424960 bytes (425 kB, 415 KiB) copied, 0.0668331 s, 6.4 MB/s
[email protected]:~/linux/uboot/nxp_uboot/uboot-imx-rel_imx_4.1.15_2.1.0_ga$

9、将SD卡插入开发板进行验证

U-Boot 2016.03 (Jul 20 2021 - 08:25:23 -0700)

CPU:   Freescale i.MX6ULL rev1.1 69 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 39C
Reset cause: POR
Board: MX6ULL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

Display: TFT43AB (480x272)
Video: 480x272x24
In:    serial
Out:   serial
Err:   serial
switch to partitions #0, OK
mmc0 is current device
Net:   Board Net Initialization Failed
No ethernet found.
Normal Boot
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
switch to partitions #0, OK
mmc0 is current device
reading boot.scr
** Unable to read file boot.scr **
reading zImage
** Unable to read file zImage **
Booting from net ...
No ethernet found.
No ethernet found.
Bad Linux ARM zImage magic!
=>

通过uboot启动信息可以看出,编译成功。

相关标签: i.MX6ULL uboot