Skip to contentSkip to conversation

Kbuild: sync with Linux 3.16

PATCH New Masahiro Yamada 2 participants 7 messages Aug 5, 2014 – Aug 23, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Kbuild: sync with Linux 3.16

Linux 3.16 is out now.

This series imports various Kbuild-related updates from Linux 3.16.

I am resending the same series which was put off before.

See the reply from Tom Rini
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/188802/focus=189010

Masahiro Yamada (3):
kbuild: move extra gcc checks to scripts/Makefile.extrawarn
kbuild: sync mixed targets handling with Linux 3.16
scripts: objdiff: sync with Linux 3.16

 Makefile                   | 12 ++++----
 scripts/Makefile.build     | 61 --------------------------------------
 scripts/Makefile.extrawarn | 67 +++++++++++++++++++++++++++++++++++++++++
 scripts/mkmakefile         | 15 +++-------
 scripts/objdiff            | 74 ++++++++++++++++++++++++++++------------------
 5 files changed, 122 insertions(+), 107 deletions(-)
 create mode 100644 scripts/Makefile.extrawarn
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/3 kbuild: move extra gcc checks to scripts/Makefile.extrawarn

This commit was imported from Linux Kernel:
commit a86fe353 written by me.

W=... provides extra gcc checks.

Having such code in scripts/Makefile.build results in the same flags being added to KBUILD_CFLAGS multiple times becuase scripts/Makefile.build is invoked every time Kbuild descends into the subdirectories.

Since the top Makefile is already too cluttered, this commit moves all of extra gcc check stuff to a new file scripts/Makefile.extrawarn, which is included from the top Makefile.

---

 Makefile                   |  6 ++---
 scripts/Makefile.build     | 61 -----------------------------------------
 scripts/Makefile.extrawarn | 67 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+), 65 deletions(-)
 create mode 100644 scripts/Makefile.extrawarn
Makefile +2 -4
index 5e49545..e772c1c 100644
@@ -109,10 +109,6 @@ ifeq ("$(origin O)", "command line")
   KBUILD_OUTPUT := $(O)
 endif
 
-ifeq ("$(origin W)", "command line")
-  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := $(W)
-endif
-
 # That's our default target when none is given on the command line
 PHONY := _all
 _all:
@@ -569,6 +565,8 @@ endif
 
 export CONFIG_SYS_TEXT_BASE
 
+include $(srctree)/scripts/Makefile.extrawarn
+
 # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
 KBUILD_CPPFLAGS += $(KCPPFLAGS)
 KBUILD_AFLAGS += $(KAFLAGS)
scripts/Makefile.build +0 -61

67 lines not on this page · raw message

scripts/Makefile.extrawarn new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/3 kbuild: move extra gcc checks to scripts/Makefile.extrawarn

Quoted 10 lines · Masahiro Yamada

This commit was imported from Linux Kernel:
commit a86fe353 written by me.

W=... provides extra gcc checks.

Having such code in scripts/Makefile.build results in the same flags being added to KBUILD_CFLAGS multiple times becuase scripts/Makefile.build is invoked every time Kbuild descends into the subdirectories.

Quoted 5 lines

Since the top Makefile is already too cluttered, this commit moves all of extra gcc check stuff to a new file scripts/Makefile.extrawarn, which is included from the top Makefile.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/90cae229/attachment.pgp>
#3 lore raw

PATCH 2/3 kbuild: sync mixed targets handling with Linux 3.16

In reply to Masahiro Yamada

"make %_config all" was supported for the first time in U-Boot:
commit 53bca5ab
kbuild: support simultaneous board configuration and "make all"

Surprisingly it had not been working in Linux Kernel for a long time.

So I sent back the patch to the Linux Kbuild community and it was accepted with a little code improvement, at commit 9319f453.

Now, you can do "make defconfig all" or "make %_defconfig all" in Linux too.

This commit updates some scripts to fill the code-diff between Linux and U-Boot.

---

 Makefile           |  6 +++---
 scripts/mkmakefile | 15 ++++-----------
 2 files changed, 7 insertions(+), 14 deletions(-)
Makefile +3 -3
index e772c1c..dd07550 100644
@@ -437,12 +437,12 @@ ifeq ($(mixed-targets),1)
 # We're called with mixed targets (*config and build targets).
 # Handle them one by one.
 
-PHONY += $(MAKECMDGOALS) build-one-by-one
+PHONY += $(MAKECMDGOALS) __build_one_by_one
 
-$(MAKECMDGOALS): build-one-by-one
+$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one
 	@:
 
-build-one-by-one:
+__build_one_by_one:
 	$(Q)set -e; \
 	for i in $(MAKECMDGOALS); do \
 		$(MAKE) -f $(srctree)/Makefile $$i; \
scripts/mkmakefile +4 -11
index 0cc0442..84af27b 100644
@@ -42,18 +42,11 @@ MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$
 
 MAKEFLAGS += --no-print-directory
 
-.PHONY: all \$(MAKECMDGOALS)
+.PHONY: __sub-make \$(MAKECMDGOALS)
 
-all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
+__sub-make:
+	\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
 
-all:
-	\$(Q)\$(MAKE) \$(MAKEARGS) \$(all)
-
-Makefile:;
-
-\$(all): all
-	@:
-
-%/: all
+\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
 	@:
 EOF
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/3 kbuild: sync mixed targets handling with Linux 3.16

Quoted 9 lines · Masahiro Yamada

"make %_config all" was supported for the first time in U-Boot:
commit 53bca5ab
kbuild: support simultaneous board configuration and "make all"

Surprisingly it had not been working in Linux Kernel for a long time.

So I sent back the patch to the Linux Kbuild community and it was accepted with a little code improvement, at commit 9319f453.

Quoted 7 lines

Now, you can do "make defconfig all" or "make %_defconfig all" in Linux too.

This commit updates some scripts to fill the code-diff between Linux and U-Boot.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/b0943bd2/attachment.pgp>
#5 lore raw

PATCH 3/3 scripts: objdiff: sync with Linux 3.16

In reply to Masahiro Yamada

Import scripts/objdiff improvements from Linux v3.16, which consists of 7 commits written by me.

commit 7fa0e6db3cedc9b70d68a4170f1352e2b1aa0f90
scripts: objdiff: support directories for the augument of record command

commit 8ac28bee76eec006aac5ba5c418878a607d53a9b
scripts: objdiff: fix a comment

commit 8b5d0f20d64f00ffd5685879f8eb3659379f5aaa
scripts: objdiff: change the extension of disassembly from .o to .dis

commit 18165efa8203a34d82f60a1831ea290e7304c654
scripts: objdiff: improve path flexibility for record command

commit 1ecc8e489abfdaa6d8d1689f7ff62fdf1adda30c
scripts: objdiff: remove unnecessary code

commit 5ab370e91af70d5f1b1dbaec78798a2ff236a2d5
scripts: objdiff: direct error messages to stderr

commit fd6e12423311697860f30d10398a0f9eb91977d2
scripts: objdiff: get the path to .tmp_objdiff more simply

---

 scripts/objdiff | 74 +++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 46 insertions(+), 28 deletions(-)
scripts/objdiff +46 -28
index b3e4f10..62e51da 100755
@@ -25,25 +25,47 @@
 #
 # Note: 'make mrproper' will also remove .tmp_objdiff
 
-GIT_DIR="`git rev-parse --git-dir`"
+SRCTREE=$(cd $(git rev-parse --show-toplevel 2>/dev/null); pwd)
 
-if [ -d "$GIT_DIR" ]; then
-	TMPD="${GIT_DIR%git}tmp_objdiff"
-
-	[ -d "$TMPD" ] || mkdir "$TMPD"
-else
-	echo "ERROR: git directory not found."
+if [ -z "$SRCTREE" ]; then
+	echo >&2 "ERROR: Not a git repository."
 	exit 1
 fi
 
+TMPD=$SRCTREE/.tmp_objdiff
+
 usage() {
-	echo "Usage: $0 <command> <args>"
-	echo "  record    <list of object files>"
-	echo "  diff      <commitA> <commitB>"
-	echo "  clean     all | <commit>"
+	echo >&2 "Usage: $0 <command> <args>"
+	echo >&2 "  record    <list of object files or directories>"
+	echo >&2 "  diff      <commitA> <commitB>"
+	echo >&2 "  clean     all | <commit>"
 	exit 1
 }
 
+get_output_dir() {
+	dir=${1%/*}
+
+	if [ "$dir" = "$1" ]; then
+		dir=.
+	fi
+
+	dir=$(cd $dir; pwd)
+
+	echo $TMPD/$CMT${dir#$SRCTREE}
+}
+
+do_objdump() {
+	dir=$(get_output_dir $1)
+	base=${1##*/}
+	dis=$dir/${base%.o}.dis
+
+	[ ! -d "$dir" ] && mkdir -p $dir
+
+	# remove addresses for a cleaner diff
+	# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
+	$OBJDUMP -D $1 | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis
+}
+
 dorecord() {
 	[ $# -eq 0 ] && usage
 
@@ -52,20 +74,16 @@ dorecord() {
 	CMT="`git rev-parse --short HEAD`"
 
 	OBJDUMP="${CROSS_COMPILE}objdump"
-	OBJDIFFD="$TMPD/$CMT"
-
-	[ ! -d "$OBJDIFFD" ] && mkdir -p "$OBJDIFFD"
 
-	for f in $FILES; do
-		dn="${f%/*}"
-		bn="${f##*/}"
-
-		[ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn"
-
-		# remove addresses for a more clear diff
-		# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
-		$OBJDUMP -D "$f" | sed "s/^[[:space:]]\+[0-9a-f]\+//" \
-			>"$OBJDIFFD/$dn/$bn"
+	for d in $FILES; do
+		if [ -d "$d" ]; then
+			for f in $(find $d -name '*.o')
+			do
+				do_objdump $f
+			done
+		else
+			do_objdump $d
+		fi
 	done
 }
 
@@ -90,12 +108,12 @@ dodiff() {
 	DSTD="$TMPD/$DST"
 
 	if [ ! -d "$SRCD" ]; then
-		echo "ERROR: $SRCD doesn't exist"
+		echo >&2 "ERROR: $SRCD doesn't exist"
 		exit 1
 	fi
 
 	if [ ! -d "$DSTD" ]; then
-		echo "ERROR: $DSTD doesn't exist"
+		echo >&2 "ERROR: $DSTD doesn't exist"
 		exit 1
 	fi
 
@@ -114,7 +132,7 @@ doclean() {
 		if [ -d "$TMPD/$CMT" ]; then
 			rm -rf $TMPD/$CMT
 		else
-			echo "$CMT not found"
+			echo >&2 "$CMT not found"
 		fi
 	fi
 }
@@ -135,7 +153,7 @@ case "$1" in
 		doclean $*
 		;;
 	*)
-		echo "Unrecognized command '$1'"
+		echo >&2 "Unrecognized command '$1'"
 		exit 1
 		;;
 esac
Signature · 1 line
1.9.1
#6 lore raw

PATCH 3/3 scripts: objdiff: sync with Linux 3.16

Quoted 18 lines · Masahiro Yamada

Import scripts/objdiff improvements from Linux v3.16, which consists of 7 commits written by me.

commit 7fa0e6db3cedc9b70d68a4170f1352e2b1aa0f90
scripts: objdiff: support directories for the augument of record command

commit 8ac28bee76eec006aac5ba5c418878a607d53a9b
scripts: objdiff: fix a comment

commit 8b5d0f20d64f00ffd5685879f8eb3659379f5aaa
scripts: objdiff: change the extension of disassembly from .o to .dis

commit 18165efa8203a34d82f60a1831ea290e7304c654
scripts: objdiff: improve path flexibility for record command

commit 1ecc8e489abfdaa6d8d1689f7ff62fdf1adda30c
scripts: objdiff: remove unnecessary code

Quoted 7 lines

commit 5ab370e91af70d5f1b1dbaec78798a2ff236a2d5
scripts: objdiff: direct error messages to stderr

commit fd6e12423311697860f30d10398a0f9eb91977d2
scripts: objdiff: get the path to .tmp_objdiff more simply

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140823/e21156c7/attachment.pgp>