Linux学习笔记(9)——u-boot移植(上)

  1. 从恩智浦官网下载NXP开发板通用uboot文件uboot-imx-2016.03-2.1.0-g9bd38ef-v1.0,不经任何更改,进行编译,按以下shell脚本进行配置:
  1 #!/bin/bash
  2 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
  3 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_14x14_evk_emmc_defconfig
  4 make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

执行脚本文件后,下载至开发板。重启开发板出现以下提示:

U-Boot 2016.03 (Dec 30 2019 - 23:38:14 +0800)

CPU:   Freescale i.MX6ULL rev1.1 69 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 36C
Reset cause: POR
Board: MX6ULL 14x14 EVK
I2C:   ready
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
unsupported panel ATK-LCD-7-1024x600
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 
  1. 根据开发板的实际硬件进行更改
    2.1 添加开发板默认配置文件
    创建(复制)开发板的默认配置文件,编辑以下内容:
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6ull_glen_emmc/imximage.cfg,MX6ULL_EVK_EMMC_REWORK"
CONFIG_ARM=y
CONFIG_ARCH_MX6=y
CONFIG_TARGET_MX6ULL_GLEN_EMMC=y
CONFIG_CMD_GPIO=y

2.2 添加开发板对应的头文件
复制开发板的mx6ullevk.h头文件,并重命名为mx6ull_glen_emmc.h,并把

#ifndef __MX6ULLEVK_CONFIG_H
#define __MX6ULLEVK_CONFIG_H

改为

#ifndef __MX6ULLEVK_CONFIG_H
#define __MX6ULLEVK_CONFIG_H

mx6ull_glen_emmc.h里面的宏定义基本用于配置 uboot,也有一些I.MX6ULL 的配置项目。如果我们自己要想使能或者禁止 uboot 的某些功能,那就在mx6ull_glen_emmc.h 里面做修改即可。
2.3 添加开发板对应的板级文件夹

mx6ull_glen_emmc
├── imximage.cfg
├── imximage_lpddr2.cfg
├── Kconfig
├── MAINTAINERS
├── Makefile
├── mx6ull_glen_emmc.c
├── plugin.S
└── README
  1. 修改mx6ull_glen_emmc下的Makefile文件内容为如下:
# (C) Copyright 2015 Freescale Semiconductor, Inc.
#
# SPDX-License-Identifier:	GPL-2.0+
#

obj-y  := mx6ull_glen_emmc.o

extra-$(CONFIG_USE_PLUGIN) :=  plugin.bin
$(obj)/plugin.bin: $(obj)/plugin.o
	$(OBJCOPY) -O binary --gap-fill 0xff $< $@
  1. 修改mx6ull_glen_emmc目录下的imximage.cfg文件为如下:
/*PLUGIN    plugin-binary-file    IRAM_FREE_START_ADDR*/
PLUGIN	board/freescale/mx6ull_glen_emmc/plugin.bin 0x00907000
  1. 修改mx6ull_glen_emmc目录下的Kconfig文件为如下:
if TARGET_MX6ULL_GLEN_EMMC

config SYS_BOARD
	default "mx6ull_glen_emmc"

config SYS_VENDOR
	default "freescale"

config SYS_CONFIG_NAME
	default "mx6ull_glen_emmc"

endif
  1. 修改mx6ull_glen_emmc目录下的MAINTAINERS为如下:
MX6ULL_GLEN_EMMC BOARD
M:	Peng Fan 
S:	Maintained
F:	board/freescale/mx6ull_glen_emmc/
F:	include/configs/mx6ull_glen_emmc.h
F:	configs/mx6ull_glen_emmc_defconfig

2.4 修改U-BOOT图形界面配置文件
在文件arch/arm/cpu/armv7/mx6/Kconfig的内容基础上添加如下代码:

config TRAGET_MX6ULL_GLEN_EMMC
	bool "Support mx6ull_glen_emmc"
	select MX6ULL
	select DM
	select DM_THERMAL
source "board/freescale/mx6ull_glen_emmc/Kconfig"

至此,开发板信息已经添加到uboot中了,接下来就是编译这个新添加的开发板。
2.5 使用新添加的板子配置编译uboot
在uboot根目录下创建一个用于编译的shell脚本,其内容如下 :

  1 #!/bin/bash
  2 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
  3 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mx6ull_glen_emmc_defconfig
  4 make V=1 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

烧写开发板,重启,显示如下:


U-Boot 2016.03 (Jan 02 2020 - 00:03:38 +0800)

CPU:   Freescale i.MX6ULL rev1.1 69 MHz (running at 396 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 41C
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 

你可能感兴趣的:(Linux)