From 8e9b466799230bc20a029579e92d4cd526e5a2e1 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 20 Aug 2017 15:04:11 +0900 Subject: kbuild: use $(abspath ...) instead of $(shell cd ... && /bin/pwd) Kbuild conventionally uses $(shell cd ... && /bin/pwd) idiom to get the absolute path of the directory because GNU Make 3.80, the minimal supported version at that time, did not support $(abspath ...) or $(realpath ...). Commit 37d69ee30808 ("docs: bump minimal GNU Make version to 3.81") dropped the GNU Make 3.80 support, so we are now allowed to use those make-builtin helpers. This conversion will provide better portability without relying on the pwd command or its location /bin/pwd. I am intentionally using $(realpath ...) instead $(abspath ...) in some places. The difference between the two is $(realpath ...) returns an empty string if the given path does not exist. It is convenient in places where we need to error-out if the makefile fails to create an output directory. Signed-off-by: Masahiro Yamada Acked-by: Thierry Reding --- scripts/gdb/linux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile index 8b00031f5349..ab3cfe727a4e 100644 --- a/scripts/gdb/linux/Makefile +++ b/scripts/gdb/linux/Makefile @@ -1,6 +1,6 @@ always := gdb-scripts -SRCTREE := $(shell cd $(srctree) && /bin/pwd) +SRCTREE := $(abspath $(srctree)) $(obj)/gdb-scripts: ifneq ($(KBUILD_SRC),) -- cgit v1.2.3 From de8cf95047cfe06d0bc3b7bbbe4fd337d47da2c7 Mon Sep 17 00:00:00 2001 From: Johannes Thumshirn Date: Wed, 30 Aug 2017 16:04:13 +0200 Subject: Kbuild: enable -Wunused-macros warning for "make W=2" We have lots of dead defines and macros in drivers, lets offer users a way to detect and eventually remove them. Signed-off-by: Johannes Thumshirn Signed-off-by: Masahiro Yamada --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index fb3522fd8702..ae8a1357d01d 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -37,6 +37,7 @@ warning-2 += $(call cc-option, -Wlogical-op) warning-2 += $(call cc-option, -Wmissing-field-initializers) warning-2 += $(call cc-option, -Wsign-compare) warning-2 += $(call cc-option, -Wmaybe-uninitialized) +warning-2 += $(call cc-option, -Wunused-macros) warning-3 := -Wbad-function-cast warning-3 += -Wcast-qual -- cgit v1.2.3 From cfd63736726a7fabb3dd89ea91cff143ac4dc8a7 Mon Sep 17 00:00:00 2001 From: Nicolas Porcel Date: Sat, 19 Aug 2017 00:20:51 +0200 Subject: kbuild: Use KCONFIG_CONFIG in buildtar Previously, .config was used in buildtar script regardless of the value of KCONFIG_CONFIG. Signed-off-by: Nicolas Porcel Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/package/buildtar b/scripts/package/buildtar index e046bff33589..483ba00524d5 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -56,7 +56,7 @@ mkdir -p -- "${tmpdir}/boot" # # Try to install modules # -if grep -q '^CONFIG_MODULES=y' "${objtree}/.config"; then +if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install fi @@ -65,7 +65,7 @@ fi # Install basic kernel files # cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}" -cp -v -- "${objtree}/.config" "${tmpdir}/boot/config-${KERNELRELEASE}" +cp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}" cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" -- cgit v1.2.3 From dd965f1f0857e72eb6d4cfb28769ba01465ba01b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 2 Sep 2017 17:05:34 +0900 Subject: kbuild: buildtar: fix tar error when CONFIG_MODULES is disabled $tmpdir/lib is created by "make modules_install". It does not exist if CONFIG_MODULES is disabled, then tar reports the following messages: tar: lib: Cannot stat: No such file or directory tar: Exiting with failure status due to previous errors Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 483ba00524d5..60dd836a0214 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -51,13 +51,14 @@ esac # rm -rf -- "${tmpdir}" mkdir -p -- "${tmpdir}/boot" - +dirs=boot # # Try to install modules # if grep -q '^CONFIG_MODULES=y' "${KCONFIG_CONFIG}"; then make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install + dirs="$dirs lib" fi @@ -129,7 +130,7 @@ esac if tar --owner=root --group=root --help >/dev/null 2>&1; then opts="--owner=root --group=root" fi - tar cf - -C "$tmpdir" boot/ lib/ $opts | ${compress} > "${tarball}${file_ext}" + tar cf - -C "$tmpdir" $dirs $opts | ${compress} > "${tarball}${file_ext}" ) echo "Tarball successfully created in ${tarball}${file_ext}" -- cgit v1.2.3 From 77780f799e66cd261746a281dbbef1ee0c6997cd Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 2 Sep 2017 17:05:35 +0900 Subject: kbuild: buildtar: do not print successful message if tar returns error The previous commit spotted that "Tarball successfully created ..." is displayed even if the "tar" command returns error code because it is followed by "| ${compress}". Let the build fail instead of printing the successful message since if the "tar" command fails, the output may not be what users expect. Avoid the use of the pipe. While we are here, refactor the script removing the use of sub-shell, ${compress}, ${file_ext}. Signed-off-by: Masahiro Yamada --- scripts/package/buildtar | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 60dd836a0214..51f947118256 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -24,20 +24,19 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" # case "${1}" in tar-pkg) - compress="cat" - file_ext="" + opts= ;; targz-pkg) - compress="gzip" - file_ext=".gz" + opts=--gzip + tarball=${tarball}.gz ;; tarbz2-pkg) - compress="bzip2" - file_ext=".bz2" + opts=--bzip2 + tarball=${tarball}.bz2 ;; tarxz-pkg) - compress="xz" - file_ext=".xz" + opts=--xz + tarball=${tarball}.xz ;; *) echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 @@ -125,14 +124,12 @@ esac # # Create the tarball # -( - opts= - if tar --owner=root --group=root --help >/dev/null 2>&1; then - opts="--owner=root --group=root" - fi - tar cf - -C "$tmpdir" $dirs $opts | ${compress} > "${tarball}${file_ext}" -) +if tar --owner=root --group=root --help >/dev/null 2>&1; then + opts="$opts --owner=root --group=root" +fi + +tar cf $tarball -C $tmpdir $opts $dirs -echo "Tarball successfully created in ${tarball}${file_ext}" +echo "Tarball successfully created in $tarball" exit 0 -- cgit v1.2.3