向UBOOT中移植代码总结

来源:互联网 发布:js 数组转对象 编辑:程序博客网 时间:2024/05/15 12:59

1.首先,将要移植的代码目录(如bootpicsnd)整个拷贝到UBOOT工程中,最好放到对应的board目录下。

2.在bootpicsnd目录里,新建一个Makefile,参考如下:

#
# (C) Copyright 2000-2007
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#


include $(TOPDIR)/config.mk


LIB := $(obj)libbootpicsnd.a




COBJS = cdjpeg.o jaricom.o jcomapi.o jdapimin.o jdapistd.o jdarith.o jdatasrc.o jdcoefct.o jdcolor.o jddctmgr.o jdhuff.o jdinput.o jdmainct.o jdmarker.o jdmaster.o jdmerge.o jdpostct.o jdsample.o jdtrans.o jerror.o jidctflt.o jidctfst.o jidctint.o jmemmgr.o jmemnobs.o jquant1.o jquant2.o jutils.o wrbmp.o jpeg.o I2CMaster.o cmd_I2C.o bootpic.o bootsnd.o


SRCS := $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))


all: $(LIB)


$(LIB): $(obj).depend $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)


#########################################################################


# defines $(obj).depend target
include $(SRCTREE)/rules.mk


sinclude $(obj).depend


#########################################################################

注意:特殊颜色部分为对应的C文件,和这些原文生成的.o要ar成的库libbootpicsnd.a 

3.在顶层的Makefile里,填加如下一句,使生成的uboot elf文件中,包含进libbootpicsnd.a

LIBS += board/hs3000/bootpicsnd/libbootpicsnd.a

4.make hs3000_config;make

5.此时一般都会报头文件的问题,想办法解决之。

6.编译成功后,会在相应的目录下(bootpicsnd)生成bootpicsnd.a,在u-boot.map中,能看到bootpicsnd.a相关的内容。

7.ok。


0 0