本文主要是介绍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$ lsA10
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移植一配置编译单板的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!