summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile57
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/Makefile.clean9
-rw-r--r--scripts/Makefile.kasan17
-rw-r--r--scripts/Makefile.lib21
-rw-r--r--scripts/basic/Makefile3
-rw-r--r--scripts/dtc/Makefile3
-rw-r--r--scripts/imx/Makefile6
-rw-r--r--scripts/imx/imx-image.c17
-rw-r--r--scripts/imx/imx-usb-loader.c2
-rw-r--r--scripts/mod/Makefile4
-rw-r--r--scripts/mxsimage.c11
-rw-r--r--scripts/rsatoc.c2
-rw-r--r--scripts/setupmbr/Makefile3
-rwxr-xr-xscripts/spdxcheck.py7
-rw-r--r--scripts/tegra/Makefile4
16 files changed, 91 insertions, 77 deletions
diff --git a/scripts/Makefile b/scripts/Makefile
index 75e68822d1..30b7ec540c 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -1,50 +1,45 @@
###
# scripts contains sources for various helper programs used throughout
# barebox for the build process.
-# ---------------------------------------------------------------------------
-# kallsyms: Find all symbols in barebox
-hostprogs-y += bin2c
-hostprogs-y += mkimage
-hostprogs-y += fix_size
-hostprogs-y += bareboxenv
-hostprogs-y += bareboxcrc32
-hostprogs-y += kernel-install
-hostprogs-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
+hostprogs-always-y += bin2c
+hostprogs-always-y += mkimage
+hostprogs-always-y += fix_size
+hostprogs-always-y += bareboxenv
+hostprogs-always-y += bareboxcrc32
+hostprogs-always-y += kernel-install
+hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS) += rsatoc
HOSTCFLAGS_rsatoc = `pkg-config --cflags openssl`
HOSTLDLIBS_rsatoc = `pkg-config --libs openssl`
-hostprogs-$(CONFIG_IMD) += bareboximd
-hostprogs-$(CONFIG_KALLSYMS) += kallsyms
-hostprogs-$(CONFIG_MIPS) += mips-relocs
-hostprogs-$(CONFIG_MVEBU_HOSTTOOLS) += kwbimage kwboot mvebuimg
-hostprogs-$(CONFIG_ARCH_OMAP) += omap_signGP mk-omap-image
-hostprogs-$(CONFIG_ARCH_S5PCxx) += s5p_cksum
-hostprogs-$(CONFIG_ARCH_DAVINCI) += mkublheader
+hostprogs-always-$(CONFIG_IMD) += bareboximd
+hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms
+hostprogs-always-$(CONFIG_MIPS) += mips-relocs
+hostprogs-always-$(CONFIG_MVEBU_HOSTTOOLS) += kwbimage kwboot mvebuimg
+hostprogs-always-$(CONFIG_ARCH_OMAP) += omap_signGP mk-omap-image
+hostprogs-always-$(CONFIG_ARCH_S5PCxx) += s5p_cksum
+hostprogs-always-$(CONFIG_ARCH_DAVINCI) += mkublheader
HOSTCFLAGS_zynq_mkimage.o = -I$(srctree) -I$(srctree)/arch/arm/mach-zynq/include
-hostprogs-$(CONFIG_ARCH_ZYNQ) += zynq_mkimage
-hostprogs-$(CONFIG_ARCH_SOCFPGA) += socfpga_mkimage
-hostprogs-$(CONFIG_MXS_HOSTTOOLS)+= mxsimage mxsboot
-hostprogs-$(CONFIG_ARCH_LAYERSCAPE) += pblimage
-hostprogs-$(CONFIG_ARCH_STM32MP) += stm32image
+hostprogs-always-$(CONFIG_ARCH_ZYNQ) += zynq_mkimage
+hostprogs-always-$(CONFIG_ARCH_SOCFPGA) += socfpga_mkimage
+hostprogs-always-$(CONFIG_MXS_HOSTTOOLS) += mxsimage mxsboot
+hostprogs-always-$(CONFIG_ARCH_LAYERSCAPE) += pblimage
+hostprogs-always-$(CONFIG_ARCH_STM32MP) += stm32image
KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
HOSTLDLIBS_mxsimage = `pkg-config --libs openssl`
HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
HOSTLDLIBS_omap3-usb-loader = `pkg-config --libs libusb-1.0`
-hostprogs-$(CONFIG_OMAP3_USB_LOADER) += omap3-usb-loader
+hostprogs-always-$(CONFIG_OMAP3_USB_LOADER) += omap3-usb-loader
HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
-hostprogs-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT) += omap4_usbboot
+hostprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT) += omap4_usbboot
-userprogs-$(CONFIG_BAREBOXENV_TARGET) += bareboxenv-target
-userprogs-$(CONFIG_KERNEL_INSTALL_TARGET) += kernel-install-target
-userprogs-$(CONFIG_BAREBOXCRC32_TARGET) += bareboxcrc32-target
-userprogs-$(CONFIG_IMD_TARGET) += bareboximd-target
+userprogs-always-$(CONFIG_BAREBOXENV_TARGET) += bareboxenv-target
+userprogs-always-$(CONFIG_KERNEL_INSTALL_TARGET) += kernel-install-target
+userprogs-always-$(CONFIG_BAREBOXCRC32_TARGET) += bareboxcrc32-target
+userprogs-always-$(CONFIG_IMD_TARGET) += bareboximd-target
userccflags += -I $(srctree)/$(src)/include
-userprogs := $(userprogs-y)
-always-y := $(hostprogs-y) $(hostprogs-m) $(userprogs-y)
-
subdir-y += mod
subdir-y += imx
subdir-$(CONFIG_X86) += setupmbr
@@ -52,4 +47,4 @@ subdir-$(CONFIG_DTC) += dtc
subdir-$(CONFIG_ARCH_TEGRA) += tegra
# Let clean descend into subdirs
-subdir- += basic kconfig setupmbr
+subdir- += basic kconfig
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a3dfe261af..1614a1ac58 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -45,7 +45,7 @@ include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-di
include scripts/Makefile.lib
# Do not include host rules unless needed
-ifneq ($(hostprogs)$(hostprogs-y)$(hostprogs-m),)
+ifneq ($(hostprogs),)
include scripts/Makefile.host
endif
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index 97fd2ef48c..3c4519fa8a 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -35,9 +35,12 @@ subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
# build a list of files to remove, usually relative to the current
# directory
-__clean-files := $(extra-y) $(extra-m) $(extra-) \
- $(always) $(always-y) $(always-m) $(always-) $(targets) $(clean-files) \
- $(hostprogs) $(hostprogs-y) $(hostprogs-m) $(hostprogs-) $(userprogs)
+__clean-files := \
+ $(clean-files) $(targets) $(hostprogs) $(userprogs) \
+ $(extra-y) $(extra-m) $(extra-) \
+ $(always-y) $(always-m) $(always-) \
+ $(hostprogs-always-y) $(hostprogs-always-m) $(hostprogs-always-) \
+ $(userprogs-always-y) $(userprogs-always-m) $(userprogs-always-)
# as clean-files is given relative to the current directory, this adds
# a $(obj) prefix, except for absolute paths
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan
new file mode 100644
index 0000000000..83f6aa543d
--- /dev/null
+++ b/scripts/Makefile.kasan
@@ -0,0 +1,17 @@
+ # SPDX-License-Identifier: GPL-2.0
+ifdef CONFIG_KASAN
+CFLAGS_KASAN_NOSANITIZE := -fno-builtin
+KASAN_SHADOW_OFFSET ?= $(CONFIG_KASAN_SHADOW_OFFSET)
+endif
+
+CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
+
+cc-param = $(call cc-option, -mllvm -$(1), $(call cc-option, --param $(1)))
+
+CFLAGS_KASAN := $(CFLAGS_KASAN_MINIMAL) \
+ $(call cc-param,asan-globals=1) \
+ $(call cc-param,asan-instrument-allocas=1)
+
+ifndef CONFIG_CPU_64
+CFLAGS_KASAN += $(call cc-param,asan-stack=1)
+endif
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 337430cd00..2844d29be6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -89,6 +89,17 @@ real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))
always-y += $(always-m)
+# hostprogs-always-y += foo
+# ... is a shorthand for
+# hostprogs += foo
+# always-y += foo
+hostprogs += $(hostprogs-always-y) $(hostprogs-always-m)
+always-y += $(hostprogs-always-y) $(hostprogs-always-m)
+
+# userprogs-always-y is likewise.
+userprogs += $(userprogs-always-y) $(userprogs-always-m)
+always-y += $(userprogs-always-y) $(userprogs-always-m)
+
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))
@@ -127,6 +138,16 @@ _c_flags = $(KBUILD_CFLAGS) $(ccflags-y) $(CFLAGS_$(target-stem).o)
_a_flags = $(KBUILD_AFLAGS) $(asflags-y) $(AFLAGS_$(target-stem).o)
_cpp_flags = $(KBUILD_CPPFLAGS) $(cppflags-y) $(CPPFLAGS_$(target-stem).lds)
+#
+# Enable address sanitizer flags for kernel except some files or directories
+# we don't want to check (depends on variables KASAN_SANITIZE_obj.o, KASAN_SANITIZE)
+#
+ifeq ($(CONFIG_KASAN),y)
+_c_flags += $(if $(part-of-pbl),, $(if $(patsubst n%,, \
+ $(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \
+ $(CFLAGS_KASAN), $(CFLAGS_KASAN_NOSANITIZE)))
+endif
+
ifeq ($(CONFIG_UBSAN),y)
_CFLAGS_UBSAN = $(eval _CFLAGS_UBSAN := $(CFLAGS_UBSAN))$(_CFLAGS_UBSAN)
_c_flags += $(if $(patsubst n%,, \
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile
index 290dd27d28..eeb6a38c55 100644
--- a/scripts/basic/Makefile
+++ b/scripts/basic/Makefile
@@ -2,5 +2,4 @@
#
# fixdep: used to generate dependency information during build process
-hostprogs := fixdep
-always-y := $(hostprogs)
+hostprogs-always-y += fixdep
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 69b0f6a0e0..06a265cf7b 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -1,8 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# scripts/dtc makefile
-hostprogs-$(CONFIG_DTC) := dtc fdtget
-always := $(hostprogs-y)
+hostprogs-always-$(CONFIG_DTC) += dtc fdtget
dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
srcpos.o checks.o util.o
diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
index e7af2c98ef..029f9ca9f8 100644
--- a/scripts/imx/Makefile
+++ b/scripts/imx/Makefile
@@ -1,7 +1,5 @@
-hostprogs-$(CONFIG_ARCH_IMX_IMXIMAGE) += imx-image
-hostprogs-$(CONFIG_ARCH_IMX_USBLOADER) += imx-usb-loader
-
-always := $(hostprogs-y)
+hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE) += imx-image
+hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER) += imx-usb-loader
HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0`
HOSTLDLIBS_imx-usb-loader = `pkg-config --libs libusb-1.0`
diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index de04962b09..f5e89d07a6 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -1,17 +1,6 @@
-/*
- * (C) Copyright 2013 Sascha Hauer, Pengutronix
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
+// SPDX-License-Identifier: GPL-2.0-or-later
+// SPDX-FileCopyrightText: 2013 Sascha Hauer, Pengutronix
+
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 28f342633d..e277d29035 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -39,8 +39,6 @@
#define get_min(a, b) (((a) < (b)) ? (a) : (b))
-#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
-
#define FT_APP 0xaa
#define FT_CSF 0xcc
#define FT_DCD 0xee
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
index e02b9f4ce9..9926ed08dc 100644
--- a/scripts/mod/Makefile
+++ b/scripts/mod/Makefile
@@ -1,5 +1,5 @@
-hostprogs-y := modpost mk_elfconfig
-always := $(hostprogs-y) empty.o
+hostprogs-always-y += modpost mk_elfconfig
+always-y += empty.o
modpost-objs := modpost.o sumversion.o
diff --git a/scripts/mxsimage.c b/scripts/mxsimage.c
index aa25440862..d33c4c8a0a 100644
--- a/scripts/mxsimage.c
+++ b/scripts/mxsimage.c
@@ -1,10 +1,7 @@
-/*
- * Freescale i.MX23/i.MX28 SB image generator
- *
- * Copyright (C) 2012-2013 Marek Vasut <marex@denx.de>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
+// SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-OpenSSL-exception
+// SPDX-FileCopyrightText: 2012-2013 Marek Vasut <marex@denx.de>
+
+/* Freescale i.MX23/i.MX28 SB image generator */
#include <errno.h>
#include <fcntl.h>
diff --git a/scripts/rsatoc.c b/scripts/rsatoc.c
index 8f2eb8fded..f2d91b8e0d 100644
--- a/scripts/rsatoc.c
+++ b/scripts/rsatoc.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-OpenSSL-exception
/*
* rsatoc - utility to convert an RSA key to a C struct
*
diff --git a/scripts/setupmbr/Makefile b/scripts/setupmbr/Makefile
index 8680fedce7..6e33d15362 100644
--- a/scripts/setupmbr/Makefile
+++ b/scripts/setupmbr/Makefile
@@ -1,4 +1,3 @@
HOST_EXTRACFLAGS=-I$(srctree)
-hostprogs-y := setupmbr
-always := $(hostprogs-y)
+hostprogs-always-y += setupmbr
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 723bfa4ebf..6374e078a5 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -32,7 +32,8 @@ class SPDXdata(object):
def read_spdxdata(repo):
# The subdirectories of LICENSES in the kernel source
- license_dirs = [ "preferred" ]
+ # Note: exceptions needs to be parsed as last directory.
+ license_dirs = [ "preferred", "dual", "deprecated", "exceptions" ]
lictree = repo.head.commit.tree['LICENSES']
spdx = SPDXdata()
@@ -58,13 +59,13 @@ def read_spdxdata(repo):
elif l.startswith('SPDX-Licenses:'):
for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','):
if not lic in spdx.licenses:
- raise SPDXException(None, 'Exception %s missing license %s' %(ex, lic))
+ raise SPDXException(None, 'Exception %s missing license %s' %(exception, lic))
spdx.exceptions[exception].append(lic)
elif l.startswith("License-Text:"):
if exception:
if not len(spdx.exceptions[exception]):
- raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %excid)
+ raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %exception)
spdx.exception_files += 1
else:
spdx.license_files += 1
diff --git a/scripts/tegra/Makefile b/scripts/tegra/Makefile
index 8ebc27ca73..dec0b529d6 100644
--- a/scripts/tegra/Makefile
+++ b/scripts/tegra/Makefile
@@ -1,6 +1,4 @@
-hostprogs-$(CONFIG_ARCH_TEGRA) += cbootimage
-
-always := $(hostprogs-y)
+hostprogs-always-$(CONFIG_ARCH_TEGRA) += cbootimage
HOSTLDLIBS_cbootimage = '-lm'