OK6410 u-boot-2012.04.01移植一配置编译单板

2024-05-09 04:48

本文主要是介绍OK6410 u-boot-2012.04.01移植一配置编译单板,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

去年移植的,现在整理拿出来与大家分享。以前移植时遇到种种麻烦,厌烦DNW老出问题无法识别,买的openjtag不支持MLC NAND无法下程序,DM9000老ping不通,总在拨开关sd卡启动还是NAND启动,介绍一种简单可行的移植方法,不需要像我以前一样寻求各种下载程序的方法,总为下载裸板程序苦恼。我的思路,首先板级初始化支持单板,放到内存运行,接着给u-boot增加菜单,将我前面写的自我更新程序update添加进去,单板就具有借助串口下载程序的功能。再完善u-boot其它部分,让移植的u-boot正常跑起来。这样我们不需要DNW、没有open JTAG、不用老ping网卡,照样能玩u-boot移植,只需要一根串口线就OK。言归正传下面开始移植

开发环境:
系统:ubuntu 10.04.4
单板:ok6410
NAND FLASH:K9GAG08U0D 2048MB
DDR:K4X1G163PCX2 256MB
NET:DM9000AEP
编译器:arm-linux-gcc-4.3.2
搭建开发环境详见ubuntu 10.04.4开发环境配置。

目标:
1.板级初始化,支持单板ok6410
2.增加菜单update功能
3.修改u-boot,支持NAND启动
4.增加MLC NAND支持
5.支持DM9000,网卡下载程序
6.修改环境变量以及mtdpart分区
7.u-boot裁剪及制作补丁

 一、获取源代码

ftp://ftp.denx.de/pub/u-boot/  下载u-boot-2012.04.01.tar.bz2,解压到工作目录即可。交叉编译链arm-linux-gcc-4.3.2.tar.bz2到处都是,配置见ubuntu 10.04.4开发环境配置。

change@change:/si$ ls
A10
A13
android_kernel.tar
arm-linux-gcc-3.4.5-glibc-2.3.6.tar.bz2
busybox-1.21.0.tar.bz2
gcc-linaro-arm-linux-gnueabihf-4.8-2013.04-20130417_linux.tar.bz2
jz4755
linux-2.6.22.6.tar.bz2
linux-3.0.62
linux-3.0.62.tar.bz2
micro2440
OK6410
pcduino
pcduino_a10_hwpack_20130428
pcduino_a10_hwpack_20130428.tar.xz
s3c2440
s5pc100
TQ2440
u-boot-1.1.6.tar.bz2
u-boot-2012.04.01.tar.bz2
u-boot-2012.10.tar.bz2
change@change:/si$ tar xjf u-boot-2012.04.01.tar.bz2 -C OK6410/
change@change:/si$ cd OK6410/
change@change:/si/OK6410$ ls
1_led  2_uart0  clock.c  source  u-boot-2012.04.01  update
change@change:/si/OK6410$ 

方便移植,新建Source Insighe工程,阅读源码,工程添加源码是,以下未用文件可以不添加
board/samsung下除 smdk6400 以外的所有其它目标板文件夹不添加
arch/arm/cpu/下除 arm1176、u-boot.lds以外的所有其它cpu目录不添加
include/目录下arm-XXX  的文件目录,只留下 asm-arm ,其它arm-XXX 不添加
include/configs 目录下除 smdk6400.h  以外的所有其它配置头文件不添加

二、新建单板

change@change:/si/OK6410$ cd u-boot-2012.04.01/
change@change:/si/OK6410/u-boot-2012.04.01$ cp -rf board/samsung/smdk6400/ board/samsung/smdk6410
change@change:/si/OK6410/u-boot-2012.04.01$ mv board/samsung/smdk6410/smdk6400.c board/samsung/smdk6410/smdk6410.c
change@change:/si/OK6410/u-boot-2012.04.01$ 

修改board/samsung/TQ2440/Makefile文件中28行的COBJS改为:
  COBJS   := smdk6410.o 
change@change:/si/OK6410/u-boot-2012.04.01$ cp include/configs/smdk6400.h include/configs/ok6410.h
change@change:/si/OK6410/u-boot-2012.04.01$ vim Makefile 
705:增加如下内smdk6410_noUSB_config \
smdk6410_config :unconfig
@mkdir -p $(obj)include $(obj)board/samsung/smdk6410
@mkdir -p $(obj)nand_spl/board/samsung/smdk6410
@echo "#define CONFIG_NAND_U_BOOT" > $(obj)include/config.h
@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
@if [ -z "$(findstring smdk6410_noUSB_config,$@)" ]; then\
echo "RAM_TEXT = 0x57e00000" >> $(obj)board/samsung/smdk6410/config.tmp;\
else \
echo "RAM_TEXT = 0xc7e00000" >> $(obj)board/samsung/smdk6410/config.tmp;\
fi
@$(MKCONFIG) smdk6410 arm arm1176 smdk6410 samsung s3c64xx
@echo "CONFIG_NAND_U_BOOT = y" >> $(obj)include/config.mk
三、配置、编译

先看看交叉编译器是否配好,正常的话arm-none-linux-gnueabi-gcc -v输出如下

change@change:/si/OK6410/u-boot-2012.04.01$ arm-none-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/julian/lite-respin/linux/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2008q3-72' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/lite-respin/linux/obj/host-libs-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/lite-respin/linux/install/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) 
change@change:/si/OK6410/u-boot-2012.04.01$ 

change@change:/si/OK6410/u-boot-2012.04.01$ make smdk6410_config 
warning: Please migrate to boards.cfg.  Failure to do so will
         mean removal of your board in the next release.
Configuring for smdk6410 board...
change@change:/si/OK6410/u-boot-2012.04.01$ make

...........arm-linux-gcc -E -g  -Os   -fno-common -ffixed-r8 -msoft-float  -fno-common -ffixed-r8 -msoft-float  -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x57e00000 -I/si/OK6410/u-boot-2012.04.01/include -fno-builtin -ffreestanding -nostdinc -isystem /home/change/tools/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/include -pipe  -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5t -march=armv5t -include /si/OK6410/u-boot-2012.04.01/include/u-boot/u-boot.lds.h -DCPUDIR=arch/arm/cpu/arm1176  -ansi -D__ASSEMBLY__ -P - </si/OK6410/u-boot-2012.04.01/board/samsung/smdk6410/u-boot-nand.lds >u-boot.lds
UNDEF_SYM=`arm-linux-objdump -x board/samsung/smdk6410/libsmdk6410.o api/libapi.o arch/arm/cpu/arm1176/libarm1176.o arch/arm/cpu/arm1176/s3c64xx/libs3c64xx.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/usb/ulpi/libusb_ulpi.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o lib/zlib/libz.o net/libnet.o post/libpost.o | sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`; cd /si/OK6410/u-boot-2012.04.01 && arm-linux-ld  -pie -T u-boot.lds -Bstatic -Ttext 0x57e00000 $UNDEF_SYM arch/arm/cpu/arm1176/start.o --start-group api/libapi.o arch/arm/cpu/arm1176/libarm1176.o arch/arm/cpu/arm1176/s3c64xx/libs3c64xx.o arch/arm/lib/libarm.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/libpower.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/spi/libspi.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/usb/ulpi/libusb_ulpi.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cramfs/libcramfs.o fs/ext2/libext2fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/reiserfs/libreiserfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o lib/zlib/libz.o net/libnet.o post/libpost.o board/samsung/smdk6410/libsmdk6410.o --end-group /si/OK6410/u-boot-2012.04.01/arch/arm/lib/eabi_compat.o  -L /home/change/tools/usr/local/arm/4.3.2/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.2/armv4t -lgcc -Map u-boot.map -o u-boot
arm-linux-objcopy -O srec u-boot u-boot.srec
arm-linux-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
make -C nand_spl/board/samsung/smdk6410 all
make[1]: Entering directory `/si/OK6410/u-boot-2012.04.01/nand_spl/board/samsung/smdk6410'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/si/OK6410/u-boot-2012.04.01/nand_spl/board/samsung/smdk6410'
make: *** [nand_spl] Error 2
看到Error,其实仔细看没关系,我们需要的u-boot.bin其实已经生成。如果你觉得不爽就根据Error修改哈Makefile,也就是把nand_spl部分去掉。

change@change:/si/OK6410/u-boot-2012.04.01$ vim Makefile 、

找到501:屏蔽掉nand_spl如下

#nand_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend
# $(MAKE) -C nand_spl/board/$(BOARDDIR) all

$(obj)u-boot-nand.bin: nand_spl $(obj)u-boot.bin
# cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin

change@change:/si/OK6410/u-boot-2012.04.01$ make

就不会出现错误了,可以看到u-boot.bin生成了

change@change:/si/OK6410/u-boot-2012.04.01$ ls
api         config.mk  drivers   lib          nand_spl     rules.mk         u-boot
arch        COPYING    dts       MAINTAINERS  net          snapshot.commit  u-boot.bin
board       CREDITS    examples  MAKEALL      onenand_ipl  spl              u-boot.lds
boards.cfg  disk       fs        Makefile     post         System.map       u-boot.map
common      doc        include   mkconfig     README       tools            u-boot.srec
change@change:/si/OK6410/u-boot-2012.04.01$ 

但是现在的u-boot.bin还不能在单板上跑,需要修改,下面修改代码


这篇关于OK6410 u-boot-2012.04.01移植一配置编译单板的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/972427

相关文章

在 Spring Boot 中实现异常处理最佳实践

《在SpringBoot中实现异常处理最佳实践》本文介绍如何在SpringBoot中实现异常处理,涵盖核心概念、实现方法、与先前查询的集成、性能分析、常见问题和最佳实践,感兴趣的朋友一起看看吧... 目录一、Spring Boot 异常处理的背景与核心概念1.1 为什么需要异常处理?1.2 Spring B

SpringBoot3.4配置校验新特性的用法详解

《SpringBoot3.4配置校验新特性的用法详解》SpringBoot3.4对配置校验支持进行了全面升级,这篇文章为大家详细介绍了一下它们的具体使用,文中的示例代码讲解详细,感兴趣的小伙伴可以参考... 目录基本用法示例定义配置类配置 application.yml注入使用嵌套对象与集合元素深度校验开发

如何在 Spring Boot 中实现 FreeMarker 模板

《如何在SpringBoot中实现FreeMarker模板》FreeMarker是一种功能强大、轻量级的模板引擎,用于在Java应用中生成动态文本输出(如HTML、XML、邮件内容等),本文... 目录什么是 FreeMarker 模板?在 Spring Boot 中实现 FreeMarker 模板1. 环

IntelliJ IDEA 中配置 Spring MVC 环境的详细步骤及问题解决

《IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决》:本文主要介绍IntelliJIDEA中配置SpringMVC环境的详细步骤及问题解决,本文分步骤结合实例给大... 目录步骤 1:创建 Maven Web 项目步骤 2:添加 Spring MVC 依赖1、保存后执行2、将新的依赖

Spring Boot中JSON数值溢出问题从报错到优雅解决办法

《SpringBoot中JSON数值溢出问题从报错到优雅解决办法》:本文主要介绍SpringBoot中JSON数值溢出问题从报错到优雅的解决办法,通过修改字段类型为Long、添加全局异常处理和... 目录一、问题背景:为什么我的接口突然报错了?二、为什么会发生这个错误?1. Java 数据类型的“容量”限制

SpringBoot基于配置实现短信服务策略的动态切换

《SpringBoot基于配置实现短信服务策略的动态切换》这篇文章主要为大家详细介绍了SpringBoot在接入多个短信服务商(如阿里云、腾讯云、华为云)后,如何根据配置或环境切换使用不同的服务商,需... 目录目标功能示例配置(application.yml)配置类绑定短信发送策略接口示例:阿里云 & 腾

Spring Boot 整合 SSE的高级实践(Server-Sent Events)

《SpringBoot整合SSE的高级实践(Server-SentEvents)》SSE(Server-SentEvents)是一种基于HTTP协议的单向通信机制,允许服务器向浏览器持续发送实... 目录1、简述2、Spring Boot 中的SSE实现2.1 添加依赖2.2 实现后端接口2.3 配置超时时

Spring Boot读取配置文件的五种方式小结

《SpringBoot读取配置文件的五种方式小结》SpringBoot提供了灵活多样的方式来读取配置文件,这篇文章为大家介绍了5种常见的读取方式,文中的示例代码简洁易懂,大家可以根据自己的需要进... 目录1. 配置文件位置与加载顺序2. 读取配置文件的方式汇总方式一:使用 @Value 注解读取配置方式二

如何为Yarn配置国内源的详细教程

《如何为Yarn配置国内源的详细教程》在使用Yarn进行项目开发时,由于网络原因,直接使用官方源可能会导致下载速度慢或连接失败,配置国内源可以显著提高包的下载速度和稳定性,本文将详细介绍如何为Yarn... 目录一、查询当前使用的镜像源二、设置国内源1. 设置为淘宝镜像源2. 设置为其他国内源三、还原为官方

CentOS7更改默认SSH端口与配置指南

《CentOS7更改默认SSH端口与配置指南》SSH是Linux服务器远程管理的核心工具,其默认监听端口为22,由于端口22众所周知,这也使得服务器容易受到自动化扫描和暴力破解攻击,本文将系统性地介绍... 目录引言为什么要更改 SSH 默认端口?步骤详解:如何更改 Centos 7 的 SSH 默认端口1