Kmake

From OMAPpedia

Revision as of 20:40, 11 March 2011 by Omapwiki (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script does the following:

WARNING: this does not provide any logical/functionality checks and merely uses a series of existing kernel scripts to go through the patch

#!/bin/bash

if [ x$1 = x2 ]; then
	BIG_TEST=1
	BLOAT=1
fi
if [ x$1 = x1 ]; then
	BLOAT=1
fi

TMP_PATCH=/tmp/test.patch
CHECKPATCH=/tmp/chkpatch-report
CHECKSTACK=/tmp/chkstack-report
CHECKNAMESPACE=/tmp/chknamespace-report
CHECKINCLUDE=/tmp/chkincludekernel-report
CHECKHEADERS=/tmp/chkheaderkernel-report
CHECKHEADERDEP=/tmp/chkheaderdepkernel-report
CHECK_WARN=/tmp/chkwarn-file-report
CHECK_KDOC=/tmp/chkkdoc-file-report
CHECK_INC=/tmp/chkinc-file-report
CHECK_HEADERDEP=/tmp/chkheaderdep-file-report
CHECKAM=/tmp/chkam-patch-report
CHECKB=/tmp/chkbuildkernel-report
CHECKBLOAT=/tmp/chkbloat-o-meter-report
ALLFILES="$TMP_PATCH $CHECKPATCH $CHECKNAMESPACE $CHECKINCLUDE $CHECKHEADERS
	  $CHECKHEADERDEP $CHECK_WARN $CHECK_KDOC $CHECK_INC
	  $CHECK_HEADERDEP $CHECKAM $CHECKB $CHECKBLOAT"
PRINT_FILES="$CHECKPATCH $CHECK_WARN $CHECK_KDOC $CHECK_INC $CHECK_HEADERDEP"

export mmake='make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -j1'

git format-patch -M --stdout -1> $TMP_PATCH
./scripts/checkpatch.pl --strict $TMP_PATCH >$CHECKPATCH

ALLBFILES=`diffstat -lp1 $TMP_PATCH`
CFILES=`diffstat -lp1 $TMP_PATCH|grep "c$"|sort`
OFILES=`diffstat -lp1 $TMP_PATCH|grep "[Sc]$"|sort|sed -e "s/[Sc]$/o/g"`

rm $OFILES
$mmake C=2 $OFILES  2>$CHECK_WARN

./scripts/kernel-doc $CFILES 2>$CHECK_KDOC
./scripts/checkincludes.pl $CFILES >$CHECK_INC
./scripts/headerdep.pl $CFILES >$CHECK_HEADERDEP

if [ -n "$BLOAT" ]; then
	cp $TMP_PATCH in_test.patch
	cp .config /tmp/oc
	git reset --hard HEAD^
	$mmake C=1 uImage 2>/tmp/Kerr_old
	cp vmlinux vmlinux_old
	git am $TMP_PATCH 2>$CHECKAM
	mv /tmp/oc .config
	$mmake C=1 uImage 2>/tmp/Kerr_cur
	cp vmlinux vmlinux_cur
	diff -purN /tmp/Kerr_old /tmp/Kerr_cur>$CHECKB
	./scripts/bloat-o-meter vmlinux_old vmlinux_cur >$CHECKBLOAT
	PRINT_FILES="$PRINT_FILES $CHECKAM $CHECKB $CHECKBLOAT"
fi

if [ -n "$BIG_TEST" ]; then
	$mmake checkstack >$CHECKSTACK
	$mmake namespacecheck >$CHECKNAMESPACE
	$mmake includecheck >$CHECKINCLUDE
	$mmake headers_check>$CHECKHEADERS
	$mmake headerdep>$CHECKHEADERDEP
	PRINT_FILES="$PRINT_FILES $CHECKSTACK $BORDER
		$CHECKNAMESPACE $CHECKINCLUDE $BORDER
		$CHECKHEADERS $CHECKHEADERDEP $BORDER"
fi

REPORT=./report-k-make
git branch -v>$REPORT
date>>$REPORT
for i in $PRINT_FILES
do
	f=`echo $i|cut -d '/' -f3`
	echo "========== FILE $f ======"|tee -a $REPORT
	cat $i|tee -a $REPORT
done

rm -f $ALLFILES 2>/dev/null
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox