tools: make it possible to build tools unconfigured
PATCH 1/1 tools: make it possible to build tools unconfigured
Sometimes we want to build common tools without configuring for specific target. Currently top Makefile has some support for this but it doesn't work. This patch tries to fix this.
Things changed:
- config.mk disable 'ld script not found error' in case if we are
building tools only.
- Makefile mkimage relies on autogenerated version so we need to
move $(VERSION_FILE) rule out of ifeq and make tools rule depend on it.
- tools/Makefile put common/env_embedded.o and envcrc.o to object list
conditionally. This fixes errors during dependency generation.
--- Makefile | 34 +++++++++++++++++----------------- config.mk | 2 ++ tools/Makefile | 19 ++++++++++++++++--- 3 files changed, 35 insertions(+), 20 deletions(-)
Makefile +17 -17
@@ -140,7 +140,7 @@ SUBDIRS = tools \ examples/standalone \ examples/api -.PHONY : $(SUBDIRS) +.PHONY : $(SUBDIRS) $(VERSION_FILE) ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
@@ -422,19 +422,6 @@ mmc_spl: $(TIMESTAMP_FILE) $(VERSION_FILE) depend $(obj)mmc_spl/u-boot-mmc-spl.bin: mmc_spl -$(VERSION_FILE): - @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ - printf '#define PLAIN_VERSION "%s%s"\n' \ - "$(U_BOOT_VERSION)" "$${localvers}" ; \ - printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ - "$(U_BOOT_VERSION)" "$${localvers}" ; \ - ) > [email protected] - @( printf '#define CC_VERSION_STRING "%s"\n' \ - '$(shell $(CC) --version | head -n 1)' )>> [email protected] - @( printf '#define LD_VERSION_STRING "%s"\n' \ - '$(shell $(LD) -v | head -n 1)' )>> [email protected] - @cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@ - $(TIMESTAMP_FILE): @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@ @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@
@@ -509,20 +496,33 @@ $(obj)lib/asm-offsets.s: $(obj)include/autoconf.mk.dep \ else # !config.mk all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \ $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \ -$(filter-out tools,$(SUBDIRS)) $(TIMESTAMP_FILE) $(VERSION_FILE) \ +$(filter-out tools,$(SUBDIRS)) $(TIMESTAMP_FILE) \ updater depend dep tags ctags etags cscope $(obj)System.map: @echo "System not configured - see README" >&2 @ exit 1 -tools: +tools: $(VERSION_FILE) $(MAKE) -C $@ all endif # config.mk +$(VERSION_FILE): + @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ + printf '#define PLAIN_VERSION "%s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + ) > [email protected] + @( printf '#define CC_VERSION_STRING "%s"\n' \ + '$(shell $(CC) --version | head -n 1)' )>> [email protected] + @( printf '#define LD_VERSION_STRING "%s"\n' \ + '$(shell $(LD) -v | head -n 1)' )>> [email protected] + @cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@ + easylogo env gdb: $(MAKE) -C tools/$@ all MTD_VERSION=${MTD_VERSION} gdbtools: gdb -tools-all: easylogo env gdb +tools-all: easylogo env gdb $(VERSION_FILE) $(MAKE) -C tools HOST_TOOLS_ALL=y .PHONY : CHANGELOG
config.mk +2 -0
@@ -180,7 +180,9 @@ ifndef LDSCRIPT LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds endif ifeq ($(wildcard $(LDSCRIPT)),) + ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk)) $(error could not find linker script) + endif endif endif
tools/Makefile +16 -3
@@ -67,7 +67,14 @@ BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) # Source files which exist outside the tools directory -EXT_OBJ_FILES-y += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_FLASH) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_NAND) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += common/env_embedded.o EXT_OBJ_FILES-y += common/image.o EXT_OBJ_FILES-y += lib/crc32.o EXT_OBJ_FILES-y += lib/md5.o
@@ -77,7 +84,14 @@ EXT_OBJ_FILES-y += lib/sha1.o OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o NOPED_OBJ_FILES-y += default_image.o -OBJ_FILES-y += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc.o +OBJ_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc.o NOPED_OBJ_FILES-y += fit_image.o OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
@@ -149,7 +163,6 @@ HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ -DUSE_HOSTCC \ -D__KERNEL_STRICT_NAMES - all: $(obj).depend $(BINS) $(LOGO-y) subdirs $(obj)bin2header$(SFX): $(obj)bin2header.o
Signature · 1 line
1.7.4.4
PATCH 1/1 tools: make it possible to build tools unconfigured
Quoted 3 lines · On Wednesday, June 15, 2011 17:37:33 Ilya Yanok wrote:
Sometimes we want to build common tools without configuring for specific target. Currently top
Makefilehas some support for this but it doesn't work. This patch tries to fix this.
i think you'll need to split this up in logical sep changesets since you are fixing different problems.
Quoted 3 lines
Things changed:
- config.mk disable 'ld script not found error' in case if we are
building tools only.
i dont like copying & pasting the same logic in multiple places. this is how code rots and bug fixes diverge.
considering LDSCRIPT/CONFIG_SYS_LDSCRIPT only get used by the top level u-boot file, and only when the system is configured, i wonder if we shouldnt just rip it out of config.mk and into the top level Makefile.
let's see what Scott thinks ...
Quoted 2 lines
-
Makefilemkimage relies on autogenerated version so we need to
move $(VERSION_FILE) rule out of ifeq and make tools rule depend on it.
the VERSION_FILE changes look fine
Quoted 2 lines
-
tools/Makefileputcommon/env_embedded.oand envcrc.o to object list
conditionally. This fixes errors during dependency generation.
pretty sure this breaks board builds. if the only thing this fixes is a harmless warning when generating dependency files, then i say ignore it. after all, this is how it has always worked in the past and no one really cared.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110618/5b53f0b2/attachment.pgp
PATCH 1/1 tools: make it possible to build tools unconfigured
Dear Mike Frysinger,
Quoted 5 lines · In message <[email protected]> you wrote:
pretty sure this breaks board builds. if the only thing this fixes is a harmless warning when generating dependency files, then i say ignore it. after all, this is how it has always worked in the past and no one really cared.
There have been no warnings when generating dependencies.
Changes that cause new warnings need to be fixed.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de What was sliced bread the greatest thing since?
PATCH 1/1 tools: make it possible to build tools unconfigured
Quoted 7 lines · On Saturday, June 18, 2011 16:11:17 Wolfgang Denk wrote:
Quoted 4 lines · Mike Frysinger
pretty sure this breaks board builds. if the only thing this fixes is a harmless warning when generating dependency files, then i say ignore it. after all, this is how it has always worked in the past and no one really cared.
There have been no warnings when generating dependencies.
yes, there has. you probably dont run make tools (at least, in an unconfigured tree), so you've never noticed.
Quoted 1 line
Changes that cause new warnings need to be fixed.
you'll have to define "new" here. the warning he refers to has been there for many many releases, and for pretty much as long as i can remember.
i dont mind fixing warnings, but i do mind breaking the building of boards to fix a harmless warning.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110618/a0b40352/attachment.pgp
PATCH 1/1 tools: make it possible to build tools unconfigured
In reply to Mike FrysingerHi Mike,
thanks for your comments.
Quoted 2 lines · Mike Frysinger
i think you'll need to split this up in logical sep changesets since you are fixing different problems.
Ok, will do.
Quoted 6 lines
Quoted 3 lines
Things changed:
- config.mk disable 'ld script not found error' in case if we are
building tools only.i dont like copying & pasting the same logic in multiple places. this is how code rots and bug fixes diverge.
Agreed. How should I fix this?
Quoted 5 lines
considering LDSCRIPT/CONFIG_SYS_LDSCRIPT only get used by the top level u-boot file, and only when the system is configured, i wonder if we shouldnt just rip it out of config.mk and into the top level
Makefile.let's see what Scott thinks ...
I see. Let's wait for Scott's comments then.
Quoted 4 lines
Quoted 2 lines
-
tools/Makefileputcommon/env_embedded.oand envcrc.o to object list
conditionally. This fixes errors during dependency generation.pretty sure this breaks board builds. if the only thing this fixes is a
I'm sorry but I can't see how this can break the builds. Could you please be more specific? I've tried to build some boards, it actually works...
Quoted 3 lines
harmless warning when generating dependency files, then i say ignore it. after all, this is how it has always worked in the past and no one really cared.
Yep, they are harmless but they are not warnings but rather scary errors actually. ;) I think it's better to fix them.
Regards, Ilya.
PATCH 1/1 tools: make it possible to build tools unconfigured
Quoted 10 lines · On Sunday, June 19, 2011 13:55:13 Ilya Yanok wrote:
Quoted 5 lines · Mike Frysinger
Quoted 3 lines
-
tools/Makefileputcommon/env_embedded.oand envcrc.o to object listconditionally. This fixes errors during dependency generation.
pretty sure this breaks board builds. if the only thing this fixes is a
I'm sorry but I can't see how this can break the builds. Could you please be more specific? I've tried to build some boards, it actually works...
i might be thinking of a different env_embedded situation. a different problem with your patch to tools/Makefile: you copied the same logic multiple times which means more bitrot.
why dont you do something like:
tools/Makefile +14 -10
@@ -48,17 +48,21 @@ CONFIG_NETCONSOLE = y CONFIG_SHA1_CHECK_UB_IMG = y endif +# Merge all the different vars for envcrc into one +ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y +ENVCRC-$(CONFIG_ENV_IS_IN_DATAFLASH) = y +ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y +ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y +ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y +ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y +ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y +ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y +CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y) + # Generated executable files BIN_FILES-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX) BIN_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_DATAFLASH) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_EEPROM) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_FLASH) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_ONENAND) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_NAND) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_NVRAM) += envcrc$(SFX) -BIN_FILES-$(CONFIG_ENV_IS_IN_SPI_FLASH) += envcrc$(SFX) +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_INCA_IP) += inca-swap-bytes$(SFX)
@@ -67,7 +71,7 @@ BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) # Source files which exist outside the tools directory -EXT_OBJ_FILES-y += common/env_embedded.o +EXT_OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += common/env_embedded.o EXT_OBJ_FILES-y += common/image.o EXT_OBJ_FILES-y += lib/crc32.o EXT_OBJ_FILES-y += lib/md5.o
@@ -77,7 +81,7 @@ EXT_OBJ_FILES-y += lib/sha1.o OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o NOPED_OBJ_FILES-y += default_image.o -OBJ_FILES-y += envcrc.o +OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o NOPED_OBJ_FILES-y += fit_image.o OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
Quoted 6 lines
Quoted 3 lines
harmless warning when generating dependency files, then i say ignore it. after all, this is how it has always worked in the past and no one really cared.
Yep, they are harmless but they are not warnings but rather scary errors actually. ;) I think it's better to fix them.
i guess my threshold for being scared is a bit higher :p
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110619/1756d7d9/attachment.pgp
PATCH 1/1 tools: make it possible to build tools unconfigured
Hi Mike,
Quoted 3 lines · Mike Frysinger
i might be thinking of a different
env_embeddedsituation. a different problem with your patch totools/Makefile: you copied the same logic multiple times which means more bitrot.
Yes, that's a good point. Your patch looks good to me. Should I write a commit message and repost it or will you?
Regards, Ilya.
PATCH 1/1 tools: make it possible to build tools unconfigured
Quoted 7 lines · On Sunday, June 19, 2011 18:46:42 Ilya Yanok wrote:
Quoted 3 lines · Mike Frysinger
i might be thinking of a different
env_embeddedsituation. a different problem with your patch totools/Makefile: you copied the same logic multiple times which means more bitrot.Yes, that's a good point. Your patch looks good to me. Should I write a commit message and repost it or will you?
respin your patches taking my suggestions into account
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110619/18a34526/attachment.pgp
PATCH 1/1 tools: make it possible to build tools unconfigured
In reply to Mike FrysingerQuoted 5 lines · On Sat, 18 Jun 2011 15:03:09 -0400 Mike Frysinger <[email protected]> wrote:
considering LDSCRIPT/CONFIG_SYS_LDSCRIPT only get used by the top level u-boot file, and only when the system is configured, i wonder if we shouldnt just rip it out of config.mk and into the top level
Makefile.let's see what Scott thinks ...
Sounds fine.
-Scott
PATCH 1/1 tools: make it possible to build tools unconfigured
In reply to Ilya YanokDear Ilya,
Quoted 11 lines · In message <[email protected]> you wrote:
Sometimes we want to build common tools without configuring for specific target. Currently top
Makefilehas some support for this but it doesn't work. This patch tries to fix this.
Things changed:
- config.mk disable 'ld script not found error' in case if we are
building tools only.
-Makefilemkimage relies on autogenerated version so we need to
move $(VERSION_FILE) rule out of ifeq and make tools rule depend on it.
-tools/Makefileputcommon/env_embedded.oand envcrc.o to object list
conditionally. This fixes errors during dependency generation.
Quoted 6 lines
Signed-off-by Ilya Yanok <[email protected]>--- Makefile | 34 +++++++++++++++++----------------- config.mk | 2 ++ tools/Makefile | 19 ++++++++++++++++--- 3 files changed, 35 insertions(+), 20 deletions(-)
Is it correct to assume that this commit has been obsolteted by the following commits:
249b53a 2011-10-06 20:19:42 +0200 Build timestamp_autogenerated.h without config a76406f 2011-10-06 20:20:15 +0200 Safer timestamp_autogenerated.h generation 9f87658 2011-10-06 20:21:16 +0200 ublimage: NAND block size isn't set at build-time
?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Every living thing wants to survive. -- Spock, "The Ultimate Computer", stardate 4731.3
PATCH 1/1 tools: make it possible to build tools unconfigured
Dear Wolfgang,
Quoted 18 lines · Wolfgang Denk
Quoted 11 lines
Sometimes we want to build common tools without configuring for specific target. Currently top
Makefilehas some support for this but it doesn't work. This patch tries to fix this.
Things changed:
- config.mk disable 'ld script not found error' in case if we are
building tools only.
-Makefilemkimage relies on autogenerated version so we need to
move $(VERSION_FILE) rule out of ifeq and make tools rule depend on it.
-tools/Makefileputcommon/env_embedded.oand envcrc.o to object list
conditionally. This fixes errors during dependency generation.Quoted 6 lines
Signed-off-by Ilya Yanok <[email protected]>--- Makefile | 34 +++++++++++++++++----------------- config.mk | 2 ++ tools/Makefile | 19 ++++++++++++++++--- 3 files changed, 35 insertions(+), 20 deletions(-)
Quoted 6 lines
Is it correct to assume that this commit has been obsolteted by the following commits:
249b53a 2011-10-06 20:19:42 +0200 Build timestamp_autogenerated.h without config a76406f 2011-10-06 20:20:15 +0200 Safer timestamp_autogenerated.h generation 9f87658 2011-10-06 20:21:16 +0200 ublimage: NAND block size isn't set at build-time
Not exactly. I've reposted my patch splitting it into three as Mike suggested, and all these patches are already applied.
The commits you mention deal with the related problems that were introduced later during the development.
Regards, Ilya.
PATCH 1/1 tools: make it possible to build tools unconfigured
Dear Ilya Yanok,
Quoted 3 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Is it correct to assume that this commit has been obsolteted by the following commits:
...
Quoted 5 lines
Not exactly. I've reposted my patch splitting it into three as Mike suggested, and all these patches are already applied.
The commits you mention deal with the related problems that were introduced later during the development.
So it should still be applied?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I am more bored than you could ever possibly be. Go back to work.
PATCH 1/1 tools: make it possible to build tools unconfigured
Dear Wolfgang,
Quoted 10 lines · Wolfgang Denk
Quoted 2 lines
Quoted 2 lines
Is it correct to assume that this commit has been obsolteted by the following commits:
...
Quoted 5 lines
Not exactly. I've reposted my patch splitting it into three as Mike suggested, and all these patches are already applied.
The commits you mention deal with the related problems that were introduced later during the development.
So it should still be applied?
No, you can just drop it. It's already applied long ago (well, its second version).
Regards, Ilya.