scripts: cleanup scripts directory
Remove unused and obsolete scripts we used with Kbuild or scripts that were copied from Linux but never used or modified for Zephyr: - vercomp: not needed with cmake, version comparison is built-in - mksysmap: Linux script - make-ll parallel build script, something that is more suitable in $HOME/bin, not in Zephyr tree - headerdep.pl: Linux specific, not adapted or used with Zephyr - timestamp: used by other checkpatch scripts under scripts/checkpatch - move uncrustify.cfg to .uncrustify.cfg in top tree for easy access and alongside other configuration files. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
6f979c39eb
commit
fdadb501f7
|
@ -15,8 +15,8 @@
|
|||
|
||||
exe_name=$(basename $0)
|
||||
|
||||
do_checkpatch_bin=${ZEPHYR_BASE}/scripts/do_checkpatch.sh
|
||||
timestamp_bin=${ZEPHYR_BASE}/scripts/timestamp
|
||||
do_checkpatch_bin=${ZEPHYR_BASE}/scripts/checkpatch/do_checkpatch.sh
|
||||
timestamp_bin=${ZEPHYR_BASE}/scripts/checkpatch/timestamp
|
||||
|
||||
declare update=n
|
||||
declare quiet=n
|
||||
|
|
|
@ -24,7 +24,7 @@ checkpatch_switches="\
|
|||
"
|
||||
ignore_list=BRACES,PRINTK_WITHOUT_KERN_LEVEL,SPLIT_STRING,FILE_PATH_CHANGES,GERRIT_CHANGE_ID
|
||||
|
||||
timestamp_bin=${ZEPHYR_BASE}/scripts/timestamp
|
||||
timestamp_bin=${ZEPHYR_BASE}/scripts/checkpatch/timestamp
|
||||
timestamp="${timestamp_bin} -u"
|
||||
checkpatch_bin=${ZEPHYR_BASE}/scripts/checkpatch.pl
|
||||
checkpatch="${checkpatch_bin} ${checkpatch_switches} --ignore ${ignore_list}"
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
#! /usr/bin/perl
|
||||
#
|
||||
# Detect cycles in the header file dependency graph
|
||||
# Vegard Nossum <vegardno@ifi.uio.no>
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Getopt::Long;
|
||||
|
||||
my $opt_all;
|
||||
my @opt_include;
|
||||
my $opt_graph;
|
||||
|
||||
&Getopt::Long::Configure(qw(bundling pass_through));
|
||||
&GetOptions(
|
||||
help => \&help,
|
||||
version => \&version,
|
||||
|
||||
all => \$opt_all,
|
||||
"I=s" => \@opt_include,
|
||||
graph => \$opt_graph,
|
||||
);
|
||||
|
||||
push @opt_include, 'include';
|
||||
my %deps = ();
|
||||
my %linenos = ();
|
||||
|
||||
my @headers = grep { strip($_) } @ARGV;
|
||||
|
||||
parse_all(@headers);
|
||||
|
||||
if($opt_graph) {
|
||||
graph();
|
||||
} else {
|
||||
detect_cycles(@headers);
|
||||
}
|
||||
|
||||
|
||||
sub help {
|
||||
print "Usage: $0 [options] file...\n";
|
||||
print "\n";
|
||||
print "Options:\n";
|
||||
print " --all\n";
|
||||
print " --graph\n";
|
||||
print "\n";
|
||||
print " -I includedir\n";
|
||||
print "\n";
|
||||
print "To make nice graphs, try:\n";
|
||||
print " $0 --graph include/linux/kernel.h | dot -Tpng -o graph.png\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub version {
|
||||
print "headerdep version 2\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Get a file name that is relative to our include paths
|
||||
sub strip {
|
||||
my $filename = shift;
|
||||
|
||||
for my $i (@opt_include) {
|
||||
my $stripped = $filename;
|
||||
$stripped =~ s/^$i\///;
|
||||
|
||||
return $stripped if $stripped ne $filename;
|
||||
}
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
# Search for the file name in the list of include paths
|
||||
sub search {
|
||||
my $filename = shift;
|
||||
return $filename if -f $filename;
|
||||
|
||||
for my $i (@opt_include) {
|
||||
my $path = "$i/$filename";
|
||||
return $path if -f $path;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub parse_all {
|
||||
# Parse all the headers.
|
||||
my @queue = @_;
|
||||
while(@queue) {
|
||||
my $header = pop @queue;
|
||||
next if exists $deps{$header};
|
||||
|
||||
$deps{$header} = [] unless exists $deps{$header};
|
||||
|
||||
my $path = search($header);
|
||||
next unless $path;
|
||||
|
||||
open(my $file, '<', $path) or die($!);
|
||||
chomp(my @lines = <$file>);
|
||||
close($file);
|
||||
|
||||
for my $i (0 .. $#lines) {
|
||||
my $line = $lines[$i];
|
||||
if(my($dep) = ($line =~ m/^#\s*include\s*<(.*?)>/)) {
|
||||
push @queue, $dep;
|
||||
push @{$deps{$header}}, [$i + 1, $dep];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_cycle {
|
||||
# $cycle[n] includes $cycle[n + 1];
|
||||
# $cycle[-1] will be the culprit
|
||||
my $cycle = shift;
|
||||
|
||||
# Adjust the line numbers
|
||||
for my $i (0 .. $#$cycle - 1) {
|
||||
$cycle->[$i]->[0] = $cycle->[$i + 1]->[0];
|
||||
}
|
||||
$cycle->[-1]->[0] = 0;
|
||||
|
||||
my $first = shift @$cycle;
|
||||
my $last = pop @$cycle;
|
||||
|
||||
my $msg = "In file included";
|
||||
printf "%s from %s,\n", $msg, $last->[1] if defined $last;
|
||||
|
||||
for my $header (reverse @$cycle) {
|
||||
printf "%s from %s:%d%s\n",
|
||||
" " x length $msg,
|
||||
$header->[1], $header->[0],
|
||||
$header->[1] eq $last->[1] ? ' <-- here' : '';
|
||||
}
|
||||
|
||||
printf "%s:%d: warning: recursive header inclusion\n",
|
||||
$first->[1], $first->[0];
|
||||
}
|
||||
|
||||
# Find and print the smallest cycle starting in the specified node.
|
||||
sub detect_cycles {
|
||||
my @queue = map { [[0, $_]] } @_;
|
||||
while(@queue) {
|
||||
my $top = pop @queue;
|
||||
my $name = $top->[-1]->[1];
|
||||
|
||||
for my $dep (@{$deps{$name}}) {
|
||||
my $chain = [@$top, [$dep->[0], $dep->[1]]];
|
||||
|
||||
# If the dep already exists in the chain, we have a
|
||||
# cycle...
|
||||
if(grep { $_->[1] eq $dep->[1] } @$top) {
|
||||
print_cycle($chain);
|
||||
next if $opt_all;
|
||||
return;
|
||||
}
|
||||
|
||||
push @queue, $chain;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub mangle {
|
||||
$_ = shift;
|
||||
s/\//__/g;
|
||||
s/\./_/g;
|
||||
s/-/_/g;
|
||||
$_;
|
||||
}
|
||||
|
||||
# Output dependency graph in GraphViz language.
|
||||
sub graph {
|
||||
print "digraph {\n";
|
||||
|
||||
print "\t/* vertices */\n";
|
||||
for my $header (keys %deps) {
|
||||
printf "\t%s [label=\"%s\"];\n",
|
||||
mangle($header), $header;
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
print "\t/* edges */\n";
|
||||
for my $header (keys %deps) {
|
||||
for my $dep (@{$deps{$header}}) {
|
||||
printf "\t%s -> %s;\n",
|
||||
mangle($header), mangle($dep->[1]);
|
||||
}
|
||||
}
|
||||
|
||||
print "}\n";
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (c) 2014-2015 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[ x$(which grep) = x ] && exit -1
|
||||
|
||||
num_cpus=$(\grep -c "^processor" /proc/cpuinfo)
|
||||
|
||||
if [ x${ZEPHYR_JOBS} = x ]; then
|
||||
ZEPHYR_JOBS=$((${num_cpus} * 2 + 1))
|
||||
fi
|
||||
|
||||
echo Using $ZEPHYR_JOBS threads
|
||||
nice make --jobs=${ZEPHYR_JOBS} --load-average=${num_cpus} $@
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/sh -x
|
||||
# Based on the vmlinux file create the System.map file
|
||||
# System.map is used by module-init tools and some debugging
|
||||
# tools to retrieve the actual addresses of symbols in the kernel.
|
||||
#
|
||||
# Usage
|
||||
# mksysmap vmlinux System.map
|
||||
|
||||
|
||||
#####
|
||||
# Generate System.map (actual filename passed as second argument)
|
||||
|
||||
# $NM produces the following output:
|
||||
# f0081e80 T alloc_vfsmnt
|
||||
|
||||
# The second row specify the type of the symbol:
|
||||
# A = Absolute
|
||||
# B = Uninitialised data (.bss)
|
||||
# C = Common symbol
|
||||
# D = Initialised data
|
||||
# G = Initialised data for small objects
|
||||
# I = Indirect reference to another symbol
|
||||
# N = Debugging symbol
|
||||
# R = Read only
|
||||
# S = Uninitialised data for small objects
|
||||
# T = Text code symbol
|
||||
# U = Undefined symbol
|
||||
# V = Weak symbol
|
||||
# W = Weak symbol
|
||||
# Corresponding small letters are local symbols
|
||||
|
||||
# For System.map filter away:
|
||||
# a - local absolute symbols
|
||||
# U - undefined global symbols
|
||||
# N - debugging symbols
|
||||
# w - local weak symbols
|
||||
|
||||
# readprofile starts reading symbols when _stext is found, and
|
||||
# continue until it finds a symbol which is not either of 'T', 't',
|
||||
# 'W' or 'w'. __crc_ are 'A' and placed in the middle
|
||||
# so we just ignore them to let readprofile continue to work.
|
||||
# (At least sparc64 has __crc_ in the middle).
|
||||
|
||||
$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
|
|
@ -1,43 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# `vercomp()` is copied from: http://stackoverflow.com/a/4025065
|
||||
|
||||
# Usage: vercomp <version 1> <version 2>
|
||||
# return codes:
|
||||
# 0: version 1 and version 2 are the same
|
||||
# 1: version 1 is higher
|
||||
# 2: version 2 is higher
|
||||
|
||||
|
||||
vercomp () {
|
||||
if [[ $1 == $2 ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
# fill empty fields in ver1 with zeros
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
||||
do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i=0; i<${#ver1[@]}; i++))
|
||||
do
|
||||
if [[ -z ${ver2[i]} ]]
|
||||
then
|
||||
# fill empty fields in ver2 with zeros
|
||||
ver2[i]=0
|
||||
fi
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
||||
then
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
vercomp $1 $2
|
Loading…
Reference in a new issue