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

相关文章

mybatis映射器配置小结

《mybatis映射器配置小结》本文详解MyBatis映射器配置,重点讲解字段映射的三种解决方案(别名、自动驼峰映射、resultMap),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定... 目录select中字段的映射问题使用SQL语句中的别名功能使用mapUnderscoreToCame

Linux下MySQL数据库定时备份脚本与Crontab配置教学

《Linux下MySQL数据库定时备份脚本与Crontab配置教学》在生产环境中,数据库是核心资产之一,定期备份数据库可以有效防止意外数据丢失,本文将分享一份MySQL定时备份脚本,并讲解如何通过cr... 目录备份脚本详解脚本功能说明授权与可执行权限使用 Crontab 定时执行编辑 Crontab添加定

Java使用jar命令配置服务器端口的完整指南

《Java使用jar命令配置服务器端口的完整指南》本文将详细介绍如何使用java-jar命令启动应用,并重点讲解如何配置服务器端口,同时提供一个实用的Web工具来简化这一过程,希望对大家有所帮助... 目录1. Java Jar文件简介1.1 什么是Jar文件1.2 创建可执行Jar文件2. 使用java

SpringBoot 多环境开发实战(从配置、管理与控制)

《SpringBoot多环境开发实战(从配置、管理与控制)》本文详解SpringBoot多环境配置,涵盖单文件YAML、多文件模式、MavenProfile分组及激活策略,通过优先级控制灵活切换环境... 目录一、多环境开发基础(单文件 YAML 版)(一)配置原理与优势(二)实操示例二、多环境开发多文件版

Vite 打包目录结构自定义配置小结

《Vite打包目录结构自定义配置小结》在Vite工程开发中,默认打包后的dist目录资源常集中在asset目录下,不利于资源管理,本文基于Rollup配置原理,本文就来介绍一下通过Vite配置自定义... 目录一、实现原理二、具体配置步骤1. 基础配置文件2. 配置说明(1)js 资源分离(2)非 JS 资

MySQL8 密码强度评估与配置详解

《MySQL8密码强度评估与配置详解》MySQL8默认启用密码强度插件,实施MEDIUM策略(长度8、含数字/字母/特殊字符),支持动态调整与配置文件设置,推荐使用STRONG策略并定期更新密码以提... 目录一、mysql 8 密码强度评估机制1.核心插件:validate_password2.密码策略级

ShardingProxy读写分离之原理、配置与实践过程

《ShardingProxy读写分离之原理、配置与实践过程》ShardingProxy是ApacheShardingSphere的数据库中间件,通过三层架构实现读写分离,解决高并发场景下数据库性能瓶... 目录一、ShardingProxy技术定位与读写分离核心价值1.1 技术定位1.2 读写分离核心价值二

QT Creator配置Kit的实现示例

《QTCreator配置Kit的实现示例》本文主要介绍了使用Qt5.12.12与VS2022时,因MSVC编译器版本不匹配及WindowsSDK缺失导致配置错误的问题解决,感兴趣的可以了解一下... 目录0、背景:qt5.12.12+vs2022一、症状:二、原因:(可以跳过,直奔后面的解决方法)三、解决方

SpringBoot路径映射配置的实现步骤

《SpringBoot路径映射配置的实现步骤》本文介绍了如何在SpringBoot项目中配置路径映射,使得除static目录外的资源可被访问,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一... 目录SpringBoot路径映射补:springboot 配置虚拟路径映射 @RequestMapp

Nginx中配置使用非默认80端口进行服务的完整指南

《Nginx中配置使用非默认80端口进行服务的完整指南》在实际生产环境中,我们经常需要将Nginx配置在其他端口上运行,本文将详细介绍如何在Nginx中配置使用非默认端口进行服务,希望对大家有所帮助... 目录一、为什么需要使用非默认端口二、配置Nginx使用非默认端口的基本方法2.1 修改listen指令