[U-Boot] final u-boot cleanup -- Makefiles testing non-existent CONFIG vars

Robert P. J. Day rpjday at crashcourse.ca
Wed Jan 4 20:04:34 CET 2017


  last example of cleanup script for today, i promise. one more
cleanup script i wrote a while back identified something very
specific; Makefiles that were testing CONFIG_ variables when those
variables did not seem to be set anywhere.

  as in, if a Makefile contained the line:

  obj-$(CONFIG_RDAY) += rday.o

it would only make sense that the variable "CONFIG_RDAY" would need to
be set *somewhere* (or at the very least defined in a Kconfig file),
otherwise, that file would never be compiled.

  i dumped the output of that script to the same wiki page:

http://www.crashcourse.ca/wiki/index.php/U-Boot_Kconfig_cleanup

it's the last section, and it might contain a few false positives
since the Makefile itself might hardcode that variable, or might add a
compilation option of "-DCONFIG_RDAY", and so on. for the most part,
though, the list looks pretty good.

  as an example, there's this:

  >>>>> ALI152X
  ./drivers/misc/Makefile:obj-$(CONFIG_ALI152X) += ali512x.o

that means that that Makefile is testing that variable, when it does
not seem to be set by anything in the entire code base:

$ grep -r ALI152X *
drivers/misc/Makefile:obj-$(CONFIG_ALI152X) += ali512x.o
$

  here's another example:

  >>>>> CMD_FITUPD
  ./cmd/Makefile:obj-$(CONFIG_CMD_FITUPD) += fitupd.o

absolutely nothing sets that variable, so that command will never be
compiled into the image. one suspects that an entry for that command
should be added to cmd/Kconfig, no?

  finally, here's an interesting example:

  >>>>> YAFFS2
  ./fs/Makefile:obj-$(CONFIG_YAFFS2) += yaffs2/
  ./cmd/Makefile:obj-$(CONFIG_YAFFS2) += yaffs2.o

and if you search for the string "YAFFS2", you get:

cmd/yaffs2.c:#ifdef YAFFS2_DEBUG
cmd/Makefile:obj-$(CONFIG_YAFFS2) += yaffs2.o
fs/yaffs2/yaffs_packedtags1.h:/* This is used to pack YAFFS1 tags, not YAFFS2 tags. */
fs/yaffs2/yaffs_guts.h:#define YAFFS_MIN_YAFFS2_CHUNK_SIZE	1024
fs/yaffs2/yaffs_guts.h:#define YAFFS_MIN_YAFFS2_SPARE_SIZE	32
fs/yaffs2/yaffs_guts.h:/* Sequence numbers are used in YAFFS2 to determine block allocation order.
fs/yaffs2/yaffs_guts.h:/* Stuff used for extended tags in YAFFS2 */
fs/yaffs2/yaffs_guts.h:	/* YAFFS2 stuff */
fs/yaffs2/yaffs_guts.h:	/* Extra info if this is an object header (YAFFS2 only) */
fs/yaffs2/yaffs_guts.h:	 * However, if this state is returned on a YAFFS2 device,
fs/yaffs2/yaffs_packedtags2.h:/* This is used to pack YAFFS2 tags, not YAFFS1tags. */
fs/yaffs2/Makefile:		-DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE \
fs/yaffs2/yaffs_yaffs2.h:#ifndef __YAFFS_YAFFS2_H__
fs/yaffs2/yaffs_yaffs2.h:#define __YAFFS_YAFFS2_H__
fs/yaffs2/yaffs_guts.c:		 * Correction for YAFFS2: This could happen quite a lot and we
fs/yaffs2/yaffs_guts.c:			 * Backwards scanning YAFFS2: The old one is what
fs/yaffs2/yaffs_guts.c:		/* Handle YAFFS2 case (backward scanning)
fs/yaffs2/yaffs_mtdif2.c:/* mtd interface for YAFFS2 */
fs/Makefile:obj-$(CONFIG_YAFFS2) += yaffs2/
scripts/config_whitelist.txt:CONFIG_YAFFS2

  uh, this line looks interesting:

  fs/yaffs2/Makefile:             -DCONFIG_YAFFS_YAFFS2 -DNO_Y_INLINE \

is that a typo? should it read:

  fs/yaffs2/Makefile:             -DCONFIG_YAFFS2 -DNO_Y_INLINE \

anyway, that's it for today ... feel free to peruse that new list to
see what parts of Makefiles seem to not be compiled.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
\



More information about the U-Boot mailing list