sparse: add as a new package selectable from the config
authorJohn Crispin <john@openwrt.org>
Sat, 12 Apr 2014 21:21:49 +0000 (21:21 +0000)
committerJohn Crispin <john@openwrt.org>
Sat, 12 Apr 2014 21:21:49 +0000 (21:21 +0000)
This change does multiple things, all related to enable sparse usage as
a static analysis tool selectable from the OpenWrt configuration:
*add a KERNEL_SPARSE option in the config to add sparse to the kernel
 build (through the C=1 option usage)
*add sparse as a new host tools. It will get selected automatically when
 the above option will be enabled

Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com>
SVN-Revision: 40490

config/Config-kernel.in
include/kernel-defaults.mk
tools/Makefile
tools/sparse/Makefile [new file with mode: 0644]

index a475e9aae21e15bee10e8bdd656cd19a074fb549..dd83cf9e7c051e9efb633a2b036ab306f2cd754f 100644 (file)
@@ -144,6 +144,10 @@ config USE_RFKILL
        bool "Enable rfkill support"
        default RFKILL_SUPPORT
 
+config USE_SPARSE
+       bool "Enable sparse check during kernel build"
+       default n
+
 #
 # CGROUP support symbols
 #
index caaa09d51ddd567a5a8884459fc5c664e45fd6d9..322aeed5fa0607f2b9cf0d58d1b976097118c426 100644 (file)
@@ -24,6 +24,10 @@ ifneq (,$(KERNEL_CC))
   KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
 endif
 
+ifdef CONFIG_USE_SPARSE
+  KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
+endif
+
 export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
 
 # defined in quilt.mk
index 428cf0bedbf00b6f18ae9bd6ebbb0172cb7890c2..75d2b0d892ff6b8f4dba551e94f040baa5fbdabc 100644 (file)
@@ -38,6 +38,7 @@ tools-$(CONFIG_TARGET_ar71xx) += lzma-old squashfs
 tools-y += lzma squashfs4
 tools-$(BUILD_B43_TOOLS) += b43-tools
 tools-$(BUILD_PPL_CLOOG) += ppl cloog
+tools-$(CONFIG_USE_SPARSE) += sparse
 
 # builddir dependencies
 $(curdir)/bison/compile := $(curdir)/flex/install
diff --git a/tools/sparse/Makefile b/tools/sparse/Makefile
new file mode 100644 (file)
index 0000000..6cdeed5
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2014 Qualcomm-Atheros Inc.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=sparse
+PKG_VERSION:=0.5.0
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@KERNEL/software/devel/sparse/dist/
+PKG_MD5SUM:=68bc834c57836251fbee55a7707bab39
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Install
+       $(INSTALL_BIN) $(HOST_BUILD_DIR)/sparse $(STAGING_DIR_HOST)/bin
+endef
+
+$(eval $(call HostBuild))