其他分享
首页 > 其他分享> > 移植uboot2019.10到tiny4412开发板(二)

移植uboot2019.10到tiny4412开发板(二)

作者:互联网

宿主机 : 虚拟机 Ubuntu 16.04
目标板[底板]: Tiny4412SDK
目标板[核心板]: Tiny4412
U-BOOT版本: 2019.10
交叉编译器: gcc-arm-none-eabi-9-2020-q2-update

从网上下载代码到虚拟机,编译代码出现:
root@ubuntu:/home/uboot/source2017.03/u-boot-2019.10# make menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/mconf.o
YACC scripts/kconfig/zconf.tab.c
/bin/sh: 1: bison: not found
make[1]: *** [scripts/kconfig/zconf.tab.c] Error 127
make: *** [menuconfig] Error 2
解决方法:
root@ubuntu:/home/uboot/source2017.03/u-boot-2019.10# sudo apt-get install bison
root@ubuntu:/home/uboot/source2017.03/u-boot-2019.10# sudo apt-get install flex

1.修改arch/arm/mach-exynos/Kconfig文件
config TARGET_TINY4412
bool “Exynos4412 Tiny4412 board”
select SUPPORT_SPL
source “board/samsung/tiny4412/Kconfig”

2.创建tiny4412板级文件
cp board/samsung/origen/ board/samsung/tiny4412/
cd board/samsung/tiny4412/tools/
mv mkorigenspl.c mktiny4412spl.c
cd board/samsung/tiny4412/
mv origen.c tiny4412.c
3. 将origen改为tiny4412
修改文件board/samsung/tiny4412/Makefile
修改文件board/samsung/tiny4412/Kconfig
修改文件board/samsung/tiny4412/MAINTAINERS

4.复制tiny4412头文件 cp include/configs/origen.h include/configs/tiny4412.h
修改文件include/configs/tiny4412.h

5.复制文件tiny4412默认配置文件
configs/origen_defconfig configs/tiny4412_defconfig
修改tiny4412_defconfig

6.修改文件scripts/config_whitelist.txt

7.先复制文件 cp arch/arm/dts/exynos4210-origen.dts arch/arm/dts/exynos4412-tiny4412.dts
修改exynos4412-tiny4412.dts文件
修改文件arch/arm/dts/Makefile

8.Soc级别的修改
路径 arch/arm/mach-exynos/ 中都是关于exynos系列芯片的代码,时钟的修改,DRAM的开启等都在这里。
不过这里提供的仅为通用的代码。对于特定的exynos4412芯片,我在这个目录下复制添加如下文件:
cd arch/arm/mach-exynos/
cp clock_init_exynos4.c clock_init_exynos4412.c
cp dmc_init_exynos4.c dmc_init_exynos4412.c
cp exynos4_setup.h exynos4412_setup.h

1.修改文件arch/arm/mach-exynos/include/mach/clock.h
2.修改文件arch/arm/mach-exynos/clock_init_exynos4412.c
exynos4412芯片时钟的配置
3.修改文件arch/arm/mach-exynos/dmc_init_exynos4412.c
4.修改文件arch/arm/mach-exynos/exynos4412_setup.h
5.修改文件arch/arm/mach-exynos/Makefile
6.修改文件arch/arm/mach-exynos/lowlevel_init.c
7.修改文件arch/arm/mach-exynos/spl_boot.c
编译报错:make tiny4412_defconfig
make

  1. /usr/local/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-ld.bfd: common/built-in.o: in function putc': /home/uboot/u-boot-2019.10/common/console.c:509: undefined reference toprintch’
    /usr/local/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-ld.bfd: common/built-in.o: in function puts': /home/uboot/u-boot-2019.10/common/console.c:559: undefined reference toprintch’
    make: *** [u-boot] Error 1
    解决办法:
    在.config中将CONFIG_DEBUG_UART去掉
    2./usr/local/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-ld.bfd: arch/arm/mach-exynos/built-in.o: in function do_lowlevel_init': /home/uboot/u-boot-2019.10/arch/arm/mach-exynos/lowlevel_init.c:217: undefined reference tosystem_clock_init’
    /usr/local/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-ld.bfd: /home/uboot/u-boot-2019.10/arch/arm/mach-exynos/lowlevel_init.c:225: undefined reference to `mem_ctrl_init’
    make[1]: *** [spl/u-boot-spl] Error 1
    make: *** [spl/u-boot-spl] Error
    自己在makefile中有问题:obj- ( C O N F I G E X Y N O S 4210 ) + = d m c i n i t e x y n o s 4412. o c l o c k i n i t e x y n o s 4412. o o b j − (CONFIG_EXYNOS4210)+= dmc_init_exynos4412.o clock_init_exynos4412.o obj- (CONFIGE​XYNOS4210)+=dmci​nite​xynos4412.oclocki​nite​xynos4412.oobj−(CONFIG_EXYNOS4412)+= dmc_init_exynos4412.o clock_init_exynos4412.o

3.arch/arm/mach-exynos/spl_boot.c: In function ‘copy_uboot_to_ram’:
arch/arm/mach-exynos/spl_boot.c:226:12: error: ‘UBOOT_START_OFFSET’ undeclared (first use in this function); did you mean ‘BL2_START_OFFSET’?
226 | offset = UBOOT_START_OFFSET;
| ^~~~~~~~~~~~~~~~~~
| BL2_START_OFFSET
arch/arm/mach-exynos/spl_boot.c:226:12: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/mach-exynos/spl_boot.c:227:10: error: ‘UBOOT_SIZE_BLOC_COUNT’ undeclared (first use in this function); did you mean ‘BL2_SIZE_BLOC_COUNT’?
227 | size = UBOOT_SIZE_BLOC_COUNT;
| ^~~~~~~~~~~~~~~~~~~~~
| BL2_SIZE_BLOC_COUNT
解决办法:
在tiny4412.h最后面加上
/* U-Boot copy size from boot Media to DRAM.*/
#define COPY_UBOOT_SIZE 0xC8000 //800KB
#define UBOOT_START_OFFSET ((RESERVE_BLOCK_SIZE + BL1_SIZE + BL2_SIZE) /512)
#define UBOOT_SIZE_BLOC_COUNT (COPY_UBOOT_SIZE /512)

代码路径:root@ubuntu:/home/uboot/u-boot-2019.10/

将可执行程序拷贝到sd卡上
root@ubuntu:/home/uboot/u-boot-2019.10/sd_fuse# make
gcc -o mkbl2 V310-EVT1-mkbl2.c
gcc -o sd_fdisk sd_fdisk.c
root@ubuntu:/home/uboot/u-boot-2019.10/sd_fuse/tiny4412# sudo./sd_fusing.sh /dev/sdb
在这里插入图片描述

将sd卡插入开发板可启动,打印信息如下:
U-Boot 2019.10 (Feb 16 2021 - 22:46:48 +0800) for TINY4412
CPU: Exynos4412 @ 1.4 GHz
Model: Insignal Tiny4412 evaluation board based on Exynos4412
DRAM: 1 GiB
WARNING: Caches not enabled
MMC: SAMSUNG SDHCI: 0
Loading Environment from MMC… MMC: no card present
*** Warning - No block device, using default environment

Hit any key to stop autoboot: 0
MMC: no card present
MMC: no card present
Wrong Image Format for bootm command
ERROR: can’t get kernel image!
TINY4412 #

参考博客:https://blog.csdn.net/lgc1990/article/details/109160426

标签:boot,uboot2019.10,开发板,exynos,tiny4412,arch,arm,mach
来源: https://blog.csdn.net/weixin_41842559/article/details/113829789