aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2016-09-22 11:41:08 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2016-09-22 11:41:08 +0300
commit3e4b5ee336bf4a1ed12deee4d90eb2cceedadcc4 (patch)
tree1932f1c3bf67a06e8be041e080b311ea1fc8d8fa /meta-linaro
parent8d090bb620da4030d4e3e4734f1c0f497960a02a (diff)
downloadmeta-linaro-3e4b5ee336bf4a1ed12deee4d90eb2cceedadcc4.tar.gz
idlestat: update recipe to 0.6 release
* Use the LICENSE file instead of Makefile for the license checksum and update the checksum as appropriate - no license changes (still GPL-2.0) * Update PV from 0.2+git to 0.6+git * Update the SRCREV to 0.6 tag commit * Add patches submitted upstream to fix various minor issues found with static analysis * Pass CC to oe-runmake, otherwise we don't cross-compile Change-Id: I26c7e3250ffd1a79e3190a15eecf4d979bb602f4 Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Diffstat (limited to 'meta-linaro')
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/0001-Replace-deprecated-readdir_r-with-readdir.patch55
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/0002-topology-remove-check-for-same-cpuid-cannot-exist-in.patch31
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/0003-fix-memory-leak-in-cpuidle_get_target_residency-free.patch28
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/0004-Fix-TRACE_IPIIRQ_FORMAT-string-format-width-overflow.patch35
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/0005-Use-zu-format-specifier-for-size_t-types.patch40
-rw-r--r--meta-linaro/recipes-extra/idlestat/files/Makefile.patch17
-rw-r--r--meta-linaro/recipes-extra/idlestat/idlestat_git.bb19
7 files changed, 221 insertions, 4 deletions
diff --git a/meta-linaro/recipes-extra/idlestat/files/0001-Replace-deprecated-readdir_r-with-readdir.patch b/meta-linaro/recipes-extra/idlestat/files/0001-Replace-deprecated-readdir_r-with-readdir.patch
new file mode 100644
index 00000000..ad40e714
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/0001-Replace-deprecated-readdir_r-with-readdir.patch
@@ -0,0 +1,55 @@
+From f9c43f7bc8edff2e9accc993adb87cd0b5719980 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 31 Aug 2016 09:38:12 +0100
+Subject: [PATCH 1/5] Replace deprecated readdir_r with readdir
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+readdir_r is deprecated and should be replaced with readdir. readdir_r
+is considered unsafe on systems where NAME_MAX is undefined and on
+some systems it cannot read directory entries with very long names.
+
+Fixes build warning:
+topology.c:357:2: warning: ‘readdir_r’ is deprecated
+ [-Wdeprecated-declarations]
+ while (!readdir_r(dir, &dirent, &direntp)) {
+ ^~~~~
+In file included from topology.c:35:0:
+/usr/include/dirent.h:183:12: note: declared here
+ extern int readdir_r (DIR *__restrict __dirp,
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ topology.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/topology.c b/topology.c
+index 39b07bd..e293a59 100644
+--- a/topology.c
++++ b/topology.c
+@@ -331,7 +331,7 @@ static struct cpu_topology *topo_folder_scan(char *path, folder_filter_t filter)
+ {
+ DIR *dir, *dir_topology;
+ char *basedir, *newpath;
+- struct dirent dirent, *direntp;
++ struct dirent *direntp;
+ struct stat s;
+ int ret;
+ int is_online;
+@@ -354,11 +354,7 @@ static struct cpu_topology *topo_folder_scan(char *path, folder_filter_t filter)
+ return result;
+ }
+
+- while (!readdir_r(dir, &dirent, &direntp)) {
+-
+- if (!direntp)
+- break;
+-
++ while ((direntp = readdir(dir)) != NULL) {
+ if (direntp->d_name[0] == '.')
+ continue;
+
+--
+2.9.3
+
diff --git a/meta-linaro/recipes-extra/idlestat/files/0002-topology-remove-check-for-same-cpuid-cannot-exist-in.patch b/meta-linaro/recipes-extra/idlestat/files/0002-topology-remove-check-for-same-cpuid-cannot-exist-in.patch
new file mode 100644
index 00000000..4550b4ad
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/0002-topology-remove-check-for-same-cpuid-cannot-exist-in.patch
@@ -0,0 +1,31 @@
+From 91039258fc378c747762806f06b4638430a60188 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 31 Aug 2016 09:25:40 +0100
+Subject: [PATCH 2/5] topology: remove check for same cpuid cannot exist in 2
+ different cores
+
+This breaks on recent kernels because the cpu enumation from /sys may not
+be in numerical order. Remove it for now.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ topology.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/topology.c b/topology.c
+index e293a59..1e1e774 100644
+--- a/topology.c
++++ b/topology.c
+@@ -149,9 +149,6 @@ int add_topo_info(struct cpu_topology *topo_list, struct topology_info *info)
+ if (s_core->cpu_num > 1)
+ s_core->is_ht = true;
+
+- /* Assumption: Same cpuid cannot exist in 2 different cores */
+- assert(!check_exist_from_head(&s_phy->cpu_enum_head, info->cpu_id));
+-
+ /* Add to the list (really a set) of all contained cpus in s_phy */
+ list_add_tail(&s_cpu->list_phy_enum, &s_phy->cpu_enum_head);
+
+--
+2.9.3
+
diff --git a/meta-linaro/recipes-extra/idlestat/files/0003-fix-memory-leak-in-cpuidle_get_target_residency-free.patch b/meta-linaro/recipes-extra/idlestat/files/0003-fix-memory-leak-in-cpuidle_get_target_residency-free.patch
new file mode 100644
index 00000000..c9bb70dc
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/0003-fix-memory-leak-in-cpuidle_get_target_residency-free.patch
@@ -0,0 +1,28 @@
+From 312b9908f8ab6ce208cadc7c47d5b2e9e47e1807 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 31 Aug 2016 09:54:01 +0100
+Subject: [PATCH 3/5] fix memory leak in cpuidle_get_target_residency, free
+ fpathA
+
+fpath is not being free'd causing a small memory leak, free it.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ idlestat.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/idlestat.c b/idlestat.c
+index ede98a0..f6a07e5 100644
+--- a/idlestat.c
++++ b/idlestat.c
+@@ -293,6 +293,7 @@ int cpuidle_get_target_residency(int cpu, int state)
+ free(fpath);
+ return -1;
+ }
++ free(fpath);
+ ret = fscanf(snf, "%u", &tr);
+ fclose(snf);
+
+--
+2.9.3
+
diff --git a/meta-linaro/recipes-extra/idlestat/files/0004-Fix-TRACE_IPIIRQ_FORMAT-string-format-width-overflow.patch b/meta-linaro/recipes-extra/idlestat/files/0004-Fix-TRACE_IPIIRQ_FORMAT-string-format-width-overflow.patch
new file mode 100644
index 00000000..c5b09fed
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/0004-Fix-TRACE_IPIIRQ_FORMAT-string-format-width-overflow.patch
@@ -0,0 +1,35 @@
+From 1b466c0757da1ba8eb62ebd1ade558d144f96956 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 31 Aug 2016 09:30:23 +0100
+Subject: [PATCH 4/5] Fix TRACE_IPIIRQ_FORMAT string format width overflow scan
+ issue
+
+cppcheck detected a potential buffer overflow with a %s scanf width format
+specifier being larger than the destination buffer. Reduce the scan size to
+match the expected buffer size.
+
+Fixes error:
+[idlestat.c:974]: (error) Width 32 given in format string (no. 2) is larger
+ than destination buffer 'irqname[17]', use %16s to prevent overflowing it.
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ idlestat.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/idlestat.c b/idlestat.c
+index f6a07e5..c956032 100644
+--- a/idlestat.c
++++ b/idlestat.c
+@@ -950,7 +950,7 @@ void output_cstate_info(FILE *f, struct cpu_topology * topo, int nrcpus)
+ }
+
+ #define TRACE_IRQ_FORMAT "%*[^[][%d] %*[^=]=%d%*[^=]=%16s"
+-#define TRACE_IPIIRQ_FORMAT "%*[^[][%d] %*[^(](%32s"
++#define TRACE_IPIIRQ_FORMAT "%*[^[][%d] %*[^(](%16s"
+ #define TRACECMD_REPORT_FORMAT "%*[^]]] %lf:%*[^=]=%u%*[^=]=%d"
+ #define TRACE_FORMAT "%*[^]]] %*s %lf:%*[^=]=%u%*[^=]=%d"
+
+--
+2.9.3
+
diff --git a/meta-linaro/recipes-extra/idlestat/files/0005-Use-zu-format-specifier-for-size_t-types.patch b/meta-linaro/recipes-extra/idlestat/files/0005-Use-zu-format-specifier-for-size_t-types.patch
new file mode 100644
index 00000000..f57d58ee
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/0005-Use-zu-format-specifier-for-size_t-types.patch
@@ -0,0 +1,40 @@
+From 8fa49bb41b6192d6c7de177569760968c4bc0680 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Wed, 31 Aug 2016 10:17:32 +0100
+Subject: [PATCH 5/5] Use %zu format specifier for size_t types
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+ tracefile_idlestat.c | 2 +-
+ tracefile_tracecmd.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tracefile_idlestat.c b/tracefile_idlestat.c
+index 3430693..01b1b26 100644
+--- a/tracefile_idlestat.c
++++ b/tracefile_idlestat.c
+@@ -166,7 +166,7 @@ void load_text_data_lines(FILE *f, char *buffer, struct cpuidle_datas *datas)
+ }
+ } while (fgets(buffer, BUFSIZE, f));
+
+- fprintf(stderr, "Log is %lf secs long with %zd events\n",
++ fprintf(stderr, "Log is %lf secs long with %zu events\n",
+ end - begin, count);
+ }
+
+diff --git a/tracefile_tracecmd.c b/tracefile_tracecmd.c
+index 586d3c5..eda7b6b 100644
+--- a/tracefile_tracecmd.c
++++ b/tracefile_tracecmd.c
+@@ -50,7 +50,7 @@ void tracecmd_load_text_data_lines(FILE *f, char *buffer, struct cpuidle_datas *
+ }
+ } while (fgets(buffer, BUFSIZE, f));
+
+- fprintf(stderr, "Log is %lf secs long with %zd events\n",
++ fprintf(stderr, "Log is %lf secs long with %zu events\n",
+ end - begin, count);
+ }
+
+--
+2.9.3
+
diff --git a/meta-linaro/recipes-extra/idlestat/files/Makefile.patch b/meta-linaro/recipes-extra/idlestat/files/Makefile.patch
new file mode 100644
index 00000000..ef34babe
--- /dev/null
+++ b/meta-linaro/recipes-extra/idlestat/files/Makefile.patch
@@ -0,0 +1,17 @@
+Index: idlestat-0.5/Makefile
+===================================================================
+--- idlestat-0.5.orig/Makefile
++++ idlestat-0.5/Makefile
+@@ -38,10 +38,10 @@ OBJS = idlestat.o topology.o trace.o uti
+ default: idlestat
+
+ %.o: %.c
+- $(CROSS_COMPILE)$(CC) -c -o $@ $< $(CFLAGS)
++ $(CROSS_COMPILE)$(CC) -c $(CPPFLAGS) -o $@ $< $(CFLAGS)
+
+ idlestat: $(OBJS)
+- $(CROSS_COMPILE)$(CC) $(CFLAGS) $(OBJS) -o $@
++ $(CROSS_COMPILE)$(CC) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS)
+
+ install: idlestat idlestat.1
+ install -D -t /usr/local/bin idlestat
diff --git a/meta-linaro/recipes-extra/idlestat/idlestat_git.bb b/meta-linaro/recipes-extra/idlestat/idlestat_git.bb
index 7018cc11..3de7c976 100644
--- a/meta-linaro/recipes-extra/idlestat/idlestat_git.bb
+++ b/meta-linaro/recipes-extra/idlestat/idlestat_git.bb
@@ -3,14 +3,25 @@ SUMMARY = "Idlestat is a tool which can show how long a CPU or cluster \
enters idle state. This infomation is obtained using traces from trace-cmd \
or ftrace tools."
LICENSE = "GPL-2.0"
-LIC_FILES_CHKSUM = "file://Makefile;md5=1e2d28a88b081f97157089bb67d4249d"
-SRCREV = "6de5e87ccf87beb0946c627c10554efb1480326f"
-PV = "0.2+git${SRCPV}"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=eb723b61539feef013de476e68b5c50a"
+SRCREV = "7398755f136d551c03ebc1e784625e9e3f77c1de"
+PV = "0.6+git${SRCPV}"
-SRC_URI = "git://git.linaro.org/power/idlestat.git"
+SRC_URI = "git://git.linaro.org/power/idlestat.git \
+ file://Makefile.patch \
+ file://0001-Replace-deprecated-readdir_r-with-readdir.patch \
+ file://0002-topology-remove-check-for-same-cpuid-cannot-exist-in.patch \
+ file://0003-fix-memory-leak-in-cpuidle_get_target_residency-free.patch \
+ file://0004-Fix-TRACE_IPIIRQ_FORMAT-string-format-width-overflow.patch \
+ file://0005-Use-zu-format-specifier-for-size_t-types.patch \
+"
S = "${WORKDIR}/git"
+do_compile() {
+ oe_runmake CC='${CC}'
+}
+
do_install () {
install -D -p -m0755 idlestat ${D}/${sbindir}/idlestat
}