Merge branch 'master' of git://git.denx.de/u-boot-blackfin
authorTom Rini <trini@ti.com>
Mon, 16 Dec 2013 14:13:25 +0000 (09:13 -0500)
committerTom Rini <trini@ti.com>
Mon, 16 Dec 2013 14:13:25 +0000 (09:13 -0500)
177 files changed:
.gitignore
Makefile
README
arch/arm/cpu/armv7/zynq/timer.c
arch/arm/cpu/pxa/timer.c
arch/arm/lib/bootm.c
arch/blackfin/config.mk
arch/powerpc/config.mk
arch/powerpc/cpu/74xx_7xx/config.mk
arch/powerpc/cpu/Makefile
arch/powerpc/cpu/mpc512x/config.mk
arch/powerpc/cpu/mpc5xx/config.mk
arch/powerpc/cpu/mpc5xxx/config.mk
arch/powerpc/cpu/mpc824x/config.mk
arch/powerpc/cpu/mpc8260/config.mk
arch/powerpc/cpu/mpc83xx/config.mk
arch/powerpc/cpu/mpc85xx/config.mk
arch/powerpc/cpu/mpc86xx/config.mk
arch/powerpc/cpu/mpc8xx/config.mk
arch/powerpc/cpu/mpc8xxx/Makefile
arch/powerpc/cpu/ppc4xx/config.mk
arch/powerpc/lib/bootm.c
board/freescale/common/p_corenet/Makefile
common/Makefile
common/board_f.c
common/cmd_bootm.c
common/cmd_elf.c
common/fdt_support.c
config.mk
doc/README.vxworks [new file with mode: 0644]
drivers/mtd/nand/Makefile
drivers/mtd/ubi/Makefile
drivers/serial/lpc32xx_hsuart.c
drivers/usb/gadget/Makefile
dts/Makefile
examples/standalone/.gitignore
examples/standalone/82559_eeprom.c [deleted file]
examples/standalone/Makefile
fs/jffs2/jffs2_1pass.c
fs/yaffs2/yaffs_uboot_glue.c
fs/yaffs2/yaffsfs.c
include/common.h
include/config_defaults.h
include/configs/B4860QDS.h
include/configs/BSC9131RDB.h
include/configs/BSC9132QDS.h
include/configs/DU440.h
include/configs/EXBITGEN.h
include/configs/JSE.h
include/configs/KAREF.h
include/configs/METROBOX.h
include/configs/MIP405.h
include/configs/MPC8315ERDB.h
include/configs/MPC8323ERDB.h
include/configs/MPC832XEMDS.h
include/configs/MPC8349EMDS.h
include/configs/MPC8349ITX.h
include/configs/MPC8360EMDS.h
include/configs/MPC8360ERDK.h
include/configs/MPC837XEMDS.h
include/configs/MPC837XERDB.h
include/configs/MPC8536DS.h
include/configs/MPC8540ADS.h
include/configs/MPC8541CDS.h
include/configs/MPC8544DS.h
include/configs/MPC8548CDS.h
include/configs/MPC8555CDS.h
include/configs/MPC8560ADS.h
include/configs/MPC8568MDS.h
include/configs/MPC8569MDS.h
include/configs/MPC8572DS.h
include/configs/MPC8610HPCD.h
include/configs/MPC8641HPCN.h
include/configs/P1010RDB.h
include/configs/P1022DS.h
include/configs/P1023RDS.h
include/configs/P1_P2_RDB.h
include/configs/P2020COME.h
include/configs/P2020DS.h
include/configs/P2041RDB.h
include/configs/PIP405.h
include/configs/PMC440.h
include/configs/T1040QDS.h
include/configs/T1040RDB.h
include/configs/T1042RDB_PI.h
include/configs/TQM834x.h
include/configs/VCMA9.h
include/configs/W7OLMC.h
include/configs/W7OLMG.h
include/configs/ac14xx.h
include/configs/actux1.h
include/configs/actux2.h
include/configs/actux3.h
include/configs/actux4.h
include/configs/alpr.h
include/configs/amcc-common.h
include/configs/aria.h
include/configs/balloon3.h
include/configs/coreboot.h
include/configs/corenet_ds.h
include/configs/csb272.h
include/configs/csb472.h
include/configs/dvlhost.h
include/configs/km/kmp204x-common.h
include/configs/korat.h
include/configs/lp8x4x.h
include/configs/lubbock.h
include/configs/lwmon5.h
include/configs/mecp5123.h
include/configs/mpc5121ads.h
include/configs/mpq101.h
include/configs/mx1ads.h
include/configs/omap5912osk.h
include/configs/p1_p2_rdb_pc.h
include/configs/p3p440.h
include/configs/palmld.h
include/configs/palmtc.h
include/configs/palmtreo680.h
include/configs/pcs440ep.h
include/configs/pdm360ng.h
include/configs/pxa-common.h
include/configs/pxa255_idp.h
include/configs/quad100hd.h
include/configs/rsdproto.h
include/configs/sbc8349.h
include/configs/sbc8548.h
include/configs/sbc8641d.h
include/configs/smdk2410.h
include/configs/socrates.h
include/configs/stxgp3.h
include/configs/stxssa.h
include/configs/t4qds.h
include/configs/trizepsiv.h
include/configs/vme8349.h
include/configs/vpac270.h
include/configs/xaeniax.h
include/configs/zeus.h
include/configs/zipitz2.h
include/vxworks.h
lib/time.c
post/Makefile
post/board/lwmon/Makefile
post/board/lwmon5/Makefile
post/board/netta/Makefile
post/board/pdm360ng/Makefile
post/cpu/mpc83xx/Makefile
post/cpu/ppc4xx/Makefile
post/drivers/Makefile
post/lib_powerpc/Makefile
post/lib_powerpc/fpu/Makefile
scripts/binutils-version.sh [moved from tools/binutils-version.sh with 100% similarity, mode: 0644]
scripts/checkpatch.pl [moved from tools/checkpatch.pl with 100% similarity]
scripts/checkstack.pl [moved from tools/checkstack.pl with 100% similarity]
scripts/cleanpatch [moved from tools/cleanpatch with 100% similarity]
scripts/dtc-version.sh [moved from tools/dtc-version.sh with 100% similarity, mode: 0644]
scripts/gcc-version.sh [moved from tools/gcc-version.sh with 100% similarity, mode: 0644]
scripts/setlocalversion [moved from tools/setlocalversion with 100% similarity]
spl/.gitignore [deleted file]
spl/Makefile
test/image/test-imagetools.sh [new file with mode: 0755]
tools/.gitignore
tools/Makefile
tools/aisimage.c
tools/default_image.c
tools/dumpimage.c [new file with mode: 0644]
tools/dumpimage.h [new file with mode: 0644]
tools/fit_image.c
tools/imagetool.c [new file with mode: 0644]
tools/imagetool.h [new file with mode: 0644]
tools/imximage.c
tools/kwbimage.c
tools/mkimage.c
tools/mkimage.h
tools/mxsimage.c
tools/omapimage.c
tools/pblimage.c
tools/ublimage.c

index a39bd54..3b14c25 100644 (file)
@@ -47,8 +47,6 @@
 /u-boot.ais
 /u-boot.dtb
 /u-boot.sb
-/u-boot.bd
-/u-boot.geany
 
 #
 # Generated files
 /errlog
 /reloc_off
 
+/spl/
+!/spl/Makefile
+/tpl/
+
 /include/generated/
 /include/spl-autoconf.mk
 /include/tpl-autoconf.mk
@@ -88,6 +90,3 @@ GPATH
 GRTAGS
 GSYMS
 GTAGS
-
-# spl ais files
-/spl/*.ais
index 7310c4e..d6398fe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -109,11 +109,6 @@ export     TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
 MKCONFIG       := $(SRCTREE)/mkconfig
 export MKCONFIG
 
-ifneq ($(OBJTREE),$(SRCTREE))
-REMOTE_BUILD   := 1
-export REMOTE_BUILD
-endif
-
 # $(obj) and (src) are defined in config.mk but here in main Makefile
 # we also need them before config.mk is included which is the case for
 # some targets like unconfig, clean, clobber, distclean, etc.
@@ -187,7 +182,7 @@ ifndef LDSCRIPT
        #LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
        ifdef CONFIG_SYS_LDSCRIPT
                # need to strip off double quotes
-               LDSCRIPT := $(subst ",,$(CONFIG_SYS_LDSCRIPT))
+               LDSCRIPT := $(CONFIG_SYS_LDSCRIPT:"%"=%)
        endif
 endif
 
@@ -218,15 +213,11 @@ endif
 #########################################################################
 # U-Boot objects....order is important (i.e. start must be first)
 
-OBJS  = $(CPUDIR)/start.o
-ifeq ($(CPU),ppc4xx)
-OBJS += $(CPUDIR)/resetvec.o
-endif
-ifeq ($(CPU),mpc85xx)
-OBJS += $(CPUDIR)/resetvec.o
-endif
+head-y := $(CPUDIR)/start.o
+head-$(CONFIG_4xx) += arch/powerpc/cpu/ppc4xx/resetvec.o
+head-$(CONFIG_MPC85xx) += arch/powerpc/cpu/mpc85xx/resetvec.o
 
-OBJS := $(addprefix $(obj),$(OBJS))
+OBJS := $(addprefix $(obj),$(head-y))
 
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard board/$(VENDOR)/common/Makefile),y,n)
 
@@ -249,9 +240,9 @@ LIBS-y += drivers/i2c/
 LIBS-y += drivers/input/
 LIBS-y += drivers/mmc/
 LIBS-y += drivers/mtd/
-LIBS-y += drivers/mtd/nand/
+LIBS-$(CONFIG_CMD_NAND) += drivers/mtd/nand/
 LIBS-y += drivers/mtd/onenand/
-LIBS-y += drivers/mtd/ubi/
+LIBS-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
 LIBS-y += drivers/mtd/spi/
 LIBS-y += drivers/net/
 LIBS-y += drivers/net/phy/
@@ -275,7 +266,7 @@ LIBS-y += drivers/usb/ulpi/
 LIBS-y += common/
 LIBS-y += lib/libfdt/
 LIBS-$(CONFIG_API) += api/
-LIBS-y += post/
+LIBS-$(CONFIG_HAS_POST) += post/
 LIBS-y += test/
 
 ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
@@ -345,7 +336,7 @@ ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
 ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
-ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
+ALL-$(CONFIG_SPL) += $(obj)$(CONFIG_SPL_TARGET:"%"=%)
 endif
 
 # enable combined SPL/u-boot/dtb rules for tegra
@@ -528,7 +519,7 @@ GEN_UBOOT = \
 endif
 
 $(obj)u-boot:  depend \
-               $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(LDSCRIPT) $(obj)u-boot.lds
+               $(SUBDIR_TOOLS) $(OBJS) $(LIBS) $(obj)u-boot.lds
                $(GEN_UBOOT)
 ifeq ($(CONFIG_KALLSYMS),y)
                smap=`$(call SYSTEM_MAP,$(obj)u-boot) | \
@@ -549,10 +540,7 @@ $(SUBDIRS):        depend
 
 $(SUBDIR_EXAMPLES-y): $(obj)u-boot
 
-$(LDSCRIPT):   depend
-               $(MAKE) -C $(dir $@) $(notdir $@)
-
-$(obj)u-boot.lds: $(LDSCRIPT)
+$(obj)u-boot.lds: $(LDSCRIPT) depend
                $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@
 
 nand_spl:      $(TIMESTAMP_FILE) $(VERSION_FILE) depend
@@ -586,7 +574,7 @@ FINDFLAGS := -L
 checkstack:
                $(CROSS_COMPILE)objdump -d $(obj)u-boot \
                        `$(FIND) $(obj) -name u-boot-spl -print` | \
-                       perl $(src)tools/checkstack.pl $(ARCH)
+                       perl $(src)scripts/checkstack.pl $(ARCH)
 
 tags ctags:
                ctags -w -o $(obj)ctags `$(FIND) $(FINDFLAGS) $(TAG_SUBDIRS) \
@@ -638,63 +626,49 @@ checkdtc:
 # to regenerate the autoconf.mk file.
 $(obj)include/autoconf.mk.dep: $(obj)include/config.h include/common.h
        @$(XECHO) Generating $@ ; \
-       set -e ; \
        : Generate the dependancies ; \
        $(CC) -x c -DDO_DEPS_ONLY -M $(CFLAGS) $(CPPFLAGS) \
-               -MQ $(obj)include/autoconf.mk include/common.h > $@
+               -MQ $(obj)include/autoconf.mk include/common.h > $@ || \
+               rm $@
 
 $(obj)include/autoconf.mk: $(obj)include/config.h
        @$(XECHO) Generating $@ ; \
-       set -e ; \
        : Extract the config macros ; \
-       $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h | \
-               sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
-       mv $@.tmp $@
+       $(CPP) $(CFLAGS) -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
+               sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
+       rm $@.tmp
 
 # Auto-generate the spl-autoconf.mk file (which is included by all makefiles for SPL)
 $(obj)include/tpl-autoconf.mk: $(obj)include/config.h
        @$(XECHO) Generating $@ ; \
-       set -e ; \
        : Extract the config macros ; \
        $(CPP) $(CFLAGS) -DCONFIG_TPL_BUILD  -DCONFIG_SPL_BUILD\
-                       -DDO_DEPS_ONLY -dM include/common.h | \
-       sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
-       mv $@.tmp $@
+                       -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
+               sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
+       rm $@.tmp
 
 $(obj)include/spl-autoconf.mk: $(obj)include/config.h
        @$(XECHO) Generating $@ ; \
-       set -e ; \
        : Extract the config macros ; \
-       $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h | \
-       sed -n -f tools/scripts/define2mk.sed > $@.tmp && \
-       mv $@.tmp $@
-
-$(obj)include/generated/generic-asm-offsets.h: $(obj)include/autoconf.mk.dep \
-       $(obj)include/spl-autoconf.mk \
-       $(obj)include/tpl-autoconf.mk \
-       $(obj)lib/asm-offsets.s
+       $(CPP) $(CFLAGS) -DCONFIG_SPL_BUILD -DDO_DEPS_ONLY -dM include/common.h > $@.tmp && \
+               sed -n -f tools/scripts/define2mk.sed $@.tmp > $@; \
+       rm $@.tmp
+
+$(obj)include/generated/generic-asm-offsets.h: $(obj)lib/asm-offsets.s
        @$(XECHO) Generating $@
        tools/scripts/make-asm-offsets $(obj)lib/asm-offsets.s $@
 
-$(obj)lib/asm-offsets.s:       $(obj)include/autoconf.mk.dep \
-       $(obj)include/spl-autoconf.mk \
-       $(obj)include/tpl-autoconf.mk \
-       $(src)lib/asm-offsets.c
+$(obj)lib/asm-offsets.s: $(obj)include/config.h $(src)lib/asm-offsets.c
        @mkdir -p $(obj)lib
        $(CC) -DDO_DEPS_ONLY \
                $(CFLAGS) $(CFLAGS_$(BCURDIR)/$(@F)) $(CFLAGS_$(BCURDIR)) \
                -o $@ $(src)lib/asm-offsets.c -c -S
 
-$(obj)include/generated/asm-offsets.h: $(obj)include/autoconf.mk.dep \
-       $(obj)include/spl-autoconf.mk \
-       $(obj)include/tpl-autoconf.mk \
-       $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
+$(obj)include/generated/asm-offsets.h: $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s
        @$(XECHO) Generating $@
        tools/scripts/make-asm-offsets $(obj)$(CPUDIR)/$(SOC)/asm-offsets.s $@
 
-$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s:  $(obj)include/autoconf.mk.dep \
-       $(obj)include/spl-autoconf.mk \
-       $(obj)include/tpl-autoconf.mk
+$(obj)$(CPUDIR)/$(SOC)/asm-offsets.s: $(obj)include/config.h
        @mkdir -p $(obj)$(CPUDIR)/$(SOC)
        if [ -f $(src)$(CPUDIR)/$(SOC)/asm-offsets.c ];then \
                $(CC) -DDO_DEPS_ONLY \
@@ -726,7 +700,7 @@ checkarmreloc: $(obj)u-boot
 
 $(VERSION_FILE):
                @mkdir -p $(dir $(VERSION_FILE))
-               @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
+               @( localvers='$(shell $(TOPDIR)/scripts/setlocalversion $(TOPDIR))' ; \
                   printf '#define PLAIN_VERSION "%s%s"\n' \
                        "$(U_BOOT_VERSION)" "$${localvers}" ; \
                   printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
@@ -781,9 +755,7 @@ $(obj).boards.depend:       boards.cfg
 #########################################################################
 
 clean:
-       @rm -f $(obj)examples/standalone/82559_eeprom                     \
-              $(obj)examples/standalone/atmel_df_pow2                    \
-              $(obj)examples/standalone/eepro100_eeprom                  \
+       @rm -f $(obj)examples/standalone/atmel_df_pow2                    \
               $(obj)examples/standalone/hello_world                      \
               $(obj)examples/standalone/interrupt                        \
               $(obj)examples/standalone/mem_to_mem_idma2intr             \
@@ -793,10 +765,11 @@ clean:
               $(obj)examples/standalone/timer
        @rm -f $(obj)examples/api/demo{,.bin}
        @rm -f $(obj)tools/bmp_logo        $(obj)tools/easylogo/easylogo  \
-              $(obj)tools/env/{fw_printenv,fw_setenv}                    \
+              $(obj)tools/env/fw_printenv                                \
               $(obj)tools/envcrc                                         \
-              $(obj)tools/gdb/{astest,gdbcont,gdbsend}                   \
+              $(obj)tools/gdb/{gdbcont,gdbsend}                          \
               $(obj)tools/gen_eth_addr    $(obj)tools/img2srec           \
+              $(obj)tools/dump{env,}image                \
               $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk         \
               $(obj)tools/mk{$(BOARD),}spl                               \
               $(obj)tools/mxsboot                                        \
@@ -805,7 +778,6 @@ clean:
               $(obj)tools/proftool
        @rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}        \
               $(obj)board/matrix_vision/*/bootscript.img                 \
-              $(obj)board/voiceblue/eeprom                               \
               $(obj)u-boot.lds                                           \
               $(obj)arch/blackfin/cpu/init.{lds,elf}
        @rm -f $(obj)include/bmp_logo.h
@@ -841,7 +813,6 @@ clobber:    tidy
        @rm -f $(obj)u-boot.ais
        @rm -f $(obj)u-boot.dtb
        @rm -f $(obj)u-boot.sb
-       @rm -f $(obj)u-boot.bd
        @rm -f $(obj)u-boot.spr
        @rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map}
        @rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
diff --git a/README b/README
index 8f0b38c..895fef3 100644 (file)
--- a/README
+++ b/README
@@ -5252,6 +5252,15 @@ when your kernel is intended to use an initial ramdisk:
        Load Address: 0x00000000
        Entry Point:  0x00000000
 
+The "dumpimage" is a tool to disassemble images built by mkimage. Its "-i"
+option performs the converse operation of the mkimage's second form (the "-d"
+option). Given an image built by mkimage, the dumpimage extracts a "data file"
+from the image:
+
+       tools/dumpimage -i image -p position data_file
+         -i ==> extract from the 'image' a specific 'data_file', \
+          indexed by 'position'
+
 
 Installing a Linux Image:
 -------------------------
index 636322a..2be253c 100644 (file)
@@ -107,8 +107,7 @@ void __udelay(unsigned long usec)
        if (usec == 0)
                return;
 
-       countticks = (u32) (((unsigned long long) TIMER_TICK_HZ * usec) /
-                                                               1000000);
+       countticks = lldiv(TIMER_TICK_HZ * usec, 1000000);
 
        /* decrementing timer */
        timeend = readl(&timer_base->counter) - countticks;
index 78d9f32..c4717de 100644 (file)
@@ -28,12 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static unsigned long long tick_to_time(unsigned long long tick)
 {
-       return tick * CONFIG_SYS_HZ / TIMER_FREQ_HZ;
+       return lldiv(tick * CONFIG_SYS_HZ, TIMER_FREQ_HZ);
 }
 
 static unsigned long long us_to_tick(unsigned long long us)
 {
-       return (us * TIMER_FREQ_HZ) / 1000000;
+       return lldiv(us * TIMER_FREQ_HZ, 1000000);
 }
 
 int timer_init(void)
index f476a89..dff10ba 100644 (file)
@@ -326,3 +326,26 @@ int bootz_setup(ulong image, ulong *start, ulong *end)
 }
 
 #endif /* CONFIG_CMD_BOOTZ */
+
+#if defined(CONFIG_BOOTM_VXWORKS)
+void boot_prep_vxworks(bootm_headers_t *images)
+{
+#if defined(CONFIG_OF_LIBFDT)
+       int off;
+
+       if (images->ft_addr) {
+               off = fdt_path_offset(images->ft_addr, "/memory");
+               if (off < 0) {
+                       if (arch_fixup_memory_node(images->ft_addr))
+                               puts("## WARNING: fixup memory failed!\n");
+               }
+       }
+#endif
+       cleanup_before_linux();
+}
+void boot_jump_vxworks(bootm_headers_t *images)
+{
+       /* ARM VxWorks requires device tree physical address to be passed */
+       ((void (*)(void *))images->ep)(images->ft_addr);
+}
+#endif
index 35f8716..73fa798 100644 (file)
@@ -14,9 +14,9 @@ CONFIG_BFIN_CPU := \
        $(shell awk '$$2 == "CONFIG_BFIN_CPU" { print $$3 }' \
                $(src)include/configs/$(BOARD).h)
 else
-CONFIG_BFIN_CPU := $(strip $(subst ",,$(CONFIG_BFIN_CPU)))
+CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%))
 endif
-CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
+CONFIG_BFIN_BOOT_MODE := $(strip $(CONFIG_BFIN_BOOT_MODE:"%"=%))
 
 PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
index e6bb935..f75c3bf 100644 (file)
@@ -9,8 +9,9 @@ CROSS_COMPILE ?= ppc_8xx-
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
 LDFLAGS_FINAL += --gc-sections
-PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections
-PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
+PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections \
+                                                               -meabi
+PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__ -ffixed-r2
 PLATFORM_LDFLAGS  += -n
 
 # Support generic board on PPC
index 9053191..96812a0 100644 (file)
@@ -5,6 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -ffixed-r2 -mstring
+PLATFORM_CPPFLAGS += -DCONFIG_74xx_7xx -mstring
index d630abe..88b5298 100644 (file)
@@ -1,3 +1,3 @@
-ifneq ($(filter mpc83xx mpc85xx mpc86xx,$(CPU)),)
-obj-y += mpc8xxx/
-endif
+obj-$(CONFIG_MPC83xx) += mpc8xxx/
+obj-$(CONFIG_MPC85xx) += mpc8xxx/
+obj-$(CONFIG_MPC86xx) += mpc8xxx/
index 04717a4..03759e6 100644 (file)
@@ -4,7 +4,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \
-                       -ffixed-r2 -msoft-float -mcpu=603e
+PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 -msoft-float -mcpu=603e
index b33f17a..31e2dc9 100644 (file)
@@ -5,6 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS +=   -meabi
-
-PLATFORM_CPPFLAGS +=   -DCONFIG_5xx -ffixed-r2 -mpowerpc -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_5xx -mpowerpc -msoft-float
index 57bdd2d..3384f6f 100644 (file)
@@ -5,7 +5,5 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx -ffixed-r2 \
+PLATFORM_CPPFLAGS += -DCONFIG_MPC5xxx \
                     -mstring -mcpu=603e -mmultiple
index ef605f0..a224bc8 100644 (file)
@@ -5,6 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -ffixed-r2 -mstring -mcpu=603e -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_MPC824X -mstring -mcpu=603e -msoft-float
index 91b0497..dfac710 100644 (file)
@@ -5,7 +5,5 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 -ffixed-r2 \
+PLATFORM_CPPFLAGS += -DCONFIG_8260 -DCONFIG_CPM2 \
                     -mstring -mcpu=603e -mmultiple
index c16a003..dfce4d5 100644 (file)
@@ -4,7 +4,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_MPC83xx -DCONFIG_E300 \
-                       -ffixed-r2 -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_MPC83xx -DCONFIG_E300 -msoft-float
index 9eef539..72c964c 100644 (file)
@@ -5,13 +5,10 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -ffixed-r2 -Wa,-me500 -msoft-float -mno-string
+PLATFORM_CPPFLAGS += -Wa,-me500 -msoft-float -mno-string
 
 # -mspe=yes is needed to have -mno-spe accepted by a buggy GCC;
 # see "[PATCH,rs6000] make -mno-spe work as expected" on
 # http://gcc.gnu.org/ml/gcc-patches/2008-04/msg00311.html
-PF_CPPFLAGS_SPE := $(call cc-option,-mspe=yes) \
+PLATFORM_CPPFLAGS += $(call cc-option,-mspe=yes) \
                   $(call cc-option,-mno-spe)
-PLATFORM_CPPFLAGS += $(PF_CPPFLAGS_SPE)
index 5dbf6a8..69a0b96 100644 (file)
@@ -5,7 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -ffixed-r2 -mstring
-PLATFORM_CPPFLAGS += -maltivec -mabi=altivec -msoft-float
+PLATFORM_CPPFLAGS += -mstring -maltivec -mabi=altivec -msoft-float
index c04e733..ee2c883 100644 (file)
@@ -5,6 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-
-PLATFORM_CPPFLAGS += -DCONFIG_8xx -ffixed-r2 -mstring -mcpu=860 -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_8xx -mstring -mcpu=860 -msoft-float
index f66ee2e..e95539e 100644 (file)
@@ -19,10 +19,8 @@ ifdef MINIMAL
 obj-$(CONFIG_FSL_LAW) += law.o
 
 else
-
-ifneq ($(CPU),mpc83xx)
-obj-y  += cpu.o
-endif
+obj-$(CONFIG_MPC85xx) += cpu.o
+obj-$(CONFIG_MPC86xx) += cpu.o
 
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
 obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
index c2b0f9a..71c2a6c 100644 (file)
@@ -5,8 +5,7 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-PLATFORM_RELFLAGS += -meabi
-PLATFORM_CPPFLAGS += -DCONFIG_4xx -ffixed-r2 -mstring -msoft-float
+PLATFORM_CPPFLAGS += -DCONFIG_4xx -mstring -msoft-float
 
 cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
 is440:=$(shell grep CONFIG_440 $(TOPDIR)/include/$(cfg))
index e7153b0..41fc8f7 100644 (file)
@@ -32,6 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern ulong get_effective_memsize(void);
 static ulong get_sp (void);
+extern void ft_fixup_num_cores(void *blob);
 static void set_clocks_in_mhz (bd_t *kbd);
 
 #ifndef CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE
@@ -277,3 +278,58 @@ static void set_clocks_in_mhz (bd_t *kbd)
 #endif /* CONFIG_MPC5xxx */
        }
 }
+
+#if defined(CONFIG_BOOTM_VXWORKS)
+void boot_prep_vxworks(bootm_headers_t *images)
+{
+#if defined(CONFIG_OF_LIBFDT)
+       int off;
+       u64 base, size;
+
+       if (!images->ft_addr)
+               return;
+
+       base = (u64)gd->bd->bi_memstart;
+       size = (u64)gd->bd->bi_memsize;
+
+       off = fdt_path_offset(images->ft_addr, "/memory");
+       if (off < 0)
+               fdt_fixup_memory(images->ft_addr, base, size);
+
+#if defined(CONFIG_MP)
+#if defined(CONFIG_MPC85xx)
+       ft_fixup_cpu(images->ft_addr, base + size);
+       ft_fixup_num_cores(images->ft_addr);
+#elif defined(CONFIG_MPC86xx)
+       off = fdt_add_mem_rsv(images->ft_addr,
+                       determine_mp_bootpg(NULL), (u64)4096);
+       if (off < 0)
+               printf("## WARNING %s: %s\n", __func__, fdt_strerror(off));
+       ft_fixup_num_cores(images->ft_addr);
+#endif
+       flush_cache((unsigned long)images->ft_addr, images->ft_len);
+#endif
+#endif
+}
+
+void boot_jump_vxworks(bootm_headers_t *images)
+{
+       /* PowerPC VxWorks boot interface conforms to the ePAPR standard
+        * general purpuse registers:
+        *
+        *      r3: Effective address of the device tree image
+        *      r4: 0
+        *      r5: 0
+        *      r6: ePAPR magic value
+        *      r7: shall be the size of the boot IMA in bytes
+        *      r8: 0
+        *      r9: 0
+        *      TCR: WRC = 0, no watchdog timer reset will occur
+        */
+       WATCHDOG_RESET();
+
+       ((void (*)(void *, ulong, ulong, ulong,
+               ulong, ulong, ulong))images->ep)(images->ft_addr,
+               0, 0, EPAPR_MAGIC, getenv_bootm_mapsize(), 0, 0);
+}
+#endif
index 889c493..1f399d2 100644 (file)
@@ -5,8 +5,6 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-CPPFLAGS += -I$(TOPDIR)
-
 obj-y                  += law.o
 obj-$(CONFIG_PCI)      += pci.o
 obj-y                  += tlb.o
index 74404be..d12cba5 100644 (file)
@@ -230,8 +230,6 @@ obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
 obj-y += memsize.o
 obj-y += stdio.o
 
-CPPFLAGS += -I..
-
 $(obj)env_embedded.o: $(src)env_embedded.c
        $(CC) $(AFLAGS) -Wa,--no-warn \
                -DENV_CRC=$(shell $(obj)../tools/envcrc) \
index f0664bc..fcfd713 100644 (file)
@@ -1010,6 +1010,7 @@ void board_init_f(ulong boot_flags)
 #endif
 
        gd->flags = boot_flags;
+       gd->have_console = 0;
 
        if (initcall_run_list(init_sequence_f))
                hang();
index ba73f57..3f57659 100644 (file)
 #include <asm/io.h>
 #include <linux/compiler.h>
 
+#if defined(CONFIG_BOOTM_VXWORKS) && \
+       (defined(CONFIG_PPC) || defined(CONFIG_ARM))
+#include <vxworks.h>
+#endif
+
 #if defined(CONFIG_CMD_USB)
 #include <usb.h>
 #endif
@@ -120,8 +125,11 @@ static boot_os_fn do_bootm_ose;
 #if defined(CONFIG_BOOTM_PLAN9)
 static boot_os_fn do_bootm_plan9;
 #endif
-#if defined(CONFIG_CMD_ELF)
+#if defined(CONFIG_BOOTM_VXWORKS) && \
+       (defined(CONFIG_PPC) || defined(CONFIG_ARM))
 static boot_os_fn do_bootm_vxworks;
+#endif
+#if defined(CONFIG_CMD_ELF)
 static boot_os_fn do_bootm_qnxelf;
 int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
@@ -149,8 +157,11 @@ static boot_os_fn *boot_os[] = {
 #if defined(CONFIG_BOOTM_PLAN9)
        [IH_OS_PLAN9] = do_bootm_plan9,
 #endif
-#if defined(CONFIG_CMD_ELF)
+#if defined(CONFIG_BOOTM_VXWORKS) && \
+       (defined(CONFIG_PPC) || defined(CONFIG_ARM))
        [IH_OS_VXWORKS] = do_bootm_vxworks,
+#endif
+#if defined(CONFIG_CMD_ELF)
        [IH_OS_QNX] = do_bootm_qnxelf,
 #endif
 #ifdef CONFIG_INTEGRITY
@@ -333,7 +344,8 @@ static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
        if (((images.os.type == IH_TYPE_KERNEL) ||
             (images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
             (images.os.type == IH_TYPE_MULTI)) &&
-           (images.os.os == IH_OS_LINUX)) {
+           (images.os.os == IH_OS_LINUX ||
+                images.os.os == IH_OS_VXWORKS)) {
                if (bootm_find_ramdisk(flag, argc, argv))
                        return 1;
 
@@ -1531,10 +1543,10 @@ static int do_bootm_netbsd(int flag, int argc, char * const argv[],
 
        /*
         * NetBSD Stage-2 Loader Parameters:
-        *   r3: ptr to board info data
-        *   r4: image address
-        *   r5: console device
-        *   r6: boot args string
+        *   arg[0]: pointer to board info data
+        *   arg[1]: image load address
+        *   arg[2]: char pointer to the console device to use
+        *   arg[3]: char pointer to the boot arguments
         */
        (*loader)(gd->bd, os_hdr, consdev, cmdline);
 
@@ -1678,12 +1690,66 @@ static int do_bootm_plan9(int flag, int argc, char * const argv[],
 }
 #endif /* CONFIG_BOOTM_PLAN9 */
 
-#if defined(CONFIG_CMD_ELF)
+#if defined(CONFIG_BOOTM_VXWORKS) && \
+       (defined(CONFIG_PPC) || defined(CONFIG_ARM))
+
+void do_bootvx_fdt(bootm_headers_t *images)
+{
+#if defined(CONFIG_OF_LIBFDT)
+       int ret;
+       char *bootline;
+       ulong of_size = images->ft_len;
+       char **of_flat_tree = &images->ft_addr;
+       struct lmb *lmb = &images->lmb;
+
+       if (*of_flat_tree) {
+               boot_fdt_add_mem_rsv_regions(lmb, *of_flat_tree);
+
+               ret = boot_relocate_fdt(lmb, of_flat_tree, &of_size);
+               if (ret)
+                       return;
+
+               ret = fdt_add_subnode(*of_flat_tree, 0, "chosen");
+               if ((ret >= 0 || ret == -FDT_ERR_EXISTS)) {
+                       bootline = getenv("bootargs");
+                       if (bootline) {
+                               ret = fdt_find_and_setprop(*of_flat_tree,
+                                               "/chosen", "bootargs",
+                                               bootline,
+                                               strlen(bootline) + 1, 1);
+                               if (ret < 0) {
+                                       printf("## ERROR: %s : %s\n", __func__,
+                                              fdt_strerror(ret));
+                                       return;
+                               }
+                       }
+               } else {
+                       printf("## ERROR: %s : %s\n", __func__,
+                              fdt_strerror(ret));
+                       return;
+               }
+       }
+#endif
+
+       boot_prep_vxworks(images);
+
+       bootstage_mark(BOOTSTAGE_ID_RUN_OS);
+
+#if defined(CONFIG_OF_LIBFDT)
+       printf("## Starting vxWorks at 0x%08lx, device tree at 0x%08lx ...\n",
+              (ulong)images->ep, (ulong)*of_flat_tree);
+#else
+       printf("## Starting vxWorks at 0x%08lx\n", (ulong)images->ep);
+#endif
+
+       boot_jump_vxworks(images);
+
+       puts("## vxWorks terminated\n");
+}
+
 static int do_bootm_vxworks(int flag, int argc, char * const argv[],
                             bootm_headers_t *images)
 {
-       char str[80];
-
        if (flag != BOOTM_STATE_OS_GO)
                return 0;
 
@@ -1694,13 +1760,13 @@ static int do_bootm_vxworks(int flag, int argc, char * const argv[],
        }
 #endif
 
-       sprintf(str, "%lx", images->ep); /* write entry-point into string */
-       setenv("loadaddr", str);
-       do_bootvx(NULL, 0, 0, NULL);
+       do_bootvx_fdt(images);
 
        return 1;
 }
+#endif
 
+#if defined(CONFIG_CMD_ELF)
 static int do_bootm_qnxelf(int flag, int argc, char * const argv[],
                            bootm_headers_t *images)
 {
index f741f6b..ab9c7e3 100644 (file)
@@ -156,16 +156,16 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * If we don't know where the image is then we're done.
         */
 
-       if (argc < 1)
+       if (argc < 2)
                addr = load_addr;
        else
-               addr = simple_strtoul(argv[0], NULL, 16);
+               addr = simple_strtoul(argv[1], NULL, 16);
 
 #if defined(CONFIG_CMD_NET)
        /*
         * Check to see if we need to tftp the image ourselves before starting
         */
-       if ((argc == 1) && (strcmp(argv[0], "tftp") == 0)) {
+       if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) {
                if (NetLoop(TFTPGET) <= 0)
                        return 1;
                printf("Automatic boot of VxWorks image at address 0x%08lx ...\n",
index 1f0d8f5..4e32b02 100644 (file)
@@ -400,10 +400,11 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
        nodeoffset = fdt_path_offset(blob, "/memory");
        if (nodeoffset < 0) {
                nodeoffset = fdt_add_subnode(blob, 0, "memory");
-               if (nodeoffset < 0)
+               if (nodeoffset < 0) {
                        printf("WARNING: could not create /memory: %s.\n",
                                        fdt_strerror(nodeoffset));
-               return nodeoffset;
+                       return nodeoffset;
+               }
        }
        err = fdt_setprop(blob, nodeoffset, "device_type", "memory",
                        sizeof("memory"));
index d5b09a0..b824bb3 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -125,9 +125,9 @@ endif
 
 # cc-version
 # Usage gcc-ver := $(call cc-version)
-cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
-binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
-dtc-version = $(shell $(SHELL) $(SRCTREE)/tools/dtc-version.sh $(DTC))
+cc-version = $(shell $(SHELL) $(SRCTREE)/scripts/gcc-version.sh $(CC))
+binutils-version = $(shell $(SHELL) $(SRCTREE)/scripts/binutils-version.sh $(AS))
+dtc-version = $(shell $(SHELL) $(SRCTREE)/scripts/dtc-version.sh $(DTC))
 
 #
 # Include the make variables (CC, etc...)
diff --git a/doc/README.vxworks b/doc/README.vxworks
new file mode 100644 (file)
index 0000000..4cb302e
--- /dev/null
@@ -0,0 +1,19 @@
+From VxWorks 6.9+ (not include 6.9), VxWorks starts adopting device tree as its hardware
+decription mechansim (for PowerPC and ARM), thus requiring boot interface changes.
+This section will describe the new interface.
+
+For PowerPC, the calling convention of the new VxWorks entry point conforms to the ePAPR standard,
+which is shown below (see ePAPR for more details):
+
+    void (*kernel_entry)(fdt_addr,
+              0, 0, EPAPR_MAGIC, boot_IMA, 0, 0)
+
+For ARM, the calling convention is show below:
+
+    void (*kernel_entry)(void *fdt_addr)
+
+When booting new VxWorks kernel (uImage format), the parameters passed to bootm is like below:
+
+    bootm <kernel image address> - <device tree address>
+
+The do_bootvx command still works as it was for older VxWorks kernels.
index e145cd1..02b149c 100644 (file)
@@ -5,8 +5,6 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-ifdef CONFIG_CMD_NAND
-
 ifdef CONFIG_SPL_BUILD
 
 ifdef CONFIG_SPL_NAND_DRIVERS
@@ -69,4 +67,3 @@ obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o
 obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
 
 endif # drivers
-endif # nand
index e1f3a24..56c2823 100644 (file)
@@ -5,9 +5,6 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-ifdef CONFIG_CMD_UBI
 obj-y += build.o vtbl.o vmt.o upd.o kapi.o eba.o io.o wl.o scan.o crc32.o
-
 obj-y += misc.o
 obj-y += debug.o
-endif
index 9c7c621..c8926a8 100644 (file)
@@ -38,6 +38,9 @@ static int lpc32xx_serial_getc(void)
 
 static void lpc32xx_serial_putc(const char c)
 {
+       if (c == '\n')
+               serial_putc('\r');
+
        writel(c, &hsuart->tx);
 
        /* Wait for character to be sent */
index f52d3f4..f13b172 100644 (file)
@@ -5,12 +5,8 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-# if defined(CONFIG_USB_GADGET) || defined(CONFIG_USB_ETHER)
-#   Everytime you forget how crufty makefiles can get things like
-#   this remind you...
-ifneq (,$(CONFIG_USB_GADGET)$(CONFIG_USB_ETHER))
-obj-y += epautoconf.o config.o usbstring.o
-endif
+obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
+obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 
 # new USB gadget layer dependencies
 ifdef CONFIG_USB_GADGET
index 140c8bc..6c7198f 100644 (file)
@@ -10,7 +10,7 @@
 ifeq ($(DEVICE_TREE),)
 $(if $(CONFIG_DEFAULT_DEVICE_TREE),,\
 $(error Please define CONFIG_DEFAULT_DEVICE_TREE in your board header file))
-DEVICE_TREE = $(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE))
+DEVICE_TREE = $(CONFIG_DEFAULT_DEVICE_TREE:"%"=%)
 endif
 
 DTS_INCDIRS =  $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
index 4d9ce66..6d3a616 100644 (file)
@@ -1,6 +1,4 @@
-/82559_eeprom
 /atmel_df_pow2
-/eepro100_eeprom
 /hello_world
 /interrupt
 /mem_to_mem_idma2intr
diff --git a/examples/standalone/82559_eeprom.c b/examples/standalone/82559_eeprom.c
deleted file mode 100644 (file)
index c253055..0000000
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright 1998-2001 by Donald Becker.
- * This software may be used and distributed according to the terms of
- * the GNU General Public License (GPL), incorporated herein by reference.
- * Contact the author for use under other terms.
- *
- * This program must be compiled with "-O"!
- * See the bottom of this file for the suggested compile-command.
- *
- * The author may be reached as becker@scyld.com, or C/O
- *  Scyld Computing Corporation
- *  410 Severn Ave., Suite 210
- *  Annapolis MD 21403
- *
- * Common-sense licensing statement: Using any portion of this program in
- * your own program means that you must give credit to the original author
- * and release the resulting code under the GPL.
- */
-
-#define _PPC_STRING_H_         /* avoid unnecessary str/mem functions */
-
-#include <common.h>
-#include <exports.h>
-#include <asm/io.h>
-
-
-/* Default EEPROM for i82559 */
-static unsigned short default_eeprom[64] = {
-       0x0100, 0x0302, 0x0504, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0x40c0, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
-       0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
-};
-
-static unsigned short eeprom[256];
-
-static int eeprom_size = 64;
-static int eeprom_addr_size = 6;
-
-static int debug = 0;
-
-static inline unsigned short swap16(unsigned short x)
-{
-       return (((x & 0xff) << 8) | ((x & 0xff00) >> 8));
-}
-
-
-void * memcpy(void * dest,const void *src,size_t count)
-{
-       char *tmp = (char *) dest, *s = (char *) src;
-
-       while (count--)
-               *tmp++ = *s++;
-
-       return dest;
-}
-
-
-/* The EEPROM commands include the alway-set leading bit. */
-#define EE_WRITE_CMD   (5)
-#define EE_READ_CMD            (6)
-#define EE_ERASE_CMD   (7)
-
-/* Serial EEPROM section. */
-#define EE_SHIFT_CLK   0x01    /* EEPROM shift clock. */
-#define EE_CS                  0x02    /* EEPROM chip select. */
-#define EE_DATA_WRITE  0x04    /* EEPROM chip data in. */
-#define EE_DATA_READ   0x08    /* EEPROM chip data out. */
-#define EE_ENB                 (0x4800 | EE_CS)
-#define EE_WRITE_0             0x4802
-#define EE_WRITE_1             0x4806
-#define EE_OFFSET              14
-
-/* Delay between EEPROM clock transitions. */
-#define eeprom_delay(ee_addr)  inw(ee_addr)
-
-/* Wait for the EEPROM to finish the previous operation. */
-static int eeprom_busy_poll(long ee_ioaddr)
-{
-       int i;
-       outw(EE_ENB, ee_ioaddr);
-       for (i = 0; i < 10000; i++)                     /* Typical 2000 ticks */
-               if (inw(ee_ioaddr) & EE_DATA_READ)
-                       break;
-       return i;
-}
-
-/* This executes a generic EEPROM command, typically a write or write enable.
-   It returns the data output from the EEPROM, and thus may also be used for
-   reads. */
-static int do_eeprom_cmd(long ioaddr, int cmd, int cmd_len)
-{
-       unsigned retval = 0;
-       long ee_addr = ioaddr + EE_OFFSET;
-
-       if (debug > 1)
-               printf(" EEPROM op 0x%x: ", cmd);
-
-       outw(EE_ENB | EE_SHIFT_CLK, ee_addr);
-
-       /* Shift the command bits out. */
-       do {
-               short dataval = (cmd & (1 << cmd_len)) ? EE_WRITE_1 : EE_WRITE_0;
-               outw(dataval, ee_addr);
-               eeprom_delay(ee_addr);
-               if (debug > 2)
-                       printf("%X", inw(ee_addr) & 15);
-               outw(dataval | EE_SHIFT_CLK, ee_addr);
-               eeprom_delay(ee_addr);
-               retval = (retval << 1) | ((inw(ee_addr) & EE_DATA_READ) ? 1 : 0);
-       } while (--cmd_len >= 0);
-#if 0
-       outw(EE_ENB, ee_addr);
-#endif
-       /* Terminate the EEPROM access. */
-       outw(EE_ENB & ~EE_CS, ee_addr);
-       if (debug > 1)
-               printf(" EEPROM result is 0x%5.5x.\n", retval);
-       return retval;
-}
-
-static int read_eeprom(long ioaddr, int location, int addr_len)
-{
-       return do_eeprom_cmd(ioaddr, ((EE_READ_CMD << addr_len) | location)
-               << 16 , 3 + addr_len + 16) & 0xffff;
-}
-
-static void write_eeprom(long ioaddr, int index, int value, int addr_len)
-{
-       long ee_ioaddr = ioaddr + EE_OFFSET;
-       int i;
-
-       /* Poll for previous op finished. */
-       eeprom_busy_poll(ee_ioaddr);                    /* Typical 0 ticks */
-       /* Enable programming modes. */
-       do_eeprom_cmd(ioaddr, (0x4f << (addr_len-4)), 3 + addr_len);
-       /* Do the actual write. */
-       do_eeprom_cmd(ioaddr,
-                                 (((EE_WRITE_CMD<<addr_len) | index)<<16) | (value & 0xffff),
-                                 3 + addr_len + 16);
-       /* Poll for write finished. */
-       i = eeprom_busy_poll(ee_ioaddr);                        /* Typical 2000 ticks */
-       if (debug)
-               printf(" Write finished after %d ticks.\n", i);
-       /* Disable programming. This command is not instantaneous, so we check
-          for busy before the next op. */
-       do_eeprom_cmd(ioaddr, (0x40 << (addr_len-4)), 3 + addr_len);
-       eeprom_busy_poll(ee_ioaddr);
-}
-
-static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr)
-{
-       unsigned short checksum = 0;
-       int size_test;
-       int i;
-
-       printf("Resetting i82559 EEPROM @ 0x%08lx ... ", ioaddr);
-
-       size_test = do_eeprom_cmd(ioaddr, (EE_READ_CMD << 8) << 16, 27);
-       eeprom_addr_size = (size_test & 0xffe0000) == 0xffe0000 ? 8 : 6;
-       eeprom_size = 1 << eeprom_addr_size;
-
-       memcpy(eeprom, default_eeprom, sizeof default_eeprom);
-
-       for (i = 0; i < 3; i++)
-               eeprom[i] = (hwaddr[i*2+1]<<8) + hwaddr[i*2];
-
-       /* Recalculate the checksum. */
-       for (i = 0; i < eeprom_size - 1; i++)
-               checksum += eeprom[i];
-       eeprom[i] = 0xBABA - checksum;
-
-       for (i = 0; i < eeprom_size; i++)
-               write_eeprom(ioaddr, i, eeprom[i], eeprom_addr_size);
-
-       for (i = 0; i < eeprom_size; i++)
-               if (read_eeprom(ioaddr, i, eeprom_addr_size) != eeprom[i]) {
-                       printf("failed\n");
-                       return 1;
-               }
-
-       printf("done\n");
-       return 0;
-}
-
-static unsigned int hatoi(char *p, char **errp)
-{
-       unsigned int res = 0;
-
-       while (1) {
-               switch (*p) {
-               case 'a':
-               case 'b':
-               case 'c':
-               case 'd':
-               case 'e':
-               case 'f':
-                       res |= (*p - 'a' + 10);
-                       break;
-               case 'A':
-               case 'B':
-               case 'C':
-               case 'D':
-               case 'E':
-               case 'F':
-                       res |= (*p - 'A' + 10);
-                       break;
-               case '0':
-               case '1':
-               case '2':
-               case '3':
-               case '4':
-               case '5':
-               case '6':
-               case '7':
-               case '8':
-               case '9':
-                       res |= (*p - '0');
-                       break;
-               default:
-                       if (errp) {
-                               *errp = p;
-                       }
-               return res;
-               }
-               p++;
-               if (*p == 0) {
-                       break;
-               }
-               res <<= 4;
-       }
-
-       if (errp) {
-               *errp = NULL;
-       }
-
-       return res;
-}
-
-static unsigned char *gethwaddr(char *in, unsigned char *out)
-{
-       char tmp[3];
-       int i;
-       char *err;
-
-       for (i=0;i<6;i++) {
-               if (in[i*3+2] == 0 && i == 5) {
-                       out[i] = hatoi(&in[i*3], &err);
-                       if (err) {
-                               return NULL;
-                       }
-               } else if (in[i*3+2] == ':' && i < 5) {
-                       tmp[0] = in[i*3];
-                       tmp[1] = in[i*3+1];
-                       tmp[2] = 0;
-                       out[i] = hatoi(tmp, &err);
-                       if (err) {
-                               return NULL;
-                       }
-               } else {
-                       return NULL;
-               }
-       }
-
-       return out;
-}
-
-static u32
-read_config_dword(int bus, int dev, int func, int reg)
-{
-       u32 res;
-
-       outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
-            0xcf8);
-       res = inl(0xcfc);
-       outl(0, 0xcf8);
-       return res;
-}
-
-static u16
-read_config_word(int bus, int dev, int func, int reg)
-{
-       u32 res;
-
-       outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
-            0xcf8);
-       res = inw(0xcfc + (reg & 2));
-       outl(0, 0xcf8);
-       return res;
-}
-
-static void
-write_config_word(int bus, int dev, int func, int reg, u16 data)
-{
-
-       outl(0x80000000|(bus&0xff)<<16|(dev&0x1f)<<11|(func&7)<<8|(reg&0xfc),
-            0xcf8);
-       outw(data, 0xcfc + (reg & 2));
-       outl(0, 0xcf8);
-}
-
-
-int main (int argc, char * const argv[])
-{
-       unsigned char *eth_addr;
-       uchar buf[6];
-       int instance;
-
-       app_startup(argv);
-       if (argc != 2) {
-               printf ("call with base Ethernet address\n");
-               return 1;
-       }
-
-
-       eth_addr = gethwaddr(argv[1], buf);
-       if (NULL == eth_addr) {
-               printf ("Can not parse ethernet address\n");
-               return 1;
-       }
-       if (eth_addr[5] & 0x01) {
-               printf("Base Ethernet address must be even\n");
-       }
-
-
-       for (instance = 0; instance < 2; instance ++)  {
-               unsigned int io_addr;
-               unsigned char mac[6];
-               int bar1 = read_config_dword(0, 6+instance, 0, 0x14);
-               if (! (bar1 & 1)) {
-                       printf("ETH%d is disabled %x\n", instance, bar1);
-               } else {
-                       printf("ETH%d IO=0x%04x\n", instance, bar1 & ~3);
-               }
-               io_addr = (bar1 & (~3L));
-
-
-               write_config_word(0, 6+instance, 0, 4,
-                                 read_config_word(0, 6+instance, 0, 4) | 1);
-               printf("ETH%d CMD %04x\n", instance,
-                          read_config_word(0, 6+instance, 0, 4));
-
-               memcpy(mac, eth_addr, 6);
-               mac[5] += instance;
-
-               printf("got io=%04x, ha=%02x:%02x:%02x:%02x:%02x:%02x\n",
-                          io_addr, mac[0], mac[1], mac[2],
-                          mac[3], mac[4], mac[5]);
-               reset_eeprom(io_addr, mac);
-       }
-       return 0;
-}
index f4f102b..0841c75 100644 (file)
@@ -7,25 +7,22 @@
 
 include $(TOPDIR)/config.mk
 
-ELF-$(ARCH)  :=
-ELF-$(CPU)   :=
 ELF-y        := hello_world
 
 ELF-$(CONFIG_SMC91111)           += smc91111_eeprom
 ELF-$(CONFIG_SMC911X)            += smc911x_eeprom
 ELF-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
-ELF-i386                         += 82559_eeprom
-ELF-mpc5xxx                      += interrupt
-ELF-mpc8xx                       += test_burst timer
-ELF-mpc8260                      += mem_to_mem_idma2intr
-ELF-ppc                          += sched
+ELF-$(CONFIG_MPC5xxx)            += interrupt
+ELF-$(CONFIG_8xx)                += test_burst timer
+ELF-$(CONFIG_8260)               += mem_to_mem_idma2intr
+ELF-$(CONFIG_PPC)                += sched
 
 #
 # Some versions of make do not handle trailing white spaces properly;
 # leading to build failures. The problem was found with GNU Make 3.80.
 # Using 'strip' as a workaround for the problem.
 #
-ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(CPU)))
+ELF := $(strip $(ELF-y))
 
 SREC := $(addsuffix .srec,$(ELF))
 BIN  := $(addsuffix .bin,$(ELF))
@@ -34,11 +31,9 @@ COBJS        := $(ELF:=.o)
 
 LIB    = $(obj)libstubs.o
 
-LIBAOBJS-$(ARCH)     :=
-LIBAOBJS-$(CPU)      :=
-LIBAOBJS-ppc         += $(ARCH)_longjmp.o $(ARCH)_setjmp.o
-LIBAOBJS-mpc8xx      += test_burst_lib.o
-LIBAOBJS := $(LIBAOBJS-$(ARCH)) $(LIBAOBJS-$(CPU))
+LIBAOBJS-$(CONFIG_PPC) += ppc_longjmp.o ppc_setjmp.o
+LIBAOBJS-$(CONFIG_8xx) += test_burst_lib.o
+LIBAOBJS := $(LIBAOBJS-y)
 
 LIBCOBJS = stubs.o
 
index c856983..3fb5db3 100644 (file)
 #include <common.h>
 #include <config.h>
 #include <malloc.h>
+#include <div64.h>
 #include <linux/stat.h>
 #include <linux/time.h>
 #include <watchdog.h>
@@ -1438,7 +1439,7 @@ jffs2_1pass_build_lists(struct part_info * part)
 {
        struct b_lists *pL;
        struct jffs2_unknown_node *node;
-       u32 nr_sectors = part->size/part->sector_size;
+       u32 nr_sectors;
        u32 i;
        u32 counter4 = 0;
        u32 counterF = 0;
@@ -1447,6 +1448,7 @@ jffs2_1pass_build_lists(struct part_info * part)
        u32 buf_size = DEFAULT_EMPTY_SCAN_SIZE;
        char *buf;
 
+       nr_sectors = lldiv(part->size, part->sector_size);
        /* turn off the lcd.  Refreshing the lcd adds 50% overhead to the */
        /* jffs2 list building enterprise nope.  in newer versions the overhead is */
        /* only about 5 %.  not enough to inconvenience people for. */
index e113e40..50000a1 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 
 #include <config.h>
 #include "nand.h"
@@ -184,7 +185,7 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
        }
 
        if (end_block == 0)
-               end_block = mtd->size / mtd->erasesize - 1;
+               end_block = lldiv(mtd->size, mtd->erasesize - 1);
 
        if (end_block < start_block) {
                printf("Bad start/end\n");
index ac4a010..334598e 100644 (file)
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <div64.h>
 #include "yaffsfs.h"
 #include "yaffs_guts.h"
 #include "yaffscfg.h"
@@ -1603,8 +1604,8 @@ static int yaffsfs_DoStat(struct yaffs_obj *obj, struct yaffs_stat *buf)
                buf->st_rdev = obj->yst_rdev;
                buf->st_size = yaffs_get_obj_length(obj);
                buf->st_blksize = obj->my_dev->data_bytes_per_chunk;
-               buf->st_blocks = (buf->st_size + buf->st_blksize - 1) /
-                   buf->st_blksize;
+               buf->st_blocks = lldiv(buf->st_size + buf->st_blksize - 1,
+                   buf->st_blksize);
 #if CONFIG_YAFFS_WINCE
                buf->yst_wince_atime[0] = obj->win_atime[0];
                buf->yst_wince_atime[1] = obj->win_atime[1];
index 8ca67f6..d49c514 100644 (file)
@@ -698,6 +698,10 @@ ulong get_ddr_freq(ulong);
 #if defined(CONFIG_MPC85xx)
 typedef MPC85xx_SYS_INFO sys_info_t;
 void   get_sys_info  ( sys_info_t * );
+#  if defined(CONFIG_OF_LIBFDT)
+       void ft_fixup_cpu(void *, u64);
+       void ft_fixup_num_cores(void *);
+#  endif
 #endif
 #if defined(CONFIG_MPC86xx)
 typedef MPC86xx_SYS_INFO sys_info_t;
index 567b46c..ad08c1d 100644 (file)
@@ -14,6 +14,7 @@
 #define CONFIG_BOOTM_NETBSD 1
 #define CONFIG_BOOTM_PLAN9 1
 #define CONFIG_BOOTM_RTEMS 1
+#define CONFIG_BOOTM_VXWORKS 1
 
 #define CONFIG_GZIP 1
 #define CONFIG_ZLIB 1
index b2a5c19..3c6cd61 100644 (file)
@@ -737,7 +737,6 @@ unsigned long get_board_ddr_clk(void);
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 499d8c2..4aed5af 100644 (file)
@@ -382,7 +382,6 @@ extern unsigned long get_sdram_size(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 #define CONFIG_USB_EHCI
index a6601fe..f025e31 100644 (file)
@@ -625,7 +625,6 @@ combinations. this should be removed later
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 2d7fc59..71be122 100644 (file)
@@ -406,7 +406,6 @@ int du440_phy_addr(int devnum);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 #define CONFIG_SOURCE          1
index f366308..208b599 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 #endif /* __CONFIG_H */
index 4284d6a..5738ea9 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 #endif /* __CONFIG_H */
index 71e90d7..39eb2ef 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE  230400        /* kgdb serial port baud   */
-#define CONFIG_KGDB_SER_INDEX 2                     /* kgdb serial port        */
 #endif
 
 /*-----------------------------------------------------------------------
index 32ec0bf..6715435 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE  230400        /* kgdb serial port baud   */
-#define CONFIG_KGDB_SER_INDEX 2                     /* kgdb serial port        */
 #endif
 
 /*-----------------------------------------------------------------------
index f248a56..6042a1e 100644 (file)
  ************************************************************/
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /************************************************************
index 0f9f436..aedb529 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index a1e5f3b..c4c771b 100644 (file)
 
 #if (CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 71fc497..f5b6202 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 0374841..7640d06 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index e2ae596..ffb9a15 100644 (file)
@@ -730,7 +730,6 @@ boards, we say we have two, but don't display a message if we find only one. */
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 
index ed780f1..d4c82cd 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index d31be19..01e7ac7 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 98ffb9c..f52e77a 100644 (file)
@@ -662,7 +662,6 @@ extern int board_pci_host_broken(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index ca28c0e..938f7ab 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 9ab1bc1..9b7cc64 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 046b14b..2d42b25 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 
index eca3b53..b9ad034 100644 (file)
@@ -410,7 +410,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 8132ec0..90fc2da 100644 (file)
@@ -441,7 +441,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 6acd54d..5fff1e2 100644 (file)
@@ -535,7 +535,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 5ffdd01..23c6b07 100644 (file)
@@ -408,7 +408,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index bb9ae2d..44b7679 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 
index 7406ac3..4f438a8 100644 (file)
@@ -430,7 +430,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index df5572b..d877e8b 100644 (file)
@@ -566,7 +566,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 63480ec..44d83a2 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 41ebe31..f930fcd 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 0e666ba..65d61c2 100644 (file)
@@ -670,7 +670,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #if defined(CONFIG_CMD_KGDB)
     #define CONFIG_KGDB_BAUDRATE       230400  /* speed to run kgdb serial port */
-    #define CONFIG_KGDB_SER_INDEX      2       /* which serial port to use */
 #endif
 
 /*
index 1ed5e1d..fe5309a 100644 (file)
@@ -739,7 +739,6 @@ extern unsigned long get_sdram_size(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 262c3e5..ba43cce 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 2aa1f59..11c74ff 100644 (file)
@@ -469,7 +469,6 @@ extern unsigned long get_clock_freq(void);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index b592c19..85cb076 100644 (file)
@@ -606,7 +606,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 15d2a43..ce3c762 100644 (file)
@@ -432,7 +432,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 9d3d9b3..ada6c7b 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index b238574..ee71252 100644 (file)
@@ -677,7 +677,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 1180724..29888b4 100644 (file)
  ************************************************************/
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /************************************************************
index 5ab9315..efe6960 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /* pass open firmware flat tree */
index 43a5778..d0ebd6a 100644 (file)
@@ -682,7 +682,6 @@ unsigned long get_board_ddr_clk(void);
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 7931231..d721139 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index eff08e3..2c02d9d 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index fc25425..15cf2bd 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 57b620d..d40185e 100644 (file)
 #if defined(CONFIG_CMD_KGDB)
 /* speed to run kgdb serial port */
 #define CONFIG_KGDB_BAUDRATE           115200
-/* what's this ? it's not used anywhere */
-#define CONFIG_KGDB_SER_INDEX          2       /* which serial port to use */
 #endif
 
 /* Miscellaneous configurable options */
index 8fda1b1..00a24ab 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use     */
 #endif
 
 /*
index 6836fc7..8ed2fa2 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use     */
 #endif
 
 /*
index 1205557..d6cef88 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE           230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX          2       /* which serial port to use */
 #endif
 
 /*
index 3315f54..9b8bd78 100644 (file)
@@ -58,8 +58,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 # define CONFIG_KGDB_BAUDRATE          230400
-/* which serial port to use */
-# define CONFIG_KGDB_SER_INDEX         1
 #endif
 
 /* Miscellaneous configurable options */
index fb391ec..f0cbff7 100644 (file)
@@ -51,8 +51,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 # define CONFIG_KGDB_BAUDRATE          230400
-/* which serial port to use */
-# define CONFIG_KGDB_SER_INDEX         1
 #endif
 
 /* Miscellaneous configurable options */
index 61d96f5..7639107 100644 (file)
@@ -49,8 +49,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 # define CONFIG_KGDB_BAUDRATE          230400
-/* which serial port to use */
-# define CONFIG_KGDB_SER_INDEX         1
 #endif
 
 /* Miscellaneous configurable options */
index 2387279..12bd98a 100644 (file)
@@ -56,8 +56,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 # define CONFIG_KGDB_BAUDRATE          230400
-/* which serial port to use */
-# define CONFIG_KGDB_SER_INDEX         1
 #endif
 
 /* Miscellaneous configurable options */
index 61fdeba..08bba36 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /* pass open firmware flat tree */
index c9e9a03..0f38c92 100644 (file)
  */
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port*/
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use     */
 #endif
 
 /*
index 32216cd..b8d955a 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE           230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX          2       /* which serial port to use */
 #endif
 
 /*
index 12df45b..8b2a6cf 100644 (file)
@@ -61,7 +61,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define        CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index 556b42a..d1d732f 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE                   115200
-#define CONFIG_KGDB_SER_INDEX                  2
 #endif
 
 /*
index 665295c..969b990 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index ca0bffa..8a848be 100644 (file)
@@ -99,7 +99,6 @@
  */
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 596095d..5c03417 100644 (file)
@@ -98,7 +98,6 @@
  */
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 87b3314..1af7f16 100644 (file)
@@ -57,8 +57,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 # define CONFIG_KGDB_BAUDRATE          230400
-/* which serial port to use */
-# define CONFIG_KGDB_SER_INDEX         1
 #endif
 
 /* Miscellaneous configurable options */
index 7700b38..50330cc 100644 (file)
@@ -385,7 +385,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 #define __USB_PHY_TYPE utmi
index b09af19..811ff99 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400 /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use     */
 #endif
 
 /* Pass open firmware flat tree */
index 68e1a97..379c786 100644 (file)
@@ -93,7 +93,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define        CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index b87df54..4ffe165 100644 (file)
@@ -86,7 +86,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /*
index c348329..e9c8d8f 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2           /* which serial port to use */
 #endif
 
 /*
index 6501ea4..d415ecd 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 4a8adf6..38337b4 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index ec09e15..4cac8ee 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 # define CONFIG_KGDB_BAUDRATE  230400 /* speed to run kgdb serial port */
-# define CONFIG_KGDB_SER_INDEX 2      /* which serial port to use */
 #endif
 
 /*
index c15d546..12667c5 100644 (file)
@@ -86,8 +86,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   115200          /* speed to run kgdb serial port */
-                                               /* what's this ? it's not used anywhere */
-#define CONFIG_KGDB_SER_INDEX  1               /* which serial port to use */
 #endif
 
 /*
index c48790d..376dfdb 100644 (file)
@@ -94,7 +94,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  1       /* which serial port to use */
 #endif
 
 /*
index 57ed019..c6df11b 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 3fde7ca..1fdd602 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 #endif /* __CONFIG_H */
index 84bc9ed..ae4dd75 100644 (file)
@@ -93,7 +93,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define        CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index 661101c..1f94f0c 100644 (file)
@@ -95,7 +95,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define        CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index adf8519..3662663 100644 (file)
@@ -94,7 +94,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index 400cb3e..5a5fe7f 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*-----------------------------------------------------------------------
index 266d107..2a54e5c 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /* POST support */
index 5856ee1..f0ecc34 100644 (file)
@@ -16,7 +16,6 @@
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400
-#define        CONFIG_KGDB_SER_INDEX           2
 #endif
 
 /*
index 84ad006..af7c076 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   115200          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /*
index 7b04e0c..20d6178 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /* ENVIRONMENT VARS */
index f144f84..92318c3 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /*
index a258fe8..b7f83e0 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index bdb8eb5..4912d69 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index dba948a..78f8219 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index a87444e..d4ae19f 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port */
-/* what's this ? it's not used anywhere */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 0e6b864..fd590e4 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port*/
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use     */
 #endif
 
 
index ee1f1f3..2a9c9a3 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*Note: change below for your network setting!!! */
index 63dd767..d0cb68a 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*Note: change below for your network setting!!! */
index d9b0ed0..54a5e3e 100644 (file)
 
 #ifdef CONFIG_CMD_KGDB
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index 0615117..b7804d2 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /*
index 734d13f..7ecbafe 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400  /* speed of kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2       /* which serial port to use */
 #endif
 
 /*
index c3ac612..71a89b6 100644 (file)
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400  /* kgdb serial port speed */
-#define        CONFIG_KGDB_SER_INDEX           2       /* which serial port to use */
 #endif
 
 /*
index 431ed96..2999d1b 100644 (file)
@@ -84,7 +84,6 @@
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   115200                  /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  1                       /* which serial port to use */
 #endif
 
 /*
index 9d58738..d8aeb37 100644 (file)
 
 #if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#define CONFIG_KGDB_SER_INDEX  2               /* which serial port to use */
 #endif
 
 /*
index 52a745e..f9ccca7 100644 (file)
@@ -117,7 +117,6 @@ unsigned char zipitz2_spi_read(void);
  */
 #ifdef CONFIG_CMD_KGDB
 #define        CONFIG_KGDB_BAUDRATE            230400          /* speed to run kgdb serial port */
-#define        CONFIG_KGDB_SER_INDEX           2               /* which serial port to use */
 #endif
 
 /*
index c5d1577..122043c 100644 (file)
@@ -9,6 +9,9 @@
 #define _VXWORKS_H_
 
 int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+void boot_prep_vxworks(bootm_headers_t *images);
+void boot_jump_vxworks(bootm_headers_t *images);
+void do_bootvx_fdt(bootm_headers_t *images);
 
 /*
  * Use bootaddr to find the location in memory that VxWorks
index 09bb05a..8085aa4 100644 (file)
@@ -71,8 +71,8 @@ unsigned long __weak notrace timer_get_us(void)
 }
 static unsigned long long usec_to_tick(unsigned long usec)
 {
-       uint64_t tick = usec * get_tbclk();
-       usec *= get_tbclk();
+       uint64_t tick = usec;
+       tick *= get_tbclk();
        do_div(tick, 1000000);
        return tick;
 }
index 1439244..2fa6f8a 100644 (file)
@@ -5,16 +5,14 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += post.o
+obj- += post.o
 obj-$(CONFIG_POST_STD_LIST)    += tests.o
 
-obj-$(CONFIG_HAS_POST) += drivers/
-ifeq ($(ARCH),powerpc)
-obj-$(CONFIG_HAS_POST) += lib_powerpc/
-endif
-ifneq ($(filter mpc83xx mpc8xx ppc4xx,$(CPU)),)
-obj-$(CONFIG_HAS_POST) += cpu/$(CPU)/
-endif
+obj-y += drivers/
+obj-$(CONFIG_PPC) += lib_powerpc/
+obj-$(CONFIG_MPC83xx) += cpu/mpc83xx/
+obj-$(CONFIG_8xx) += cpu/mpc8xx/
+obj-$(CONFIG_4xx) += cpu/ppc4xx/
 ifneq ($(filter lwmon lwmon5 netta pdm360ng,$(BOARD)),)
-obj-$(CONFIG_HAS_POST) += board/$(BOARD)/
+obj-y += board/$(BOARD)/
 endif
index b23debc..7f6d5a0 100644 (file)
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += sysmon.o
+obj-y += sysmon.o
index a50ce67..76262c7 100644 (file)
@@ -5,4 +5,4 @@
 #
 # SPDX-License-Identifier:     GPL-2.0+
 
-obj-$(CONFIG_HAS_POST) += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o
+obj-y += sysmon.o watchdog.o dspic.o fpga.o dsp.o gdc.o
index 5c37f49..8fc1945 100644 (file)
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += codec.o dsp.o
+obj-y += codec.o dsp.o
index b43b77b..9aa96a1 100644 (file)
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += coproc_com.o
+obj-y += coproc_com.o
index 4b3c50e..d57b667 100644 (file)
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += ecc.o
+obj-y += ecc.o
index ed3e8e8..e9ec286 100644 (file)
@@ -5,12 +5,12 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += cache_4xx.o
-obj-$(CONFIG_HAS_POST) += cache.o
-obj-$(CONFIG_HAS_POST) += denali_ecc.o
-obj-$(CONFIG_HAS_POST) += ether.o
-obj-$(CONFIG_HAS_POST) += fpu.o
-obj-$(CONFIG_HAS_POST) += ocm.o
-obj-$(CONFIG_HAS_POST) += spr.o
-obj-$(CONFIG_HAS_POST) += uart.o
-obj-$(CONFIG_HAS_POST) += watchdog.o
+obj-y += cache_4xx.o
+obj-y += cache.o
+obj-y += denali_ecc.o
+obj-y += ether.o
+obj-y += fpu.o
+obj-y += ocm.o
+obj-y += spr.o
+obj-y += uart.o
+obj-y += watchdog.o
index 328f880..1abfb1f 100644 (file)
@@ -5,4 +5,4 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += flash.o i2c.o memory.o rtc.o
+obj-y += flash.o i2c.o memory.o rtc.o
index d2b8a94..0cbb6b6 100644 (file)
@@ -5,9 +5,9 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += asm.o
-obj-$(CONFIG_HAS_POST) += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o
-obj-$(CONFIG_HAS_POST) += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o
-obj-$(CONFIG_HAS_POST) += store.o load.o cr.o b.o multi.o string.o complex.o
+obj-y += asm.o
+obj-y += cpu.o cmp.o cmpi.o two.o twox.o three.o threex.o
+obj-y += threei.o andi.o srawi.o rlwnm.o rlwinm.o rlwimi.o
+obj-y += store.o load.o cr.o b.o multi.o string.o complex.o
 
-obj-$(CONFIG_HAS_POST) += fpu/
+obj-y += fpu/
index ee01a31..ae56a82 100644 (file)
@@ -5,15 +5,15 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-obj-$(CONFIG_HAS_POST) += 20001122-1.o
-obj-$(CONFIG_HAS_POST) += 20010114-2.o
-obj-$(CONFIG_HAS_POST) += 20010226-1.o
-obj-$(CONFIG_HAS_POST) += 980619-1.o
-obj-$(CONFIG_HAS_POST) += acc1.o
-obj-$(CONFIG_HAS_POST) += compare-fp-1.o
-obj-$(CONFIG_HAS_POST) += fpu.o
-obj-$(CONFIG_HAS_POST) += mul-subnormal-single-1.o
-obj-$(CONFIG_HAS_POST) += darwin-ldouble.o
+obj- += 20001122-1.o
+obj- += 20010114-2.o
+obj- += 20010226-1.o
+obj- += 980619-1.o
+obj- += acc1.o
+obj- += compare-fp-1.o
+obj- += fpu.o
+obj- += mul-subnormal-single-1.o
+obj- += darwin-ldouble.o
 
 CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
 CFLAGS += -mhard-float -fkeep-inline-functions
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from tools/binutils-version.sh
rename to scripts/binutils-version.sh
similarity index 100%
rename from tools/checkpatch.pl
rename to scripts/checkpatch.pl
similarity index 100%
rename from tools/checkstack.pl
rename to scripts/checkstack.pl
similarity index 100%
rename from tools/cleanpatch
rename to scripts/cleanpatch
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from tools/dtc-version.sh
rename to scripts/dtc-version.sh
old mode 100755 (executable)
new mode 100644 (file)
similarity index 100%
rename from tools/gcc-version.sh
rename to scripts/gcc-version.sh
diff --git a/spl/.gitignore b/spl/.gitignore
deleted file mode 100644 (file)
index 7c88147..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-u-boot-spl
-u-boot-spl.bin
-u-boot-spl.lds
-u-boot-spl.map
index 2a787af..1e88d74 100644 (file)
@@ -37,22 +37,15 @@ endif
 HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(SRCTREE)/board/$(VENDOR)/common/Makefile),y,n)
 
 ifdef  CONFIG_SPL_START_S_PATH
-START_PATH := $(subst ",,$(CONFIG_SPL_START_S_PATH))
+START_PATH := $(CONFIG_SPL_START_S_PATH:"%"=%)
 else
 START_PATH := $(CPUDIR)
 endif
 
-START := $(START_PATH)/start.o
-ifeq ($(CPU),x86)
-START += $(START_PATH)/start16.o
-START += $(START_PATH)/resetvec.o
-endif
-ifeq ($(CPU),ppc4xx)
-START += $(START_PATH)/resetvec.o
-endif
-ifeq ($(CPU),mpc85xx)
-START += $(START_PATH)/resetvec.o
-endif
+head-y := $(START_PATH)/start.o
+head-$(CONFIG_X86) += $(START_PATH)/start16.o $(START_PATH)/resetvec.o
+head-$(CONFIG_4xx) += $(START_PATH)/resetvec.o
+head-$(CONFIG_MPC85xx) += $(START_PATH)/resetvec.o
 
 LIBS-y += arch/$(ARCH)/lib/
 
@@ -78,7 +71,7 @@ LIBS-y += fs/
 LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
        drivers/power/pmic/
-LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/
+LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
@@ -90,17 +83,13 @@ LIBS-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += drivers/usb/musb-new/
 LIBS-$(CONFIG_SPL_USBETH_SUPPORT) += drivers/usb/gadget/
 LIBS-$(CONFIG_SPL_WATCHDOG_SUPPORT) += drivers/watchdog/
 
-ifneq (,$(CONFIG_MX23)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
+ifneq (,$(CONFIG_MX23)$(CONFIG_MX35)$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
 LIBS-y += arch/$(ARCH)/imx-common/
 endif
 
 LIBS-$(CONFIG_ARM) += arch/arm/cpu/
 LIBS-$(CONFIG_PPC) += arch/powerpc/cpu/
 
-ifneq ($(CONFIG_MX23)$(CONFIG_MX35),)
-LIBS-y += arch/$(ARCH)/imx-common/
-endif
-
 LIBS-y := $(patsubst %/, %/built-in.o, $(LIBS-y))
 
 # Add GCC lib
@@ -109,7 +98,7 @@ PLATFORM_LIBGCC = $(SPLTREE)/arch/$(ARCH)/lib/libgcc.o
 PLATFORM_LIBS := $(filter-out %/libgcc.o, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
 endif
 
-START := $(addprefix $(SPLTREE)/,$(START))
+START := $(addprefix $(SPLTREE)/,$(head-y))
 LIBS := $(addprefix $(SPLTREE)/,$(sort $(LIBS-y)))
 
 __START := $(subst $(obj),,$(START))
@@ -118,7 +107,7 @@ __LIBS := $(subst $(obj),,$(LIBS))
 # Linker Script
 ifdef CONFIG_SPL_LDSCRIPT
 # need to strip off double quotes
-LDSCRIPT := $(addprefix $(SRCTREE)/,$(subst ",,$(CONFIG_SPL_LDSCRIPT)))
+LDSCRIPT := $(addprefix $(SRCTREE)/,$(CONFIG_SPL_LDSCRIPT:"%"=%))
 endif
 
 ifeq ($(wildcard $(LDSCRIPT)),)
diff --git a/test/image/test-imagetools.sh b/test/image/test-imagetools.sh
new file mode 100755 (executable)
index 0000000..9e299e1
--- /dev/null
@@ -0,0 +1,141 @@
+#!/bin/bash
+#
+# Written by Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
+#
+# Sanity check for mkimage and dumpimage tools
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+# To run this:
+#
+# make O=sandbox sandbox_config
+# make O=sandbox
+# ./test/image/test-imagetools.sh
+
+BASEDIR=sandbox
+SRCDIR=sandbox/boot
+IMAGE_NAME="v1.0-test"
+IMAGE=linux.img
+DATAFILE0=vmlinuz
+DATAFILE1=initrd.img
+DATAFILE2=System.map
+DATAFILES="${DATAFILE0} ${DATAFILE1} ${DATAFILE2}"
+TEST_OUT=test_output
+MKIMAGE=${BASEDIR}/tools/mkimage
+DUMPIMAGE=${BASEDIR}/tools/dumpimage
+MKIMAGE_LIST=mkimage.list
+DUMPIMAGE_LIST=dumpimage.list
+
+# Remove all the files we created
+cleanup()
+{
+       local file
+
+       for file in ${DATAFILES}; do
+               rm -f ${file} ${SRCDIR}/${file}
+       done
+       rm -f ${IMAGE} ${DUMPIMAGE_LIST} ${MKIMAGE_LIST} ${TEST_OUT}
+       rmdir ${SRCDIR}
+}
+
+# Check that two files are the same
+assert_equal()
+{
+       if ! diff $1 $2; then
+               echo "Failed."
+               cleanup
+               exit 1
+       fi
+}
+
+# Create some test files
+create_files()
+{
+       local file
+
+       mkdir -p ${SRCDIR}
+       for file in ${DATAFILES}; do
+               head -c $RANDOM /dev/urandom >${SRCDIR}/${file}
+       done
+}
+
+# Run a command, echoing it first
+do_cmd()
+{
+       local cmd="$@"
+
+       echo "# ${cmd}"
+       ${cmd} 2>&1
+}
+
+# Run a command, redirecting output
+# Args:
+#    redirect_file
+#    command...
+do_cmd_redir()
+{
+       local redir="$1"
+       shift
+       local cmd="$@"
+
+       echo "# ${cmd}"
+       ${cmd} >${redir}
+}
+
+# Write files into an image
+create_image()
+{
+       local files="${SRCDIR}/${DATAFILE0}:${SRCDIR}/${DATAFILE1}"
+       files+=":${SRCDIR}/${DATAFILE2}"
+
+       echo -e "\nBuilding image..."
+       do_cmd ${MKIMAGE} -A x86 -O linux -T multi -n \"${IMAGE_NAME}\" \
+               -d ${files} ${IMAGE}
+       echo "done."
+}
+
+# Extract files from an image
+extract_image()
+{
+       echo -e "\nExtracting image contents..."
+       do_cmd ${DUMPIMAGE} -i ${IMAGE} -p 0 ${DATAFILE0}
+       do_cmd ${DUMPIMAGE} -i ${IMAGE} -p 1 ${DATAFILE1}
+       do_cmd ${DUMPIMAGE} -i ${IMAGE} -p 2 ${DATAFILE2}
+       do_cmd ${DUMPIMAGE} -i ${IMAGE} -p 2 ${DATAFILE2} -o ${TEST_OUT}
+       echo "done."
+}
+
+# List the contents of a file
+list_image()
+{
+       echo -e "\nListing image contents..."
+       do_cmd_redir ${MKIMAGE_LIST} ${MKIMAGE} -l ${IMAGE}
+       do_cmd_redir ${DUMPIMAGE_LIST} ${DUMPIMAGE} -l ${IMAGE}
+       echo "done."
+}
+
+main()
+{
+       local file
+
+       create_files
+
+       # Compress and extract multifile images, compare the result
+       create_image
+       extract_image
+       for file in ${DATAFILES}; do
+               assert_equal ${file} ${SRCDIR}/${file}
+       done
+       assert_equal ${TEST_OUT} ${DATAFILE2}
+
+       # List contents and compares output fro tools
+       list_image
+       assert_equal ${DUMPIMAGE_LIST} ${MKIMAGE_LIST}
+
+       # Remove files created
+       cleanup
+
+       echo "Tests passed."
+}
+
+main
index a7fee26..930fa2e 100644 (file)
@@ -3,12 +3,12 @@
 /gen_eth_addr
 /img2srec
 /kwboot
+/dumpimage
 /mkenvimage
 /mkimage
 /mpc86x_clk
 /mxsboot
 /ncb
-/ncp
 /proftool
 /ubsha1
 /xway-swap-bytes
index 14d94e3..e1264fd 100644 (file)
@@ -50,6 +50,7 @@ BIN_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc$(SFX)
 BIN_FILES-$(CONFIG_CMD_NET) += gen_eth_addr$(SFX)
 BIN_FILES-$(CONFIG_CMD_LOADS) += img2srec$(SFX)
 BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
+BIN_FILES-y += dumpimage$(SFX)
 BIN_FILES-y += mkenvimage$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-$(CONFIG_EXYNOS5250) += mk$(BOARD)spl$(SFX)
@@ -72,10 +73,12 @@ EXT_OBJ_FILES-y += lib/sha1.o
 # Source files located in the tools directory
 NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += default_image.o
+NOPED_OBJ_FILES-y += dumpimage.o
 NOPED_OBJ_FILES-y += fit_image.o
 NOPED_OBJ_FILES-y += image-host.o
 NOPED_OBJ_FILES-y += imximage.o
 NOPED_OBJ_FILES-y += kwbimage.o
+NOPED_OBJ_FILES-y += imagetool.o
 NOPED_OBJ_FILES-y += mkenvimage.o
 NOPED_OBJ_FILES-y += mkimage.o
 NOPED_OBJ_FILES-y += mxsimage.o
@@ -199,6 +202,30 @@ $(obj)xway-swap-bytes$(SFX):       $(obj)xway-swap-bytes.o
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
        $(HOSTSTRIP) $@
 
+$(obj)dumpimage$(SFX): $(obj)aisimage.o \
+                       $(FIT_SIG_OBJS) \
+                       $(obj)crc32.o \
+                       $(obj)default_image.o \
+                       $(obj)fit_image.o \
+                       $(obj)image-fit.o \
+                       $(obj)image.o \
+                       $(obj)image-host.o \
+                       $(obj)imagetool.o \
+                       $(obj)imximage.o \
+                       $(obj)kwbimage.o \
+                       $(obj)dumpimage.o \
+                       $(obj)md5.o \
+                       $(obj)mxsimage.o \
+                       $(obj)omapimage.o \
+                       $(obj)os_support.o \
+                       $(obj)pblimage.o \
+                       $(obj)sha1.o \
+                       $(obj)ublimage.o \
+                       $(LIBFDT_OBJS) \
+                       $(RSA_OBJS)
+       $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^ $(HOSTLIBS)
+       $(HOSTSTRIP) $@
+
 $(obj)mkenvimage$(SFX):        $(obj)crc32.o $(obj)mkenvimage.o \
        $(obj)os_support.o
        $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
@@ -212,6 +239,7 @@ $(obj)mkimage$(SFX):        $(obj)aisimage.o \
                        $(obj)image-fit.o \
                        $(obj)image-host.o \
                        $(obj)image.o \
+                       $(obj)imagetool.o \
                        $(obj)imximage.o \
                        $(obj)kwbimage.o \
                        $(obj)md5.o \
index 04fb649..8de370a 100644 (file)
@@ -5,7 +5,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include "aisimage.h"
 #include <image.h>
 
@@ -176,7 +176,7 @@ static uint32_t *ais_insert_cmd_header(uint32_t cmd, uint32_t nargs,
 
 }
 
-static uint32_t *ais_alloc_buffer(struct mkimage_params *params)
+static uint32_t *ais_alloc_buffer(struct image_tool_params *params)
 {
        int dfd;
        struct stat sbuf;
@@ -216,7 +216,7 @@ static uint32_t *ais_alloc_buffer(struct mkimage_params *params)
        return ptr;
 }
 
-static uint32_t *ais_copy_image(struct mkimage_params *params,
+static uint32_t *ais_copy_image(struct image_tool_params *params,
        uint32_t *aisptr)
 
 {
@@ -252,7 +252,7 @@ static uint32_t *ais_copy_image(struct mkimage_params *params,
 
 }
 
-static int aisimage_generate(struct mkimage_params *params,
+static int aisimage_generate(struct image_tool_params *params,
        struct image_type_params *tparams)
 {
        FILE *fd = NULL;
@@ -370,7 +370,7 @@ static int aisimage_check_image_types(uint8_t type)
 }
 
 static int aisimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct ais_header *ais_hdr = (struct ais_header *)ptr;
 
@@ -384,11 +384,11 @@ static int aisimage_verify_header(unsigned char *ptr, int image_size,
 }
 
 static void aisimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
 }
 
-int aisimage_check_params(struct mkimage_params *params)
+int aisimage_check_params(struct image_tool_params *params)
 {
        if (!params)
                return CFG_INVALID;
@@ -427,5 +427,5 @@ static struct image_type_params aisimage_params = {
 
 void init_ais_image_type(void)
 {
-       mkimage_register(&aisimage_params);
+       register_image_type(&aisimage_params);
 }
index fd8b9f5..0a0792e 100644 (file)
@@ -14,7 +14,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include <u-boot/crc.h>
 
@@ -29,7 +29,7 @@ static int image_check_image_types(uint8_t type)
                return EXIT_FAILURE;
 }
 
-static int image_check_params(struct mkimage_params *params)
+static int image_check_params(struct image_tool_params *params)
 {
        return  ((params->dflag && (params->fflag || params->lflag)) ||
                (params->fflag && (params->dflag || params->lflag)) ||
@@ -37,7 +37,7 @@ static int image_check_params(struct mkimage_params *params)
 }
 
 static int image_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        uint32_t len;
        const unsigned char *data;
@@ -86,7 +86,7 @@ static int image_verify_header(unsigned char *ptr, int image_size,
 }
 
 static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        uint32_t checksum;
 
@@ -117,6 +117,62 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
        image_set_hcrc(hdr, checksum);
 }
 
+static int image_save_datafile(struct image_tool_params *params,
+                              ulong file_data, ulong file_len)
+{
+       int dfd;
+       const char *datafile = params->outfile;
+
+       dfd = open(datafile, O_RDWR | O_CREAT | O_TRUNC | O_BINARY,
+                  S_IRUSR | S_IWUSR);
+       if (dfd < 0) {
+               fprintf(stderr, "%s: Can't open \"%s\": %s\n",
+                       params->cmdname, datafile, strerror(errno));
+               return -1;
+       }
+
+       if (write(dfd, (void *)file_data, file_len) != (ssize_t)file_len) {
+               fprintf(stderr, "%s: Write error on \"%s\": %s\n",
+                       params->cmdname, datafile, strerror(errno));
+               close(dfd);
+               return -1;
+       }
+
+       close(dfd);
+
+       return 0;
+}
+
+static int image_extract_datafile(void *ptr, struct image_tool_params *params)
+{
+       const image_header_t *hdr = (const image_header_t *)ptr;
+       ulong file_data;
+       ulong file_len;
+
+       if (image_check_type(hdr, IH_TYPE_MULTI)) {
+               ulong idx = params->pflag;
+               ulong count;
+
+               /* get the number of data files present in the image */
+               count = image_multi_count(hdr);
+
+               /* retrieve the "data file" at the idx position */
+               image_multi_getimg(hdr, idx, &file_data, &file_len);
+
+               if ((file_len == 0) || (idx >= count)) {
+                       fprintf(stderr, "%s: No such data file %ld in \"%s\"\n",
+                               params->cmdname, idx, params->imagefile);
+                       return -1;
+               }
+       } else {
+               file_data = image_get_data(hdr);
+               file_len = image_get_size(hdr);
+       }
+
+       /* save the "data file" into the file system */
+       return image_save_datafile(params, file_data, file_len);
+}
+
 /*
  * Default image type parameters definition
  */
@@ -128,10 +184,11 @@ static struct image_type_params defimage_params = {
        .verify_header = image_verify_header,
        .print_header = image_print_contents,
        .set_header = image_set_header,
+       .extract_datafile = image_extract_datafile,
        .check_params = image_check_params,
 };
 
 void init_default_image_type(void)
 {
-       mkimage_register(&defimage_params);
+       register_image_type(&defimage_params);
 }
diff --git a/tools/dumpimage.c b/tools/dumpimage.c
new file mode 100644 (file)
index 0000000..542ee28
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ * Based on mkimage.c.
+ *
+ * Written by Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include "dumpimage.h"
+#include <image.h>
+#include <version.h>
+
+static void usage(void);
+
+/* image_type_params linked list to maintain registered image types supports */
+static struct image_type_params *dumpimage_tparams;
+
+/* parameters initialized by core will be used by the image type code */
+static struct image_tool_params params = {
+       .type = IH_TYPE_KERNEL,
+};
+
+/**
+ * dumpimage_register() - register respective image generation/list support
+ *
+ * the input struct image_type_params is checked and appended to the link
+ * list, if the input structure is already registered, issue an error
+ *
+ * @tparams: Image type parameters
+ */
+static void dumpimage_register(struct image_type_params *tparams)
+{
+       struct image_type_params **tp;
+
+       if (!tparams) {
+               fprintf(stderr, "%s: %s: Null input\n", params.cmdname,
+                       __func__);
+               exit(EXIT_FAILURE);
+       }
+
+       /* scan the linked list, check for registry and point the last one */
+       for (tp = &dumpimage_tparams; *tp != NULL; tp = &(*tp)->next) {
+               if (!strcmp((*tp)->name, tparams->name)) {
+                       fprintf(stderr, "%s: %s already registered\n",
+                               params.cmdname, tparams->name);
+                       return;
+               }
+       }
+
+       /* add input struct entry at the end of link list */
+       *tp = tparams;
+       /* mark input entry as last entry in the link list */
+       tparams->next = NULL;
+
+       debug("Registered %s\n", tparams->name);
+}
+
+/**
+ * dumpimage_get_type() - find the image type params for a given image type
+ *
+ * Scan all registered image types and check the input type_id for each
+ * supported image type
+ *
+ * @return respective image_type_params pointer. If the input type is not
+ * supported by any of registered image types, returns NULL
+ */
+static struct image_type_params *dumpimage_get_type(int type)
+{
+       struct image_type_params *curr;
+
+       for (curr = dumpimage_tparams; curr != NULL; curr = curr->next) {
+               if (curr->check_image_type) {
+                       if (!curr->check_image_type(type))
+                               return curr;
+               }
+       }
+       return NULL;
+}
+
+/*
+ * dumpimage_verify_print_header() - verifies the image header
+ *
+ * Scan registered image types and verify the image_header for each
+ * supported image type. If verification is successful, this prints
+ * the respective header.
+ *
+ * @return 0 on success, negative if input image format does not match with
+ * any of supported image types
+ */
+static int dumpimage_verify_print_header(void *ptr, struct stat *sbuf)
+{
+       int retval = -1;
+       struct image_type_params *curr;
+
+       for (curr = dumpimage_tparams; curr != NULL; curr = curr->next) {
+               if (curr->verify_header) {
+                       retval = curr->verify_header((unsigned char *)ptr,
+                                                    sbuf->st_size, &params);
+                       if (retval != 0)
+                               continue;
+                       /*
+                        * Print the image information  if verify is
+                        * successful
+                        */
+                       if (curr->print_header) {
+                               curr->print_header(ptr);
+                       } else {
+                               fprintf(stderr,
+                                       "%s: print_header undefined for %s\n",
+                                       params.cmdname, curr->name);
+                       }
+                       break;
+               }
+       }
+
+       return retval;
+}
+
+/*
+ * dumpimage_extract_datafile -
+ *
+ * It scans all registered image types,
+ * verifies image_header for each supported image type
+ * if verification is successful, it extracts the desired file,
+ * indexed by pflag, from the image
+ *
+ * returns negative if input image format does not match with any of
+ * supported image types
+ */
+static int dumpimage_extract_datafile(void *ptr, struct stat *sbuf)
+{
+       int retval = -1;
+       struct image_type_params *curr;
+
+       for (curr = dumpimage_tparams; curr != NULL; curr = curr->next) {
+               if (curr->verify_header) {
+                       retval = curr->verify_header((unsigned char *)ptr,
+                                                    sbuf->st_size, &params);
+                       if (retval != 0)
+                               continue;
+                       /*
+                        * Extract the file from the image
+                        * if verify is successful
+                        */
+                       if (curr->extract_datafile) {
+                               curr->extract_datafile(ptr, &params);
+                       } else {
+                               fprintf(stderr,
+                                       "%s: extract_datafile undefined for %s\n",
+                                       params.cmdname, curr->name);
+                       break;
+                       }
+               }
+       }
+
+       return retval;
+}
+
+int main(int argc, char **argv)
+{
+       int opt;
+       int ifd = -1;
+       struct stat sbuf;
+       char *ptr;
+       int retval = 0;
+       struct image_type_params *tparams = NULL;
+
+       /* Init all image generation/list support */
+       register_image_tool(dumpimage_register);
+
+       params.cmdname = *argv;
+
+       while ((opt = getopt(argc, argv, "li:o:p:V")) != -1) {
+               switch (opt) {
+               case 'l':
+                       params.lflag = 1;
+                       break;
+               case 'i':
+                       params.imagefile = optarg;
+                       params.iflag = 1;
+                       break;
+               case 'o':
+                       params.outfile = optarg;
+                       break;
+               case 'p':
+                       params.pflag = strtoul(optarg, &ptr, 10);
+                       if (*ptr) {
+                               fprintf(stderr,
+                                       "%s: invalid file position %s\n",
+                                       params.cmdname, *argv);
+                               exit(EXIT_FAILURE);
+                       }
+                       break;
+               case 'V':
+                       printf("dumpimage version %s\n", PLAIN_VERSION);
+                       exit(EXIT_SUCCESS);
+               default:
+                       usage();
+               }
+       }
+
+       if (optind >= argc)
+               usage();
+
+       /* set tparams as per input type_id */
+       tparams = dumpimage_get_type(params.type);
+       if (tparams == NULL) {
+               fprintf(stderr, "%s: unsupported type %s\n",
+                       params.cmdname, genimg_get_type_name(params.type));
+               exit(EXIT_FAILURE);
+       }
+
+       /*
+        * check the passed arguments parameters meets the requirements
+        * as per image type to be generated/listed
+        */
+       if (tparams->check_params) {
+               if (tparams->check_params(&params))
+                       usage();
+       }
+
+       if (params.iflag)
+               params.datafile = argv[optind];
+       else
+               params.imagefile = argv[optind];
+       if (!params.outfile)
+               params.outfile = params.datafile;
+
+       ifd = open(params.imagefile, O_RDONLY|O_BINARY);
+       if (ifd < 0) {
+               fprintf(stderr, "%s: Can't open \"%s\": %s\n",
+                       params.cmdname, params.imagefile,
+                       strerror(errno));
+               exit(EXIT_FAILURE);
+       }
+
+       if (params.lflag || params.iflag) {
+               if (fstat(ifd, &sbuf) < 0) {
+                       fprintf(stderr, "%s: Can't stat \"%s\": %s\n",
+                               params.cmdname, params.imagefile,
+                               strerror(errno));
+                       exit(EXIT_FAILURE);
+               }
+
+               if ((unsigned)sbuf.st_size < tparams->header_size) {
+                       fprintf(stderr,
+                               "%s: Bad size: \"%s\" is not valid image\n",
+                               params.cmdname, params.imagefile);
+                       exit(EXIT_FAILURE);
+               }
+
+               ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, ifd, 0);
+               if (ptr == MAP_FAILED) {
+                       fprintf(stderr, "%s: Can't read \"%s\": %s\n",
+                               params.cmdname, params.imagefile,
+                               strerror(errno));
+                       exit(EXIT_FAILURE);
+               }
+
+               /*
+                * Both calls bellow scan through dumpimage registry for all
+                * supported image types and verify the input image file
+                * header for match
+                */
+               if (params.iflag) {
+                       /*
+                        * Extract the data files from within the matched
+                        * image type. Returns the error code if not matched
+                        */
+                       retval = dumpimage_extract_datafile(ptr, &sbuf);
+               } else {
+                       /*
+                        * Print the image information for matched image type
+                        * Returns the error code if not matched
+                        */
+                       retval = dumpimage_verify_print_header(ptr, &sbuf);
+               }
+
+               (void)munmap((void *)ptr, sbuf.st_size);
+               (void)close(ifd);
+
+               return retval;
+       }
+
+       (void)close(ifd);
+
+       return EXIT_SUCCESS;
+}
+
+static void usage(void)
+{
+       fprintf(stderr, "Usage: %s -l image\n"
+               "          -l ==> list image header information\n",
+               params.cmdname);
+       fprintf(stderr,
+               "       %s -i image [-p position] [-o outfile] data_file\n"
+               "          -i ==> extract from the 'image' a specific 'data_file'"
+               ", indexed by 'position' (starting at 0)\n",
+               params.cmdname);
+       fprintf(stderr,
+               "       %s -V ==> print version information and exit\n",
+               params.cmdname);
+
+       exit(EXIT_FAILURE);
+}
diff --git a/tools/dumpimage.h b/tools/dumpimage.h
new file mode 100644 (file)
index 0000000..d78523d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Based on mkimage.c.
+ *
+ * Written by Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _DUMPIMAGE_H_
+#define _DUMPIMAGE_H_
+
+#include "os_support.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+#include <sha1.h>
+#include "fdt_host.h"
+#include "imagetool.h"
+
+#undef DUMPIMAGE_DEBUG
+
+#ifdef DUMPIMAGE_DEBUG
+#define debug(fmt, args...)    printf(fmt, ##args)
+#else
+#define debug(fmt, args...)
+#endif /* DUMPIMAGE_DEBUG */
+
+#endif /* _DUMPIMAGE_H_ */
index 0400a60..1466164 100644 (file)
@@ -14,6 +14,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#include "imagetool.h"
 #include "mkimage.h"
 #include <image.h>
 #include <u-boot/crc.h>
@@ -21,7 +22,7 @@
 static image_header_t header;
 
 static int fit_verify_header (unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        return fdt_check_header(ptr);
 }
@@ -34,7 +35,7 @@ static int fit_check_image_types (uint8_t type)
                return EXIT_FAILURE;
 }
 
-int mmap_fdt(struct mkimage_params *params, const char *fname, void **blobp,
+int mmap_fdt(struct image_tool_params *params, const char *fname, void **blobp,
                struct stat *sbuf)
 {
        void *ptr;
@@ -88,7 +89,7 @@ int mmap_fdt(struct mkimage_params *params, const char *fname, void **blobp,
  * returns:
  *     only on success, otherwise calls exit (EXIT_FAILURE);
  */
-static int fit_handle_file (struct mkimage_params *params)
+static int fit_handle_file(struct image_tool_params *params)
 {
        char tmpfile[MKIMAGE_MAX_TMPFILE_LEN];
        char cmd[MKIMAGE_MAX_DTC_CMDLINE_LEN];
@@ -184,7 +185,7 @@ err_system:
        return -1;
 }
 
-static int fit_check_params (struct mkimage_params *params)
+static int fit_check_params(struct image_tool_params *params)
 {
        return  ((params->dflag && (params->fflag || params->lflag)) ||
                (params->fflag && (params->dflag || params->lflag)) ||
@@ -205,5 +206,5 @@ static struct image_type_params fitimage_params = {
 
 void init_fit_image_type (void)
 {
-       mkimage_register (&fitimage_params);
+       register_image_type(&fitimage_params);
 }
diff --git a/tools/imagetool.c b/tools/imagetool.c
new file mode 100644 (file)
index 0000000..29d2189
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * (C) Copyright 2013
+ *
+ * Written by Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include "imagetool.h"
+
+/*
+ * Callback function to register a image type within a tool
+ */
+static imagetool_register_t register_func;
+
+/*
+ * register_image_tool -
+ *
+ * The tool provides its own registration function in order to all image
+ * types initialize themselves.
+ */
+void register_image_tool(imagetool_register_t image_register)
+{
+       /*
+        * Save the image tool callback function. It will be used to register
+        * image types within that tool
+        */
+       register_func = image_register;
+
+       /* Init Freescale PBL Boot image generation/list support */
+       init_pbl_image_type();
+       /* Init Kirkwood Boot image generation/list support */
+       init_kwb_image_type();
+       /* Init Freescale imx Boot image generation/list support */
+       init_imx_image_type();
+       /* Init Freescale mxs Boot image generation/list support */
+       init_mxs_image_type();
+       /* Init FIT image generation/list support */
+       init_fit_image_type();
+       /* Init TI OMAP Boot image generation/list support */
+       init_omap_image_type();
+       /* Init Default image generation/list support */
+       init_default_image_type();
+       /* Init Davinci UBL support */
+       init_ubl_image_type();
+       /* Init Davinci AIS support */
+       init_ais_image_type();
+}
+
+/*
+ * register_image_type -
+ *
+ * Register a image type within a tool
+ */
+void register_image_type(struct image_type_params *tparams)
+{
+       register_func(tparams);
+}
diff --git a/tools/imagetool.h b/tools/imagetool.h
new file mode 100644 (file)
index 0000000..c2c9aea
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * (C) Copyright 2013
+ *
+ * Written by Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _IMAGETOOL_H_
+#define _IMAGETOOL_H_
+
+#include "os_support.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <time.h>
+#include <unistd.h>
+#include <sha1.h>
+#include "fdt_host.h"
+
+#define ARRAY_SIZE(x)          (sizeof(x) / sizeof((x)[0]))
+
+#define IH_ARCH_DEFAULT                IH_ARCH_INVALID
+
+/*
+ * This structure defines all such variables those are initialized by
+ * mkimage and dumpimage main core and need to be referred by image
+ * type specific functions
+ */
+struct image_tool_params {
+       int dflag;
+       int eflag;
+       int fflag;
+       int iflag;
+       int lflag;
+       int pflag;
+       int vflag;
+       int xflag;
+       int skipcpy;
+       int os;
+       int arch;
+       int type;
+       int comp;
+       char *dtc;
+       unsigned int addr;
+       unsigned int ep;
+       char *imagename;
+       char *imagename2;
+       char *datafile;
+       char *imagefile;
+       char *cmdname;
+       const char *outfile;    /* Output filename */
+       const char *keydir;     /* Directory holding private keys */
+       const char *keydest;    /* Destination .dtb for public key */
+       const char *comment;    /* Comment to add to signature node */
+       int require_keys;       /* 1 to mark signing keys as 'required' */
+};
+
+/*
+ * image type specific variables and callback functions
+ */
+struct image_type_params {
+       /* name is an identification tag string for added support */
+       char *name;
+       /*
+        * header size is local to the specific image type to be supported,
+        * mkimage core treats this as number of bytes
+        */
+       uint32_t header_size;
+       /* Image type header pointer */
+       void *hdr;
+       /*
+        * There are several arguments that are passed on the command line
+        * and are registered as flags in image_tool_params structure.
+        * This callback function can be used to check the passed arguments
+        * are in-lined with the image type to be supported
+        *
+        * Returns 1 if parameter check is successful
+        */
+       int (*check_params) (struct image_tool_params *);
+       /*
+        * This function is used by list command (i.e. mkimage -l <filename>)
+        * image type verification code must be put here
+        *
+        * Returns 0 if image header verification is successful
+        * otherwise, returns respective negative error codes
+        */
+       int (*verify_header) (unsigned char *, int, struct image_tool_params *);
+       /* Prints image information abstracting from image header */
+       void (*print_header) (const void *);
+       /*
+        * The header or image contents need to be set as per image type to
+        * be generated using this callback function.
+        * further output file post processing (for ex. checksum calculation,
+        * padding bytes etc..) can also be done in this callback function.
+        */
+       void (*set_header) (void *, struct stat *, int,
+                                       struct image_tool_params *);
+       /*
+        * This function is used by the command to retrieve a data file from
+        * the image (i.e. dumpimage -i <image> -p <position> <data_file>).
+        * Thus the code to extract a file from an image must be put here.
+        *
+        * Returns 0 if the file was successfully retrieved from the image,
+        * or a negative value on error.
+        */
+       int (*extract_datafile) (void *, struct image_tool_params *);
+       /*
+        * Some image generation support for ex (default image type) supports
+        * more than one type_ids, this callback function is used to check
+        * whether input (-T <image_type>) is supported by registered image
+        * generation/list low level code
+        */
+       int (*check_image_type) (uint8_t);
+       /* This callback function will be executed if fflag is defined */
+       int (*fflag_handle) (struct image_tool_params *);
+       /*
+        * This callback function will be executed for variable size record
+        * It is expected to build this header in memory and return its length
+        * and a pointer to it by using image_type_params.header_size and
+        * image_type_params.hdr. The return value shall indicate if an
+        * additional padding should be used when copying the data image
+        * by returning the padding length.
+        */
+       int (*vrec_header) (struct image_tool_params *,
+               struct image_type_params *);
+       /* pointer to the next registered entry in linked list */
+       struct image_type_params *next;
+};
+
+/*
+ * Tool registration function.
+ */
+typedef void (*imagetool_register_t)(struct image_type_params *);
+
+/*
+ * Initializes all image types with the given registration callback
+ * function.
+ * An image tool uses this function to initialize all image types.
+ */
+void register_image_tool(imagetool_register_t image_register);
+
+/*
+ * Register a image type within a tool.
+ * An image type uses this function to register itself within
+ * all tools.
+ */
+void register_image_type(struct image_type_params *tparams);
+
+/*
+ * There is a c file associated with supported image type low level code
+ * for ex. default_image.c, fit_image.c
+ * init_xxx_type() is the only function referred by image tool core to avoid
+ * a single lined header file, you can define them here
+ *
+ * Supported image types init functions
+ */
+void init_default_image_type(void);
+void init_pbl_image_type(void);
+void init_ais_image_type(void);
+void init_kwb_image_type(void);
+void init_imx_image_type(void);
+void init_mxs_image_type(void);
+void init_fit_image_type(void);
+void init_ubl_image_type(void);
+void init_omap_image_type(void);
+
+void pbl_load_uboot(int fd, struct image_tool_params *mparams);
+
+#endif /* _IMAGETOOL_H_ */
index 511e3f2..18dc051 100644 (file)
@@ -9,7 +9,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "imximage.h"
 
@@ -520,7 +520,7 @@ static int imximage_check_image_types(uint8_t type)
 }
 
 static int imximage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct imx_header *imx_hdr = (struct imx_header *) ptr;
 
@@ -549,7 +549,7 @@ static void imximage_print_header(const void *ptr)
 }
 
 static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        struct imx_header *imxhdr = (struct imx_header *)ptr;
        uint32_t dcd_len;
@@ -589,7 +589,7 @@ static void imximage_set_header(void *ptr, struct stat *sbuf, int ifd,
        }
 }
 
-int imximage_check_params(struct mkimage_params *params)
+int imximage_check_params(struct image_tool_params *params)
 {
        if (!params)
                return CFG_INVALID;
@@ -611,7 +611,7 @@ int imximage_check_params(struct mkimage_params *params)
                (params->xflag) || !(strlen(params->imagename));
 }
 
-static int imximage_generate(struct mkimage_params *params,
+static int imximage_generate(struct image_tool_params *params,
        struct image_type_params *tparams)
 {
        struct imx_header *imxhdr;
@@ -701,5 +701,5 @@ static struct image_type_params imximage_params = {
 
 void init_imx_image_type(void)
 {
-       mkimage_register(&imximage_params);
+       register_image_type(&imximage_params);
 }
index 1df6b20..109d616 100644 (file)
@@ -6,7 +6,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "kwbimage.h"
 
@@ -54,7 +54,7 @@ static int lineno = -1;
 /*
  * Report Error if xflag is set in addition to default
  */
-static int kwbimage_check_params (struct mkimage_params *params)
+static int kwbimage_check_params(struct image_tool_params *params)
 {
        if (!strlen (params->imagename)) {
                printf ("Error:%s - Configuration file not specified, "
@@ -288,7 +288,7 @@ INVL_CMD:
 }
 
 static void kwbimage_set_header (void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        struct kwb_header *hdr = (struct kwb_header *)ptr;
        bhr_t *mhdr = &hdr->kwb_hdr;
@@ -322,7 +322,7 @@ static void kwbimage_set_header (void *ptr, struct stat *sbuf, int ifd,
 }
 
 static int kwbimage_verify_header (unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct kwb_header *hdr = (struct kwb_header *)ptr;
        bhr_t *mhdr = &hdr->kwb_hdr;
@@ -382,5 +382,5 @@ static struct image_type_params kwbimage_params = {
 
 void init_kwb_image_type (void)
 {
-       mkimage_register (&kwbimage_params);
+       register_image_type(&kwbimage_params);
 }
index 7f22101..123d0c7 100644 (file)
@@ -19,7 +19,7 @@ static void usage(void);
 struct image_type_params *mkimage_tparams = NULL;
 
 /* parameters initialized by core will be used by the image type code */
-struct mkimage_params params = {
+struct image_tool_params params = {
        .os = IH_OS_LINUX,
        .arch = IH_ARCH_PPC,
        .type = IH_TYPE_KERNEL,
@@ -139,24 +139,8 @@ main (int argc, char **argv)
        struct image_type_params *tparams = NULL;
        int pad_len = 0;
 
-       /* Init Freescale PBL Boot image generation/list support */
-       init_pbl_image_type();
-       /* Init Kirkwood Boot image generation/list support */
-       init_kwb_image_type ();
-       /* Init Freescale imx Boot image generation/list support */
-       init_imx_image_type ();
-       /* Init Freescale mxs Boot image generation/list support */
-       init_mxs_image_type();
-       /* Init FIT image generation/list support */
-       init_fit_image_type ();
-       /* Init TI OMAP Boot image generation/list support */
-       init_omap_image_type();
-       /* Init Default image generation/list support */
-       init_default_image_type ();
-       /* Init Davinci UBL support */
-       init_ubl_image_type();
-       /* Init Davinci AIS support */
-       init_ais_image_type();
+       /* Init all image generation/list support */
+       register_image_tool(mkimage_register);
 
        params.cmdname = *argv;
        params.addr = params.ep = 0;
@@ -632,8 +616,7 @@ copy_file (int ifd, const char *datafile, int pad)
        (void) close (dfd);
 }
 
-void
-usage ()
+static void usage(void)
 {
        fprintf (stderr, "Usage: %s -l image\n"
                         "          -l ==> list image header information\n",
index af49154..d5491b6 100644 (file)
@@ -20,6 +20,7 @@
 #include <unistd.h>
 #include <sha1.h>
 #include "fdt_host.h"
+#include "imagetool.h"
 
 #undef MKIMAGE_DEBUG
 
@@ -29,8 +30,6 @@
 #define debug(fmt,args...)
 #endif /* MKIMAGE_DEBUG */
 
-#define ARRAY_SIZE(x)          (sizeof(x) / sizeof((x)[0]))
-
 static inline void *map_sysmem(ulong paddr, unsigned long len)
 {
        return (void *)(uintptr_t)paddr;
@@ -47,124 +46,4 @@ static inline ulong map_to_sysmem(void *ptr)
 #define MKIMAGE_MAX_DTC_CMDLINE_LEN    512
 #define MKIMAGE_DTC                    "dtc"   /* assume dtc is in $PATH */
 
-#define IH_ARCH_DEFAULT                IH_ARCH_INVALID
-
-/*
- * This structure defines all such variables those are initialized by
- * mkimage main core and need to be referred by image type specific
- * functions
- */
-struct mkimage_params {
-       int dflag;
-       int eflag;
-       int fflag;
-       int lflag;
-       int vflag;
-       int xflag;
-       int skipcpy;
-       int os;
-       int arch;
-       int type;
-       int comp;
-       char *dtc;
-       unsigned int addr;
-       unsigned int ep;
-       char *imagename;
-       char *imagename2;
-       char *datafile;
-       char *imagefile;
-       char *cmdname;
-       const char *keydir;     /* Directory holding private keys */
-       const char *keydest;    /* Destination .dtb for public key */
-       const char *comment;    /* Comment to add to signature node */
-       int require_keys;       /* 1 to mark signing keys as 'required' */
-};
-
-/*
- * image type specific variables and callback functions
- */
-struct image_type_params {
-       /* name is an identification tag string for added support */
-       char *name;
-       /*
-        * header size is local to the specific image type to be supported,
-        * mkimage core treats this as number of bytes
-        */
-       uint32_t header_size;
-       /* Image type header pointer */
-       void *hdr;
-       /*
-        * There are several arguments that are passed on the command line
-        * and are registered as flags in mkimage_params structure.
-        * This callback function can be used to check the passed arguments
-        * are in-lined with the image type to be supported
-        *
-        * Returns 1 if parameter check is successful
-        */
-       int (*check_params) (struct mkimage_params *);
-       /*
-        * This function is used by list command (i.e. mkimage -l <filename>)
-        * image type verification code must be put here
-        *
-        * Returns 0 if image header verification is successful
-        * otherwise, returns respective negative error codes
-        */
-       int (*verify_header) (unsigned char *, int, struct mkimage_params *);
-       /* Prints image information abstracting from image header */
-       void (*print_header) (const void *);
-       /*
-        * The header or image contents need to be set as per image type to
-        * be generated using this callback function.
-        * further output file post processing (for ex. checksum calculation,
-        * padding bytes etc..) can also be done in this callback function.
-        */
-       void (*set_header) (void *, struct stat *, int,
-                                       struct mkimage_params *);
-       /*
-        * Some image generation support for ex (default image type) supports
-        * more than one type_ids, this callback function is used to check
-        * whether input (-T <image_type>) is supported by registered image
-        * generation/list low level code
-        */
-       int (*check_image_type) (uint8_t);
-       /* This callback function will be executed if fflag is defined */
-       int (*fflag_handle) (struct mkimage_params *);
-       /*
-        * This callback function will be executed for variable size record
-        * It is expected to build this header in memory and return its length
-        * and a pointer to it by using image_type_params.header_size and
-        * image_type_params.hdr. The return value shall indicate if an
-        * additional padding should be used when copying the data image
-        * by returning the padding length.
-        */
-       int (*vrec_header) (struct mkimage_params *,
-               struct image_type_params *);
-       /* pointer to the next registered entry in linked list */
-       struct image_type_params *next;
-};
-
-/*
- * Exported functions
- */
-void mkimage_register (struct image_type_params *tparams);
-
-/*
- * There is a c file associated with supported image type low level code
- * for ex. default_image.c, fit_image.c
- * init is the only function referred by mkimage core.
- * to avoid a single lined header file, you can define them here
- *
- * Supported image types init functions
- */
-void pbl_load_uboot(int fd, struct mkimage_params *mparams);
-void init_pbl_image_type(void);
-void init_ais_image_type(void);
-void init_kwb_image_type (void);
-void init_imx_image_type (void);
-void init_mxs_image_type(void);
-void init_default_image_type (void);
-void init_fit_image_type (void);
-void init_ubl_image_type(void);
-void init_omap_image_type(void);
-
 #endif /* _MKIIMAGE_H_ */
index 5db19b2..b214050 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <openssl/evp.h>
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include "mxsimage.h"
 #include <image.h>
 
@@ -2148,11 +2148,11 @@ static int mxsimage_check_image_types(uint8_t type)
 }
 
 static void mxsimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
 }
 
-int mxsimage_check_params(struct mkimage_params *params)
+int mxsimage_check_params(struct image_tool_params *params)
 {
        if (!params)
                return -1;
@@ -2193,7 +2193,7 @@ static int mxsimage_verify_print_header(char *file, int silent)
 
 char *imagefile;
 static int mxsimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct sb_boot_image_header *hdr;
 
@@ -2291,7 +2291,7 @@ static int sb_build_image(struct sb_image_ctx *ictx,
        return 0;
 }
 
-static int mxsimage_generate(struct mkimage_params *params,
+static int mxsimage_generate(struct image_tool_params *params,
        struct image_type_params *tparams)
 {
        int ret;
@@ -2337,7 +2337,7 @@ static struct image_type_params mxsimage_params = {
 
 void init_mxs_image_type(void)
 {
-       mkimage_register(&mxsimage_params);
+       register_image_type(&mxsimage_params);
 }
 
 #else
index 8774a7e..d59bc4d 100644 (file)
@@ -14,7 +14,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "omapimage.h"
 
@@ -69,7 +69,7 @@ static int valid_gph_load_addr(uint32_t load_addr)
 }
 
 static int omapimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct ch_toc *toc = (struct ch_toc *)ptr;
        struct gp_header *gph = (struct gp_header *)(ptr+OMAP_CH_HDR_SIZE);
@@ -188,7 +188,7 @@ static int toc_offset(void *hdr, void *member)
 }
 
 static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        struct ch_toc *toc = (struct ch_toc *)ptr;
        struct ch_settings *chs = (struct ch_settings *)
@@ -224,7 +224,7 @@ static void omapimage_set_header(void *ptr, struct stat *sbuf, int ifd,
        }
 }
 
-int omapimage_check_params(struct mkimage_params *params)
+int omapimage_check_params(struct image_tool_params *params)
 {
        return  (params->dflag && (params->fflag || params->lflag)) ||
                (params->fflag && (params->dflag || params->lflag)) ||
@@ -247,5 +247,5 @@ static struct image_type_params omapimage_params = {
 
 void init_omap_image_type(void)
 {
-       mkimage_register(&omapimage_params);
+       register_image_type(&omapimage_params);
 }
index bac5faf..ef3d7f6 100644 (file)
@@ -3,7 +3,7 @@
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "pblimage.h"
 
@@ -242,7 +242,7 @@ static void add_end_cmd(void)
        }
 }
 
-void pbl_load_uboot(int ifd, struct mkimage_params *params)
+void pbl_load_uboot(int ifd, struct image_tool_params *params)
 {
        FILE *fp_uboot;
        int size;
@@ -281,7 +281,7 @@ static int pblimage_check_image_types(uint8_t type)
 }
 
 static int pblimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct pbl_header *pbl_hdr = (struct pbl_header *) ptr;
 
@@ -308,7 +308,7 @@ static void pblimage_print_header(const void *ptr)
 }
 
 static void pblimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        /*nothing need to do, pbl_load_uboot takes care of whole file. */
 }
@@ -327,5 +327,5 @@ static struct image_type_params pblimage_params = {
 void init_pbl_image_type(void)
 {
        pbl_size = 0;
-       mkimage_register(&pblimage_params);
+       register_image_type(&pblimage_params);
 }
index aafe248..cbbbe20 100644 (file)
@@ -13,7 +13,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#include "mkimage.h"
+#include "imagetool.h"
 #include <image.h>
 #include "ublimage.h"
 
@@ -193,7 +193,7 @@ static int ublimage_check_image_types(uint8_t type)
 }
 
 static int ublimage_verify_header(unsigned char *ptr, int image_size,
-                       struct mkimage_params *params)
+                       struct image_tool_params *params)
 {
        struct ubl_header *ubl_hdr = (struct ubl_header *)ptr;
 
@@ -211,7 +211,7 @@ static void ublimage_print_header(const void *ptr)
 }
 
 static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd,
-                               struct mkimage_params *params)
+                               struct image_tool_params *params)
 {
        struct ubl_header *ublhdr = (struct ubl_header *)ptr;
 
@@ -219,7 +219,7 @@ static void ublimage_set_header(void *ptr, struct stat *sbuf, int ifd,
        parse_cfg_file(ublhdr, params->imagename);
 }
 
-int ublimage_check_params(struct mkimage_params *params)
+int ublimage_check_params(struct image_tool_params *params)
 {
        if (!params)
                return CFG_INVALID;
@@ -257,5 +257,5 @@ static struct image_type_params ublimage_params = {
 
 void init_ubl_image_type(void)
 {
-       mkimage_register(&ublimage_params);
+       register_image_type(&ublimage_params);
 }