summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Makefile95
-rw-r--r--README9
-rw-r--r--arch/arm/cpu/armv7/zynq/timer.c3
-rw-r--r--arch/arm/cpu/pxa/timer.c4
-rw-r--r--arch/arm/lib/bootm.c23
-rw-r--r--arch/blackfin/config.mk4
-rw-r--r--arch/powerpc/config.mk5
-rw-r--r--arch/powerpc/cpu/74xx_7xx/config.mk4
-rw-r--r--arch/powerpc/cpu/Makefile6
-rw-r--r--arch/powerpc/cpu/mpc512x/config.mk5
-rw-r--r--arch/powerpc/cpu/mpc5xx/config.mk4
-rw-r--r--arch/powerpc/cpu/mpc5xxx/config.mk4
-rw-r--r--arch/powerpc/cpu/mpc824x/config.mk4
-rw-r--r--arch/powerpc/cpu/mpc8260/config.mk4
-rw-r--r--arch/powerpc/cpu/mpc83xx/config.mk5
-rw-r--r--arch/powerpc/cpu/mpc85xx/config.mk7
-rw-r--r--arch/powerpc/cpu/mpc86xx/config.mk5
-rw-r--r--arch/powerpc/cpu/mpc8xx/config.mk4
-rw-r--r--arch/powerpc/cpu/mpc8xxx/Makefile6
-rw-r--r--arch/powerpc/cpu/ppc4xx/config.mk3
-rw-r--r--arch/powerpc/lib/bootm.c56
-rw-r--r--board/freescale/common/p_corenet/Makefile2
-rw-r--r--common/Makefile2
-rw-r--r--common/board_f.c1
-rw-r--r--common/cmd_bootm.c92
-rw-r--r--common/cmd_elf.c6
-rw-r--r--common/fdt_support.c5
-rw-r--r--config.mk6
-rw-r--r--doc/README.vxworks19
-rw-r--r--drivers/mtd/nand/Makefile3
-rw-r--r--drivers/mtd/ubi/Makefile3
-rw-r--r--drivers/serial/lpc32xx_hsuart.c3
-rw-r--r--drivers/usb/gadget/Makefile8
-rw-r--r--dts/Makefile2
-rw-r--r--examples/standalone/.gitignore2
-rw-r--r--examples/standalone/82559_eeprom.c356
-rw-r--r--examples/standalone/Makefile21
-rw-r--r--fs/jffs2/jffs2_1pass.c4
-rw-r--r--fs/yaffs2/yaffs_uboot_glue.c3
-rw-r--r--fs/yaffs2/yaffsfs.c5
-rw-r--r--include/common.h4
-rw-r--r--include/config_defaults.h1
-rw-r--r--include/configs/B4860QDS.h1
-rw-r--r--include/configs/BSC9131RDB.h1
-rw-r--r--include/configs/BSC9132QDS.h1
-rw-r--r--include/configs/DU440.h1
-rw-r--r--include/configs/EXBITGEN.h1
-rw-r--r--include/configs/JSE.h1
-rw-r--r--include/configs/KAREF.h1
-rw-r--r--include/configs/METROBOX.h1
-rw-r--r--include/configs/MIP405.h1
-rw-r--r--include/configs/MPC8315ERDB.h1
-rw-r--r--include/configs/MPC8323ERDB.h1
-rw-r--r--include/configs/MPC832XEMDS.h1
-rw-r--r--include/configs/MPC8349EMDS.h1
-rw-r--r--include/configs/MPC8349ITX.h1
-rw-r--r--include/configs/MPC8360EMDS.h1
-rw-r--r--include/configs/MPC8360ERDK.h1
-rw-r--r--include/configs/MPC837XEMDS.h1
-rw-r--r--include/configs/MPC837XERDB.h1
-rw-r--r--include/configs/MPC8536DS.h1
-rw-r--r--include/configs/MPC8540ADS.h1
-rw-r--r--include/configs/MPC8541CDS.h1
-rw-r--r--include/configs/MPC8544DS.h1
-rw-r--r--include/configs/MPC8548CDS.h1
-rw-r--r--include/configs/MPC8555CDS.h1
-rw-r--r--include/configs/MPC8560ADS.h1
-rw-r--r--include/configs/MPC8568MDS.h1
-rw-r--r--include/configs/MPC8569MDS.h1
-rw-r--r--include/configs/MPC8572DS.h1
-rw-r--r--include/configs/MPC8610HPCD.h1
-rw-r--r--include/configs/MPC8641HPCN.h1
-rw-r--r--include/configs/P1010RDB.h1
-rw-r--r--include/configs/P1022DS.h1
-rw-r--r--include/configs/P1023RDS.h1
-rw-r--r--include/configs/P1_P2_RDB.h1
-rw-r--r--include/configs/P2020COME.h1
-rw-r--r--include/configs/P2020DS.h1
-rw-r--r--include/configs/P2041RDB.h1
-rw-r--r--include/configs/PIP405.h1
-rw-r--r--include/configs/PMC440.h1
-rw-r--r--include/configs/T1040QDS.h1
-rw-r--r--include/configs/T1040RDB.h1
-rw-r--r--include/configs/T1042RDB_PI.h1
-rw-r--r--include/configs/TQM834x.h1
-rw-r--r--include/configs/VCMA9.h2
-rw-r--r--include/configs/W7OLMC.h1
-rw-r--r--include/configs/W7OLMG.h1
-rw-r--r--include/configs/ac14xx.h1
-rw-r--r--include/configs/actux1.h2
-rw-r--r--include/configs/actux2.h2
-rw-r--r--include/configs/actux3.h2
-rw-r--r--include/configs/actux4.h2
-rw-r--r--include/configs/alpr.h1
-rw-r--r--include/configs/amcc-common.h1
-rw-r--r--include/configs/aria.h1
-rw-r--r--include/configs/balloon3.h1
-rw-r--r--include/configs/coreboot.h1
-rw-r--r--include/configs/corenet_ds.h1
-rw-r--r--include/configs/csb272.h1
-rw-r--r--include/configs/csb472.h1
-rw-r--r--include/configs/dvlhost.h2
-rw-r--r--include/configs/km/kmp204x-common.h1
-rw-r--r--include/configs/korat.h1
-rw-r--r--include/configs/lp8x4x.h1
-rw-r--r--include/configs/lubbock.h1
-rw-r--r--include/configs/lwmon5.h1
-rw-r--r--include/configs/mecp5123.h1
-rw-r--r--include/configs/mpc5121ads.h1
-rw-r--r--include/configs/mpq101.h1
-rw-r--r--include/configs/mx1ads.h2
-rw-r--r--include/configs/omap5912osk.h1
-rw-r--r--include/configs/p1_p2_rdb_pc.h1
-rw-r--r--include/configs/p3p440.h1
-rw-r--r--include/configs/palmld.h1
-rw-r--r--include/configs/palmtc.h1
-rw-r--r--include/configs/palmtreo680.h1
-rw-r--r--include/configs/pcs440ep.h1
-rw-r--r--include/configs/pdm360ng.h1
-rw-r--r--include/configs/pxa-common.h1
-rw-r--r--include/configs/pxa255_idp.h1
-rw-r--r--include/configs/quad100hd.h1
-rw-r--r--include/configs/rsdproto.h1
-rw-r--r--include/configs/sbc8349.h1
-rw-r--r--include/configs/sbc8548.h1
-rw-r--r--include/configs/sbc8641d.h1
-rw-r--r--include/configs/smdk2410.h2
-rw-r--r--include/configs/socrates.h1
-rw-r--r--include/configs/stxgp3.h1
-rw-r--r--include/configs/stxssa.h1
-rw-r--r--include/configs/t4qds.h1
-rw-r--r--include/configs/trizepsiv.h1
-rw-r--r--include/configs/vme8349.h1
-rw-r--r--include/configs/vpac270.h1
-rw-r--r--include/configs/xaeniax.h1
-rw-r--r--include/configs/zeus.h1
-rw-r--r--include/configs/zipitz2.h1
-rw-r--r--include/vxworks.h3
-rw-r--r--lib/time.c4
-rw-r--r--post/Makefile16
-rw-r--r--post/board/lwmon/Makefile2
-rw-r--r--post/board/lwmon5/Makefile2
-rw-r--r--post/board/netta/Makefile2
-rw-r--r--post/board/pdm360ng/Makefile2
-rw-r--r--post/cpu/mpc83xx/Makefile2
-rw-r--r--post/cpu/ppc4xx/Makefile18
-rw-r--r--post/drivers/Makefile2
-rw-r--r--post/lib_powerpc/Makefile10
-rw-r--r--post/lib_powerpc/fpu/Makefile18
-rw-r--r--[-rwxr-xr-x]scripts/binutils-version.sh (renamed from tools/binutils-version.sh)0
-rwxr-xr-xscripts/checkpatch.pl (renamed from tools/checkpatch.pl)0
-rwxr-xr-xscripts/checkstack.pl (renamed from tools/checkstack.pl)0
-rwxr-xr-xscripts/cleanpatch (renamed from tools/cleanpatch)0
-rw-r--r--[-rwxr-xr-x]scripts/dtc-version.sh (renamed from tools/dtc-version.sh)0
-rw-r--r--[-rwxr-xr-x]scripts/gcc-version.sh (renamed from tools/gcc-version.sh)0
-rwxr-xr-xscripts/setlocalversion (renamed from tools/setlocalversion)0
-rw-r--r--spl/.gitignore4
-rw-r--r--spl/Makefile29
-rwxr-xr-xtest/image/test-imagetools.sh141
-rw-r--r--tools/.gitignore2
-rw-r--r--tools/Makefile28
-rw-r--r--tools/aisimage.c16
-rw-r--r--tools/default_image.c67
-rw-r--r--tools/dumpimage.c305
-rw-r--r--tools/dumpimage.h33
-rw-r--r--tools/fit_image.c11
-rw-r--r--tools/imagetool.c58
-rw-r--r--tools/imagetool.h173
-rw-r--r--tools/imximage.c12
-rw-r--r--tools/kwbimage.c10
-rw-r--r--tools/mkimage.c25
-rw-r--r--tools/mkimage.h123
-rw-r--r--tools/mxsimage.c12
-rw-r--r--tools/omapimage.c10
-rw-r--r--tools/pblimage.c10
-rw-r--r--tools/ublimage.c10
177 files changed, 1187 insertions, 893 deletions
diff --git a/.gitignore b/.gitignore
index a39bd54..3b14c25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,8 +47,6 @@
/u-boot.ais
/u-boot.dtb
/u-boot.sb
-/u-boot.bd
-/u-boot.geany
#
# Generated files
@@ -59,6 +57,10 @@
/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
diff --git a/Makefile b/Makefile
index 7310c4e..d6398fe 100644
--- 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
--- 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:
-------------------------
diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index 636322a..2be253c 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -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;
diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index 78d9f32..c4717de 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -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)
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f476a89..dff10ba 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -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
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 35f8716..73fa798 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -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
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index e6bb935..f75c3bf 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/74xx_7xx/config.mk b/arch/powerpc/cpu/74xx_7xx/config.mk
index 9053191..96812a0 100644
--- a/arch/powerpc/cpu/74xx_7xx/config.mk
+++ b/arch/powerpc/cpu/74xx_7xx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/Makefile b/arch/powerpc/cpu/Makefile
index d630abe..88b5298 100644
--- a/arch/powerpc/cpu/Makefile
+++ b/arch/powerpc/cpu/Makefile
@@ -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/
diff --git a/arch/powerpc/cpu/mpc512x/config.mk b/arch/powerpc/cpu/mpc512x/config.mk
index 04717a4..03759e6 100644
--- a/arch/powerpc/cpu/mpc512x/config.mk
+++ b/arch/powerpc/cpu/mpc512x/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc5xx/config.mk b/arch/powerpc/cpu/mpc5xx/config.mk
index b33f17a..31e2dc9 100644
--- a/arch/powerpc/cpu/mpc5xx/config.mk
+++ b/arch/powerpc/cpu/mpc5xx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc5xxx/config.mk b/arch/powerpc/cpu/mpc5xxx/config.mk
index 57bdd2d..3384f6f 100644
--- a/arch/powerpc/cpu/mpc5xxx/config.mk
+++ b/arch/powerpc/cpu/mpc5xxx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc824x/config.mk b/arch/powerpc/cpu/mpc824x/config.mk
index ef605f0..a224bc8 100644
--- a/arch/powerpc/cpu/mpc824x/config.mk
+++ b/arch/powerpc/cpu/mpc824x/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc8260/config.mk b/arch/powerpc/cpu/mpc8260/config.mk
index 91b0497..dfac710 100644
--- a/arch/powerpc/cpu/mpc8260/config.mk
+++ b/arch/powerpc/cpu/mpc8260/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc83xx/config.mk b/arch/powerpc/cpu/mpc83xx/config.mk
index c16a003..dfce4d5 100644
--- a/arch/powerpc/cpu/mpc83xx/config.mk
+++ b/arch/powerpc/cpu/mpc83xx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc85xx/config.mk b/arch/powerpc/cpu/mpc85xx/config.mk
index 9eef539..72c964c 100644
--- a/arch/powerpc/cpu/mpc85xx/config.mk
+++ b/arch/powerpc/cpu/mpc85xx/config.mk
@@ -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)
diff --git a/arch/powerpc/cpu/mpc86xx/config.mk b/arch/powerpc/cpu/mpc86xx/config.mk
index 5dbf6a8..69a0b96 100644
--- a/arch/powerpc/cpu/mpc86xx/config.mk
+++ b/arch/powerpc/cpu/mpc86xx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc8xx/config.mk b/arch/powerpc/cpu/mpc8xx/config.mk
index c04e733..ee2c883 100644
--- a/arch/powerpc/cpu/mpc8xx/config.mk
+++ b/arch/powerpc/cpu/mpc8xx/config.mk
@@ -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
diff --git a/arch/powerpc/cpu/mpc8xxx/Makefile b/arch/powerpc/cpu/mpc8xxx/Makefile
index f66ee2e..e95539e 100644
--- a/arch/powerpc/cpu/mpc8xxx/Makefile
+++ b/arch/powerpc/cpu/mpc8xxx/Makefile
@@ -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
diff --git a/arch/powerpc/cpu/ppc4xx/config.mk b/arch/powerpc/cpu/ppc4xx/config.mk
index c2b0f9a..71c2a6c 100644
--- a/arch/powerpc/cpu/ppc4xx/config.mk
+++ b/arch/powerpc/cpu/ppc4xx/config.mk
@@ -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))
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index e7153b0..41fc8f7 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -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
diff --git a/board/freescale/common/p_corenet/Makefile b/board/freescale/common/p_corenet/Makefile
index 889c493..1f399d2 100644
--- a/board/freescale/common/p_corenet/Makefile
+++ b/board/freescale/common/p_corenet/Makefile
@@ -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
diff --git a/common/Makefile b/common/Makefile
index 74404be..d12cba5 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -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) \
diff --git a/common/board_f.c b/common/board_f.c
index f0664bc..fcfd713 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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();
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index ba73f57..3f57659 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -23,6 +23,11 @@
#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)
{
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index f741f6b..ab9c7e3 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -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",
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 1f0d8f5..4e32b02 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -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"));
diff --git a/config.mk b/config.mk
index d5b09a0..b824bb3 100644
--- 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
index 0000000..4cb302e
--- /dev/null
+++ b/doc/README.vxworks
@@ -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.
diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index e145cd1..02b149c 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -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
diff --git a/drivers/mtd/ubi/Makefile b/drivers/mtd/ubi/Makefile
index e1f3a24..56c2823 100644
--- a/drivers/mtd/ubi/Makefile
+++ b/drivers/mtd/ubi/Makefile
@@ -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
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 9c7c621..c8926a8 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -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 */
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index f52d3f4..f13b172 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -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
diff --git a/dts/Makefile b/dts/Makefile
index 140c8bc..6c7198f 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -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
diff --git a/examples/standalone/.gitignore b/examples/standalone/.gitignore
index 4d9ce66..6d3a616 100644
--- a/examples/standalone/.gitignore
+++ b/examples/standalone/.gitignore
@@ -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
index c253055..0000000
--- a/examples/standalone/82559_eeprom.c
+++ /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;
-}
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index f4f102b..0841c75 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -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
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index c856983..3fb5db3 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -114,6 +114,7 @@
#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. */
diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c
index e113e40..50000a1 100644
--- a/fs/yaffs2/yaffs_uboot_glue.c
+++ b/fs/yaffs2/yaffs_uboot_glue.c
@@ -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");
diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c
index ac4a010..334598e 100644
--- a/fs/yaffs2/yaffsfs.c
+++ b/fs/yaffs2/yaffsfs.c
@@ -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];
diff --git a/include/common.h b/include/common.h
index 8ca67f6..d49c514 100644
--- a/include/common.h
+++ b/include/common.h
@@ -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;
diff --git a/include/config_defaults.h b/include/config_defaults.h
index 567b46c..ad08c1d 100644
--- a/include/config_defaults.h
+++ b/include/config_defaults.h
@@ -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
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index b2a5c19..3c6cd61 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -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
/*
diff --git a/include/configs/BSC9131RDB.h b/include/configs/BSC9131RDB.h
index 499d8c2..4aed5af 100644
--- a/include/configs/BSC9131RDB.h
+++ b/include/configs/BSC9131RDB.h
@@ -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
diff --git a/include/configs/BSC9132QDS.h b/include/configs/BSC9132QDS.h
index a6601fe..f025e31 100644
--- a/include/configs/BSC9132QDS.h
+++ b/include/configs/BSC9132QDS.h
@@ -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
/*
diff --git a/include/configs/DU440.h b/include/configs/DU440.h
index 2d7fc59..71be122 100644
--- a/include/configs/DU440.h
+++ b/include/configs/DU440.h
@@ -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
diff --git a/include/configs/EXBITGEN.h b/include/configs/EXBITGEN.h
index f366308..208b599 100644
--- a/include/configs/EXBITGEN.h
+++ b/include/configs/EXBITGEN.h
@@ -186,6 +186,5 @@
#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 */
diff --git a/include/configs/JSE.h b/include/configs/JSE.h
index 4284d6a..5738ea9 100644
--- a/include/configs/JSE.h
+++ b/include/configs/JSE.h
@@ -274,6 +274,5 @@
#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 */
diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h
index 71e90d7..39eb2ef 100644
--- a/include/configs/KAREF.h
+++ b/include/configs/KAREF.h
@@ -273,7 +273,6 @@
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* kgdb serial port baud */
-#define CONFIG_KGDB_SER_INDEX 2 /* kgdb serial port */
#endif
/*-----------------------------------------------------------------------
diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h
index 32ec0bf..6715435 100644
--- a/include/configs/METROBOX.h
+++ b/include/configs/METROBOX.h
@@ -338,7 +338,6 @@
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 230400 /* kgdb serial port baud */
-#define CONFIG_KGDB_SER_INDEX 2 /* kgdb serial port */
#endif
/*-----------------------------------------------------------------------
diff --git a/include/configs/MIP405.h b/include/configs/MIP405.h
index f248a56..6042a1e 100644
--- a/include/configs/MIP405.h
+++ b/include/configs/MIP405.h
@@ -396,7 +396,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
/************************************************************
diff --git a/include/configs/MPC8315ERDB.h b/include/configs/MPC8315ERDB.h
index 0f9f436..aedb529 100644
--- a/include/configs/MPC8315ERDB.h
+++ b/include/configs/MPC8315ERDB.h
@@ -634,7 +634,6 @@
#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
/*
diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h
index a1e5f3b..c4c771b 100644
--- a/include/configs/MPC8323ERDB.h
+++ b/include/configs/MPC8323ERDB.h
@@ -481,7 +481,6 @@
#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
/*
diff --git a/include/configs/MPC832XEMDS.h b/include/configs/MPC832XEMDS.h
index 71fc497..f5b6202 100644
--- a/include/configs/MPC832XEMDS.h
+++ b/include/configs/MPC832XEMDS.h
@@ -574,7 +574,6 @@
#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
/*
diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h
index 0374841..7640d06 100644
--- a/include/configs/MPC8349EMDS.h
+++ b/include/configs/MPC8349EMDS.h
@@ -737,7 +737,6 @@
#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
/*
diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h
index e2ae596..ffb9a15 100644
--- a/include/configs/MPC8349ITX.h
+++ b/include/configs/MPC8349ITX.h
@@ -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
diff --git a/include/configs/MPC8360EMDS.h b/include/configs/MPC8360EMDS.h
index ed780f1..d4c82cd 100644
--- a/include/configs/MPC8360EMDS.h
+++ b/include/configs/MPC8360EMDS.h
@@ -683,7 +683,6 @@
#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
/*
diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h
index d31be19..01e7ac7 100644
--- a/include/configs/MPC8360ERDK.h
+++ b/include/configs/MPC8360ERDK.h
@@ -544,7 +544,6 @@
#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
/*
diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h
index 98ffb9c..f52e77a 100644
--- a/include/configs/MPC837XEMDS.h
+++ b/include/configs/MPC837XEMDS.h
@@ -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
/*
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index ca28c0e..938f7ab 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -678,7 +678,6 @@
#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
/*
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 9ab1bc1..9b7cc64 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -740,7 +740,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
/*
diff --git a/include/configs/MPC8540ADS.h b/include/configs/MPC8540ADS.h
index 046b14b..2d42b25 100644
--- a/include/configs/MPC8540ADS.h
+++ b/include/configs/MPC8540ADS.h
@@ -397,7 +397,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
diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h
index eca3b53..b9ad034 100644
--- a/include/configs/MPC8541CDS.h
+++ b/include/configs/MPC8541CDS.h
@@ -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
/*
diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h
index 8132ec0..90fc2da 100644
--- a/include/configs/MPC8544DS.h
+++ b/include/configs/MPC8544DS.h
@@ -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
/*
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index 6acd54d..5fff1e2 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -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
/*
diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h
index 5ffdd01..23c6b07 100644
--- a/include/configs/MPC8555CDS.h
+++ b/include/configs/MPC8555CDS.h
@@ -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
/*
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index bb9ae2d..44b7679 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -438,7 +438,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
diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h
index 7406ac3..4f438a8 100644
--- a/include/configs/MPC8568MDS.h
+++ b/include/configs/MPC8568MDS.h
@@ -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
/*
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index df5572b..d877e8b 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -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
/*
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index 63480ec..44d83a2 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -682,7 +682,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
/*
diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
index 41ebe31..f930fcd 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -517,7 +517,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
/*
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index 0e666ba..65d61c2 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -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
/*
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index 1ed5e1d..fe5309a 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -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
/*
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index 262c3e5..ba43cce 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -725,7 +725,6 @@
#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
/*
diff --git a/include/configs/P1023RDS.h b/include/configs/P1023RDS.h
index 2aa1f59..11c74ff 100644
--- a/include/configs/P1023RDS.h
+++ b/include/configs/P1023RDS.h
@@ -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
/*
diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h
index b592c19..85cb076 100644
--- a/include/configs/P1_P2_RDB.h
+++ b/include/configs/P1_P2_RDB.h
@@ -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
/*
diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h
index 15d2a43..ce3c762 100644
--- a/include/configs/P2020COME.h
+++ b/include/configs/P2020COME.h
@@ -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
/*
diff --git a/include/configs/P2020DS.h b/include/configs/P2020DS.h
index 9d3d9b3..ada6c7b 100644
--- a/include/configs/P2020DS.h
+++ b/include/configs/P2020DS.h
@@ -670,7 +670,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
/*
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index b238574..ee71252 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -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
/*
diff --git a/include/configs/PIP405.h b/include/configs/PIP405.h
index 1180724..29888b4 100644
--- a/include/configs/PIP405.h
+++ b/include/configs/PIP405.h
@@ -353,7 +353,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
/************************************************************
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h
index 5ab9315..efe6960 100644
--- a/include/configs/PMC440.h
+++ b/include/configs/PMC440.h
@@ -492,7 +492,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
/* pass open firmware flat tree */
diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h
index 43a5778..d0ebd6a 100644
--- a/include/configs/T1040QDS.h
+++ b/include/configs/T1040QDS.h
@@ -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
/*
diff --git a/include/configs/T1040RDB.h b/include/configs/T1040RDB.h
index 7931231..d721139 100644
--- a/include/configs/T1040RDB.h
+++ b/include/configs/T1040RDB.h
@@ -609,7 +609,6 @@
#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
/*
diff --git a/include/configs/T1042RDB_PI.h b/include/configs/T1042RDB_PI.h
index eff08e3..2c02d9d 100644
--- a/include/configs/T1042RDB_PI.h
+++ b/include/configs/T1042RDB_PI.h
@@ -613,7 +613,6 @@
#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
/*
diff --git a/include/configs/TQM834x.h b/include/configs/TQM834x.h
index fc25425..15cf2bd 100644
--- a/include/configs/TQM834x.h
+++ b/include/configs/TQM834x.h
@@ -495,7 +495,6 @@
#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
/*
diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h
index 57b620d..d40185e 100644
--- a/include/configs/VCMA9.h
+++ b/include/configs/VCMA9.h
@@ -138,8 +138,6 @@
#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 */
diff --git a/include/configs/W7OLMC.h b/include/configs/W7OLMC.h
index 8fda1b1..00a24ab 100644
--- a/include/configs/W7OLMC.h
+++ b/include/configs/W7OLMC.h
@@ -301,7 +301,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
/*
diff --git a/include/configs/W7OLMG.h b/include/configs/W7OLMG.h
index 6836fc7..8ed2fa2 100644
--- a/include/configs/W7OLMG.h
+++ b/include/configs/W7OLMG.h
@@ -304,7 +304,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
/*
diff --git a/include/configs/ac14xx.h b/include/configs/ac14xx.h
index 1205557..d6cef88 100644
--- a/include/configs/ac14xx.h
+++ b/include/configs/ac14xx.h
@@ -471,7 +471,6 @@
#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
/*
diff --git a/include/configs/actux1.h b/include/configs/actux1.h
index 3315f54..9b8bd78 100644
--- a/include/configs/actux1.h
+++ b/include/configs/actux1.h
@@ -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 */
diff --git a/include/configs/actux2.h b/include/configs/actux2.h
index fb391ec..f0cbff7 100644
--- a/include/configs/actux2.h
+++ b/include/configs/actux2.h
@@ -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 */
diff --git a/include/configs/actux3.h b/include/configs/actux3.h
index 61d96f5..7639107 100644
--- a/include/configs/actux3.h
+++ b/include/configs/actux3.h
@@ -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 */
diff --git a/include/configs/actux4.h b/include/configs/actux4.h
index 2387279..12bd98a 100644
--- a/include/configs/actux4.h
+++ b/include/configs/actux4.h
@@ -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 */
diff --git a/include/configs/alpr.h b/include/configs/alpr.h
index 61fdeba..08bba36 100644
--- a/include/configs/alpr.h
+++ b/include/configs/alpr.h
@@ -349,7 +349,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
/* pass open firmware flat tree */
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
index c9e9a03..0f38c92 100644
--- a/include/configs/amcc-common.h
+++ b/include/configs/amcc-common.h
@@ -125,7 +125,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
/*
diff --git a/include/configs/aria.h b/include/configs/aria.h
index 32216cd..b8d955a 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -507,7 +507,6 @@
#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
/*
diff --git a/include/configs/balloon3.h b/include/configs/balloon3.h
index 12df45b..8b2a6cf 100644
--- a/include/configs/balloon3.h
+++ b/include/configs/balloon3.h
@@ -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
/*
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index 556b42a..d1d732f 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -204,7 +204,6 @@
#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE 115200
-#define CONFIG_KGDB_SER_INDEX 2
#endif
/*
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 665295c..969b990 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -672,7 +672,6 @@
#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
/*
diff --git a/include/configs/csb272.h b/include/configs/csb272.h
index ca0bffa..8a848be 100644
--- a/include/configs/csb272.h
+++ b/include/configs/csb272.h
@@ -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
/*
diff --git a/include/configs/csb472.h b/include/configs/csb472.h
index 596095d..5c03417 100644
--- a/include/configs/csb472.h
+++ b/include/configs/csb472.h
@@ -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
/*
diff --git a/include/configs/dvlhost.h b/include/configs/dvlhost.h
index 87b3314..1af7f16 100644
--- a/include/configs/dvlhost.h
+++ b/include/configs/dvlhost.h
@@ -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 */
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 7700b38..50330cc 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -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
diff --git a/include/configs/korat.h b/include/configs/korat.h
index b09af19..811ff99 100644
--- a/include/configs/korat.h
+++ b/include/configs/korat.h
@@ -542,7 +542,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
/* Pass open firmware flat tree */
diff --git a/include/configs/lp8x4x.h b/include/configs/lp8x4x.h
index 68e1a97..379c786 100644
--- a/include/configs/lp8x4x.h
+++ b/include/configs/lp8x4x.h
@@ -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
/*
diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h
index b87df54..4ffe165 100644
--- a/include/configs/lubbock.h
+++ b/include/configs/lubbock.h
@@ -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
/*
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
index c348329..e9c8d8f 100644
--- a/include/configs/lwmon5.h
+++ b/include/configs/lwmon5.h
@@ -660,7 +660,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
/*
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index 6501ea4..d415ecd 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -364,7 +364,6 @@
#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
/*
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index 4a8adf6..38337b4 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -520,7 +520,6 @@
#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
/*
diff --git a/include/configs/mpq101.h b/include/configs/mpq101.h
index ec09e15..4cac8ee 100644
--- a/include/configs/mpq101.h
+++ b/include/configs/mpq101.h
@@ -345,7 +345,6 @@
#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
/*
diff --git a/include/configs/mx1ads.h b/include/configs/mx1ads.h
index c15d546..12667c5 100644
--- a/include/configs/mx1ads.h
+++ b/include/configs/mx1ads.h
@@ -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
/*
diff --git a/include/configs/omap5912osk.h b/include/configs/omap5912osk.h
index c48790d..376dfdb 100644
--- a/include/configs/omap5912osk.h
+++ b/include/configs/omap5912osk.h
@@ -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
/*
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 57ed019..c6df11b 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -928,7 +928,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
/*
diff --git a/include/configs/p3p440.h b/include/configs/p3p440.h
index 3fde7ca..1fdd602 100644
--- a/include/configs/p3p440.h
+++ b/include/configs/p3p440.h
@@ -303,6 +303,5 @@
#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 */
diff --git a/include/configs/palmld.h b/include/configs/palmld.h
index 84bc9ed..ae4dd75 100644
--- a/include/configs/palmld.h
+++ b/include/configs/palmld.h
@@ -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
/*
diff --git a/include/configs/palmtc.h b/include/configs/palmtc.h
index 661101c..1f94f0c 100644
--- a/include/configs/palmtc.h
+++ b/include/configs/palmtc.h
@@ -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
/*
diff --git a/include/configs/palmtreo680.h b/include/configs/palmtreo680.h
index adf8519..3662663 100644
--- a/include/configs/palmtreo680.h
+++ b/include/configs/palmtreo680.h
@@ -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
/*
diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h
index 400cb3e..5a5fe7f 100644
--- a/include/configs/pcs440ep.h
+++ b/include/configs/pcs440ep.h
@@ -427,7 +427,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
/*-----------------------------------------------------------------------
diff --git a/include/configs/pdm360ng.h b/include/configs/pdm360ng.h
index 266d107..2a54e5c 100644
--- a/include/configs/pdm360ng.h
+++ b/include/configs/pdm360ng.h
@@ -441,7 +441,6 @@
#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 */
diff --git a/include/configs/pxa-common.h b/include/configs/pxa-common.h
index 5856ee1..f0ecc34 100644
--- a/include/configs/pxa-common.h
+++ b/include/configs/pxa-common.h
@@ -16,7 +16,6 @@
*/
#ifdef CONFIG_CMD_KGDB
#define CONFIG_KGDB_BAUDRATE 230400
-#define CONFIG_KGDB_SER_INDEX 2
#endif
/*
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index 84ad006..af7c076 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -199,7 +199,6 @@
#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
/*
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
index 7b04e0c..20d6178 100644
--- a/include/configs/quad100hd.h
+++ b/include/configs/quad100hd.h
@@ -265,7 +265,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
/* ENVIRONMENT VARS */
diff --git a/include/configs/rsdproto.h b/include/configs/rsdproto.h
index f144f84..92318c3 100644
--- a/include/configs/rsdproto.h
+++ b/include/configs/rsdproto.h
@@ -121,7 +121,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
/*
diff --git a/include/configs/sbc8349.h b/include/configs/sbc8349.h
index a258fe8..b7f83e0 100644
--- a/include/configs/sbc8349.h
+++ b/include/configs/sbc8349.h
@@ -643,7 +643,6 @@
#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
/*
diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h
index bdb8eb5..4912d69 100644
--- a/include/configs/sbc8548.h
+++ b/include/configs/sbc8548.h
@@ -575,7 +575,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
/*
diff --git a/include/configs/sbc8641d.h b/include/configs/sbc8641d.h
index dba948a..78f8219 100644
--- a/include/configs/sbc8641d.h
+++ b/include/configs/sbc8641d.h
@@ -523,7 +523,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
/*
diff --git a/include/configs/smdk2410.h b/include/configs/smdk2410.h
index a87444e..d4ae19f 100644
--- a/include/configs/smdk2410.h
+++ b/include/configs/smdk2410.h
@@ -101,8 +101,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 2 /* which serial port to use */
#endif
/*
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index 0e6b864..fd590e4 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -363,7 +363,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
diff --git a/include/configs/stxgp3.h b/include/configs/stxgp3.h
index ee1f1f3..2a9c9a3 100644
--- a/include/configs/stxgp3.h
+++ b/include/configs/stxgp3.h
@@ -341,7 +341,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
/*Note: change below for your network setting!!! */
diff --git a/include/configs/stxssa.h b/include/configs/stxssa.h
index 63dd767..d0cb68a 100644
--- a/include/configs/stxssa.h
+++ b/include/configs/stxssa.h
@@ -376,7 +376,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
/*Note: change below for your network setting!!! */
diff --git a/include/configs/t4qds.h b/include/configs/t4qds.h
index d9b0ed0..54a5e3e 100644
--- a/include/configs/t4qds.h
+++ b/include/configs/t4qds.h
@@ -303,7 +303,6 @@
#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
/*
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 0615117..b7804d2 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -125,7 +125,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
/*
diff --git a/include/configs/vme8349.h b/include/configs/vme8349.h
index 734d13f..7ecbafe 100644
--- a/include/configs/vme8349.h
+++ b/include/configs/vme8349.h
@@ -539,7 +539,6 @@
#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
/*
diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h
index c3ac612..71a89b6 100644
--- a/include/configs/vpac270.h
+++ b/include/configs/vpac270.h
@@ -124,7 +124,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
/*
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index 431ed96..2999d1b 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -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
/*
diff --git a/include/configs/zeus.h b/include/configs/zeus.h
index 9d58738..d8aeb37 100644
--- a/include/configs/zeus.h
+++ b/include/configs/zeus.h
@@ -283,7 +283,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
/*
diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 52a745e..f9ccca7 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -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
/*
diff --git a/include/vxworks.h b/include/vxworks.h
index c5d1577..122043c 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -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
diff --git a/lib/time.c b/lib/time.c
index 09bb05a..8085aa4 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -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;
}
diff --git a/post/Makefile b/post/Makefile
index 1439244..2fa6f8a 100644
--- a/post/Makefile
+++ b/post/Makefile
@@ -5,16 +5,14 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_HAS_POST) += post.o
+obj-y += 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
diff --git a/post/board/lwmon/Makefile b/post/board/lwmon/Makefile
index b23debc..7f6d5a0 100644
--- a/post/board/lwmon/Makefile
+++ b/post/board/lwmon/Makefile
@@ -5,4 +5,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_HAS_POST) += sysmon.o
+obj-y += sysmon.o
diff --git a/post/board/lwmon5/Makefile b/post/board/lwmon5/Makefile
index a50ce67..76262c7 100644
--- a/post/board/lwmon5/Makefile
+++ b/post/board/lwmon5/Makefile
@@ -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
diff --git a/post/board/netta/Makefile b/post/board/netta/Makefile
index 5c37f49..8fc1945 100644
--- a/post/board/netta/Makefile
+++ b/post/board/netta/Makefile
@@ -5,4 +5,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_HAS_POST) += codec.o dsp.o
+obj-y += codec.o dsp.o
diff --git a/post/board/pdm360ng/Makefile b/post/board/pdm360ng/Makefile
index b43b77b..9aa96a1 100644
--- a/post/board/pdm360ng/Makefile
+++ b/post/board/pdm360ng/Makefile
@@ -5,4 +5,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_HAS_POST) += coproc_com.o
+obj-y += coproc_com.o
diff --git a/post/cpu/mpc83xx/Makefile b/post/cpu/mpc83xx/Makefile
index 4b3c50e..d57b667 100644
--- a/post/cpu/mpc83xx/Makefile
+++ b/post/cpu/mpc83xx/Makefile
@@ -5,4 +5,4 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-$(CONFIG_HAS_POST) += ecc.o
+obj-y += ecc.o
diff --git a/post/cpu/ppc4xx/Makefile b/post/cpu/ppc4xx/Makefile
index ed3e8e8..e9ec286 100644
--- a/post/cpu/ppc4xx/Makefile
+++ b/post/cpu/ppc4xx/Makefile
@@ -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
diff --git a/post/drivers/Makefile b/post/drivers/Makefile
index 328f880..1abfb1f 100644
--- a/post/drivers/Makefile
+++ b/post/drivers/Makefile
@@ -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
diff --git a/post/lib_powerpc/Makefile b/post/lib_powerpc/Makefile
index d2b8a94..0cbb6b6 100644
--- a/post/lib_powerpc/Makefile
+++ b/post/lib_powerpc/Makefile
@@ -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/
diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile
index ee01a31..ae56a82 100644
--- a/post/lib_powerpc/fpu/Makefile
+++ b/post/lib_powerpc/fpu/Makefile
@@ -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-y += 20001122-1.o
+obj-y += 20010114-2.o
+obj-y += 20010226-1.o
+obj-y += 980619-1.o
+obj-y += acc1.o
+obj-y += compare-fp-1.o
+obj-y += fpu.o
+obj-y += mul-subnormal-single-1.o
+obj-y += darwin-ldouble.o
CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//)
CFLAGS += -mhard-float -fkeep-inline-functions
diff --git a/tools/binutils-version.sh b/scripts/binutils-version.sh
index d4d9eb4..d4d9eb4 100755..100644
--- a/tools/binutils-version.sh
+++ b/scripts/binutils-version.sh
diff --git a/tools/checkpatch.pl b/scripts/checkpatch.pl
index 88c5bc7..88c5bc7 100755
--- a/tools/checkpatch.pl
+++ b/scripts/checkpatch.pl
diff --git a/tools/checkstack.pl b/scripts/checkstack.pl
index c1cdc0a..c1cdc0a 100755
--- a/tools/checkstack.pl
+++ b/scripts/checkstack.pl
diff --git a/tools/cleanpatch b/scripts/cleanpatch
index 9680d03..9680d03 100755
--- a/tools/cleanpatch
+++ b/scripts/cleanpatch
diff --git a/tools/dtc-version.sh b/scripts/dtc-version.sh
index e8c94d3..e8c94d3 100755..100644
--- a/tools/dtc-version.sh
+++ b/scripts/dtc-version.sh
diff --git a/tools/gcc-version.sh b/scripts/gcc-version.sh
index debecb5..debecb5 100755..100644
--- a/tools/gcc-version.sh
+++ b/scripts/gcc-version.sh
diff --git a/tools/setlocalversion b/scripts/setlocalversion
index f551b4c..f551b4c 100755
--- a/tools/setlocalversion
+++ b/scripts/setlocalversion
diff --git a/spl/.gitignore b/spl/.gitignore
deleted file mode 100644
index 7c88147..0000000
--- a/spl/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-u-boot-spl
-u-boot-spl.bin
-u-boot-spl.lds
-u-boot-spl.map
diff --git a/spl/Makefile b/spl/Makefile
index 2a787af..1e88d74 100644
--- a/spl/Makefile
+++ b/spl/Makefile
@@ -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
index 0000000..9e299e1
--- /dev/null
+++ b/test/image/test-imagetools.sh
@@ -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
diff --git a/tools/.gitignore b/tools/.gitignore
index a7fee26..930fa2e 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -3,12 +3,12 @@
/gen_eth_addr
/img2srec
/kwboot
+/dumpimage
/mkenvimage
/mkimage
/mpc86x_clk
/mxsboot
/ncb
-/ncp
/proftool
/ubsha1
/xway-swap-bytes
diff --git a/tools/Makefile b/tools/Makefile
index 14d94e3..e1264fd 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -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 \
diff --git a/tools/aisimage.c b/tools/aisimage.c
index 04fb649..8de370a 100644
--- a/tools/aisimage.c
+++ b/tools/aisimage.c
@@ -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);
}
diff --git a/tools/default_image.c b/tools/default_image.c
index fd8b9f5..0a0792e 100644
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -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
index 0000000..542ee28
--- /dev/null
+++ b/tools/dumpimage.c
@@ -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
index 0000000..d78523d
--- /dev/null
+++ b/tools/dumpimage.h
@@ -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_ */
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 0400a60..1466164 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -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
index 0000000..29d2189
--- /dev/null
+++ b/tools/imagetool.c
@@ -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
index 0000000..c2c9aea
--- /dev/null
+++ b/tools/imagetool.h
@@ -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_ */
diff --git a/tools/imximage.c b/tools/imximage.c
index 511e3f2..18dc051 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -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);
}
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index 1df6b20..109d616 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -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);
}
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 7f22101..123d0c7 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -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",
diff --git a/tools/mkimage.h b/tools/mkimage.h
index af49154..d5491b6 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -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_ */
diff --git a/tools/mxsimage.c b/tools/mxsimage.c
index 5db19b2..b214050 100644
--- a/tools/mxsimage.c
+++ b/tools/mxsimage.c
@@ -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
diff --git a/tools/omapimage.c b/tools/omapimage.c
index 8774a7e..d59bc4d 100644
--- a/tools/omapimage.c
+++ b/tools/omapimage.c
@@ -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);
}
diff --git a/tools/pblimage.c b/tools/pblimage.c
index bac5faf..ef3d7f6 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -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);
}
diff --git a/tools/ublimage.c b/tools/ublimage.c
index aafe248..cbbbe20 100644
--- a/tools/ublimage.c
+++ b/tools/ublimage.c
@@ -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);
}