M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
This directory contains Various useful scripts for working with OE builds
+97
View File
@@ -0,0 +1,97 @@
#!/bin/sh
export BBFETCH2=True
export BB_ENV_EXTRAWHITE="PSEUDO_BUILD PSEUDO_DISABLED $BB_ENV_EXTRAWHITE"
NO_BUILD_OPTS="--version -h --help -p --parse-only -s --show-versions -e --environment -g --graphviz"
needpseudo="1"
for opt in $@; do
for key in $NO_BUILD_OPTS; do
if [ $opt = $key ]
then
needpseudo="0"
break
fi
done
[ $needpseudo = "0" ] && break
done
# Make sure we're not using python v3.x. This check can't go into
# sanity.bbclass because bitbake's source code doesn't even pass
# parsing stage when used with python v3, so we catch it here so we
# can offer a meaningful error message.
py_v3_check=`/usr/bin/env python --version 2>&1 | grep "Python 3"`
if [ "$py_v3_check" != "" ]; then
echo "Bitbake is not compatible with python v3"
echo "Please set up python v2 as your default python interpreter"
exit 1
fi
# Similarly, we now have code that doesn't parse correctly with older
# versions of Python, and rather than fixing that and be eternally
# vigilant for any other new feature use, just check the version here.
py_v26_check=`python -c 'import sys; print sys.version_info >= (2,6,0)'`
if [ "$py_v26_check" != "True" ]; then
echo "BitBake requires Python 2.6 or later"
exit 1
fi
needtar="1"
TARVERSION=`tar --version | head -n 1 | cut -d ' ' -f 4`
float_test() {
echo | awk 'END { exit ( !( '"$1"')); }'
}
# Tar version 1.24 and onwards handle symlinks in sstate packages correctly
# but earlier versions do not
float_test "$TARVERSION > 1.23" && needtar="0"
buildpseudo="1"
if [ $needpseudo = "1" ] && [ -e "$BUILDDIR/pseudodone" ]; then
PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
if [ -e "$PSEUDOBINDIR/pseudo" -a -e "$PSEUDOBINDIR/tar" -a "$needtar" = "1" ]; then
buildpseudo="0"
fi
if [ -e "$PSEUDOBINDIR/pseudo" -a $needtar = "0" ]; then
buildpseudo="0"
fi
fi
if [ $needpseudo = "0" ]; then
buildpseudo="0"
fi
OLDPATH=$PATH
export PATH=`echo $PATH | sed s#[^:]*/scripts:##`
if [ $buildpseudo = "1" ]; then
echo "Pseudo is not present but is required, building this first before the main build"
export PSEUDO_BUILD=1
TARTARGET="tar-replacement-native"
if [ $needtar = "0" ]; then
TARTARGET=""
fi
bitbake pseudo-native $TARTARGET -c populate_sysroot
ret=$?
if [ "$ret" != "0" ]; then
exit 1
fi
PSEUDOBINDIR=`bitbake -e | grep STAGING_BINDIR_NATIVE=\" | cut -d '=' -f2 | cut -d '"' -f2`
ret=$?
if [ "$ret" != "0" ]; then
exit 1
fi
echo $PSEUDOBINDIR > $BUILDDIR/pseudodone
# This needs to exist in case pseudo has to log somewhere
mkdir -p $PSEUDOBINDIR/../../var/pseudo
fi
BITBAKE=`which bitbake`
export PATH=$OLDPATH
if [ $needpseudo = "1" ]; then
export PSEUDO_BUILD=2
PSEUDOBINDIR=`cat $BUILDDIR/pseudodone`
PSEUDO_BINDIR=$PSEUDOBINDIR PSEUDO_LIBDIR=$PSEUDOBINDIR/../lib/pseudo/lib PSEUDO_PREFIX=$PSEUDOBINDIR/../../ PSEUDO_DISABLED=1 $PSEUDOBINDIR/pseudo $BITBAKE $@
else
export PSEUDO_BUILD=0
$BITBAKE $@
fi
ret=$?
exit $ret
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
help ()
{
base=`basename $0`
echo -e "Usage: $base command"
echo "Avaliable commands:"
echo -e "\texport <file>: export and lock down the AUTOPR values from the PR service into a file for release."
echo -e "\timport <file>: import the AUTOPR values from the exported file into the PR service."
}
export ()
{
file=$1
[ "x${file}" == "x" ] && help && exit 1
rm -f ${file}
touch dummy.inc
bitbake -R conf/prexport.conf -R dummy.inc -p
s=`bitbake -R conf/prexport.conf -R dummy.inc -e | grep ^PRSERV_DUMPFILE= | cut -f2 -d\"`
rm -f dummy.inc
if [ "x${s}" != "x" ];
then
[ -e $s ] && mv -f $s $file && echo "Exporting to file $file succeeded!"
return 0
fi
echo "Exporting to file $file failed!"
return 1
}
import ()
{
file=$1
[ "x${file}" == "x" ] && help && exit 1
touch dummy.inc
bitbake -R conf/primport.conf -R dummy.inc -R $file -p
ret=$?
rm -f dummy.inc
[ $ret -eq 0 ] && echo "Importing from file $file succeeded!" || echo "Importing from file $file failed!"
return $ret
}
[ $# -eq 0 ] && help && exit 1
case $1 in
export)
export $2
;;
import)
import $2
;;
*)
help
exit 1
;;
esac
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python
# Report significant differences in the buildhistory repository since a specific revision
#
# Copyright (C) 2012 Intel Corporation
# Author: Paul Eggleton <paul.eggleton@linux.intel.com>
import sys
import os.path
# Ensure PythonGit is installed (buildhistory_analysis needs it)
try:
import git
except ImportError:
print("Please install PythonGit 0.3.1 or later in order to use this script")
sys.exit(1)
def main():
if (len(sys.argv) < 3):
print("Report significant differences in the buildhistory repository")
print("Syntax: %s <buildhistory-path> <since-revision> [to-revision]" % os.path.basename(sys.argv[0]))
print("If to-revision is not specified, it defaults to HEAD")
sys.exit(1)
# Set path to OE lib dir so we can import the buildhistory_analysis module
newpath = os.path.abspath(os.path.dirname(os.path.abspath(sys.argv[0])) + '/../meta/lib')
sys.path = sys.path + [newpath]
import oe.buildhistory_analysis
if len(sys.argv) > 3:
torev = sys.argv[3]
else:
torev = 'HEAD'
changes = oe.buildhistory_analysis.process_changes(sys.argv[1], sys.argv[2], torev)
for chg in changes:
print('%s' % chg)
sys.exit(0)
if __name__ == "__main__":
main()
+367
View File
@@ -0,0 +1,367 @@
#!/usr/bin/env python
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# Copyright 2011 Intel Corporation
# Authored-by: Yu Ke <ke.yu@intel.com>
# Paul Eggleton <paul.eggleton@intel.com>
# Richard Purdie <richard.purdie@intel.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import os, sys
import optparse
import logging
import subprocess
import ConfigParser
__version__ = "0.2.0"
def logger_create():
logger = logging.getLogger("")
loggerhandler = logging.StreamHandler()
loggerhandler.setFormatter(logging.Formatter("[%(asctime)s] %(message)s","%H:%M:%S"))
logger.addHandler(loggerhandler)
logger.setLevel(logging.INFO)
return logger
logger = logger_create()
class Configuration(object):
"""
Manages the configuration
For an example config file, see combo-layer.conf.example
"""
def __init__(self, options):
for key, val in options.__dict__.items():
setattr(self, key, val)
self.parser = ConfigParser.ConfigParser()
self.parser.readfp(open(self.conffile))
self.repos = {}
for repo in self.parser.sections():
self.repos[repo] = {}
for (name, value) in self.parser.items(repo):
if value.startswith("@"):
self.repos[repo][name] = eval(value.strip("@"))
else:
self.repos[repo][name] = value
def update(self, repo, option, value):
self.parser.set(repo, option, value)
self.parser.write(open(self.conffile, "w"))
def sanity_check(self):
required_options=["src_uri", "local_repo_dir", "dest_dir", "last_revision"]
msg = ""
for name in self.repos:
for option in required_options:
if option not in self.repos[name]:
msg = "%s\nOption %s is not defined for component %s" %(msg, option, name)
if msg != "":
logger.error("configuration file %s has the following error: %s" % (self.conffile,msg))
sys.exit(1)
# filterdiff is required by action_splitpatch, so check its availability
if subprocess.call("which filterdiff &>/dev/null", shell=True) != 0:
logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)")
sys.exit(1)
def runcmd(cmd,destdir=None):
"""
execute command, raise CalledProcessError if fail
return output if succeed
"""
logger.debug("run cmd '%s' in %s" % (cmd, os.getcwd() if destdir is None else destdir))
out = os.tmpfile()
try:
subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True)
except subprocess.CalledProcessError,e:
out.seek(0)
logger.error("%s" % out.read())
raise e
out.seek(0)
output = out.read()
logger.debug("output: %s" % output )
return output
def action_init(conf, args):
"""
Clone component repositories
Check git is initialised; if not, copy initial data from component repos
"""
for name in conf.repos:
ldir = conf.repos[name]['local_repo_dir']
if not os.path.exists(ldir):
logger.info("cloning %s to %s" %(conf.repos[name]['src_uri'], ldir))
subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True)
branch = conf.repos[name].get('branch', "master")
runcmd("git checkout %s" % branch, ldir)
if not os.path.exists(".git"):
runcmd("git init")
for name in conf.repos:
repo = conf.repos[name]
ldir = repo['local_repo_dir']
logger.info("copying data from %s..." % name)
dest_dir = repo['dest_dir']
if dest_dir and dest_dir != ".":
extract_dir = os.path.join(os.getcwd(), dest_dir)
os.makedirs(extract_dir)
else:
extract_dir = os.getcwd()
branch = repo.get('branch', "master")
file_filter = repo.get('file_filter', "")
runcmd("git archive %s | tar -x -C %s %s" % (branch, extract_dir, file_filter), ldir)
lastrev = runcmd("git rev-parse HEAD", ldir).strip()
conf.update(name, "last_revision", lastrev)
runcmd("git add .")
logger.info("Initial combo layer repository data has been created; please make any changes if desired and then use 'git commit' to make the initial commit.")
else:
logger.info("Repository already initialised, nothing to do.")
def check_repo_clean(repodir):
"""
check if the repo is clean
exit if repo is dirty
"""
output=runcmd("git status --porcelain", repodir)
if output:
logger.error("git repo %s is dirty, please fix it first", repodir)
sys.exit(1)
def action_update(conf, args):
"""
update the component repos
generate the patch list
apply the generated patches
"""
# make sure all repos are clean
for name in conf.repos:
check_repo_clean(conf.repos[name]['local_repo_dir'])
check_repo_clean(os.getcwd())
import uuid
patch_dir = "patch-%s" % uuid.uuid4()
os.mkdir(patch_dir)
for name in conf.repos:
repo = conf.repos[name]
ldir = repo['local_repo_dir']
dest_dir = repo['dest_dir']
branch = repo.get('branch', "master")
repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
# Step 1: update the component repo
runcmd("git checkout %s" % branch, ldir)
logger.info("git pull for component repo %s in %s ..." % (name, ldir))
output=runcmd("git pull", ldir)
logger.info(output)
# Step 2: generate the patch list and store to patch dir
logger.info("generating patches for %s" % name)
if dest_dir != ".":
prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir)
else:
prefix = ""
if repo['last_revision'] == "":
logger.info("Warning: last_revision of component %s is not set, starting from the first commit" % name)
patch_cmd_range = "--root %s" % branch
rev_cmd_range = branch
else:
patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
rev_cmd_range = patch_cmd_range
file_filter = repo.get('file_filter',"")
patch_cmd = "git format-patch -N %s --output-directory %s %s -- %s" % \
(prefix,repo_patch_dir, patch_cmd_range, file_filter)
output = runcmd(patch_cmd, ldir)
logger.debug("generated patch set:\n%s" % output)
patchlist = output.splitlines()
rev_cmd = 'git rev-list --no-merges ' + rev_cmd_range
revlist = runcmd(rev_cmd, ldir).splitlines()
# Step 3: Call repo specific hook to adjust patch
if 'hook' in repo:
# hook parameter is: ./hook patchpath revision reponame
count=len(revlist)-1
for patch in patchlist:
runcmd("%s %s %s %s" % (repo['hook'], patch, revlist[count], name))
count=count-1
# Step 4: write patch list and revision list to file, for user to edit later
patchlist_file = os.path.join(os.getcwd(), patch_dir, "patchlist-%s" % name)
repo['patchlist'] = patchlist_file
f = open(patchlist_file, 'w')
count=len(revlist)-1
for patch in patchlist:
f.write("%s %s\n" % (patch, revlist[count]))
count=count-1
f.close()
# Step 5: invoke bash for user to edit patch and patch list
if conf.interactive:
print 'Edit the patch and patch list in %s\n' \
'For example, remove the unwanted patch entry from patchlist-*, so that it will be not applied later\n' \
'When you are finished, run the following to continue:\n' \
' exit 0 -- exit and continue to apply the patch\n' \
' exit 1 -- abort and do not apply the patch\n' % patch_dir
ret = subprocess.call(["bash"], cwd=patch_dir)
if ret != 0:
print "Aborting without applying the patch"
sys.exit(0)
# Step 6: apply the generated and revised patch
action_apply_patch(conf, args)
runcmd("rm -rf %s" % patch_dir)
# Step 7: commit the updated config file if it's being tracked
relpath = os.path.relpath(conf.conffile)
try:
output = runcmd("git status --porcelain %s" % relpath)
except:
# Outside the repository
output = None
if output:
logger.info("Committing updated configuration file")
if output.lstrip().startswith("M"):
runcmd('git commit -m "Automatic commit to update last_revision" %s' % relpath)
def action_apply_patch(conf, args):
"""
apply the generated patch list to combo repo
"""
for name in conf.repos:
repo = conf.repos[name]
lastrev = repo["last_revision"]
for line in open(repo['patchlist']):
patchfile = line.split()[0]
lastrev = line.split()[1]
if os.path.getsize(patchfile) == 0:
logger.info("(skipping %s - no changes)", lastrev)
else:
cmd = "git am --keep-cr -s -p1 %s" % patchfile
logger.info("Apply %s" % patchfile )
try:
runcmd(cmd)
except subprocess.CalledProcessError:
logger.info('running "git am --abort" to cleanup repo')
runcmd("git am --abort")
logger.error('"%s" failed' % cmd)
logger.info("please manually apply patch %s" % patchfile)
logger.info("After applying, run this tool again to apply the remaining patches")
conf.update(name, "last_revision", lastrev)
sys.exit(0)
conf.update(name, "last_revision", lastrev)
def action_splitpatch(conf, args):
"""
generate the commit patch and
split the patch per repo
"""
logger.debug("action_splitpatch")
if len(args) > 1:
commit = args[1]
else:
commit = "HEAD"
patchdir = "splitpatch-%s" % commit
if not os.path.exists(patchdir):
os.mkdir(patchdir)
# filerange_root is for the repo whose dest_dir is root "."
# and it should be specified by excluding all other repo dest dir
# like "-x repo1 -x repo2 -x repo3 ..."
filerange_root = ""
for name in conf.repos:
dest_dir = conf.repos[name]['dest_dir']
if dest_dir != ".":
filerange_root = '%s -x "%s/*"' % (filerange_root, dest_dir)
for name in conf.repos:
dest_dir = conf.repos[name]['dest_dir']
patch_filename = "%s/%s.patch" % (patchdir, name)
if dest_dir == ".":
cmd = "git format-patch -n1 --stdout %s^..%s | filterdiff -p1 %s > %s" % (commit, commit, filerange_root, patch_filename)
else:
cmd = "git format-patch --no-prefix -n1 --stdout %s^..%s -- %s > %s" % (commit, commit, dest_dir, patch_filename)
runcmd(cmd)
# Detect empty patches (including those produced by filterdiff above
# that contain only preamble text)
if os.path.getsize(patch_filename) == 0 or runcmd("filterdiff %s" % patch_filename) == "":
os.remove(patch_filename)
logger.info("(skipping %s - no changes)", name)
else:
logger.info(patch_filename)
def action_error(conf, args):
logger.info("invalid action %s" % args[0])
actions = {
"init": action_init,
"update": action_update,
"splitpatch": action_splitpatch,
}
def main():
parser = optparse.OptionParser(
version = "Combo Layer Repo Tool version %s" % __version__,
usage = """%prog [options] action
Create and update a combination layer repository from multiple component repositories.
Action:
init initialise the combo layer repo
update get patches from component repos and apply them to the combo repo
splitpatch [commit] generate commit patch and split per component, default commit is HEAD""")
parser.add_option("-c", "--conf", help = "specify the config file (conf/combo-layer.conf is the default).",
action = "store", dest = "conffile", default = "conf/combo-layer.conf")
parser.add_option("-i", "--interactive", help = "interactive mode, user can edit the patch list and patches",
action = "store_true", dest = "interactive", default = False)
parser.add_option("-D", "--debug", help = "output debug information",
action = "store_true", dest = "debug", default = False)
options, args = parser.parse_args(sys.argv)
# Dispatch to action handler
if len(args) == 1:
logger.error("No action specified, exiting")
parser.print_help()
elif args[1] not in actions:
logger.error("Unsupported action %s, exiting\n" % (args[1]))
parser.print_help()
elif not os.path.exists(options.conffile):
logger.error("No valid config file, exiting\n")
parser.print_help()
else:
if options.debug:
logger.setLevel(logging.DEBUG)
confdata = Configuration(options)
confdata.sanity_check()
actions.get(args[1], action_error)(confdata, args[1:])
if __name__ == "__main__":
try:
ret = main()
except Exception:
ret = 1
import traceback
traceback.print_exc(5)
sys.exit(ret)
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
# Hook to add source component/revision info to commit message
# Parameter:
# $1 patch-file
# $2 revision
# $3 reponame
patchfile=$1
rev=$2
reponame=$3
sed -i -e "s#^Subject: \[PATCH\] \(.*\)#Subject: \[PATCH\] $reponame: \1#" $patchfile
sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\($reponame rev: $rev\)\n\n\1#" $patchfile
+51
View File
@@ -0,0 +1,51 @@
# combo-layer example configuration file
# component name
[bitbake]
# mandatory options
# git upstream uri
src_uri = git://git.openembedded.org/bitbake
# the directory to clone the component repo
local_repo_dir = /home/kyu3/src/test/bitbake
# the relative dir within the combo repo to put the component files
# use "." if the files should be in the root dir
dest_dir = bitbake
# the last update revision.
# "init" will set this automatically, however if it is empty when "update"
# is run, the tool will start from the first commit.
last_revision =
# optional options
# file_filter: only include the interested file
# file_filter = [path] [path] ...
# example:
# file_filter = src/ : only include the subdir src
# file_filter = src/*.c : only include the src *.c file
# file_filter = src/main.c src/Makefile.am : only include these two files
# hook: if provided, the tool will call the hook to process the generated
# patch from upstream, and then apply the modified patch to the combo
# repo.
# the hook script is called as follows: ./hook patchpath revision reponame
# example:
# hook = combo-layer-hook-default.sh
[oe-core]
src_uri = git://git.openembedded.org/openembedded-core
local_repo_dir = /home/kyu3/src/test/oecore
dest_dir = .
last_revision =
# It is also possible to embed python code in the config values. Similar
# to bitbake it considers every value starting with @ to be a python
# script.
# e.g. local_repo_dir could easily be configured using an environment
# variable:
#
# [bitbake]
# local_repo_dir = @os.getenv("LOCAL_REPO_DIR") + "/bitbake"
#
+137
View File
@@ -0,0 +1,137 @@
#!/bin/bash
#
# Copyright (c) 2011, Intel Corporation.
# All rights reserved.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# DESCRIPTION
# This script operates on the .dat file generated by bb-matrix.sh. It tolerates
# the header by skipping the first line, but error messages and bad data records
# need to be removed first. It will generate three views of the plot, and leave
# an interactive view open for further analysis.
#
# AUTHORS
# Darren Hart <dvhart@linux.intel.com>
#
# Setup the defaults
DATFILE="bb-matrix.dat"
XLABEL="BB_NUMBER_THREADS"
YLABEL="PARALLEL_MAKE"
FIELD=3
DEF_TITLE="Elapsed Time (seconds)"
PM3D_FRAGMENT="unset surface; set pm3d at s hidden3d 100"
SIZE="640,480"
function usage {
CMD=$(basename $0)
cat <<EOM
Usage: $CMD [-d datfile] [-f field] [-h] [-t title] [-w]
-d datfile The data file generated by bb-matrix.sh (default: $DATFILE)
-f field The field index to plot as the Z axis from the data file
(default: $FIELD, "$DEF_TITLE")
-h Display this help message
-s W,H PNG and window size in pixels (default: $SIZE)
-t title The title to display, should describe the field (-f) and units
(default: "$DEF_TITLE")
-w Render the plot as wireframe with a 2D colormap projected on the
XY plane rather than as the texture for the surface
EOM
}
# Parse and validate arguments
while getopts "d:f:hs:t:w" OPT; do
case $OPT in
d)
DATFILE="$OPTARG"
;;
f)
FIELD="$OPTARG"
;;
h)
usage
exit 0
;;
s)
SIZE="$OPTARG"
;;
t)
TITLE="$OPTARG"
;;
w)
PM3D_FRAGMENT="set pm3d at b"
W="-w"
;;
*)
usage
exit 1
;;
esac
done
# Ensure the data file exists
if [ ! -f "$DATFILE" ]; then
echo "ERROR: $DATFILE does not exist"
usage
exit 1
fi
PLOT_BASENAME=${DATFILE%.*}-f$FIELD$W
# Set a sane title
# TODO: parse the header and define titles for each format parameter for TIME(1)
if [ -z "$TITLE" ]; then
if [ ! "$FIELD" == "3" ]; then
TITLE="Field $FIELD"
else
TITLE="$DEF_TITLE"
fi
fi
# Determine the dgrid3d mesh dimensions size
MIN=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 1 | sort | uniq | head -n1)
MAX=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 1 | sort | uniq | tail -n1)
BB_CNT=$[${MAX#*0} - $MIN + 1]
MIN=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 2 | sort | uniq | head -n1)
MAX=$(tail -n +2 "$DATFILE" | cut -d ' ' -f 2 | sort | uniq | tail -n1)
PM_CNT=$[${MAX#*0} - $MIN + 1]
(cat <<EOF
set title "$TITLE"
set xlabel "$XLABEL"
set ylabel "$YLABEL"
set style line 100 lt 5 lw 1.5
$PM3D_FRAGMENT
set dgrid3d $PM_CNT,$BB_CNT
set ticslevel 0.2
set term png size $SIZE
set output "$PLOT_BASENAME.png"
splot "$DATFILE" every ::1 using 1:2:$FIELD with lines ls 100
set view 90,0
set output "$PLOT_BASENAME-bb.png"
replot
set view 90,90
set output "$PLOT_BASENAME-pm.png"
replot
set view 60,30
set term wxt size $SIZE
replot
EOF
) | gnuplot --persist
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
#
# Copyright (c) 2011, Intel Corporation.
# All rights reserved.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# DESCRIPTION
# This script runs BB_CMD (typically building core-image-sato) for all
# combincations of BB_RANGE and PM_RANGE values. It saves off all the console
# logs, the buildstats directories, and creates a bb-pm-runtime.dat file which
# can be used to postprocess the results with a plotting tool, spreadsheet, etc.
# Before running this script, it is recommended that you pre-download all the
# necessary sources by performing the BB_CMD once manually. It is also a good
# idea to disable cron to avoid runtime variations caused by things like the
# locate process. Be sure to sanitize the dat file prior to post-processing as
# it may contain error messages or bad runs that should be removed.
#
# AUTHORS
# Darren Hart <dvhart@linux.intel.com>
#
# The following ranges are appropriate for a 4 core system with 8 logical units
BB_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
PM_RANGE="04 05 06 07 08 09 10 11 12 13 14 15 16"
DATADIR="bb-matrix-$$"
BB_CMD="bitbake core-image-minimal"
RUNTIME_LOG="$DATADIR/bb-matrix.dat"
# See TIME(1) for a description of the time format parameters
# The following all report 0: W K r s t w
TIME_STR="%e %S %U %P %c %w %R %F %M %x"
# Prepare the DATADIR
mkdir $DATADIR
if [ $? -ne 0 ]; then
echo "Failed to create $DATADIR."
exit 1
fi
# Add a simple header
echo "BB PM $TIME_STR" > $RUNTIME_LOG
for BB in $BB_RANGE; do
for PM in $PM_RANGE; do
RUNDIR="$DATADIR/$BB-$PM-build"
mkdir $RUNDIR
BB_LOG=$RUNDIR/$BB-$PM-bitbake.log
date
echo "BB=$BB PM=$PM Logging to $BB_LOG"
# Export the variables under test and run the bitbake command
export BB_NUMBER_THREADS=$(echo $BB | sed 's/^0*//')
export PARALLEL_MAKE="-j $(echo $PM | sed 's/^0*//')"
/usr/bin/time -f "$BB $PM $TIME_STR" -a -o $RUNTIME_LOG $BB_CMD &> $BB_LOG
echo " $(tail -n1 $RUNTIME_LOG)"
echo -n " Cleaning up..."
mv tmp/buildstats $RUNDIR/$BB-$PM-buildstats
rm -f pseudodone &> /dev/null
rm -rf tmp &> /dev/null
rm -rf sstate-cache &> /dev/null
rm -rf tmp-eglibc &> /dev/null
echo "done"
done
done
+186
View File
@@ -0,0 +1,186 @@
#!/usr/bin/env python
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Copyright (C) Darren Hart <dvhart@linux.intel.com>, 2010
import sys
import getopt
import os
import os.path
import re
def usage():
print 'Usage: %s -d FILENAME [-d FILENAME]* -m METADIR [-m MATADIR]*' % os.path.basename(sys.argv[0])
print ' -d FILENAME documentation file to search'
print ' -h, --help display this help and exit'
print ' -m METADIR meta directory to search for recipes'
print ' -t FILENAME documentation config file (for doc tags)'
print ' -T Only display variables with doc tags (requires -t)'
def recipe_bbvars(recipe):
''' Return a unique set of every bbvar encountered in the recipe '''
prog = re.compile("[A-Z_]+")
vset = set()
try:
r = open(recipe)
except IOError as (errno, strerror):
print 'WARNING: Failed to open recipe ', recipe
print strerror
for line in r:
# Strip any comments from the line
line = line.rsplit('#')[0]
vset = vset.union(set(prog.findall(line)))
r.close()
bbvars = {}
for v in vset:
bbvars[v] = 1
return bbvars
def collect_bbvars(metadir):
''' Walk the metadir and collect the bbvars from each recipe found '''
bbvars = {}
for root,dirs,files in os.walk(metadir):
for name in files:
if name.find(".bb") >= 0:
for key in recipe_bbvars(os.path.join(root,name)).iterkeys():
if bbvars.has_key(key):
bbvars[key] = bbvars[key] + 1
else:
bbvars[key] = 1
return bbvars
def bbvar_is_documented(var, docfiles):
prog = re.compile(".*($|[^A-Z_])%s([^A-Z_]|$)" % (var))
for doc in docfiles:
try:
f = open(doc)
except IOError as (errno, strerror):
print 'WARNING: Failed to open doc ', doc
print strerror
for line in f:
if prog.match(line):
return True
f.close()
return False
def bbvar_doctag(var, docconf):
prog = re.compile('^%s\[doc\] *= *"(.*)"' % (var))
if docconf == "":
return "?"
try:
f = open(docconf)
except IOError as (errno, strerror):
return strerror
for line in f:
m = prog.search(line)
if m:
return m.group(1)
f.close()
return ""
def main():
docfiles = []
metadirs = []
bbvars = {}
undocumented = []
docconf = ""
onlydoctags = False
# Collect and validate input
try:
opts, args = getopt.getopt(sys.argv[1:], "d:hm:t:T", ["help"])
except getopt.GetoptError, err:
print '%s' % str(err)
usage()
sys.exit(2)
for o, a in opts:
if o in ('-h', '--help'):
usage()
sys.exit(0)
elif o == '-d':
if os.path.isfile(a):
docfiles.append(a)
else:
print 'ERROR: documentation file %s is not a regular file' % (a)
sys.exit(3)
elif o == '-m':
if os.path.isdir(a):
metadirs.append(a)
else:
print 'ERROR: meta directory %s is not a directory' % (a)
sys.exit(4)
elif o == "-t":
if os.path.isfile(a):
docconf = a
elif o == "-T":
onlydoctags = True
else:
assert False, "unhandled option"
if len(docfiles) == 0:
print 'ERROR: no docfile specified'
usage()
sys.exit(5)
if len(metadirs) == 0:
print 'ERROR: no metadir specified'
usage()
sys.exit(6)
if onlydoctags and docconf == "":
print 'ERROR: no docconf specified'
usage()
sys.exit(7)
# Collect all the variable names from the recipes in the metadirs
for m in metadirs:
for key,cnt in collect_bbvars(m).iteritems():
if bbvars.has_key(key):
bbvars[key] = bbvars[key] + cnt
else:
bbvars[key] = cnt
# Check each var for documentation
varlen = 0
for v in bbvars.iterkeys():
if len(v) > varlen:
varlen = len(v)
if not bbvar_is_documented(v, docfiles):
undocumented.append(v)
undocumented.sort()
varlen = varlen + 1
# Report all undocumented variables
print 'Found %d undocumented bb variables (out of %d):' % (len(undocumented), len(bbvars))
header = '%s%s%s' % (str("VARIABLE").ljust(varlen), str("COUNT").ljust(6), str("DOCTAG").ljust(7))
print header
print str("").ljust(len(header), '=')
for v in undocumented:
doctag = bbvar_doctag(v, docconf)
if not onlydoctags or not doctag == "":
print '%s%s%s' % (v.ljust(varlen), str(bbvars[v]).ljust(6), doctag)
if __name__ == "__main__":
main()
+93
View File
@@ -0,0 +1,93 @@
#!/bin/bash
#
# Perform an audit of which packages provide documentation and which
# are missing -doc packages.
#
# Setup requirements: be sure to be building for MACHINE=qemux86. Run
# this script after source'ing the build environment script, so you're
# running it from build/ directory.
#
# Maintainer: Scott Garman <scott.a.garman@intel.com>
REPORT_DOC_SIMPLE="documentation_exists.txt"
REPORT_DOC_DETAIL="documentation_exists_detail.txt"
REPORT_MISSING_SIMPLE="documentation_missing.txt"
REPORT_MISSING_DETAIL="documentation_missing_detail.txt"
REPORT_BUILD_ERRORS="build_errors.txt"
rm -rf $REPORT_DOC_SIMPLE $REPORT_DOC_DETAIL $REPORT_MISSING_SIMPLE $REPORT_MISSING_DETAIL
BITBAKE=`which bitbake`
if [ -z "$BITBAKE" ]; then
echo "Error: bitbake command not found."
echo "Did you forget to source the build environment script?"
exit 1
fi
echo "REMINDER: you need to build for MACHINE=qemux86 or you won't get useful results"
echo "REMINDER: you need to set LICENSE_FLAGS_WHITELIST appropriately in local.conf or "
echo " you'll get false positives. For example, LICENSE_FLAGS_WHITELIST = \"Commercial\""
for pkg in `bitbake -s | awk '{ print \$1 }'`; do
if [[ "$pkg" == "Loading" || "$pkg" == "Loaded" ||
"$pkg" == "Parsing" || "$pkg" == "Package" ||
"$pkg" == "NOTE:" || "$pkg" == "WARNING:" ||
"$pkg" == "done." || "$pkg" == "============" ]]
then
# Skip initial bitbake output
continue
fi
if [[ "$pkg" =~ -native$ || "$pkg" =~ -nativesdk$ ||
"$pkg" =~ -cross-canadian ]]; then
# Skip native/nativesdk/cross-canadian recipes
continue
fi
if [[ "$pkg" =~ ^meta- || "$pkg" =~ ^task- || "$pkg" =~ -image ]]; then
# Skip meta, task and image recipes
continue
fi
if [[ "$pkg" =~ ^glibc- || "$pkg" =~ ^libiconv$ ||
"$pkg" =~ -toolchain$ || "$pkg" =~ ^package-index$ ||
"$pkg" =~ ^linux- || "$pkg" =~ ^adt-installer$ ||
"$pkg" =~ ^eds-tools$ || "$pkg" =~ ^external-python-tarball$ ||
"$pkg" =~ ^qt4-embedded$ || "$pkg" =~ ^qt-mobility ]]; then
# Skip glibc, libiconv, -toolchain, and other recipes known
# to cause build conflicts or trigger false positives.
continue
fi
echo "Building package $pkg..."
bitbake $pkg > /dev/null
if [ $? -ne 0 ]; then
echo "There was an error building package $pkg" >> "$REPORT_MISSING_DETAIL"
echo "$pkg" >> $REPORT_BUILD_ERRORS
# Do not skip the remaining tests, as sometimes the
# exit status is 1 due to QA errors, and we can still
# perform the -doc checks.
fi
echo "$pkg built successfully, checking for a documentation package..."
WORKDIR=`bitbake -e $pkg | grep ^WORKDIR | awk -F '=' '{ print \$2 }' | awk -F '"' '{ print \$2 }'`
FIND_DOC_PKG=`find $WORKDIR/packages-split/*-doc -maxdepth 0 -type d`
if [ -z "$FIND_DOC_PKG" ]; then
# No -doc package was generated:
echo "No -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
echo "$pkg" >> $REPORT_MISSING_SIMPLE
continue
fi
FIND_DOC_FILES=`find $FIND_DOC_PKG -type f`
if [ -z "$FIND_DOC_FILES" ]; then
# No files shipped with the -doc package:
echo "No files shipped with the -doc package: $pkg" >> "$REPORT_MISSING_DETAIL"
echo "$pkg" >> $REPORT_MISSING_SIMPLE
continue
fi
echo "Documentation shipped with $pkg:" >> "$REPORT_DOC_DETAIL"
echo "$FIND_DOC_FILES" >> "$REPORT_DOC_DETAIL"
echo "" >> "$REPORT_DOC_DETAIL"
echo "$pkg" >> "$REPORT_DOC_SIMPLE"
done
+379
View File
@@ -0,0 +1,379 @@
#!/usr/bin/env python
# generate Python Manifest for the OpenEmbedded build system
# (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
# (C) 2007 Jeremy Laine
# licensed under MIT, see COPYING.MIT
#
# June 22, 2011 -- Mark Hatle <mark.hatle@windriver.com>
# * Updated to no longer generate special -dbg package, instead use the
# single system -dbg
# * Update version with ".1" to indicate this change
import os
import sys
import time
VERSION = "2.7.2"
__author__ = "Michael 'Mickey' Lauer <mlauer@vanille-media.de>"
__version__ = "20110222.2"
class MakefileMaker:
def __init__( self, outfile ):
"""initialize"""
self.packages = {}
self.targetPrefix = "${libdir}/python%s/" % VERSION[:3]
self.output = outfile
self.out( """
# WARNING: This file is AUTO GENERATED: Manual edits will be lost next time I regenerate the file.
# Generator: '%s' Version %s (C) 2002-2010 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
# Visit the Python for Embedded Systems Site => http://www.Vanille.de/projects/python.spy
""" % ( sys.argv[0], __version__ ) )
#
# helper functions
#
def out( self, data ):
"""print a line to the output file"""
self.output.write( "%s\n" % data )
def setPrefix( self, targetPrefix ):
"""set a file prefix for addPackage files"""
self.targetPrefix = targetPrefix
def doProlog( self ):
self.out( """ """ )
self.out( "" )
def addPackage( self, name, description, dependencies, filenames ):
"""add a package to the Makefile"""
if type( filenames ) == type( "" ):
filenames = filenames.split()
fullFilenames = []
for filename in filenames:
if filename[0] != "$":
fullFilenames.append( "%s%s" % ( self.targetPrefix, filename ) )
else:
fullFilenames.append( filename )
self.packages[name] = description, dependencies, fullFilenames
def doBody( self ):
"""generate body of Makefile"""
global VERSION
#
# generate provides line
#
provideLine = 'PROVIDES+="'
for name in sorted(self.packages):
provideLine += "%s " % name
provideLine += '"'
self.out( provideLine )
self.out( "" )
#
# generate package line
#
packageLine = 'PACKAGES="${PN}-dbg '
for name in sorted(self.packages):
if name != '${PN}-dbg':
packageLine += "%s " % name
packageLine += '${PN}-modules"'
self.out( packageLine )
self.out( "" )
#
# generate package variables
#
for name, data in sorted(self.packages.iteritems()):
desc, deps, files = data
#
# write out the description, revision and dependencies
#
self.out( 'DESCRIPTION_%s="%s"' % ( name, desc ) )
self.out( 'RDEPENDS_%s="%s"' % ( name, deps ) )
line = 'FILES_%s="' % name
#
# check which directories to make in the temporary directory
#
dirset = {} # if python had a set-datatype this would be sufficient. for now, we're using a dict instead.
for target in files:
dirset[os.path.dirname( target )] = True
#
# generate which files to copy for the target (-dfR because whole directories are also allowed)
#
for target in files:
line += "%s " % target
line += '"'
self.out( line )
self.out( "" )
self.out( 'DESCRIPTION_${PN}-modules="All Python modules"' )
line = 'RDEPENDS_${PN}-modules="'
for name, data in sorted(self.packages.iteritems()):
if name not in ['${PN}-dev']:
line += "%s " % name
self.out( "%s \"" % line )
self.out( 'ALLOW_EMPTY_${PN}-modules = "1"' )
def doEpilog( self ):
self.out( """""" )
self.out( "" )
def make( self ):
self.doProlog()
self.doBody()
self.doEpilog()
if __name__ == "__main__":
if len( sys.argv ) > 1:
os.popen( "rm -f ./%s" % sys.argv[1] )
outfile = file( sys.argv[1], "w" )
else:
outfile = sys.stdout
m = MakefileMaker( outfile )
# Add packages here. Only specify dlopen-style library dependencies here, no ldd-style dependencies!
# Parameters: revision, name, description, dependencies, filenames
#
m.addPackage( "${PN}-core", "Python Interpreter and core modules (needed!)", "",
"__future__.* _abcoll.* abc.* copy.* copy_reg.* ConfigParser.* " +
"genericpath.* getopt.* linecache.* new.* " +
"os.* posixpath.* struct.* " +
"warnings.* site.* stat.* " +
"UserDict.* UserList.* UserString.* " +
"lib-dynload/binascii.so lib-dynload/_struct.so lib-dynload/time.so " +
"lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " +
"_weakrefset.* sysconfig.* config/Makefile " +
"${includedir}/python${PYTHON_MAJMIN}/pyconfig.h " +
"${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ")
m.addPackage( "${PN}-dev", "Python Development Package", "${PN}-core",
"${includedir} " +
"${libdir}/lib*${SOLIBSDEV} " +
"${libdir}/*.la " +
"${libdir}/*.a " +
"${libdir}/*.o " +
"${libdir}/pkgconfig " +
"${base_libdir}/*.a " +
"${base_libdir}/*.o " +
"${datadir}/aclocal " +
"${datadir}/pkgconfig " )
m.addPackage( "${PN}-2to3", "Python Automated Python 2 to 3 code translation", "${PN}-core",
"${bindir}/2to3 lib2to3" ) # package
m.addPackage( "${PN}-idle", "Python Integrated Development Environment", "${PN}-core ${PN}-tkinter",
"${bindir}/idle idlelib" ) # package
m.addPackage( "${PN}-pydoc", "Python Interactive Help Support", "${PN}-core ${PN}-lang ${PN}-stringold ${PN}-re",
"${bindir}/pydoc pydoc.* pydoc_data" )
m.addPackage( "${PN}-smtpd", "Python Simple Mail Transport Daemon", "${PN}-core ${PN}-netserver ${PN}-email ${PN}-mime",
"${bindir}/smtpd.* smtpd.*" )
m.addPackage( "${PN}-audio", "Python Audio Handling", "${PN}-core",
"wave.* chunk.* sndhdr.* lib-dynload/ossaudiodev.so lib-dynload/audioop.so audiodev.* sunaudio.* sunau.* toaiff.*" )
m.addPackage( "${PN}-bsddb", "Python Berkeley Database Bindings", "${PN}-core",
"bsddb lib-dynload/_bsddb.so" ) # package
m.addPackage( "${PN}-codecs", "Python Codecs, Encodings & i18n Support", "${PN}-core ${PN}-lang",
"codecs.* encodings gettext.* locale.* lib-dynload/_locale.so lib-dynload/_codecs* lib-dynload/_multibytecodec.so lib-dynload/unicodedata.so stringprep.* xdrlib.*" )
m.addPackage( "${PN}-compile", "Python Bytecode Compilation Support", "${PN}-core",
"py_compile.* compileall.*" )
m.addPackage( "${PN}-compiler", "Python Compiler Support", "${PN}-core",
"compiler" ) # package
m.addPackage( "${PN}-compression", "Python High Level Compression Support", "${PN}-core ${PN}-zlib",
"gzip.* zipfile.* tarfile.* lib-dynload/bz2.so" )
m.addPackage( "${PN}-crypt", "Python Basic Cryptographic and Hashing Support", "${PN}-core",
"hashlib.* md5.* sha.* lib-dynload/crypt.so lib-dynload/_hashlib.so lib-dynload/_sha256.so lib-dynload/_sha512.so" )
m.addPackage( "${PN}-textutils", "Python Option Parsing, Text Wrapping and Comma-Separated-Value Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-stringold",
"lib-dynload/_csv.so csv.* optparse.* textwrap.*" )
m.addPackage( "${PN}-curses", "Python Curses Support", "${PN}-core",
"curses lib-dynload/_curses.so lib-dynload/_curses_panel.so" ) # directory + low level module
m.addPackage( "${PN}-ctypes", "Python C Types Support", "${PN}-core",
"ctypes lib-dynload/_ctypes.so lib-dynload/_ctypes_test.so" ) # directory + low level module
m.addPackage( "${PN}-datetime", "Python Calendar and Time support", "${PN}-core ${PN}-codecs",
"_strptime.* calendar.* lib-dynload/datetime.so" )
m.addPackage( "${PN}-db", "Python File-Based Database Support", "${PN}-core",
"anydbm.* dumbdbm.* whichdb.* " )
m.addPackage( "${PN}-debugger", "Python Debugger", "${PN}-core ${PN}-io ${PN}-lang ${PN}-re ${PN}-stringold ${PN}-shell ${PN}-pprint",
"bdb.* pdb.*" )
m.addPackage( "${PN}-difflib", "Python helpers for computing deltas between objects.", "${PN}-lang ${PN}-re",
"difflib.*" )
m.addPackage( "${PN}-distutils", "Python Distribution Utilities", "${PN}-core",
"config distutils" ) # package
m.addPackage( "${PN}-doctest", "Python framework for running examples in docstrings.", "${PN}-core ${PN}-lang ${PN}-io ${PN}-re ${PN}-unittest ${PN}-debugger ${PN}-difflib",
"doctest.*" )
# FIXME consider adding to some higher level package
m.addPackage( "${PN}-elementtree", "Python elementree", "${PN}-core",
"lib-dynload/_elementtree.so" )
m.addPackage( "${PN}-email", "Python Email Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-mime ${PN}-audio ${PN}-image ${PN}-netclient",
"imaplib.* email" ) # package
m.addPackage( "${PN}-fcntl", "Python's fcntl Interface", "${PN}-core",
"lib-dynload/fcntl.so" )
m.addPackage( "${PN}-hotshot", "Python Hotshot Profiler", "${PN}-core",
"hotshot lib-dynload/_hotshot.so" )
m.addPackage( "${PN}-html", "Python HTML Processing", "${PN}-core",
"formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " )
m.addPackage( "${PN}-gdbm", "Python GNU Database Support", "${PN}-core",
"lib-dynload/gdbm.so" )
m.addPackage( "${PN}-image", "Python Graphical Image Handling", "${PN}-core",
"colorsys.* imghdr.* lib-dynload/imageop.so lib-dynload/rgbimg.so" )
m.addPackage( "${PN}-io", "Python Low-Level I/O", "${PN}-core ${PN}-math",
"lib-dynload/_socket.so lib-dynload/_io.so lib-dynload/_ssl.so lib-dynload/select.so lib-dynload/termios.so lib-dynload/cStringIO.so " +
"pipes.* socket.* ssl.* tempfile.* StringIO.* io.* _pyio.*" )
m.addPackage( "${PN}-json", "Python JSON Support", "${PN}-core ${PN}-math ${PN}-re",
"json lib-dynload/_json.so" ) # package
m.addPackage( "${PN}-lang", "Python Low-Level Language Support", "${PN}-core",
"lib-dynload/_bisect.so lib-dynload/_collections.so lib-dynload/_heapq.so lib-dynload/_weakref.so lib-dynload/_functools.so " +
"lib-dynload/array.so lib-dynload/itertools.so lib-dynload/operator.so lib-dynload/parser.so " +
"atexit.* bisect.* code.* codeop.* collections.* dis.* functools.* heapq.* inspect.* keyword.* opcode.* symbol.* repr.* token.* " +
"tokenize.* traceback.* weakref.*" )
m.addPackage( "${PN}-logging", "Python Logging Support", "${PN}-core ${PN}-io ${PN}-lang ${PN}-pickle ${PN}-stringold",
"logging" ) # package
m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
"mailbox.*" )
m.addPackage( "${PN}-math", "Python Math Support", "${PN}-core",
"lib-dynload/cmath.so lib-dynload/math.so lib-dynload/_random.so random.* sets.*" )
m.addPackage( "${PN}-mime", "Python MIME Handling APIs", "${PN}-core ${PN}-io",
"mimetools.* uu.* quopri.* rfc822.* MimeWriter.*" )
m.addPackage( "${PN}-mmap", "Python Memory-Mapped-File Support", "${PN}-core ${PN}-io",
"lib-dynload/mmap.so " )
m.addPackage( "${PN}-multiprocessing", "Python Multiprocessing Support", "${PN}-core ${PN}-io ${PN}-lang",
"lib-dynload/_multiprocessing.so multiprocessing" ) # package
m.addPackage( "${PN}-netclient", "Python Internet Protocol Clients", "${PN}-core ${PN}-crypt ${PN}-datetime ${PN}-io ${PN}-lang ${PN}-logging ${PN}-mime",
"*Cookie*.* " +
"base64.* cookielib.* ftplib.* gopherlib.* hmac.* httplib.* mimetypes.* nntplib.* poplib.* smtplib.* telnetlib.* urllib.* urllib2.* urlparse.* uuid.* rfc822.* mimetools.*" )
m.addPackage( "${PN}-netserver", "Python Internet Protocol Servers", "${PN}-core ${PN}-netclient",
"cgi.* *HTTPServer.* SocketServer.*" )
m.addPackage( "${PN}-numbers", "Python Number APIs", "${PN}-core ${PN}-lang ${PN}-re",
"decimal.* numbers.*" )
m.addPackage( "${PN}-pickle", "Python Persistence Support", "${PN}-core ${PN}-codecs ${PN}-io ${PN}-re",
"pickle.* shelve.* lib-dynload/cPickle.so pickletools.*" )
m.addPackage( "${PN}-pkgutil", "Python Package Extension Utility Support", "${PN}-core",
"pkgutil.*")
m.addPackage( "${PN}-pprint", "Python Pretty-Print Support", "${PN}-core",
"pprint.*" )
m.addPackage( "${PN}-profile", "Python Basic Profiling Support", "${PN}-core ${PN}-textutils",
"profile.* pstats.* cProfile.* lib-dynload/_lsprof.so" )
m.addPackage( "${PN}-re", "Python Regular Expression APIs", "${PN}-core",
"re.* sre.* sre_compile.* sre_constants* sre_parse.*" ) # _sre is builtin
m.addPackage( "${PN}-readline", "Python Readline Support", "${PN}-core",
"lib-dynload/readline.so rlcompleter.*" )
m.addPackage( "${PN}-resource", "Python Resource Control Interface", "${PN}-core",
"lib-dynload/resource.so" )
m.addPackage( "${PN}-shell", "Python Shell-Like Functionality", "${PN}-core ${PN}-re",
"cmd.* commands.* dircache.* fnmatch.* glob.* popen2.* shlex.* shutil.*" )
m.addPackage( "${PN}-robotparser", "Python robots.txt parser", "${PN}-core ${PN}-netclient",
"robotparser.*")
m.addPackage( "${PN}-subprocess", "Python Subprocess Support", "${PN}-core ${PN}-io ${PN}-re ${PN}-fcntl ${PN}-pickle",
"subprocess.*" )
m.addPackage( "${PN}-sqlite3", "Python Sqlite3 Database Support", "${PN}-core ${PN}-datetime ${PN}-lang ${PN}-crypt ${PN}-io ${PN}-threading ${PN}-zlib",
"lib-dynload/_sqlite3.so sqlite3/dbapi2.* sqlite3/__init__.* sqlite3/dump.*" )
m.addPackage( "${PN}-sqlite3-tests", "Python Sqlite3 Database Support Tests", "${PN}-core ${PN}-sqlite3",
"sqlite3/test" )
m.addPackage( "${PN}-stringold", "Python String APIs [deprecated]", "${PN}-core ${PN}-re",
"lib-dynload/strop.so string.* stringold.*" )
m.addPackage( "${PN}-syslog", "Python Syslog Interface", "${PN}-core",
"lib-dynload/syslog.so" )
m.addPackage( "${PN}-terminal", "Python Terminal Controlling Support", "${PN}-core ${PN}-io",
"pty.* tty.*" )
m.addPackage( "${PN}-tests", "Python Tests", "${PN}-core",
"test" ) # package
m.addPackage( "${PN}-threading", "Python Threading & Synchronization Support", "${PN}-core ${PN}-lang",
"_threading_local.* dummy_thread.* dummy_threading.* mutex.* threading.* Queue.*" )
m.addPackage( "${PN}-tkinter", "Python Tcl/Tk Bindings", "${PN}-core",
"lib-dynload/_tkinter.so lib-tk" ) # package
m.addPackage( "${PN}-unittest", "Python Unit Testing Framework", "${PN}-core ${PN}-stringold ${PN}-lang",
"unittest/" )
m.addPackage( "${PN}-unixadmin", "Python Unix Administration Support", "${PN}-core",
"lib-dynload/nis.so lib-dynload/grp.so lib-dynload/pwd.so getpass.*" )
m.addPackage( "${PN}-xml", "Python basic XML support.", "${PN}-core ${PN}-elementtree ${PN}-re",
"lib-dynload/pyexpat.so xml xmllib.*" ) # package
m.addPackage( "${PN}-xmlrpc", "Python XMLRPC Support", "${PN}-core ${PN}-xml ${PN}-netserver ${PN}-lang",
"xmlrpclib.* SimpleXMLRPCServer.* DocXMLRPCServer.*" )
m.addPackage( "${PN}-zlib", "Python zlib Support.", "${PN}-core",
"lib-dynload/zlib.so" )
m.addPackage( "${PN}-mailbox", "Python Mailbox Format Support", "${PN}-core ${PN}-mime",
"mailbox.*" )
m.make()
+237
View File
@@ -0,0 +1,237 @@
#!/bin/bash
# Build performance regression test script
#
# Copyright 2011 Intel Corporation
# All rights reserved.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# DESCRIPTION
# This script is intended to be used in conjunction with "git bisect run"
# in order to find regressions in build time, however it can also be used
# independently. It cleans out the build output directories, runs a
# specified worker script (an example is test_build_time_worker.sh) under
# TIME(1), logs the results to TEST_LOGDIR (default /tmp) and returns a
# value telling "git bisect run" whether the build time is good (under
# the specified threshold) or bad (over it). There is also a tolerance
# option but it is not particularly useful as it only subtracts the
# tolerance from the given threshold and uses it as the actual threshold.
#
# It is also capable of taking a file listing git revision hashes to be
# test-applied to the repository in order to get past build failures that
# would otherwise cause certain revisions to have to be skipped; if a
# revision does not apply cleanly then the script assumes it does not
# need to be applied and ignores it.
#
# Please see the help output (syntax below) for some important setup
# instructions.
#
# AUTHORS
# Paul Eggleton <paul.eggleton@linux.intel.com>
syntax() {
echo "syntax: $0 <script> <time> <tolerance> [patchrevlist]"
echo ""
echo " script - worker script file (if in current dir, prefix with ./)"
echo " time - time threshold (in seconds, suffix m for minutes)"
echo " tolerance - tolerance (in seconds, suffix m for minutes or % for"
echo " percentage, can be 0)"
echo " patchrevlist - optional file listing revisions to apply as patches on top"
echo ""
echo "You must set TEST_BUILDDIR to point to a previously created build directory,"
echo "however please note that this script will wipe out the TMPDIR defined in"
echo "TEST_BUILDDIR/conf/local.conf as part of its initial setup (as well as your"
echo "~/.ccache)"
echo ""
echo "To get rid of the sudo prompt, please add the following line to /etc/sudoers"
echo "(use 'visudo' to edit this; also it is assumed that the user you are running"
echo "as is a member of the 'wheel' group):"
echo ""
echo "%wheel ALL=(ALL) NOPASSWD: /sbin/sysctl -w vm.drop_caches=[1-3]"
echo ""
echo "Note: it is recommended that you disable crond and any other process that"
echo "may cause significant CPU or I/O usage during build performance tests."
}
# Note - we exit with 250 here because that will tell git bisect run that
# something bad happened and stop
if [ "$1" = "" ] ; then
syntax
exit 250
fi
if [ "$2" = "" ] ; then
syntax
exit 250
fi
if [ "$3" = "" ] ; then
syntax
exit 250
fi
if ! [[ "$2" =~ ^[0-9][0-9m.]*$ ]] ; then
echo "'$2' is not a valid number for threshold"
exit 250
fi
if ! [[ "$3" =~ ^[0-9][0-9m.%]*$ ]] ; then
echo "'$3' is not a valid number for tolerance"
exit 250
fi
if [ "$TEST_BUILDDIR" = "" ] ; then
echo "Please set TEST_BUILDDIR to a previously created build directory"
exit 250
fi
if [ ! -d "$TEST_BUILDDIR" ] ; then
echo "TEST_BUILDDIR $TEST_BUILDDIR not found"
exit 250
fi
git diff --quiet
if [ $? != 0 ] ; then
echo "Working tree is dirty, cannot proceed"
exit 251
fi
if [ "$BB_ENV_EXTRAWHITE" != "" ] ; then
echo "WARNING: you are running after sourcing the build environment script, this is not recommended"
fi
runscript=$1
timethreshold=$2
tolerance=$3
if [ "$4" != "" ] ; then
patchrevlist=`cat $4`
else
patchrevlist=""
fi
if [[ timethreshold == *m* ]] ; then
timethreshold=`echo $timethreshold | sed s/m/*60/ | bc`
fi
if [[ $tolerance == *m* ]] ; then
tolerance=`echo $tolerance | sed s/m/*60/ | bc`
elif [[ $tolerance == *%* ]] ; then
tolerance=`echo $tolerance | sed s/%//`
tolerance=`echo "scale = 2; (($tolerance * $timethreshold) / 100)" | bc`
fi
tmpdir=`grep "^TMPDIR" $TEST_BUILDDIR/conf/local.conf | sed -e 's/TMPDIR[ \t]*=[ \t\?]*"//' -e 's/"//'`
if [ "x$tmpdir" = "x" ]; then
echo "Unable to determine TMPDIR from $TEST_BUILDDIR/conf/local.conf, bailing out"
exit 250
fi
sstatedir=`grep "^SSTATE_DIR" $TEST_BUILDDIR/conf/local.conf | sed -e 's/SSTATE_DIR[ \t\?]*=[ \t]*"//' -e 's/"//'`
if [ "x$sstatedir" = "x" ]; then
echo "Unable to determine SSTATE_DIR from $TEST_BUILDDIR/conf/local.conf, bailing out"
exit 250
fi
if [ `expr length $tmpdir` -lt 4 ] ; then
echo "TMPDIR $tmpdir is less than 4 characters, bailing out"
exit 250
fi
if [ `expr length $sstatedir` -lt 4 ] ; then
echo "SSTATE_DIR $sstatedir is less than 4 characters, bailing out"
exit 250
fi
echo -n "About to wipe out TMPDIR $tmpdir, press Ctrl+C to break out... "
for i in 9 8 7 6 5 4 3 2 1
do
echo -ne "\x08$i"
sleep 1
done
echo
pushd . > /dev/null
rm -f pseudodone
echo "Removing TMPDIR $tmpdir..."
rm -rf $tmpdir
echo "Removing TMPDIR $tmpdir-*libc..."
rm -rf $tmpdir-*libc
echo "Removing SSTATE_DIR $sstatedir..."
rm -rf $sstatedir
echo "Removing ~/.ccache..."
rm -rf ~/.ccache
echo "Syncing..."
sync
sync
echo "Dropping VM cache..."
#echo 3 > /proc/sys/vm/drop_caches
sudo /sbin/sysctl -w vm.drop_caches=3 > /dev/null
if [ "$TEST_LOGDIR" = "" ] ; then
logdir="/tmp"
else
logdir="$TEST_LOGDIR"
fi
rev=`git rev-parse HEAD`
logfile="$logdir/timelog_$rev.log"
echo -n > $logfile
gitroot=`git rev-parse --show-toplevel`
cd $gitroot
for patchrev in $patchrevlist ; do
echo "Applying $patchrev"
patchfile=`mktemp`
git show $patchrev > $patchfile
git apply --check $patchfile &> /dev/null
if [ $? != 0 ] ; then
echo " ... patch does not apply without errors, ignoring"
else
echo "Applied $patchrev" >> $logfile
git apply $patchfile &> /dev/null
fi
rm $patchfile
done
sync
echo "Quiescing for 5s..."
sleep 5
echo "Running $runscript at $rev..."
timeoutfile=`mktemp`
/usr/bin/time -o $timeoutfile -f "%e\nreal\t%E\nuser\t%Us\nsys\t%Ss\nmaxm\t%Mk" $runscript 2>&1 | tee -a $logfile
exitstatus=$PIPESTATUS
git reset --hard HEAD > /dev/null
popd > /dev/null
timeresult=`head -n1 $timeoutfile`
cat $timeoutfile | tee -a $logfile
rm $timeoutfile
if [ $exitstatus != 0 ] ; then
# Build failed, exit with 125 to tell git bisect run to skip this rev
echo "*** Build failed (exit code $exitstatus), skipping..." | tee -a $logfile
exit 125
fi
ret=`echo "scale = 2; $timeresult > $timethreshold - $tolerance" | bc`
echo "Returning $ret" | tee -a $logfile
exit $ret
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# This is an example script to be used in conjunction with test_build_time.sh
if [ "$TEST_BUILDDIR" = "" ] ; then
echo "TEST_BUILDDIR is not set"
exit 1
fi
buildsubdir=`basename $TEST_BUILDDIR`
if [ ! -d $buildsubdir ] ; then
echo "Unable to find build subdir $buildsubdir in current directory"
exit 1
fi
if [ -f oe-init-build-env ] ; then
. ./oe-init-build-env $buildsubdir
elif [ -f poky-init-build-env ] ; then
. ./poky-init-build-env $buildsubdir
else
echo "Unable to find build environment setup script"
exit 1
fi
if [ -f ../meta/recipes-sato/images/core-image-sato.bb ] ; then
target="core-image-sato"
else
target="poky-image-sato"
fi
echo "Build started at `date "+%Y-%m-%d %H:%M:%S"`"
echo "bitbake $target"
bitbake $target
ret=$?
echo "Build finished at `date "+%Y-%m-%d %H:%M:%S"`"
exit $ret
+228
View File
@@ -0,0 +1,228 @@
#!/bin/bash
#
# Copyright (C) 2010-2011 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
red='\E[31;40m'
green='\E[32;40m'
#Get current owner
OWNER=`whoami`
#Get group
GROUP=`id -gn ${USER}`
MACHINE_ARCH=`bitbake -e | sed -n 's/^MACHINE_ARCH=\"\(.*\)\"/\1/p'`
DEPLOY_DIR_IMAGE=`bitbake -e | sed -n 's/^DEPLOY_DIR_IMAGE=\"\(.*\)\"/\1/p'`
#Get value of varibale MACHINE_INE and DEPLOY_DIR_IMAGE
LSB_IMAGE=poky-image-lsb-${MACHINE_ARCH}-test.ext3
ECHO()
{
echo -e "${green}$@"
tput sgr0
}
ERROR()
{
echo -e "${red}$@"
tput sgr0
exit 1
}
exit_check()
{
[ $? -ne 0 ] && exit $?
}
usage()
{
ECHO "Usage: PC\$ create-lsb-image ARCH ROOTFS_IMAGE"
ECHO " ARCH: x86 or x86-64 or ppc32"
ECHO " ROOTFS_IMAGE: \
Name of the rootfs image with suffix \"tar.bz2\""
ECHO ""
ECHO "Examples:"
ECHO " PC\$ creat-lsb-image \
x86 poky-image-lsb-qemux86-20110317030443.rootfs.tar.bz2"
exit 1
}
#There should be two parameters to get machine type and name of image
if [ $# -ne 2 ]; then
usage
fi
#Get list for lsb test suite
case ${1} in
"x86")
T_ARCH=ia32
P_ARCH=i486
COM_PACKAGE_LIST="lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz"
;;
"x86-64")
T_ARCH=amd64
P_ARCH=x86_64
MACHINE_ARCH=${MACHINE_ARCH/x86_64/x86-64}
COM_PACKAGE_LIST="lsb-dist-testkit-4.1.0-5.${P_ARCH}.tar.gz"
;;
"ppc32")
P_ARCH=ppc
T_ARCH=${1}
COM_PACKAGE_LIST="lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz"
;;
*)
usage
;;
esac
APP_PACKAGE_RPMLIST="lsb-apache-2.2.14-3.lsb4.${P_ARCH}.rpm \
lsb-tcl-8.5.7-6.lsb4.${P_ARCH}.rpm \
lsb-expect-5.43.0-11.lsb4.${P_ARCH}.rpm \
lsb-groff-1.20.1-5.lsb4.${P_ARCH}.rpm \
lsb-raptor-1.4.19-3.lsb4.${P_ARCH}.rpm \
lsb-xpdf-1.01-10.lsb4.${P_ARCH}.rpm \
lsb-samba-3.4.3-5.lsb4.${P_ARCH}.rpm \
lsb-rsync-3.0.6-3.lsb4.${P_ARCH}.rpm"
APP_PACKAGE_SOURCELIST="expect-tests.tar \
tcl-tests.tar \
raptor-tests.tar \
test1.pdf \
test2.pdf"
PACKAGE_LIST="${COM_PACKAGE_LIST} \
${APP_PACKAGE_RPMLIST} \
${APP_PACKAGE_SOURCELIST}"
#Version for lsb test suite
RELEASE=released-4.1.0
#Tools of download packages
WGET="wget -c -t 5"
SERVER1="\
http://ftp.linuxfoundation.org/pub/lsb/bundles/${RELEASE}/dist-testkit"
SERVER2="\
http://ftp.linux-foundation.org/pub/lsb/app-battery/${RELEASE}/${T_ARCH}"
SERVER3="http://ftp.linuxfoundation.org/pub/lsb/snapshots/appbat/tests"
#Function for downloading package from URL pointed
download()
{
for i in $@; do
ECHO " -->Downloading package \"${i}\""
PACKAGE_NAME=${i}
suffix=${PACKAGE_NAME##*.}
if [ "$suffix" = "gz" ];then
${WGET} ${SERVER1}/${i}
elif [ "$suffix" = "rpm" ];then
${WGET} ${SERVER2}/${i}
else
${WGET} ${SERVER3}/${i}
fi
done
}
#Check lsb image
[ ! -d $DEPLOY_DIR_IMAGE ] && ERROR "\
Image directory does not exist: ${DEPLOY_DIR_IMAGE}"
ECHO "Entering directory $DEPLOY_DIR_IMAGE"
cd $DEPLOY_DIR_IMAGE
if [ ! -f ${2} ]; then
ECHO "rootfs image \"${2}\" not found in ${DEPLOY_DIR_IMAGE}"
ECHO "Please copy \"${2}\" to \"${DEPLOY_DIR_IMAGE}\""
exit 1
fi
#Umount lsbtmp
[ ! -d lsbtmp ] && mkdir lsbtmp
#Download lsb test suite
mkdir -p lsb-test-suite-${MACHINE_ARCH} || \
ERROR "Couldn't find lsb test suite for ${MACHINE_ARCH}"
cd lsb-test-suite-${MACHINE_ARCH}
ECHO "Downloading lsb test suite, it would take some time..."
download ${PACKAGE_LIST}
cd ..
#Creat lsb image
if [ -f ${LSB_IMAGE} ];then
sudo umount lsbtmp > /dev/null 2>&1
ECHO "Removing old lsb image..."
/bin/rm ${LSB_IMAGE} > /dev/null 2>&1
fi
ECHO "Creating a 8GB file for the lsb image"
dd if=/dev/zero of=${LSB_IMAGE} bs=1M count=8000 > /dev/null 2>&1
exit_check
ECHO "Formatting ext3 image..."
mkfs.ext3 -q -F ${LSB_IMAGE} > /dev/null 2>&1
tune2fs -j ${LSB_IMAGE} > /dev/null 2>&1
ECHO "Generating final image"
[ ! -d lsbtmp ] && mkdir lsbtmp
#Install file system and lsb test suite to lsb image
sudo mount -o loop ${LSB_IMAGE} lsbtmp
exit_check
ECHO " ->Installing rootfs..."
sudo tar jpxf ${2} -C lsbtmp
exit_check
ECHO " ->Installing lsb test suite..."
cd lsb-test-suite-${MACHINE_ARCH}
if [ "${1}" = "x86-64" ]; then
sudo tar zpxf lsb-dist-testkit-4.1.0-5.${P_ARCH}.tar.gz -C ../lsbtmp
else
sudo tar zpxf lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz -C ../lsbtmp
fi
exit_check
sudo mkdir ../lsbtmp/lsb-Application
sudo cp *.rpm *.tar *.pdf ../lsbtmp/lsb-Application
exit_check
cd ..
if [ -f modules-*-${MACHINE_ARCH}.tgz ];then
ECHO " ->Installing moudles of driver..."
sudo tar zpxf modules-*-${MACHINE_ARCH}.tgz -C lsbtmp/
fi
#Unmount lsbtmp
sudo umount lsbtmp
exit_check
sudo rm -rf lsbtmp
#Change file attribute
sudo chown ${OWNER}:${GROUP} ${LSB_IMAGE}
exit_check
sudo chmod 755 ${LSB_IMAGE}
exit_check
#Set up link
ln -sf ${LSB_IMAGE} poky-image-lsb-${MACHINE_ARCH}.ext3
ECHO "The LSB test environment has been setup successfully."
ECHO "Please run this image on platform ${MACHINE_ARCH}"
+226
View File
@@ -0,0 +1,226 @@
#!/bin/bash
#
# Copyright (c) 2010-2011, Intel Corporation.
# All Rights Reserved
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# This script is intended to be used to prepare a series of patches
# and a cover letter in an appropriate and consistent format for
# submission to Open Embedded and The Yocto Project, as well as to
# related projects and layers.
#
ODIR=pull-$$
RELATIVE_TO="master"
COMMIT_ID="HEAD"
PREFIX="PATCH"
RFC=0
usage() {
CMD=$(basename $0)
cat <<EOM
Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] -u remote -b branch
-b branch Branch name in the specified remote
-c Create an RFC (Request for Comment) patch series
-h Display this help message
-i commit_id Ending commit (default: HEAD)
-m msg_body_file The file containing a blurb to be inserted into the summary email
-o output_dir Specify the output directory for the messages (default: pull-PID)
-p prefix Use [prefix N/M] instead of [PATCH N/M] as the subject prefix
-r relative_to Starting commit (default: master)
-s subject The subject to be inserted into the summary email
-u remote The git remote where the branch is located
Examples:
$CMD -u contrib -b nitin/basic
$CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro
$CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc
$CMD -u contrib -p "RFC PATCH" -b nitin/experimental
EOM
}
# Parse and validate arguments
while getopts "b:chi:m:o:p:r:s:u:" OPT; do
case $OPT in
b)
BRANCH="$OPTARG"
;;
c)
RFC=1
;;
h)
usage
exit 0
;;
i)
COMMIT_ID="$OPTARG"
;;
m)
BODY="$OPTARG"
if [ ! -e "$BODY" ]; then
echo "ERROR: Body file does not exist"
exit 1
fi
;;
o)
ODIR="$OPTARG"
;;
p)
PREFIX="$OPTARG"
;;
r)
RELATIVE_TO="$OPTARG"
;;
s)
SUBJECT="$OPTARG"
;;
u)
REMOTE="$OPTARG"
REMOTE_URL=$(git config remote.$REMOTE.url)
if [ $? -ne 0 ]; then
echo "ERROR: git config failed to find a url for '$REMOTE'"
echo
echo "To add a remote url for $REMOTE, use:"
echo " git config remote.$REMOTE.url <url>"
exit 1
fi
# Rewrite private URLs to public URLs
# Determine the repository name for use in the WEB_URL later
case "$REMOTE_URL" in
*@*)
USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?"
PROTO_RE="[a-z][a-z+]*://"
GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)"
REMOTE_URL=${REMOTE_URL%.git}
REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#")
REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#")
;;
*)
echo "WARNING: Unrecognized remote URL: $REMOTE_URL"
echo " The pull and browse URLs will likely be incorrect"
;;
esac
;;
esac
done
if [ -z "$BRANCH" ] || [ -z "$REMOTE_URL" ]; then
usage
exit 1
fi
if [ $RFC -eq 1 ]; then
PREFIX="RFC $PREFIX"
fi
# Set WEB_URL from known remotes
WEB_URL=""
case "$REMOTE_URL" in
*git.yoctoproject.org*)
WEB_URL="http://git.yoctoproject.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
;;
*git.pokylinux.org*)
WEB_URL="http://git.pokylinux.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
;;
*git.openembedded.org*)
WEB_URL="http://cgit.openembedded.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
;;
*github.com*)
WEB_URL="https://github.com/$REMOTE_REPO/tree/$BRANCH"
;;
esac
# Perform a sanity test on the web URL. Issue a warning if it is not
# accessible, but do not abort as users may want to run offline.
if [ -n "$WEB_URL" ]; then
wget --no-check-certificate -q $WEB_URL -O /dev/null
if [ $? -ne 0 ]; then
echo "WARNING: Branch '$BRANCH' was not found on the contrib git tree."
echo " Please check your remote and branch parameter before sending."
echo ""
fi
fi
if [ -e $ODIR ]; then
echo "ERROR: output directory $ODIR exists."
exit 1
fi
mkdir $ODIR
# Generate the patches and cover letter
git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow --cover-letter $RELATIVE_TO..$COMMIT_ID > /dev/null
# Customize the cover letter
CL="$ODIR/0000-cover-letter.patch"
PM="$ODIR/pull-msg"
git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM"
if [ $? -ne 0 ]; then
echo "ERROR: git request-pull reported an error"
exit 1
fi
# The cover letter already has a diffstat, remove it from the pull-msg
# before inserting it.
sed -n "0,\#$REMOTE_URL# p" "$PM" | sed -i "/BLURB HERE/ r /dev/stdin" "$CL"
rm "$PM"
# If this is an RFC, make that clear in the cover letter
if [ $RFC -eq 1 ]; then
(cat <<EOM
Please review the following changes for suitability for inclusion. If you have
any objections or suggestions for improvement, please respond to the patches. If
you agree with the changes, please provide your Acked-by.
EOM
) | sed -i "/BLURB HERE/ r /dev/stdin" "$CL"
fi
# Insert the WEB_URL if there is one
if [ -n "$WEB_URL" ]; then
echo " $WEB_URL" | sed -i "\#$REMOTE_URL# r /dev/stdin" "$CL"
fi
# If the user specified a message body, insert it into the cover letter and
# remove the BLURB token.
if [ -n "$BODY" ]; then
sed -i "/BLURB HERE/ r $BODY" "$CL"
sed -i "/BLURB HERE/ d" "$CL"
fi
# If the user specified a subject, replace the SUBJECT token with it.
if [ -n "$SUBJECT" ]; then
sed -i -e "s/\*\*\* SUBJECT HERE \*\*\*/$SUBJECT/" "$CL"
fi
# Generate report for user
cat <<EOM
The following patches have been prepared:
$(for PATCH in $(ls $ODIR/*); do echo " $PATCH"; done)
Review their content, especially the summary mail:
$CL
When you are satisfied, you can send them with:
send-pull-request -a -p $ODIR
EOM
+53
View File
@@ -0,0 +1,53 @@
#! /bin/sh
# Copyright (c) 2005-2008 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
cat << EOF
AC_PREREQ(2.57)
AC_INIT([site_wide],[1.0.0])
EOF
# Disable as endian is set in the default config
#echo AC_C_BIGENDIAN
#echo
if [ -e $1/types ] ; then
while read type ; do
echo "AC_CHECK_SIZEOF([$type])"
done < $1/types
echo
fi
if [ -e $1/funcs ]; then
while read func ; do
echo "AC_CHECK_FUNCS([$func])"
done < $1/funcs
echo
fi
if [ -e $1/headers ]; then
while read header ; do
echo "AC_CHECK_HEADERS([$header])"
done < $1/headers
echo
fi
cat << EOF
AC_OUTPUT
EOF
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
exit 1
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
if ! (test -r "$BUILDDIR/conf/hob-pre.conf"); then
cat <<EOM
You had no conf/hob-pre.conf file. An initial version of this configuration
file has therefore been created for you. This file will be used to store
configuration values you set in hob.
EOM
touch conf/hob-pre.conf
fi
if ! (test -r "$BUILDDIR/conf/hob-post.conf"); then
cat <<EOM
You had no conf/hob-post.conf file. An initial version of this configuration
file has therefore been created for you. This file will be used to store
configuration values you set in hob.
EOM
(cat <<EOF
INHERIT += "image_types"
EOF
) > conf/hob-post.conf
fi
# Users don't like to launch GUI's and see a bunch of text whiz by, notify them
if [ ! -e "$BUILDDIR/pseudodone" ]; then
echo "Before we can launch the GUI we need to build some native tools required for running"
fi
bitbake -r conf/hob-pre.conf -R conf/hob-post.conf -u hob
ret=$?
exit $ret
+278
View File
@@ -0,0 +1,278 @@
#!/usr/bin/env python
# Available modulesets:
#
# bootstrap.modules
# freedesktop.modules
# gcj.modules
# gnome-2.10.modules
# gnome-2.12.modules
# gnome-2.14.modules
# gnome-2.16.modules
# gnutls.modules
# gtk28.modules
# gtk.modules
# xorg-7.0.modules
# xorg.modules
moduleset = 'xorg.modules'
import cElementTree as ElementTree
# import lxml.etree as ElementTree
import re, os, bb, bb.data
class Handlers(object):
"""
Class to act as a store for handlers of jhbuild xml elements, and as a
dispatcher of parsed Elements to those handlers.
These handlers exist to take an xml element from the jhbuild files and
either produce bitbake metadata in self.packages, or produce data which
will be used by other element handlers to do so.
Handlers(filename) -> new object to parse and process jhbuild file of
name 'filename'.
"""
cvsrootpat = re.compile(r'''
\s* # Skip leading whitespace
:(?P<scheme>[^:]+): # scheme (i.e. pserver, ext)
((?P<user>\S+?)@)? # username
(?P<host>\S+?): # non-greedy match of the remote host
(?P<path>\S+) # remote path
''', re.VERBOSE)
def __init__(self, msfile):
self.msfile = msfile
self.msbasename = os.path.basename(msfile)
self.msdirname = os.path.dirname(msfile)
self.handled = {}
self.cvsroots = {}
self.repositories = {}
self.packages = []
def handle(self, element, parent):
import sys
"""
XML Element dispatch function. Can be called both from outside the
Handlers object to initiate handling, and from within individual XML
element handlers to ensure that dependent elements have been handled.
Does not handle a given XML Element more than once, as it retains
information about the handling state of the Elements it encounters.
"""
try:
state = self.handled[element]
except KeyError:
pass
except:
return
try:
self.__class__.__dict__[element.tag](self, element, parent)
self.handled[element] = True
except KeyError:
self.handled[element] = False
sys.__stderr__.write('Unhandled element: %s\n' % element.tag)
except Exception:
sys.__stderr__.write('Error handling %s: %s:\n %s\n' % (element.tag, sys.exc_type, sys.exc_value))
self.handled[element] = False
print('handle(%s, %s) -> %s' % (element, parent, self.handled[element]))
return self.handled[element]
def cvsroot(self, element, parent):
# Rip apart the cvsroot style location to build a cvs:// url for
# bitbake's usage in the cvsmodule handler.
# root=":pserver:anoncvs@cvs.freedesktop.org:/cvs/fontconfig"
print("cvsroot(%s, %s)" % (element, parent))
root = element.attrib.get('root')
rootmatch = re.match(Handlers.cvsrootpat, root)
name = element.attrib.get('name')
user = rootmatch.group('user') or ''
if user != '':
pw = element.attrib.get('password') or ''
if pw != '':
pw = ':' + pw + '@'
else:
user = user + '@'
print('user: %s' % user)
print('pw: %s' % pw)
host = rootmatch.group('host')
print('host: %s' % host)
path = rootmatch.group('path') or '/'
print('path: %s' % path)
root = "cvs://%s%s%s%s" % (user, pw, host, path)
print('root: %s' % root)
self.cvsroots[name] = root
def cvsmodule(self, element, parent):
rootlist = [root for root in list(parent) if root.attrib.get('name') == element.attrib.get('cvsroot')]
if len(rootlist) < 1:
raise Exception("Error: cvsmodule '%s' requires cvsroot '%s'." % (element.attrib.get('module'), element.attrib.get('cvsroot')))
cvsroot = rootlist[0]
def include(self, element, parent):
href = element.attrib.get('href')
fullhref = os.path.join(self.msdirname, href)
tree = ElementTree.ElementTree(file=fullhref)
elem = tree.getroot()
# Append the children of the newly included root element to the parent
# element, and manually handle() them, as the currently running
# iteration isn't going to hit them.
for child in elem:
self.handle(child, elem)
parent.append(elem)
def repository(self, element, parent):
# TODO:
# Convert the URL in the href attribute, if necessary, to the format
# which bitbake expects to see in SRC_URI.
name = element.attrib.get('name')
self.repositories[name] = element.attrib.get('href')
def moduleset(self, element, parent):
for child in element:
self.handle(child, element)
def packagename(self, name):
# mangle name into an appropriate bitbake package name
return name.replace('/', '-')
def metamodule(self, element, parent):
# grab the deps
deps = None
for child in element:
if child.tag == 'dependencies':
deps = [self.packagename(dep.attrib.get('package')) for dep in child if dep.tag == "dep"]
# create the package
d = bb.data.init()
pn = self.packagename(element.attrib.get('id'))
d.setVar('PN', pn)
bb.data.setVar('DEPENDS', ' '.join(deps), d)
d.setVar('_handler', 'metamodule')
self.packages.append(d)
def autotools(self, element, parent):
deps = None
branch = None
for child in element:
if child.tag == 'dependencies':
deps = [self.packagename(dep.attrib.get('package')) for dep in child if dep.tag == "dep"]
elif child.tag == 'branch':
branch = child
# create the package
d = bb.data.init()
id = element.attrib.get('id')
if id is None:
raise Exception('Error: autotools element has no id attribute.')
pn = self.packagename(id)
d.setVar('PN', pn)
if deps is not None:
bb.data.setVar('DEPENDS', ' '.join(deps), d)
if branch is not None:
# <branch repo="git.freedesktop.org" module="xorg/xserver"/>
repo = os.path.join(self.repositories[branch.attrib.get('repo')], branch.attrib.get('module'))
d.setVar('SRC_URI', repo)
checkoutdir = branch.attrib.get('checkoutdir')
if checkoutdir is not None:
bb.data.setVar('S', os.path.join('${WORKDIR}', checkoutdir), d)
# build class
d.setVar('INHERITS', 'autotools')
d.setVarFlag('INHERITS', 'operator', '+=')
d.setVar('_handler', 'autotools')
self.packages.append(d)
class Emitter(object):
"""
Class which contains a single method for the emission of a bitbake
package from the bitbake data produced by a Handlers object.
"""
def __init__(self, filefunc = None, basedir = None):
def _defaultfilefunc(package):
# return a relative path to the bitbake .bb which will be written
return package.getVar('PN', 1) + '.bb'
self.filefunc = filefunc or _defaultfilefunc
self.basedir = basedir or os.path.abspath(os.curdir)
def write(self, package, template = None):
# 1) Assemble new file contents in ram, either new from bitbake
# metadata, or a combination of the template and that metadata.
# 2) Open the path returned by the filefunc + the basedir for writing.
# 3) Write the new bitbake data file.
fdata = ''
if template:
f = file(template, 'r')
fdata = f.read()
f.close()
for key in bb.data.keys(package):
fdata = fdata.replace('@@'+key+'@@', package.getVar(key))
else:
for key in bb.data.keys(package):
if key == '_handler':
continue
elif key == 'INHERITS':
fdata += 'inherit %s\n' % package.getVar('INHERITS')
else:
oper = package.getVarFlag(key, 'operator') or '='
fdata += '%s %s "%s"\n' % (key, oper, package.getVar(key))
if not os.path.exists(os.path.join(self.basedir, os.path.dirname(self.filefunc(package)))):
os.makedirs(os.path.join(self.basedir, os.path.dirname(self.filefunc(package))))
out = file(os.path.join(self.basedir, self.filefunc(package)), 'w')
out.write(fdata)
out.close()
def _test():
msfile = os.path.join(os.path.abspath(os.curdir), 'modulesets', moduleset)
tree = ElementTree.ElementTree(file=msfile)
elem = tree.getroot()
handlers = Handlers(msfile)
handlers.handle(elem, None)
def filefunc(package):
# return a relative path to the bitbake .bb which will be written
src_uri = package.getVar('SRC_URI', 1)
filename = package.getVar('PN', 1) + '.bb'
if not src_uri:
return filename
else:
substr = src_uri[src_uri.find('xorg/'):]
subdirlist = substr.split('/')[:2]
subdir = '-'.join(subdirlist)
return os.path.join(subdir, filename)
emitter = Emitter(filefunc)
for package in handlers.packages:
template = emitter.filefunc(package) + '.in'
if os.path.exists(template):
print("%s exists, emitting based on template" % template)
emitter.write(package, template)
else:
print("%s does not exist, emitting non-templated" % template)
emitter.write(package)
if __name__ == "__main__":
_test()
@@ -0,0 +1,87 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*-->
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<repository type="tarball" name="ftp.gnu.org"
href="http://ftp.gnu.org/gnu/"/>
<repository type="tarball" name="pkgconfig"
href="http://pkgconfig.freedesktop.org/releases/"/>
<repository type="tarball" name="python"
href="http://www.python.org/ftp/python/"/>
<autotools id="gettext" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="gettext/gettext-0.14.5.tar.gz" version="0.14.5"
size="7105715" md5sum="e2f6581626a22a0de66dce1d81d00de3" />
</autotools>
<autotools id="autoconf" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="autoconf/autoconf-2.59.tar.bz2" version="2.59"
size="925073" md5sum="1ee40f7a676b3cfdc0e3f7cd81551b5f" />
</autotools>
<autotools id="libtool" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="libtool/libtool-1.5.22.tar.gz" version="1.5.22"
size="2921483" md5sum="8e0ac9797b62ba4dcc8a2fb7936412b0">
<patch file="libtool-1.5.18-multilib.patch" strip="1" />
</branch>
</autotools>
<autotools id="automake-1.4" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="automake/automake-1.4-p6.tar.gz" version="1.4-p6"
size="375060" md5sum="24872b81b95d78d05834c39af2cfcf05" />
</autotools>
<autotools id="automake-1.7" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="automake/automake-1.7.9.tar.bz2" version="1.7.9"
size="577705" md5sum="571fd0b0598eb2a27dcf68adcfddfacb" />
</autotools>
<autotools id="automake-1.8" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="automake/automake-1.8.5.tar.bz2" version="1.8.5"
size="663182" md5sum="0114aa6d7dc32112834b68105fb8d7e2" />
</autotools>
<autotools id="automake-1.9" autogen-sh="configure">
<branch repo="ftp.gnu.org"
module="automake/automake-1.9.6.tar.bz2" version="1.9.6"
size="765505" md5sum="c11b8100bb311492d8220378fd8bf9e0" />
</autotools>
<autotools id="pkg-config" autogen-sh="configure">
<branch repo="pkgconfig"
module="pkg-config-0.20.tar.gz" version="0.20"
size="969993" md5sum="fb42402593e4198bc252ab248dd4158b" />
</autotools>
<autotools id="python" autogenargs="--enable-shared" autogen-sh="configure">
<branch repo="python"
module="2.4.3/Python-2.4.3.tar.bz2" version="2.4.3"
size="8005915" md5sum="141c683447d5e76be1d2bd4829574f02" />
</autotools>
<repository type="tarball" name="pyrex"
href="http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/"/>
<distutils id="pyrex">
<branch repo="pyrex"
module="Pyrex-0.9.4.1.tar.gz" version="0.9.4.1"
size="181507" md5sum="425f0543c634bc7a86fe4fce02e0e882" />
</distutils>
<metamodule id="meta-bootstrap">
<dependencies>
<dep package="gettext" />
<dep package="autoconf" />
<dep package="libtool" />
<dep package="automake-1.4" />
<dep package="automake-1.7" />
<dep package="automake-1.8" />
<dep package="automake-1.9" />
<dep package="pkg-config" />
<dep package="python" />
<dep package="pyrex" />
</dependencies>
</metamodule>
</moduleset>
@@ -0,0 +1,281 @@
<?xml version="1.0"?><!--*- mode: nxml -*-->
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<repository type="cvs" name="cairo.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo"
password=""/>
<repository type="cvs" name="dbus.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/dbus"
password=""/>
<repository type="cvs" name="fontconfig.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/fontconfig"
password=""/>
<repository type="cvs" name="hal.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/hal"
password=""/>
<repository type="cvs" name="icon-theme.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/icon-theme"
password=""/>
<repository type="cvs" name="startup-notification.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/startup-notification"
password=""/>
<repository type="cvs" name="tango.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/tango"
password=""/>
<repository type="cvs" name="xorg.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/xorg"
password=""/>
<repository type="cvs" name="poppler.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/poppler"
password=""/>
<repository type="cvs" name="system-tools-backends.freedesktop.org"
cvsroot=":pserver:anoncvs@anoncvs.freedesktop.org:/cvs/system-tools-backends"
password=""/>
<repository type="cvs" name="gnome.org"
cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome"
password=""/>
<repository type="svn" name="avahi.0pointer.de"
href="svn://svn.0pointer.de/avahi/"/>
<repository type="svn" name="libdaemon.0pointer.de"
href="svn://svn.0pointer.de/libdaemon/"/>
<repository type="git" name="git.freedesktop.org"
href="git://anongit.freedesktop.org/git/"/>
<repository type="tarball" name="cpan" href="http://search.cpan.org/CPAN/" />
<autotools id="cairo">
<branch repo="git.freedesktop.org" module="cairo"/>
<dependencies>
<dep package="fontconfig"/>
<dep package="libXrender"/>
<dep package="gtk-doc"/>
</dependencies>
<after>
<dep package="glitz"/>
</after>
</autotools>
<tarball id="cairo-1-0" version="1.0.4">
<source href="http://cairographics.org/releases/cairo-1.0.4.tar.gz"
size="1475777" md5sum="9002b0e69b3f94831a22d3f2a7735ce2"/>
<dependencies>
<dep package="fontconfig"/>
<dep package="libXrender"/>
</dependencies>
<after>
<dep package="glitz"/>
</after>
</tarball>
<autotools id="glitz">
<branch repo="cairo.freedesktop.org"/>
</autotools>
<autotools id="pycairo-1-0">
<branch repo="cairo.freedesktop.org" module="pycairo"
revision="RELEASE_1_0_2" checkoutdir="pycairo-1-0"/>
<dependencies>
<dep package="cairo-1-0"/>
</dependencies>
</autotools>
<autotools id="pycairo">
<branch repo="cairo.freedesktop.org"/>
<dependencies>
<dep package="cairo"/>
</dependencies>
</autotools>
<autotools id="cairomm">
<branch repo="cairo.freedesktop.org"/>
<dependencies>
<dep package="cairo"/>
</dependencies>
</autotools>
<autotools id="dbus" supports-non-srcdir-builds="no">
<branch repo="dbus.freedesktop.org"/>
<dependencies>
<dep package="glib"/>
</dependencies>
<after>
<dep package="gtk+"/>
</after>
</autotools>
<autotools id="dbus-0.23" supports-non-srcdir-builds="no">
<branch repo="dbus.freedesktop.org" module="dbus"
revision="dbus-0-23" checkoutdir="dbus-0.23"/>
<dependencies>
<dep package="glib"/>
</dependencies>
<after>
<dep package="gtk+"/>
</after>
</autotools>
<!-- Not maintained - try dbusmm instead -->
<autotools id="dbus-cpp">
<branch repo="dbus.freedesktop.org"/>
<dependencies>
<dep package="dbus"/>
</dependencies>
</autotools>
<autotools id="dbusmm">
<branch repo="dbus.freedesktop.org"/>
<dependencies>
<dep package="dbus"/>
</dependencies>
</autotools>
<autotools id="dbus-glib">
<branch repo="git.freedesktop.org" module="dbus/dbus-glib"/>
<dependencies>
<dep package="libxml2"/>
<dep package="dbus"/>
<dep package="glib"/>
</dependencies>
</autotools>
<distutils id="dbus-python">
<branch repo="git.freedesktop.org" module="dbus/dbus-python"/>
<dependencies>
<dep package="dbus"/>
<dep package="dbus-glib"/>
</dependencies>
</distutils>
<autotools id="PolicyKit">
<branch repo="hal.freedesktop.org"/>
<dependencies>
<dep package="dbus-glib"/>
</dependencies>
</autotools>
<autotools id="hal">
<branch repo="hal.freedesktop.org"/>
<dependencies>
<dep package="dbus"/>
<dep package="PolicyKit"/>
</dependencies>
</autotools>
<autotools id="hal-0-4">
<branch repo="hal.freedesktop.org" module="hal"
revision="hal-0_4-stable-branch" checkoutdir="hal-0.4"/>
<dependencies>
<dep package="dbus-0.23"/>
</dependencies>
</autotools>
<autotools id="fontconfig">
<branch repo="fontconfig.freedesktop.org" revision="fc-2_4_branch"/>
</autotools>
<autotools id="icon-slicer">
<branch repo="icon-theme.freedesktop.org"/>
</autotools>
<autotools id="icon-naming-utils">
<branch repo="icon-theme.freedesktop.org"/>
</autotools>
<tarball id="hicolor-icon-theme" version="0.9"
supports-non-srcdir-builds="no">
<source href="http://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.9.tar.gz"
size="32574" md5sum="1d0821cb80d394eac30bd8cec5b0b60c"/>
</tarball>
<autotools id="tango-icon-theme">
<branch repo="tango.freedesktop.org"/>
<dependencies>
<dep package="icon-naming-utils"/>
</dependencies>
</autotools>
<autotools id="tango-icon-theme-extras">
<branch repo="tango.freedesktop.org"/>
<dependencies>
<dep package="tango-icon-theme"/>
</dependencies>
</autotools>
<autotools id="startup-notification">
<branch repo="startup-notification.freedesktop.org"/>
</autotools>
<autotools id="RenderProto">
<branch repo="git.freedesktop.org"
module="xorg/proto/renderproto" checkoutdir="RenderProto" />
</autotools>
<autotools id="libXrender" supports-non-srcdir-builds="no">
<branch repo="git.freedesktop.org"
module="xorg/lib/libXrender" checkoutdir="libXrender" />
<dependencies>
<dep package="RenderProto"/>
</dependencies>
</autotools>
<autotools id="libXft" supports-non-srcdir-builds="no">
<branch repo="git.freedesktop.org"
module="xorg/lib/libXft" checkoutdir="libXft" />
<dependencies>
<dep package="fontconfig"/>
<dep package="libXrender"/>
</dependencies>
</autotools>
<autotools id="poppler">
<branch repo="poppler.freedesktop.org"/>
<dependencies>
<dep package="cairo"/>
</dependencies>
</autotools>
<autotools id="poppler-0-4">
<branch repo="poppler.freedesktop.org" module="poppler"
revision="POPPLER_0_4_X" checkoutdir="poppler-0-4"/>
<dependencies>
<dep package="cairo-1-0"/>
</dependencies>
</autotools>
<perl id="perl-net-dbus">
<branch repo="cpan"
module="authors/id/D/DA/DANBERR/Net-DBus-0.33.2.tar.gz" version="0.33.2"
size="83279" md5sum="7e722c48c4bca7740cf28512287571b7"/>
<dependencies>
<dep package="dbus"/>
</dependencies>
</perl>
<autotools id="system-tools-backends">
<branch repo="system-tools-backends.freedesktop.org"
revision="BEFORE_DBUS_MERGE"/>
<suggests>
<dep package="perl-net-dbus"/>
</suggests>
</autotools>
<autotools id="system-tools-backends-1.4">
<branch repo="system-tools-backends.freedesktop.org"
module="system-tools-backends" revision="stb-1-4"
checkoutdir="system-tools-backends-1.4"/>
</autotools>
<autotools id="libdaemon">
<branch repo="libdaemon.0pointer.de" module="trunk" checkoutdir="libdaemon"/>
</autotools>
<!-- explicit disabling of qt3 and qt4 can be removed once avahi
correctly detects what is available. -->
<autotools id="avahi" autogenargs="--disable-qt3 --disable-qt4 --disable-mono --disable-monodoc --disable-manpages --enable-compat-howl --enable-compat-libdns_sd">
<branch repo="avahi.0pointer.de" module="trunk" checkoutdir="avahi"/>
<dependencies>
<dep package="libdaemon"/>
<dep package="dbus-python"/>
<dep package="pygtk"/>
</dependencies>
</autotools>
</moduleset>
@@ -0,0 +1,135 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*-->
<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<cvsroot name="gcc.gnu.org"
root=":pserver:anoncvs@gcc.gnu.org:/cvs/gcc"
password="" />
<cvsroot name="rhug.sources.redhat.com"
root=":pserver:anoncvs@sources.redhat.com:/cvs/rhug"
password="" />
<cvsroot name="gdb.sources.redhat.com"
root=":pserver:anoncvs@sources.redhat.com:/cvs/src"
password="anoncvs" />
<cvsroot name="gnome.org"
root=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome"
password="" />
<cvsroot name="classpath.savannah.gnu.org"
root=":ext:anoncvs@savannah.gnu.org:/cvsroot/classpath"
password="" />
<cvsroot name="cairo.freedesktop.org"
root=":pserver:anoncvs@cvs.freedesktop.org:/cvs/cairo"
password="" />
<include href="gnome-2.12.modules" />
<gdbmodule id="gdb" cvsroot="gdb.sources.redhat.com" />
<gcjmodule id="gcj" cvsroot="gcc.gnu.org">
<dependencies>
<dep package="cairo" />
<dep package="gtk+" />
</dependencies>
</gcjmodule>
<cvsmodule id="java-gcj-compat" cvsroot="rhug.sources.redhat.com">
<dependencies>
<dep package="ecj-for-jhbuild" />
<dep package="gjdoc" />
</dependencies>
</cvsmodule>
<cvsmodule id="ecj-for-jhbuild" cvsroot="rhug.sources.redhat.com"
supports-non-srcdir-builds="no">
<dependencies>
<dep package="gcj" />
</dependencies>
</cvsmodule>
<cvsmodule id="gjdoc" cvsroot="classpath.savannah.gnu.org" >
<dependencies>
<dep package="gcj" />
</dependencies>
</cvsmodule>
<cvsmodule id="jg-common" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="glib" />
</dependencies>
</cvsmodule>
<cvsmodule id="cairo-java" cvsroot="cairo.freedesktop.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="jg-common" />
<dep package="cairo" />
</dependencies>
</cvsmodule>
<cvsmodule id="libgtk-java" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="jg-common" />
<dep package="cairo-java" />
</dependencies>
</cvsmodule>
<cvsmodule id="libgnomevfs-java" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="libgtk-java" />
</dependencies>
</cvsmodule>
<cvsmodule id="libgnome-java" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="libgnome" />
<dep package="libgnomeui" />
<dep package="libgnomecanvas" />
<dep package="libgtk-java" />
</dependencies>
</cvsmodule>
<cvsmodule id="libglade-java" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="libgtk-java" />
<dep package="libgnome-java" />
</dependencies>
</cvsmodule>
<cvsmodule id="libgconf-java" cvsroot="gnome.org">
<suggests>
<dep package="gcj" />
</suggests>
<dependencies>
<dep package="libgtk-java" />
<dep package="libgnome-java" />
</dependencies>
</cvsmodule>
<metamodule id="java-gnome">
<dependencies>
<dep package="libgtk-java" />
<dep package="libgnome-java" />
<dep package="libglade-java" />
<dep package="libgconf-java" />
</dependencies>
</metamodule>
</moduleset>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,36 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: nxml -*-->
<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<tarball id="libgpg-error" version="1.3">
<source href="http://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.3.tar.bz2"
size="452266" md5sum="d978065d62cde48e79497b63f80ba8fc" />
</tarball>
<tarball id="libgcrypt" version="1.2.2">
<source href="http://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.2.2.tar.bz2"
size="780315" md5sum="4a8a9a7572892ae3803a5aa558e52e02" />
<dependencies>
<dep package="libgpg-error" />
</dependencies>
</tarball>
<tarball id="libtasn1" version="0.3.4" supports-non-srcdir-builds="no">
<source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/libtasn1/libtasn1-0.3.4.tar.gz"
size="1246545" md5sum="1dbfce0e1fbd6aebc1a4506814c23d35" />
</tarball>
<tarball id="opencdk" version="0.5.8" supports-non-srcdir-builds="no">
<source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/opencdk/opencdk-0.5.8.tar.gz"
size="497122" md5sum="900c4dee7712845c19d7b2d2a93ea546" />
<dependencies>
<dep package="libgcrypt" />
</dependencies>
</tarball>
<tarball id="gnutls" version="1.4.0">
<source href="http://ftp.gnupg.org/gcrypt/alpha/gnutls/gnutls-1.4.0.tar.bz2"
size="3281324" md5sum="9e1e1b07e971c604923ec394f6922301" />
<dependencies>
<dep package="libgcrypt" />
<dep package="libtasn1" />
<dep package="opencdk" />
</dependencies>
</tarball>
</moduleset>
@@ -0,0 +1,72 @@
<?xml version="1.0"?><!--*- mode: nxml -*-->
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<repository type="cvs" name="gnome.org" default="yes"
cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome"
password=""/>
<repository type="cvs" name="mime.freedesktop.org"
cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/mime"
password=""/>
<include href="freedesktop.modules"/>
<autotools id="gnome-common">
<branch/>
</autotools>
<autotools id="intltool">
<branch/>
<dependencies>
<dep package="gnome-common"/>
</dependencies>
</autotools>
<autotools id="shared-mime-info" supports-non-srcdir-builds="no">
<branch repo="mime.freedesktop.org"/>
<dependencies>
<dep package="intltool"/>
</dependencies>
</autotools>
<autotools id="libxml2">
<branch module="gnome-xml" checkoutdir="libxml2"/>
</autotools>
<autotools id="libxslt">
<branch/>
<dependencies>
<dep package="libxml2"/>
</dependencies>
</autotools>
<autotools id="gtk-doc">
<branch/>
<dependencies>
<dep package="libxslt"/>
</dependencies>
</autotools>
<autotools id="glib">
<branch/>
<dependencies>
<dep package="gtk-doc"/>
</dependencies>
</autotools>
<autotools id="pango">
<branch/>
<dependencies>
<dep package="glib"/>
<dep package="cairo"/>
<dep package="libXft"/>
</dependencies>
</autotools>
<autotools id="atk">
<branch/>
<dependencies>
<dep package="glib"/>
</dependencies>
</autotools>
<autotools id="gtk+">
<branch/>
<dependencies>
<dep package="cairo"/>
<dep package="atk"/>
<dep package="pango"/>
<dep package="shared-mime-info"/>
</dependencies>
</autotools>
</moduleset>
@@ -0,0 +1,72 @@
<?xml version="1.0"?><!--*- mode: nxml -*-->
<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
<moduleset>
<repository type="cvs" name="gnome.org" default="yes"
cvsroot=":pserver:anonymous@anoncvs.gnome.org:/cvs/gnome"
password=""/>
<repository type="cvs" name="mime.freedesktop.org"
cvsroot=":pserver:anoncvs@cvs.freedesktop.org:/cvs/mime"
password=""/>
<include href="freedesktop.modules"/>
<autotools id="gnome-common">
<branch/>
</autotools>
<autotools id="intltool">
<branch/>
<dependencies>
<dep package="gnome-common"/>
</dependencies>
</autotools>
<autotools id="shared-mime-info" supports-non-srcdir-builds="no">
<branch repo="mime.freedesktop.org"/>
<dependencies>
<dep package="intltool"/>
</dependencies>
</autotools>
<autotools id="libxml2">
<branch module="gnome-xml" checkoutdir="libxml2"/>
</autotools>
<autotools id="libxslt">
<branch/>
<dependencies>
<dep package="libxml2"/>
</dependencies>
</autotools>
<autotools id="gtk-doc">
<branch/>
<dependencies>
<dep package="libxslt"/>
</dependencies>
</autotools>
<autotools id="glib">
<branch revision="glib-2-8"/>
<dependencies>
<dep package="gtk-doc"/>
</dependencies>
</autotools>
<autotools id="pango">
<branch revision="pango-1-10"/>
<dependencies>
<dep package="glib"/>
<dep package="cairo"/>
<dep package="libXft"/>
</dependencies>
</autotools>
<autotools id="atk">
<branch/>
<dependencies>
<dep package="glib"/>
</dependencies>
</autotools>
<autotools id="gtk+">
<branch revision="gtk-2-8"/>
<dependencies>
<dep package="cairo"/>
<dep package="atk"/>
<dep package="pango"/>
<dep package="shared-mime-info"/>
</dependencies>
</autotools>
</moduleset>
@@ -0,0 +1,115 @@
<!ELEMENT moduleset ((cvsroot|svnroot|arch-archive|darcs-archive)*,
(include|cvsmodule|svnmodule|archmodule|darcsmodule|
metamodule|tarball|mozillamodule)*) >
<!ELEMENT cvsroot EMPTY >
<!ATTLIST cvsroot
name CDATA #REQUIRED
root CDATA #REQUIRED
password CDATA #IMPLIED
default (yes|no) 'no' >
<!ELEMENT svnroot EMPTY >
<!ATTLIST svnroot
name CDATA #REQUIRED
href CDATA #REQUIRED
default (yes|no) 'no' >
<!ELEMENT arch-archive EMPTY >
<!ATTLIST arch-archive
name CDATA #REQUIRED
href CDATA #REQUIRED
default (yes|no) 'no' >
<!ELEMENT darcs-archive EMPTY >
<!ATTLIST darcs-archive
name CDATA #REQUIRED
href CDATA #REQUIRED
default (yes|no) 'no' >
<!ELEMENT include EMPTY >
<!ATTLIST include
href CDATA #REQUIRED >
<!ELEMENT cvsmodule (dependencies?,suggests?) >
<!ATTLIST cvsmodule
id CDATA #REQUIRED
module CDATA #IMPLIED
revision CDATA #IMPLIED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
cvsroot CDATA #IMPLIED
supports-non-srcdir-builds (yes|no) 'yes' >
<!ELEMENT svnmodule (dependencies?,suggests?) >
<!ATTLIST svnmodule
id CDATA #REQUIRED
module CDATA #IMPLIED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
root CDATA #IMPLIED
supports-non-srcdir-builds (yes|no) 'yes' >
<!ELEMENT archmodule (dependencies?,suggests?) >
<!ATTLIST archmodule
id CDATA #REQUIRED
version CDATA #IMPLIED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
root CDATA #IMPLIED
supports-non-srcdir-builds (yes|no) 'yes' >
<!ELEMENT darcsmodule (dependencies?,suggests?) >
<!ATTLIST darcsmodule
id CDATA #REQUIRED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
root CDATA #IMPLIED
supports-non-srcdir-builds (yes|no) 'yes' >
<!ELEMENT metamodule (dependencies) >
<!ATTLIST metamodule
id CDATA #REQUIRED >
<!ELEMENT tarball
(source,patches?,dependencies?,suggests?) >
<!ATTLIST tarball
id CDATA #REQUIRED
version CDATA #REQUIRED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
supports-non-srcdir-builds (yes|no) 'yes' >
<!ELEMENT mozillamodule (dependencies?,suggests?) >
<!ATTLIST mozillamodule
id CDATA #REQUIRED
module CDATA #IMPLIED
revision CDATA #IMPLIED
checkoutdir CDATA #IMPLIED
autogenargs CDATA #IMPLIED
makeargs CDATA #IMPLIED
cvsroot CDATA #IMPLIED >
<!-- Tarball sub-elements -->
<!ELEMENT source EMPTY >
<!ATTLIST source
href CDATA #REQUIRED
size CDATA #IMPLIED
md5sum CDATA #IMPLIED >
<!ELEMENT patches (patch)* >
<!ELEMENT patch EMPTY >
<!ATTLIST patch
file CDATA #REQUIRED
strip CDATA '0' >
<!-- common sub-elements -->
<!ELEMENT dependencies (dep*) >
<!ELEMENT suggests (dep*) >
<!ELEMENT dep EMPTY >
<!ATTLIST dep
package CDATA #REQUIRED >
@@ -0,0 +1,131 @@
default namespace = ""
start = moduleset
boolean = "yes" | "no"
moduleset = element moduleset { repository*,
(\include|package)* }
repository_cvs = attribute type { "cvs" },
attribute cvsroot { text },
attribute password { text }?
repository_svn = attribute type { "svn" },
attribute href { xsd:anyURI }
repository_arch = attribute type { "arch" },
attribute archive { text },
attribute href { xsd:anyURI }?
repository_darcs = attribute type { "darcs" },
attribute href { xsd:anyURI }
repository_git = attribute type { "git" },
attribute href { xsd:anyURI }
repository_tarball = attribute type { "tarball" },
attribute href { xsd:anyURI }
repository = element repository {
attribute name { text },
attribute default { boolean }?,
(repository_cvs|repository_svn|repository_arch|
repository_darcs|repository_git|repository_tarball)
}
\include = element include {
attribute href { xsd:anyURI }
}
package = autotools |
metamodule |
distutils |
perl |
tarball |
mozillamodule
dep = element dep {
attribute package { text }
}
dependencies = element dependencies { dep* }
after = element after { dep* } | element suggests { dep* }
common = attribute id { text } & dependencies* & after*
branch_cvs = attribute module { text }?,
attribute checkoutdir { text }?,
attribute revision { text}?,
attribute override-checkoutdir { boolean }?,
attribute update-new-dirs { boolean }?
branch_svn = attribute module { xsd:anyURI }?,
attribute checkoutdir { text }?
branch_arch = attribute module { xsd:anyURI }?,
attribute checkoutdir { text }?
branch_darcs = attribute module { xsd:anyURI }?,
attribute checkoutdir { text }?
branch_git = attribute module { xsd:anyURI }?,
attribute checkoutdir { text }?
branch_tarball = attribute module { xsd:anyURI },
attribute version { text },
attribute size { text }?,
attribute md5sum { text }?,
element patch {
attribute file { text },
attribute strip { text }?
}*
branch = element branch {
attribute repo { text }?,
(branch_cvs|branch_svn|branch_arch|branch_darcs|branch_git|branch_tarball)
}
autotools = element autotools {
branch &
attribute autogen-sh { text }? &
attribute autogenargs { text }? &
attribute makeargs { text }? &
attribute supports-non-srcdir-builds { boolean }? &
common
}
metamodule = element metamodule { common }
distutils = element distutils {
branch &
attribute supports-non-srcdir-builds { boolean }? &
common
}
perl = element perl {
branch &
attribute makeargs { text }? &
common
}
tarball = element tarball {
attribute version { text },
attribute checkoutdir { text }?,
attribute autogenargs { text }?,
attribute makeargs { text }?,
attribute supports-non-srcdir-builds { boolean }?,
(element source {
attribute href { text },
attribute size { text }?,
attribute md5sum { text }? } &
element patches {
element patch {
attribute file { text },
attribute strip { text }?
}+ }? &
common)
}
mozillamodule = element mozillamodule {
attribute module { text }?,
attribute revision { text }?,
attribute checkoutdir { text }?,
attribute autogenargs { text }?,
attribute makeargs { text }?,
attribute cvsroot { text }?,
attribute root { text }?,
common
}
@@ -0,0 +1,283 @@
<?xml version='1.0'?> <!--*- mode: nxml -*-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" encoding="ISO-8859-1" indent="yes" />
<xsl:key name="module-id" match="moduleset/*" use="@id" />
<xsl:template match="/">
<html>
<head>
<title>Module Set</title>
<style type="text/css">
<xsl:text>
div.cvsmodule, div.mozillamodule {
padding: 0.5em;
margin: 0.5em;
background: #87CEFA;
}
div.svnmodule {
padding: 0.5em;
margin: 0.5em;
background: #67AEDA;
}
div.metamodule {
padding: 0.5em;
margin: 0.5em;
background: #F08080;
}
div.tarball {
padding: 0.5em;
margin: 0.5em;
background: #EEDD82;
}
</xsl:text>
</style>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="moduleset">
<h1>Module Set</h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="dependencies">
<xsl:variable name="deps" select="dep/@package" />
<xsl:for-each select="$deps">
<a href="#{generate-id(key('module-id', .))}">
<xsl:value-of select="." />
</a>
<xsl:if test="not($deps[last()] = .)">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="cvsmodule">
<div class="{name(.)}">
<h2>
<xsl:value-of select="@id" />
<a name="{generate-id(.)}" />
</h2>
<table>
<tr>
<th align="left">Module:</th>
<td>
<xsl:choose>
<xsl:when test="@module">
<xsl:value-of select="@module" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@revision">
<xsl:text> rv:</xsl:text>
<xsl:value-of select="@revision" />
</xsl:if>
</td>
</tr>
<xsl:if test="@checkoutdir">
<tr>
<th align="left">Checkout directory:</th>
<td><xsl:value-of select="@checkoutdir" /></td>
</tr>
</xsl:if>
<xsl:if test="@autogenargs">
<tr>
<th align="left">Autogen args:</th>
<td><xsl:value-of select="@autogenargs" /></td>
</tr>
</xsl:if>
<xsl:if test="@cvsroot">
<tr>
<th align="left">CVS Root:</th>
<td><xsl:value-of select="@cvsroot" /></td>
</tr>
</xsl:if>
<xsl:if test="dependencies">
<tr>
<th align="left" valign="top">Dependencies:</th>
<td><xsl:apply-templates select="dependencies" /></td>
</tr>
</xsl:if>
</table>
</div>
</xsl:template>
<xsl:template match="svnmodule">
<div class="{name(.)}">
<h2>
<xsl:value-of select="@id" />
<a name="{generate-id(.)}" />
</h2>
<table>
<tr>
<th align="left">Module:</th>
<td>
<xsl:choose>
<xsl:when test="@module">
<xsl:value-of select="@module" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id" />
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:if test="@checkoutdir">
<tr>
<th align="left">Checkout directory:</th>
<td><xsl:value-of select="@checkoutdir" /></td>
</tr>
</xsl:if>
<xsl:if test="@autogenargs">
<tr>
<th align="left">Autogen args:</th>
<td><xsl:value-of select="@autogenargs" /></td>
</tr>
</xsl:if>
<xsl:if test="@svnroot">
<tr>
<th align="left">SVN Repository:</th>
<td><xsl:value-of select="@svnroot" /><xsl:if test="@path"><xsl:value-of select="@path" /></xsl:if></td>
</tr>
</xsl:if>
<xsl:if test="dependencies">
<tr>
<th align="left" valign="top">Dependencies:</th>
<td><xsl:apply-templates select="dependencies" /></td>
</tr>
</xsl:if>
</table>
</div>
</xsl:template>
<xsl:template match="metamodule">
<div class="{name(.)}">
<h2>
<xsl:value-of select="@id" />
<a name="{generate-id(.)}" />
</h2>
<table>
<xsl:if test="dependencies">
<tr>
<th align="left" valign="top">Dependencies:</th>
<td><xsl:apply-templates select="dependencies" /></td>
</tr>
</xsl:if>
</table>
</div>
</xsl:template>
<xsl:template match="patches">
<ul>
<xsl:for-each select="patch">
<li><xsl:value-of select="." /></li>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="tarball">
<div class="{name(.)}">
<h2>
<xsl:value-of select="@id" />
<a name="{generate-id(.)}" />
</h2>
<table>
<tr>
<th align="left">Version:</th>
<td><xsl:value-of select="@version" /></td>
</tr>
<xsl:if test="@versioncheck">
<tr>
<th align="left">Version check:</th>
<td><xsl:value-of select="@versioncheck" /></td>
</tr>
</xsl:if>
<tr>
<th align="left">Source:</th>
<td>
<a href="{source/@href}">
<xsl:value-of select="source/@href" />
</a>
<xsl:if test="source/@size">
<xsl:text> (</xsl:text>
<xsl:value-of select="source/@size" />
<xsl:text> bytes)</xsl:text>
</xsl:if>
</td>
</tr>
<xsl:if test="patches">
<tr>
<th align="left" valign="top">Patches:</th>
<td><xsl:apply-templates select="patches" /></td>
</tr>
</xsl:if>
<xsl:if test="dependencies">
<tr>
<th align="left" valign="top">Dependencies:</th>
<td><xsl:apply-templates select="dependencies" /></td>
</tr>
</xsl:if>
</table>
</div>
</xsl:template>
<xsl:template match="mozillamodule">
<div class="{name(.)}">
<h2>
<xsl:value-of select="@id" />
<a name="{generate-id(.)}" />
</h2>
<table>
<tr>
<th align="left">Module:</th>
<td>
<xsl:choose>
<xsl:when test="@module">
<xsl:value-of select="@module" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@id" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@revision">
<xsl:text> rv:</xsl:text>
<xsl:value-of select="@revision" />
</xsl:if>
</td>
</tr>
<xsl:if test="@checkoutdir">
<tr>
<th align="left">Checkout directory:</th>
<td><xsl:value-of select="@checkoutdir" /></td>
</tr>
</xsl:if>
<xsl:if test="@autogenargs">
<tr>
<th align="left">Autogen args:</th>
<td><xsl:value-of select="@autogenargs" /></td>
</tr>
</xsl:if>
<xsl:if test="@cvsroot">
<tr>
<th align="left">CVS Root:</th>
<td><xsl:value-of select="@cvsroot" /></td>
</tr>
</xsl:if>
<xsl:if test="dependencies">
<tr>
<th align="left" valign="top">Dependencies:</th>
<td><xsl:apply-templates select="dependencies" /></td>
</tr>
</xsl:if>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0">
<documentElement localName="moduleset" uri="moduleset.rnc" />
</locatingRules>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+55
View File
@@ -0,0 +1,55 @@
/*
* Copyright (C) 2005-2011 by Wind River Systems, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
#include <bits/wordsize.h>
#ifdef __WORDSIZE
#if __WORDSIZE == 32
#ifdef _MIPS_SIM
#if _MIPS_SIM == _ABIO32
#include <ENTER_HEADER_FILENAME_HERE-32.h>
#elif _MIPS_SIM == _ABIN32
#include <ENTER_HEADER_FILENAME_HERE-n32.h>
#else
#error "Unknown _MIPS_SIM"
#endif
#else /* _MIPS_SIM is not defined */
#include <ENTER_HEADER_FILENAME_HERE-32.h>
#endif
#elif __WORDSIZE == 64
#include <ENTER_HEADER_FILENAME_HERE-64.h>
#else
#error "Unknown __WORDSIZE detected"
#endif /* matches #if __WORDSIZE == 32 */
#else /* __WORDSIZE is not defined */
#error "__WORDSIZE is not defined"
#endif
+2
View File
@@ -0,0 +1,2 @@
#! /bin/sh
echo "Intercept $0: $@ -- do nothing"
+73
View File
@@ -0,0 +1,73 @@
#!/bin/sh
# OE-Core Build Enviroment Setup Script
#
# Copyright (C) 2006-2011 Linux Foundation
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# It is assumed OEROOT is already defined when this is called
if [ -z "$OEROOT" ]; then
echo >&2 "Error: OEROOT is not defined!"
return 1
fi
if [ "x$BDIR" = "x" ]; then
if [ "x$1" = "x" ]; then
BDIR="build"
else
BDIR="$1"
if [ "$BDIR" = "/" ]; then
echo >&2 "Error: / is not supported as a build directory."
return 1
fi
# Remove any possible trailing slashes. This is used to work around
# buggy readlink in Ubuntu 10.04 that doesn't ignore trailing slashes
# and hence "readlink -f new_dir_to_be_created/" returns empty.
BDIR=`echo $BDIR | sed -re 's|/+$||'`
BDIR=`readlink -f "$BDIR"`
if [ -z "$BDIR" ]; then
PARENTDIR=`dirname "$1"`
echo >&2 "Error: the directory $PARENTDIR does not exist?"
return 1
fi
fi
fi
if expr "$BDIR" : '/.*' > /dev/null ; then
BUILDDIR="$BDIR"
else
BUILDDIR="`pwd`/$BDIR"
fi
unset BDIR
BITBAKEDIR="$OEROOT/bitbake$BBEXTRA/"
BITBAKEDIR=`readlink -f "$BITBAKEDIR"`
BUILDDIR=`readlink -f "$BUILDDIR"`
if ! (test -d "$BITBAKEDIR"); then
echo >&2 "Error: The bitbake directory ($BITBAKEDIR) does not exist! Please ensure a copy of bitbake exists at this location"
return 1
fi
PATH="${OEROOT}/scripts:$BITBAKEDIR/bin/:$PATH"
unset BITBAKEDIR
# Used by the runqemu script
export BUILDDIR
export PATH
export BB_ENV_EXTRAWHITE="MACHINE DISTRO TCMODE TCLIBC http_proxy ftp_proxy https_proxy all_proxy ALL_PROXY no_proxy SSH_AGENT_PID SSH_AUTH_SOCK BB_SRCREV_POLICY SDKMACHINE BB_NUMBER_THREADS PARALLEL_MAKE GIT_PROXY_COMMAND GIT_PROXY_IGNORE SOCKS5_PASSWD SOCKS5_USER"
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
#
# Find a native sysroot to use - either from an in-tree OE build or
# from a toolchain installation. It then ensures the variable
# $OECORE_NATIVE_SYSROOT is set to the sysroot's base directory, and sets
# $PSEUDO to the path of the pseudo binary.
#
# This script is intended to be run within other scripts by source'ing
# it, e.g:
#
# SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot`
# . $SYSROOT_SETUP_SCRIPT
#
# This script will terminate execution of your calling program unless
# you set a variable $SKIP_STRICT_SYSROOT_CHECK to a non-empty string
# beforehand.
#
# Copyright (c) 2010 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
BITBAKE=`which bitbake 2> /dev/null`
if [ "x$BITBAKE" != "x" ]; then
if [ "$UID" = "0" ]; then
# Root cannot run bitbake unless sanity checking is disabled
if [ ! -d "./conf" ]; then
echo "Error: root cannot run bitbake by default, and I cannot find a ./conf directory to be able to disable sanity checking"
exit 1
fi
touch conf/sanity.conf
OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2`
rm -f conf/sanity.conf
else
OECORE_NATIVE_SYSROOT=`bitbake -e | grep ^STAGING_DIR_NATIVE | cut -d '=' -f2 | cut -d '"' -f2`
fi
else
echo "Error: Unable to locate your native sysroot."
echo "Did you forget to source the build environment setup script?"
if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then
exit 1
fi
fi
fi
# Set up pseudo command
if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/bin/pseudo" ]; then
echo "Error: Unable to find pseudo binary in $OECORE_NATIVE_SYSROOT/usr/bin/"
if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
echo "Have you run 'bitbake meta-ide-support'?"
else
echo "This shouldn't happen - something is wrong with your toolchain installation"
fi
if [ -z "$SKIP_STRICT_SYSROOT_CHECK" ]; then
exit 1
fi
fi
PSEUDO="$OECORE_NATIVE_SYSROOT/usr/bin/pseudo"
+10
View File
@@ -0,0 +1,10 @@
#! /bin/bash
(echo "CONNECT $1:$2 HTTP/1.0";
echo;
cat ) | nc $GIT_PROXY_HOST $GIT_PROXY_PORT |
(read a;
read a;
read a;
cat )
+2
View File
@@ -0,0 +1,2 @@
#! /bin/bash
oe-git-proxy-socks -S $GIT_PROXY_HOST:$GIT_PROXY_PORT $@
File diff suppressed because it is too large Load Diff
+126
View File
@@ -0,0 +1,126 @@
#!/bin/sh
# OE Build Enviroment Setup Script
#
# Copyright (C) 2006-2011 Linux Foundation
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
if [ -z "$BUILDDIR" ]; then
echo >&2 "Error: The build directory (BUILDDIR) must be set!"
exit 1
fi
mkdir -p $BUILDDIR/conf
if ! (test -d "$BUILDDIR"); then
echo >&2 "Error: The builddir ($BUILDDIR) does not exist!"
exit 1
fi
if ! (test -w "$BUILDDIR"); then
echo >&2 "Error: Cannot write to $BUILDDIR, perhaps try sourcing with a writable path? i.e. . oe-init-build-env ~/my-build"
exit 1
fi
cd "$BUILDDIR"
TEMPLATECONF=${TEMPLATECONF:-meta/conf}
#
# $TEMPLATECONF can point to a directory for the template local.conf & bblayers.conf
#
if [ "x" != "x$TEMPLATECONF" ]; then
if ! (test -d "$TEMPLATECONF"); then
# Allow TEMPLATECONF=meta-xyz/conf as a shortcut
if [ -d "$OEROOT/$TEMPLATECONF" ]; then
TEMPLATECONF="$OEROOT/$TEMPLATECONF"
fi
if ! (test -d "$TEMPLATECONF"); then
echo >&2 "Error: '$TEMPLATECONF' must be a directory containing local.conf & bblayers.conf"
return
fi
fi
OECORELAYERCONF="$TEMPLATECONF/bblayers.conf.sample"
OECORELOCALCONF="$TEMPLATECONF/local.conf.sample"
fi
if [ "x" = "x$OECORELOCALCONF" ]; then
OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample"
fi
if ! (test -r "$BUILDDIR/conf/local.conf"); then
cat <<EOM
You had no conf/local.conf file. This configuration file has therefore been
created for you with some default values. You may wish to edit it to use a
different MACHINE (target hardware) or enable parallel build options to take
advantage of multiple cores for example. See the file for more information as
common configuration options are commented.
The Yocto Project has extensive documentation about OE including a reference manual
which can be found at:
http://yoctoproject.org/documentation
For more information about OpenEmbedded see their website:
http://www.openembedded.org/
EOM
cp -f $OECORELOCALCONF $BUILDDIR/conf/local.conf
fi
if [ "x" = "x$OECORELAYERCONF" ]; then
OECORELAYERCONF="$OEROOT/meta/conf/bblayers.conf.sample"
fi
if ! (test -r "$BUILDDIR/conf/bblayers.conf"); then
cat <<EOM
You had no conf/bblayers.conf file. The configuration file has been created for
you with some default values. To add additional metadata layers into your
configuration please add entries to this file.
The Yocto Project has extensive documentation about OE including a reference manual
which can be found at:
http://yoctoproject.org/documentation
For more information about OpenEmbedded see their website:
http://www.openembedded.org/
EOM
# Put the abosolute path to the layers in bblayers.conf so we can run
# bitbake without the init script after the first run
sed "s|##COREBASE##|$OEROOT|g" $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf
fi
# Prevent disturbing a new GIT clone in same console
unset OECORELOCALCONF
unset OECORELAYERCONF
cat <<EOM
### Shell environment set up for builds. ###
You can now run 'bitbake <target>'
Common targets are:
core-image-minimal
core-image-sato
meta-toolchain
meta-toolchain-sdk
adt-installer
meta-ide-support
You can also run generated qemu images with a command like 'runqemu qemux86'
EOM
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
#
# This utility setup the necessary metadata for an rpm repo
#
# Copyright (c) 2011 Intel Corp.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Don't use TMPDIR from the external environment, it may be a distro
# variable pointing to /tmp (e.g. within X on OpenSUSE)
# Instead, use OE_TMPDIR for passing this in externally.
TMPDIR="$OE_TMPDIR"
function usage() {
echo "Usage: $0 <rpm-dir>"
echo " <rpm-dir>: default is $TMPDIR/deploy/rpm"
}
if [ $# -gt 1 ]; then
usage
exit 1
fi
setup_tmpdir() {
if [ -z "$TMPDIR" ]; then
# Try to get TMPDIR from bitbake
type -P bitbake &>/dev/null || {
echo "In order for this script to dynamically infer paths";
echo "to kernels or filesystem images, you either need";
echo "bitbake in your PATH or to source oe-init-build-env";
echo "before running this script" >&2;
exit 1; }
# We have bitbake in PATH, get TMPDIR from bitbake
TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
if [ -z "$TMPDIR" ]; then
echo "Error: this script needs to be run from your build directory,"
echo "or you need to explicitly set TMPDIR in your environment"
exit 1
fi
fi
}
setup_sysroot() {
# Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
# environment script. If that variable isn't set, we're
# either in an in-tree poky scenario or the environment
# script wasn't source'd.
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
setup_tmpdir
BUILD_ARCH=`uname -m`
BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
OECORE_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
fi
}
setup_tmpdir
setup_sysroot
if [ -n "$1" ]; then
RPM_DIR="$1"
else
RPM_DIR="$TMPDIR/deploy/rpm"
fi
if [ ! -d "$RPM_DIR" ]; then
echo "Error: rpm dir $RPM_DIR doesn't exist"
exit 1
fi
CREATEREPO=$OECORE_NATIVE_SYSROOT/usr/bin/createrepo
if [ ! -e "$CREATEREPO" ]; then
echo "Error: can't find createrepo binary"
echo "please run bitbake createrepo-native first"
exit 1
fi
$CREATEREPO "$RPM_DIR"
exit 0
+49
View File
@@ -0,0 +1,49 @@
#! /usr/bin/env python
import sys
try:
import xml.etree.cElementTree as etree
except:
import xml.etree.ElementTree as etree
def child (elem, name):
for e in elem.getchildren():
if e.tag == name:
return e
return None
def children (elem, name=None):
l = elem.getchildren()
if name:
l = [e for e in l if e.tag == name]
return l
xml = etree.parse(sys.argv[1])
for schema in child(xml.getroot(), "schemalist").getchildren():
e = child(schema, "short")
if e is not None:
schema.remove(e)
e = child(schema, "long")
if e is not None:
schema.remove(e)
for locale in children(schema, "locale"):
# One locale must exist so leave C locale...
a = locale.attrib.get("name")
if a == 'C':
continue
e = child(locale, "default")
if e is None:
schema.remove(locale)
else:
e = child(locale, "short")
if e is not None:
locale.remove(e)
e = child(locale, "long")
if e is not None:
locale.remove(e)
xml.write(sys.stdout, "UTF-8")
+778
View File
@@ -0,0 +1,778 @@
#!/bin/bash
# Common function for test
# Expect should be installed for SSH Testing
# To execute `runqemu`, NOPASSWD needs to be set in /etc/sudoers for user
# For example, for user "builder", /etc/sudoers can be like following:
# #########
# #Members of the admin group may gain root privileges
# %builder ALL=(ALL) NOPASSWD: NOPASSWD: ALL
# #########
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
TYPE="ext3"
# The folder to hold all scripts running on targets
TOOLS="$COREBASE/scripts/qemuimage-tests/tools"
# The folder to hold all projects for toolchain testing
TOOLCHAIN_PROJECTS="$COREBASE/scripts/qemuimage-tests/toolchain_projects"
# Test Directory on target for testing
TARGET_TEST_DIR="/opt/test"
# Global variable for process id
PID=0
# Global variable for target ip address
TARGET_IPADDR=0
# Global variable for test project version during toolchain test
# Version of cvs is 1.12.13
# Version of iptables is 1.4.11
# Version of sudoku-savant is 1.3
PROJECT_PV=0
# Global variable for test project download URL during toolchain test
# URL of cvs is http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2
# URL of iptables is http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2
# URL of sudoku-savant is http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2
PROJECT_DOWNLOAD_URL=0
# SDK folder to hold toolchain tarball
TOOLCHAIN_DIR="${DEPLOY_DIR}/sdk"
# Toolchain test folder to hold extracted toolchain tarball
TOOLCHAIN_TEST="/opt"
# common function for information print
Test_Error()
{
echo -e "\tTest_Error: $*"
}
Test_Info()
{
echo -e "\tTest_Info: $*"
}
# function to update target ip address
# $1 is the process id of the process, which starts the qemu target
# $2 is the ip address of the target
Test_Update_IPSAVE()
{
local pid=$1
local ip_addr=$2
if [ "$TEST_SERIALIZE" -eq 1 ]; then
echo "$pid $ip_addr" > $TARGET_IPSAVE
fi
}
# function to copy files from host into target
# $1 is the ip address of target
# $2 is the files, which need to be copied into target
# $3 is the path on target, where files are copied into
Test_SCP()
{
local ip_addr=$1
local src=$2
local des=$3
local tmpfile=`mktemp`
local timeout=60
local ret=0
# We use expect to interactive with target by ssh
local exp_cmd=`cat << EOF
eval spawn scp -o UserKnownHostsFile=$tmpfile "$src" root@$ip_addr:"$des"
set timeout $time_out
expect {
"*assword:" { send "\r"; exp_continue}
"*(yes/no)?" { send "yes\r"; exp_continue }
eof { exit [ lindex [wait] 3 ] }
}
EOF`
expect=`which expect`
if [ ! -x "$expect" ]; then
Test_Error "ERROR: Please install expect"
return 1
fi
expect -c "$exp_cmd"
ret=$?
rm -rf $tmpfile
return $ret
}
# function to run command in $ip_addr via ssh
Test_SSH()
{
local ip_addr=$1
shift
local command=$@
local tmpfile=`mktemp`
local timeout=60
local ret=0
local exp_cmd=`cat << EOF
eval spawn ssh -o UserKnownHostsFile=$tmpfile root@$ip_addr "$command"
set timeout $time_out
expect {
"*assword:" { send "\r"; exp_continue}
"*(yes/no)?" { send "yes\r"; exp_continue }
eof { exit [ lindex [wait] 3 ] }
}
EOF`
expect=`which expect`
if [ ! -x "$expect" ]; then
Test_Error "ERROR: Please install expect"
return 1
fi
expect -c "$exp_cmd"
ret=$?
rm -rf $tmpfile
return $ret
}
# function to check if ssh is up in $ip_addr
Test_SSH_UP()
{
local ip_addr=$1
local timeout=$2
local interval=0
# If TEST_SERIALIZE is set, use existing running qemu for testing
if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TARGET_IPSAVE} ]; then
timeout=50
fi
while [ ${interval} -lt ${timeout} ]
do
Test_SSH ${ip_addr} "hostname"
if [ $? -ne 0 ]; then
interval=`expr $interval + 10`
sleep 10
else
Test_Info "We can ssh on ${ip_addr} within ${interval} seconds"
return 0
fi
done
Test_Info "We can not ssh on ${ip_addr} in ${timeout} seconds"
return 1
}
# function to prepare target test environment
# $1 is the ip address of target system
# $2 is the files, which needs to be copied into target
Test_Target_Pre()
{
local ip_addr=$1
local testscript=$2
# Create a pre-defined folder for test scripts
Test_SSH $ip_addr "mkdir -p $TARGET_TEST_DIR"
if [ $? -eq 0 ]; then
# Copy test scripts into target
Test_SCP $ip_addr $testscript $TARGET_TEST_DIR && return 0
else
Test_Error "Fail to create $TARGET_TEST_DIR on target"
return 1
fi
return 1
}
# function to record test result in $TEST_RESULT/testresult.log
Test_Print_Result()
{
local PASS=0
local FAIL=0
local NORESULT=0
if [ $2 -eq 0 ]; then
PASS=1
elif [ $2 -eq 1 ]; then
FAIL=1
else
NORESULT=1
fi
# Format the output of the test result
echo -e "$1 $PASS $FAIL $NORESULT" | awk '{printf("\t"); for(i=1;i<=NF;i++) printf("%-15s",$i); printf("\n");}' >> $TEST_RESULT/testresult.log
}
# Test_Kill_Qemu to kill child pid with parent pid given
# $1 is qemu process id, which needs to be killed
Test_Kill_Qemu()
{
local ret=0
local ppid=0
local i=0
local index=0
local total=0
declare local pid
# Check if $1 pid exists and is a qemu process
ps -fp $PID | grep -iq "qemu"
# Find all children pid of the pid $1
if [ $? -eq 0 ]; then
# Check if there is any child pid of the pid $PID
ppid=$PID
ps -f --ppid $ppid
ret=$?
while [ $ret -eq 0 ]
do
# If yes, get the child pid and check if the child pid has other child pid
# Continue the while loop until there is no child pid found
pid[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'`
ppid=${pid[$i]}
i=$((i+1))
ps -f --ppid $ppid
ret=$?
done
# When TEST_SERIALIZE is set, qemu process will not be
# killed until all the cases are finished
if [ ${TEST_SERIALIZE} -eq 1 -a -e ${TEST_STATUS} ]; then
index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'`
total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'`
if [ ${index} != ${total} ]; then
Test_Info "Do not kill the qemu process and use it for later testing"
Test_Update_IPSAVE $PID $TARGET_IPADDR
else
# If it is the last case, let's kill it
while [ $i -ne 0 ]
do
i=$((i-1))
kill ${pid[$i]}
sleep 2
done
# Kill the parent id
kill $PID
fi
else
# Kill these children pids from the last one
while [ $i -ne 0 ]
do
i=$((i-1))
kill ${pid[$i]}
sleep 2
done
# Kill the parent id
kill $PID
fi
fi
return
}
# function to check if there is any qemu process
Test_Check_Qemu_UP()
{
local count=`ps -eo command | cut -d " " -f 1 | grep -c "\(^qemu\|.*/qemu\)"`
if [ ${count} -lt 1 ]; then
Test_Info "There is no Qemu process"
return 1
else
Test_Info "There is at least one Qemu process running"
return 0
fi
}
# function to check if network is up
Test_Check_IP_UP()
{
ping -c1 $1
if [ $? -ne 0 ]; then
Test_Info "IP $1 is not up"
return 1
else
Test_Info "IP $1 is up"
return 0
fi
}
# function to find kernel/rootfs image
Test_Find_Image()
{
where=""
kernel=""
arch=""
target=""
extension=""
rootfs=""
while getopts "l:k:a:t:" Option
do
case $Option in
l) where="$OPTARG"
;;
k) kernel="$OPTARG"
extension="bin"
;;
a) arch="$OPTARG"
;;
t) target="$OPTARG"
extension="ext3"
;;
*) echo "invalid option: -$Option" && return 1
;;
esac
done
if [ ! -z $kernel ]; then
if [ -L ${where}/${kernel}-${arch}.${extension} ]; then
echo ${where}/${kernel}-${arch}.${extension}
return 0
else
for i in `dir ${where}`
do
# Exclude qemux86-64 when target is qemux86
echo $i | grep "${kernel}.*${arch}.*\.${extension}" | grep -qv "${kernel}.*${arch}-64.*\.${extension}"
if [ $? -eq 0 ]; then
echo ${where}/${i}
return 0
fi
done
return 1
fi
fi
if [ ! -z $target ]; then
if [ -L ${where}/${target}-${arch}.${extension} ]; then
rootfs=`readlink -f ${where}/${target}-${arch}.${extension}`
echo ${rootfs}
return 0
else
for i in `dir ${where}`
do
# Exclude qemux86-64 when target is qemux86
echo $i | grep "${target}-${arch}.*\.${extension}" | grep -qv "${target}-${arch}-64.*\.${extension}"
if [ $? -eq 0 ]; then
echo ${where}/${i}
return 0
fi
done
return 1
fi
fi
return 1
}
# function to parse IP address of target
# $1 is the pid of qemu startup process
Test_Fetch_Target_IP()
{
local opid=$1
local ppid=0
local ip_addr=0
local i=0
declare local pid
# Check if $1 pid exists and contains ipaddr of target
ps -fp $opid | grep -oq "192\.168\.7\.[0-9]*::"
# Find all children pid of the pid $1
# and check if they contain ipaddr of target
if [ $? -ne 0 ]; then
# Check if there is any child pid of the pid $1
ppid=$opid
ps -f --ppid $ppid > /dev/zero
ret=$?
while [ $ret -eq 0 ]
do
# If yes, get the child pid and check if the child pid has other child pid
# Continue the while loop until there is no child pid found
pid[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'`
ppid=${pid[$i]}
i=$((i+1))
ps -f --ppid $ppid > /dev/zero
ret=$?
done
# Check these children pids, if they have ipaddr included in command line
while [ $i -ne 0 ]
do
i=$((i-1))
ps -fp ${pid[$i]} | grep -oq "192\.168\.7\.[0-9]*::"
if [ $? -eq 0 ]; then
ip_addr=`ps -fp ${pid[$i]} | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'`
fi
sleep 1
done
else
ip_addr=`ps -fp $opid | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'`
fi
echo $ip_addr
return
}
# function to check if qemu and its network
Test_Create_Qemu()
{
local timeout=$1
local ret=1
local up_time=0
which runqemu
if [ $? -eq 0 ]; then
RUNQEMU=`which runqemu`
else
Test_Error "Can not find runqemu in \$PATH, return fail"
return 1
fi
if [ "$QEMUARCH" = "qemux86" -o "$QEMUARCH" = "qemux86-64" ]; then
KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k bzImage -a ${QEMUARCH})
elif [ "$QEMUARCH" = "qemuarm" -o "$QEMUARCH" = "spitz" -o "$QEMUARCH" = "borzoi" -o "$QEMUARCH" = "akita" -o "$QEMUARCH" = "nokia800" ]; then
KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k zImage -a ${QEMUARCH})
elif [ "$QEMUARCH" = "qemumips" -o "$QEMUARCH" = "qemuppc" ]; then
KERNEL=$(Test_Find_Image -l ${DEPLOY_DIR}/images -k vmlinux -a ${QEMUARCH})
fi
# If there is no kernel image found, return failed directly
if [ $? -eq 1 ]; then
Test_Info "No kernel image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
return $ret
fi
ROOTFS_IMAGE=$(Test_Find_Image -l ${DEPLOY_DIR}/images -t ${QEMUTARGET} -a ${QEMUARCH})
# If there is no rootfs image found, return failed directly
if [ $? -eq 1 ]; then
Test_Info "No ${QEMUTARGET} rootfs image file found under ${DEPLOY_DIR}/images for ${QEMUARCH}, pls. have a check"
return $ret
fi
TEST_ROOTFS_IMAGE="${TEST_TMP}/${QEMUTARGET}-${QEMUARCH}-test.ext3"
CP=`which cp`
# When TEST_SERIALIZE is set, we use the existing image under tmp folder
if [ ${TEST_SERIALIZE} -eq 1 -a -e "$TARGET_IPSAVE" ]; then
# If TARGET_IPSAVE exists, check PID of the qemu process from it
PID=`awk '{print $1}' $TARGET_IPSAVE`
timeout=50
else
rm -rf $TEST_ROOTFS_IMAGE
echo "Copying rootfs $ROOTFS_IMAGE to $TEST_ROOTFS_IMAGE"
$CP $ROOTFS_IMAGE $TEST_ROOTFS_IMAGE
if [ $? -ne 0 ]; then
Test_Info "Image ${ROOTFS_IMAGE} copy to ${TEST_ROOTFS_IMAGE} failed, return fail"
return $ret
fi
export MACHINE=$QEMUARCH
# Create Qemu in localhost VNC Port 1
echo "Running xterm -display ${DISPLAY} -e 'OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60' &"
xterm -display ${DISPLAY} -e "OE_TMPDIR=${OE_TMPDIR} ${RUNQEMU} ${KERNEL} ${TEST_ROOTFS_IMAGE} && /bin/sleep 60" &
# Get the pid of the xterm processor, which will be used in Test_Kill_Qemu
PID=$!
fi
while [ ${up_time} -lt 10 ]
do
Test_Check_Qemu_UP
if [ $? -ne 0 ]; then
Test_Info "Wait for qemu up..."
up_time=`expr $up_time + 5`
sleep 5
else
Test_Info "Begin to check if qemu network is up"
break
fi
done
# Parse IP address of target from the qemu command line
if [ ${up_time} -lt ${timeout} ]; then
sleep 5
TARGET_IPADDR=`Test_Fetch_Target_IP $PID`
# If IP address is 0, means there is no qemu process found
if [ ${TARGET_IPADDR} == "0" ]; then
Test_Info "There is no qemu process or qemu ip address found, return failed"
return $ret
fi
fi
while [ ${up_time} -lt ${timeout} ]
do
Test_Check_IP_UP ${TARGET_IPADDR}
if [ $? -eq 0 ]; then
Test_Info "Qemu Network is up, ping with ${TARGET_IPADDR} is OK within ${up_time} seconds"
ret=0
break
else
Test_Info "Wait for Qemu Network up"
up_time=`expr $up_time + 5`
sleep 5
fi
done
if [ $ret -eq 0 ]; then
Test_Info "Qemu and its network is up"
return $ret
else
Test_Info "Qemu or its network is not up in ${timeout} seconds"
Test_Update_IPSAVE $PID $TARGET_IPADDR
return $ret
fi
}
# Function to prepare test project for toolchain test
# $1 is the folder holding test project file
# $2 is the test project name
Test_Project_Prepare()
{
local toolchain_dir=$1
local ret=1
if [ ! -d ${toolchain_dir} ]; then
mkdir -p ${toolchain_dir}
ret=$?
if [ $ret -ne 0 ]; then
Test_Info "Create ${toolchain_dir} fail, return"
return $ret
fi
fi
ret=0
# Download test project tarball if it does not exist
if [ ! -f ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} ]; then
wget -c -t 5 $PROJECT_DOWNLOAD_URL -O ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix}
ret=$?
fi
# Extract the test project into ${TEST_TMP}
if [ $ret -eq 0 ]; then
tar jxf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix} -C ${TEST_TMP}
ret=$?
if [ $ret -eq 0 ]; then
Test_Info "Extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP} successfully"
return $ret
else
Test_Info "Fail to extract ${2}-${PROJECT_PV}.${suffix} into ${TEST_TMP}"
return $ret
fi
else
Test_Info "Fail to download ${2}-${PROJECT_PV}.${suffix} from $PROJECT_DOWNLOAD_URL"
rm -rf ${toolchain_dir}/${2}-${PROJECT_PV}.${suffix}
return $ret
fi
}
# Function to prepare toolchain environment
# $1 is toolchain directory to hold toolchain tarball
# $2 is prefix name for toolchain tarball
Test_Toolchain_Prepare()
{
local toolchain_dir=$1
local sdk_name=$2
local ret=1
if [ ! -d ${toolchain_dir} ]; then
Test_Info "No directory ${toolchain_dir}, which holds toolchain tarballs"
return 1
fi
# Check if there is any toolchain tarball under $toolchain_dir with prefix $sdk_name
for i in `dir ${toolchain_dir}`
do
echo $i | grep "${sdk_name}-toolchain-gmae"
if [ $? -eq 0 ]; then
rm -rf ${TEST_TMP}/opt
tar jxf ${toolchain_dir}/${i} -C ${TEST_TMP}
ret=$?
break
fi
done
if [ $ret -eq 0 ]; then
Test_Info "Check if /opt is accessible for non-root user"
# Check if the non-root test user has write access of $TOOLCHAIN_TEST
if [ -d ${TOOLCHAIN_TEST} ]; then
touch ${TOOLCHAIN_TEST}
if [ $? -ne 0 ]; then
Test_Info "Has no right to modify folder $TOOLCHAIN_TEST, pls. chown it to test user"
return 2
fi
else
mkdir -p ${TOOLCHAIN_TEST}
if [ $? -ne 0 ]; then
Test_Info "Has no right to create folder $TOOLCHAIN_TEST, pls. create it and chown it to test user"
return 2
fi
fi
# If there is a toolchain folder under $TOOLCHAIN_TEST, let's remove it
if [ -d ${TOOLCHAIN_TEST}/poky ]; then
rm -rf ${TOOLCHAIN_TEST}/poky
fi
# Copy toolchain into $TOOLCHAIN_TEST
cp -r ${TEST_TMP}/opt/poky ${TOOLCHAIN_TEST}
ret=$?
if [ $ret -eq 0 ]; then
Test_Info "Successfully copy toolchain into $TOOLCHAIN_TEST"
return $ret
else
Test_Info "Meet error when copy toolchain into $TOOLCHAIN_TEST"
return $ret
fi
else
Test_Info "No tarball named ${sdk_name}-toolchain-gmae under ${toolchain_dir}"
return $ret
fi
}
# Function to execute command and exit if run out of time
# $1 is timeout value
# $2 is the command to be executed
Test_Time_Out()
{
local timeout=$1
shift
local command=$*
local date=0
local tmp=`mktemp`
local ret=1
local pid=0
local ppid=0
local i=0
declare local pid_l
# Run command in background
($command; echo $? > $tmp) &
pid=$!
while ps -e -o pid | grep -qw $pid; do
if [ $date -ge $timeout ]; then
Test_Info "$timeout Timeout when running command $command"
rm -rf $tmp
# Find all child processes of pid and kill them
ppid=$pid
ps -f --ppid $ppid
ret=$?
while [ $ret -eq 0 ]
do
# If yes, get the child pid and check if the child pid has other child pid
# Continue the while loop until there is no child pid found
pid_l[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'`
ppid=${pid_l[$i]}
i=$((i+1))
ps -f --ppid $ppid
ret=$?
done
# Kill these children pids from the last one
while [ $i -ne 0 ]
do
i=$((i-1))
kill ${pid_l[$i]}
sleep 2
done
# Kill the parent id
kill $pid
return 1
fi
sleep 5
date=`expr $date + 5`
done
ret=`cat $tmp`
rm -rf $tmp
return $ret
}
# Function to test toolchain
# $1 is test project name
# $2 is the timeout value
Test_Toolchain()
{
local test_project=$1
local timeout=$2
local ret=1
local suffix="tar.bz2"
local env_setup=""
local pro_install="${TEST_TMP}/pro_install"
# Set value for PROJECT_PV and PROJECT_DOWNLOAD_URL accordingly
if [ $test_project == "cvs" ]; then
PROJECT_PV=1.12.13
PROJECT_DOWNLOAD_URL="http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2"
elif [ $test_project == "iptables" ]; then
PROJECT_PV=1.4.11
PROJECT_DOWNLOAD_URL="http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2"
elif [ $test_project == "sudoku-savant" ]; then
PROJECT_PV=1.3
PROJECT_DOWNLOAD_URL="http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2"
else
Test_Info "Unknown test project name $test_project"
return 1
fi
# Download test project and extract it
Test_Project_Prepare $TOOLCHAIN_PROJECTS $test_project
if [ $? -ne 0 ]; then
Test_Info "Prepare test project file failed"
return 1
fi
# Extract toolchain tarball into ${TEST_TMP}
Test_Toolchain_Prepare $TOOLCHAIN_DIR $SDK_NAME
ret=$?
if [ $ret -ne 0 ]; then
Test_Info "Prepare toolchain test environment failed"
return $ret
fi
if [ ! -d ${pro_install} ]; then
mkdir -p ${pro_install}
fi
# Begin to build test project in toolchain environment
env_setup=`find ${TOOLCHAIN_TEST}/poky -name "environment-setup*"`
source $env_setup
if [ $test_project == "cvs" -o $test_project == "iptables" ]; then
cd ${TEST_TMP}/${test_project}-${PROJECT_PV}
Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; }
Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; }
Test_Time_Out $timeout make install DESTDIR=${pro_install} || { Test_Info "make failed with $test_project"; return 1; }
cd -
ret=0
elif [ $test_project == "sudoku-savant" ]; then
cd ${TEST_TMP}/${test_project}-${PROJECT_PV}
Test_Time_Out $timeout ./configure ${CONFIGURE_FLAGS} || { Test_Info "configure failed with $test_project"; return 1; }
Test_Time_Out $timeout make -j4 || { Test_Info "make failed with $test_project"; return 1; }
cd -
ret=0
else
Test_Info "Unknown test project $test_project"
ret=1
fi
return $ret
}
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
#
# Boot Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if qemu and qemu network is up.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=120
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
if [ $? -eq 0 ]; then
Test_Info "Boot Test PASS"
Test_Kill_Qemu
Test_Print_Result "Boot" 0
exit 0
else
Test_Info "Boot Test FAIL"
Test_Kill_Qemu
Test_Print_Result "Boot" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# Compiler Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if gcc/g++/make command can work in target.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if gcc/g++/make can work in target
if [ $RET -eq 0 -a -f $TOOLS/compiler_test.sh ]; then
# Copy compiler_test.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/compiler_test.sh
if [ $? -eq 0 ]; then
# Run compiler_test.sh to check if gcc/g++/make can work in target
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/compiler_test.sh"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "Compiler Test PASS"
Test_Kill_Qemu
Test_Print_Result "compiler" 0
exit 0
else
Test_Info "Compiler FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "compiler" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# Conmman Check Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if connman can work in target.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if connman can work in target
if [ $RET -eq 0 -a -f $TOOLS/connman_test.sh ]; then
# Copy connman_test.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/connman_test.sh
if [ $? -eq 0 ]; then
# Run connman_test.sh to check if connman can work in target
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/connman_test.sh"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "Connman Test PASS"
Test_Kill_Qemu
Test_Print_Result "connman" 0
exit 0
else
Test_Info "Connman Test FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "connman" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# Dmesg Check Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if there is any error log in dmesg.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if there is any error log in dmesg
if [ $RET -eq 0 -a -f $TOOLS/dmesg.sh ]; then
# Copy dmesg.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/dmesg.sh
if [ $? -eq 0 ]; then
# Run dmesg.sh to check if there is any error message with command dmesg
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/dmesg.sh"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "Dmesg Test PASS"
Test_Kill_Qemu
Test_Print_Result "dmesg" 0
exit 0
else
Test_Info "Dmesg Test FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "dmesg" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# RPM Check Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if rpm command can work in target.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if rpm query can work in target
if [ $RET -eq 0 -a -f $TOOLS/rpm_test.sh ]; then
# Copy rpm_test.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/rpm_test.sh
if [ $? -eq 0 ]; then
# Run rpm_test.sh to check if rpm query can work in target
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/rpm_test.sh -qa"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "rpm query Test PASS"
Test_Kill_Qemu
Test_Print_Result "rpm_query" 0
exit 0
else
Test_Info "rpm query FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "rpm_query" 1
exit 1
fi
+71
View File
@@ -0,0 +1,71 @@
#!/bin/bash
# SCP Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if file can be copied into target with scp command.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
SPID=0
i=0
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if file can be copied from host into target
# For qemu target, the file is 5M
if [ $RET -eq 0 ]; then
echo $QEMUARCH | grep -q "qemu"
if [ $? -eq 0 ]; then
dd if=/dev/zero of=${TEST_TMP}/scp_test_file bs=512k count=10
Test_SCP ${TARGET_IPADDR} ${TEST_TMP}/scp_test_file /home/root &
SPID=$!
fi
# Check if scp finished or not
while [ $i -lt $TIMEOUT ]
do
ps -fp $SPID > /dev/null
if [ $? -ne 0 ]; then
RET=0
break
fi
i=$((i+5))
sleep 5
done
# Kill scp process if scp is not finished in time
if [ $i -ge $TIMEOUT ]; then
RET=1
kill $SPID
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "SCP Test PASS"
Test_Kill_Qemu
Test_Print_Result "SCP" 0
exit 0
else
Test_Info "SCP Test FAIL"
Test_Kill_Qemu
Test_Print_Result "SCP" 1
exit 1
fi
+76
View File
@@ -0,0 +1,76 @@
#!/bin/bash
# Shutdown Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if target can shutdown
# For qemux86/x86-64, we use command "poweroff" for target shutdown
# For non-x86 targets, we use command "reboot" for target shutdown
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
i=0
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if target can shutdown
if [ $RET -eq 0 ]; then
echo $QEMUARCH | grep -q "qemux86"
# For qemux86/x86-64, command "poweroff" is used
# For non x86 qemu targets, command "reboot" is used because of BUG #100
if [ $? -eq 0 ]; then
Test_SSH ${TARGET_IPADDR} "/sbin/poweroff"
else
Test_SSH ${TARGET_IPADDR} "/sbin/reboot"
fi
# If qemu start up process ends up, it means shutdown completes
while [ $i -lt $TIMEOUT ]
do
ps -fp $PID > /dev/null
if [ $? -ne 0 ]; then
RET=0
break
fi
i=$((i+5))
sleep 5
done
if [ $i -ge $TIMEOUT ]; then
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "Shutdown Test PASS"
Test_Print_Result "shutdown" 0
# Remove TARGET_IPSAVE since no existing qemu running now
if [ -e ${TARGET_IPSAVE} ]; then
rm -rf ${TARGET_IPSAVE}
fi
exit 0
else
Test_Info "Shutdown Test FAIL"
Test_Kill_Qemu
Test_Print_Result "shutdown" 1
exit 1
fi
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
# SSH Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if ssh service in qemu is up.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
if [ ${RET} -eq 0 ]; then
Test_Info "SSH Test PASS"
Test_Kill_Qemu
Test_Print_Result "SSH" 0
exit 0
else
Test_Info "SSH Test FAIL"
Test_Kill_Qemu
Test_Print_Result "SSH" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# Zypper Check Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if zypper command can work in target.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if zypper help can work in target
if [ $RET -eq 0 -a -f $TOOLS/zypper_test.sh ]; then
# Copy zypper_test.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/zypper_test.sh
if [ $? -eq 0 ]; then
# Run zypper_test.sh to check if zypper help can work in target
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/zypper_test.sh help"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "zypper help Test PASS"
Test_Kill_Qemu
Test_Print_Result "zypper_help" 0
exit 0
else
Test_Info "zypper help FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "zypper_help" 1
exit 1
fi
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
# Zypper Check Test Case for Sanity Test
# The case boot up the Qemu target with `runqemu qemuxxx`.
# Then check if zypper command can work in target.
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=400
RET=1
# Start qemu and check its network
Test_Create_Qemu ${TIMEOUT}
# If qemu network is up, check ssh service in qemu
if [ $? -eq 0 ]; then
Test_Info "Begin to Test SSH Service in Qemu"
Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
RET=$?
else
RET=1
fi
# Check if zypper search can work in target
if [ $RET -eq 0 -a -f $TOOLS/zypper_test.sh ]; then
# Copy zypper_test.sh into target
Test_Target_Pre ${TARGET_IPADDR} $TOOLS/zypper_test.sh
if [ $? -eq 0 ]; then
# Run zypper_test.sh to check if zypper search can work in target
Test_SSH ${TARGET_IPADDR} "sh $TARGET_TEST_DIR/zypper_test.sh search avahi"
RET=$?
else
RET=1
fi
fi
if [ ${RET} -eq 0 ]; then
Test_Info "zypper search package avahi Test PASS"
Test_Kill_Qemu
Test_Print_Result "zypper_search" 0
exit 0
else
Test_Info "zypper search package avahi FAIL, Pls. check above error log"
Test_Kill_Qemu
Test_Print_Result "zypper_search" 1
exit 1
fi
@@ -0,0 +1,7 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity shutdown
@@ -0,0 +1 @@
sanity boot
@@ -0,0 +1,8 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity connman
sanity shutdown
@@ -0,0 +1,9 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity compiler
sanity connman
sanity shutdown
@@ -0,0 +1,3 @@
toolchain cvs
toolchain iptables
toolchain sudoku-savant
@@ -0,0 +1,7 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity shutdown
@@ -0,0 +1 @@
sanity boot
@@ -0,0 +1,8 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity connman
sanity shutdown
@@ -0,0 +1,9 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity compiler
sanity connman
sanity shutdown
@@ -0,0 +1,3 @@
toolchain cvs
toolchain iptables
toolchain sudoku-savant
@@ -0,0 +1,7 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity shutdown
@@ -0,0 +1 @@
sanity boot
@@ -0,0 +1,8 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity connman
sanity shutdown
@@ -0,0 +1,9 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity compiler
sanity connman
sanity shutdown
@@ -0,0 +1,3 @@
toolchain cvs
toolchain iptables
toolchain sudoku-savant
@@ -0,0 +1,7 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity shutdown
@@ -0,0 +1 @@
sanity boot
@@ -0,0 +1,8 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity connman
sanity shutdown
@@ -0,0 +1,9 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity compiler
sanity connman
sanity shutdown
@@ -0,0 +1,3 @@
toolchain cvs
toolchain iptables
toolchain sudoku-savant
@@ -0,0 +1,7 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity shutdown
@@ -0,0 +1 @@
sanity boot
@@ -0,0 +1,8 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity connman
sanity shutdown
@@ -0,0 +1,9 @@
sanity ssh
sanity scp
sanity dmesg
sanity zypper_help
sanity zypper_search
sanity rpm_query
sanity compiler
sanity connman
sanity shutdown
@@ -0,0 +1,3 @@
toolchain cvs
toolchain iptables
toolchain sudoku-savant
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
#
# CVS compile Test for toolchain test
# The case extract toolchain tarball into temp folder
# Then compile CVS with the toolchain environment
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=120
# Extract and test toolchain tarball
Test_Toolchain cvs ${TIMEOUT}
if [ $? -eq 0 ]; then
Test_Info "CVS Test PASS"
Test_Print_Result "CVS" 0
exit 0
elif [ $? -eq 1 ]; then
Test_Info "CVS Test FAIL"
Test_Print_Result "CVS" 1
exit 1
else
Test_Info "Skip CVS Test due to some configuration problem"
Test_Print_Result "CVS" 2
exit 2
fi
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
#
# iptables compile Test for toolchain test
# The case extract toolchain tarball into temp folder
# Then compile iptables with the toolchain environment
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=120
# Extract and test toolchain tarball
Test_Toolchain iptables ${TIMEOUT}
if [ $? -eq 0 ]; then
Test_Info "iptables Test PASS"
Test_Print_Result "iptables" 0
exit 0
elif [ $? -eq 1 ]; then
Test_Info "iptables Test FAIL"
Test_Print_Result "iptables" 1
exit 1
else
Test_Info "Skip iptables Test due to some configuration problem"
Test_Print_Result "iptables" 2
exit 2
fi
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
#
# sudoku-savant compile Test for toolchain test
# The case extract toolchain tarball into temp folder
# Then compile sudoku-savant with the toolchain environment
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
. $COREBASE/scripts/qemuimage-testlib
TIMEOUT=240
# Extract and test toolchain tarball
Test_Toolchain sudoku-savant ${TIMEOUT}
if [ $? -eq 0 ]; then
Test_Info "sudoku-savant Test PASS"
Test_Print_Result "sudoku-savant" 0
exit 0
elif [ $? -eq 1 ]; then
Test_Info "sudoku-savant Test FAIL"
Test_Print_Result "sudoku-savant" 1
exit 1
else
Test_Info "Skip sudoku-savant Test due to some configuration problem"
Test_Print_Result "sudoku-savant" 2
exit 2
fi
@@ -0,0 +1,137 @@
#!/bin/bash
# compiler test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
# Prepare test folder for compiler test
COMPILE_FOLDER="/opt/test/compile_test"
TEST_FILE="$COMPILE_FOLDER/compile_test.c"
EXECUTE_FILE="$COMPILE_FOLDER/compile_test"
TEST_MAKEFILE="$COMPILE_FOLDER/makefile"
TEST_LIST="gcc g++ make"
if [ ! -d $COMPILE_FOLDER ]; then
mkdir -p $COMPILE_FOLDER
fi
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: ##### Error Log #####"
$@
echo -e "\tTARGET: ##### End #####"
}
# Function to generate a c test file for compiler testing
Gen_File()
{
temp=`mktemp`
# Generate c/c++ test file for compiler testing
echo "#include <stdio.h>" >> $temp
echo "#include <math.h>" >> $temp
echo "" >> $temp
echo "double" >> $temp
echo "convert(long long l)" >> $temp
echo "{" >> $temp
echo " return (double)l; // or double(l)" >> $temp
echo "}" >> $temp
echo "" >> $temp
echo "int" >> $temp
echo "main(int argc, char * argv[])" >> $temp
echo "{" >> $temp
echo " long long l = 10;" >> $temp
echo " double f;" >> $temp
echo "" >> $temp
echo " f = convert(l);" >> $temp
echo " printf(\"convert: %lld => %f\n\", l, f);" >> $temp
echo "" >> $temp
echo " f = 1234.67;" >> $temp
echo " printf(\"floorf(%f) = %f\n\", f, floorf(f));" >> $temp
echo " return 0;" >> $temp
echo "}" >> $temp
echo $temp
}
# Function to generate a makefile for compiler testing
Gen_Makefile()
{
temp=`mktemp`
basename=`basename $EXECUTE_FILE`
echo -e "$basename: $basename.o" >> $temp
echo -e "\tgcc -o $basename $basename.o -lm" >> $temp
echo -e "$basename.o: $basename.c" >> $temp
echo -e "\tgcc -c $basename.c" >> $temp
echo $temp
}
# Generate a c test file for compiler testing
test_file=`Gen_File`
MOVE=`which mv`
$MOVE $test_file $TEST_FILE
# Begin compiler test in target
for cmd in $TEST_LIST
do
which $cmd
if [ $? -ne 0 ]; then
Target_Info "No $cmd command found"
exit 1
fi
if [ "$cmd" == "make" ]; then
rm -rf $EXECUTE_FILE
# For makefile test, we need to generate a makefile and run with a c file
makefile=`Gen_Makefile`
$MOVE $makefile $TEST_MAKEFILE
cd `dirname $TEST_MAKEFILE`
make
if [ $? -ne 0 ]; then
Target_Info "$cmd running with error, Pls. check error in following"
Target_Err make
exit 1
fi
else
rm -rf $EXECUTE_FILE
# For gcc/g++, we compile a c test file and check the output
$cmd $TEST_FILE -o $EXECUTE_FILE -lm
if [ $? -ne 0 ]; then
Target_Info "$cmd running with error, Pls. check error in following"
Target_Err $cmd $TEST_FILE -o $EXECUTE_FILE -lm
exit 1
fi
fi
# Check if the binary file generated by $cmd can work without error
if [ -f $EXECUTE_FILE ]; then
$EXECUTE_FILE
if [ $? -ne 0 ]; then
Target_Info "$EXECUTE_FILE running with error, Pls. check error in following"
Target_Err $EXECUTE_FILE
exit 1
else
Target_Info "$cmd can work without problem in target"
fi
else
Target_Info "No executalbe file $EXECUTE_FILE found, Pls. check the error log"
exit 1
fi
done
exit 0
@@ -0,0 +1,75 @@
#!/bin/bash
# connman test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: connman has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
# Check if ps comes from Procps or busybox first
ls -l `which ps` | grep -q "busybox"
RET=$?
if [ $RET -eq 0 ]; then
PS="ps"
else
PS="ps -ef"
fi
# Check if connmand is in target
if [ ! -f /usr/sbin/connmand ]; then
Target_Info "No connmand command found"
exit 1
fi
# Check if connmand is running in background
if [ $RET -eq 0 ]; then
count=`ps | awk '{print $5}' | grep -c connmand`
else
count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand`
fi
if [ $count -ne 1 ]; then
Target_Info "connmand has issue when running in background, Pls, check the output of ps"
${PS} | grep connmand
exit 1
fi
# Check if there is always only one connmand running in background
if [ connmand > /dev/null 2>&1 ]; then
Target_Info "connmand command run without problem"
if [ $RET -eq 0 ]; then
count=`ps | awk '{print $5}' | grep -c connmand`
else
count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand`
fi
if [ $count -ne 1 ]; then
Target_Info "There are more than one connmand running in background, Pls, check the output of ps"
${PS} | grep connmand
exit 1
else
Target_Info "There is always one connmand running in background, test pass"
exit 0
fi
else
Target_Err connmand
exit 1
fi
exit 0
@@ -0,0 +1,26 @@
#!/bin/bash
# Dmesg test script running in QEMU
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
which dmesg
if [ $? -ne 0 ]; then
echo "QEMU: No dmesg command found"
exit 1
fi
dmesg | grep -iq "error"
if [ $? -eq 0 ]; then
echo "QEMU: There is some error log in dmesg:"
echo "QEMU: ##### Error Log ######"
dmesg | grep -i "error"
echo "QEMU: ##### End ######"
exit 1
else
echo "QEMU: No error log in dmesg"
exit 0
fi
@@ -0,0 +1,45 @@
#!/bin/bash
# rpm test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: rpm command has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
which rpm
if [ $? -ne 0 ]; then
Target_Info "No rpm command found"
exit 1
fi
if [ rpm > /dev/null 2>&1 ]; then
Target_Info "rpm command run without problem"
else
Target_Err rpm
exit 1
fi
# run rpm with specific command parsed to rpm_test.sh
rpm $* > /dev/null 2>&1
if [ $? -eq 0 ]; then
Target_Info "rpm $* work without problem"
exit 0
else
Target_Err rpm $*
exit 1
fi
@@ -0,0 +1,45 @@
#!/bin/bash
# zypper test script running in target
#
# Author: Jiajun Xu <jiajun.xu@intel.com>
#
# This file is licensed under the GNU General Public License,
# Version 2.
#
Target_Info()
{
echo -e "\tTARGET: $*"
}
Target_Err()
{
echo -e "\tTARGET: zypper command has issue when running, Pls. check the error log"
echo -e "\tTARGET: ##### Error Log #####"
$1
echo -e "\tTARGET: ##### End #####"
}
which zypper
if [ $? -ne 0 ]; then
Target_Info "No zypper command found"
exit 1
fi
if [ zypper > /dev/null 2>&1 ]; then
Target_Info "zypper command run without problem"
else
Target_Err zypper
exit 1
fi
# run zypper with specific command parsed to zypper_test.sh
zypper $* > /dev/null 2>&1
if [ $? -eq 0 ]; then
Target_Info "zypper $* work without problem"
exit 0
else
Target_Err zypper $*
exit 1
fi
@@ -0,0 +1,11 @@
/Name:.*/ {
package = substr($0, 7)
next
}
/postinstall.*scriptlet .*/ {
next
}
{
print $0 >> ENVIRON["D"] "/etc/rpm-postinsts/" package ".sh"
}
+53
View File
@@ -0,0 +1,53 @@
#!/bin/sh
# This comes from the RPM5 5.4.0 distribution.
pkg=$1
if [ "$pkg" = "" -o ! -e "$pkg" ]; then
echo "no package supplied" 1>&2
exit 1
fi
leadsize=96
o=`expr $leadsize + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "sig il: $il dl: $dl"
sigsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8 + 8`
set `od -j $o -N 8 -t u1 $pkg`
il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5`
dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9`
# echo "hdr il: $il dl: $dl"
hdrsize=`expr 8 + 16 \* $il + $dl`
o=`expr $o + $hdrsize`
EXTRACTOR="dd if=$pkg ibs=$o skip=1"
COMPRESSION=`($EXTRACTOR |file -) 2>/dev/null`
if echo $COMPRESSION |grep -iq gzip; then
DECOMPRESSOR=gunzip
elif echo $COMPRESSION |grep -iq bzip2; then
DECOMPRESSOR=bunzip2
elif echo $COMPRESSION |grep -iq xz; then
DECOMPRESSOR=unxz
elif echo $COMPRESSION |grep -iq cpio; then
DECOMPRESSOR=cat
else
# Most versions of file don't support LZMA, therefore we assume
# anything not detected is LZMA
DECOMPRESSOR=`which unlzma 2>/dev/null`
case "$DECOMPRESSOR" in
/* ) ;;
* ) DECOMPRESSOR=`which lzmash 2>/dev/null`
case "$DECOMPRESSOR" in
/* ) DECOMPRESSOR="lzmash -d -c" ;;
* ) DECOMPRESSOR=cat ;;
esac
;;
esac
fi
$EXTRACTOR 2>/dev/null | $DECOMPRESSOR
+415
View File
@@ -0,0 +1,415 @@
#!/bin/bash
#
# Handle running OE images standalone with QEMU
#
# Copyright (C) 2006-2011 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
usage() {
MYNAME=`basename $0`
echo ""
echo "Usage: you can run this script with any valid combination"
echo "of the following options (in any order):"
echo " QEMUARCH - the qemu machine architecture to use"
echo " KERNEL - the kernel image file to use"
echo " ROOTFS - the rootfs image file or nfsroot directory to use"
echo " MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)"
echo " Simplified QEMU command-line options can be passed with:"
echo " nographic - disables video console"
echo " serial - enables a serial console on /dev/ttyS0"
echo " kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)"
echo " qemuparams=\"xyz\" - specify custom parameters to QEMU"
echo " bootparams=\"xyz\" - specify custom kernel parameters during boot"
echo ""
echo "Examples:"
echo " $MYNAME qemuarm"
echo " $MYNAME qemux86-64 core-image-sato ext3"
echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
echo " $MYNAME qemux86 qemuparams=\"-m 256\""
echo " $MYNAME qemux86 bootparams=\"psplash=false\""
exit 1
}
if [ "x$1" = "x" ]; then
usage
fi
MACHINE=${MACHINE:=""}
KERNEL=""
FSTYPE=""
ROOTFS=""
LAZY_ROOTFS=""
SCRIPT_QEMU_OPT=""
SCRIPT_QEMU_EXTRA_OPT=""
SCRIPT_KERNEL_OPT=""
# Don't use TMPDIR from the external environment, it may be a distro
# variable pointing to /tmp (e.g. within X on OpenSUSE)
# Instead, use OE_TMPDIR for passing this in externally.
TMPDIR="$OE_TMPDIR"
# Determine whether the file is a kernel or QEMU image, and set the
# appropriate variables
process_filename() {
filename=$1
# Extract the filename extension
EXT=`echo $filename | awk -F . '{ print \$NF }'`
# A file ending in .bin is a kernel
if [ "x$EXT" = "xbin" ]; then
if [ -z "$KERNEL" ]; then
KERNEL=$filename
else
echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
usage
fi
elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
"x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
# A file ending in a supportted fs type is a rootfs image
if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then
FSTYPE=$EXT
ROOTFS=$filename
else
echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
usage
fi
else
echo "Error: unknown file arg [$filename]"
usage
fi
}
# Parse command line args without requiring specific ordering. It's a
# bit more complex, but offers a great user experience.
KVM_ENABLED="no"
i=1
while [ $i -le $# ]; do
arg=${!i}
case $arg in
"qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc")
if [ -z "$MACHINE" ]; then
MACHINE=$arg
else
echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]"
usage
fi
;;
"ext2" | "ext3" | "jffs2" | "nfs" | "btrfs")
if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then
FSTYPE=$arg
else
echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
usage
fi
;;
*-image*)
if [ -z "$ROOTFS" ]; then
if [ -f "$arg" ]; then
process_filename $arg
elif [ -d "$arg" ]; then
# Handle the case where the nfsroot dir has -image-
# in the pathname
echo "Assuming $arg is an nfs rootfs"
FSTYPE=nfs
ROOTFS=$arg
else
ROOTFS=$arg
LAZY_ROOTFS="true"
fi
else
echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
usage
fi
;;
"nographic")
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
;;
"serial")
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -serial stdio"
SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT console=ttyS0"
;;
"qemuparams="*)
SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}"
# Warn user if they try to specify serial or kvm options
# to use simplified options instead
serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then
echo "Error: Please use simplified serial or kvm options instead"
usage
fi
;;
"bootparams="*)
SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
;;
"audio")
if [[ "x$MACHINE" == "xqemux86" || "x$MACHINE" == "xqemux86-64" ]]; then
echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest.";
QEMU_AUDIO_DRV="alsa"
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
fi
;;
"kvm")
KVM_ENABLED="yes"
KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo`
;;
*)
# A directory name is an nfs rootfs
if [ -d "$arg" ]; then
echo "Assuming $arg is an nfs rootfs"
if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then
FSTYPE=nfs
else
echo "Error: conflicting FSTYPE types [$arg] and nfs"
usage
fi
if [ -z "$ROOTFS" ]; then
ROOTFS=$arg
else
echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
usage
fi
elif [ -f "$arg" ]; then
process_filename $arg
else
echo "Error: unable to classify arg [$arg]"
usage
fi
;;
esac
i=$((i + 1))
done
if [ ! -c /dev/net/tun ] ; then
echo "TUN control device /dev/net/tun is unavailable; you may need to enable TUN (e.g. sudo modprobe tun)"
exit 1
elif [ ! -w /dev/net/tun ] ; then
echo "TUN control device /dev/net/tun is not writable, please fix (e.g. sudo chmod 666 /dev/net/tun)"
exit 1
fi
YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
# Detect KVM configuration
if [[ "x$KVM_ENABLED" == "xyes" ]]; then
if [[ -z "$KVM_CAPABLE" ]]; then
echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
if [[ "x$MACHINE" != "xqemux86" && "x$MACHINE" != "xqemux86-64" ]]; then
echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
exit 1;
fi
if [ ! -e /dev/kvm ]; then
echo "Missing KVM device. Have you inserted kvm modules? Pls. refer";
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
if 9<>/dev/kvm ; then
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
else
echo "You have no rights on /dev/kvm. Pls. change the owndership as described at";
echo "$YOCTO_KVM_WIKI";
exit 1;
fi
fi
# Report errors for missing combinations of options
if [[ -z "$MACHINE" && -z "$KERNEL" ]]; then
echo "Error: you must specify at least a MACHINE or KERNEL argument"
usage
fi
if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then
echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
usage
fi
if [ -z "$MACHINE" ]; then
MACHINE=`basename $KERNEL | sed 's/.*-\(qemux86-64\|qemux86\|qemuarm\|qemumips\|qemuppc\).*/\1/'`
if [ -z "$MACHINE" ]; then
echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]"
usage
fi
echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
fi
machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
# MACHINE is now set for all cases
# Defaults used when these vars need to be inferred
QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
QEMUX86_DEFAULT_FSTYPE=ext3
QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
QEMUX86_64_DEFAULT_FSTYPE=ext3
QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
QEMUARM_DEFAULT_FSTYPE=ext3
QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
QEMUMIPS_DEFAULT_FSTYPE=ext3
QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin
QEMUPPC_DEFAULT_FSTYPE=ext3
AKITA_DEFAULT_KERNEL=zImage-akita.bin
AKITA_DEFAULT_FSTYPE=jffs2
SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
SPITZ_DEFAULT_FSTYPE=ext3
setup_tmpdir() {
if [ -z "$TMPDIR" ]; then
# Try to get TMPDIR from bitbake
type -P bitbake &>/dev/null || {
echo "In order for this script to dynamically infer paths";
echo "to kernels or filesystem images, you either need";
echo "bitbake in your PATH or to source oe-init-build-env";
echo "before running this script" >&2;
exit 1; }
# We have bitbake in PATH, get TMPDIR from bitbake
TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
if [ -z "$TMPDIR" ]; then
echo "Error: this script needs to be run from your build directory,"
echo "or you need to explicitly set TMPDIR in your environment"
exit 1
fi
fi
}
setup_sysroot() {
# Toolchain installs set up $OECORE_NATIVE_SYSROOT in their
# environment script. If that variable isn't set, we're
# either in an in-tree build scenario or the environment
# script wasn't source'd.
if [ -z "$OECORE_NATIVE_SYSROOT" ]; then
setup_tmpdir
BUILD_ARCH=`uname -m`
BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
OECORE_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
fi
}
# Locate a rootfs image to boot which matches our expected
# machine and fstype.
findimage() {
where=$1
machine=$2
extension=$3
# Sort rootfs candidates by modification time - the most
# recently created one is the one we most likely want to boot.
filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs`
for name in $filenames; do
if [[ "$name" =~ core-image-sato-sdk ||
"$name" =~ core-image-sato ||
"$name" =~ core-image-lsb ||
"$name" =~ core-image-basic ||
"$name" =~ core-image-minimal ]]; then
ROOTFS=$name
return
fi
done
echo "Couldn't find a $machine rootfs image in $where."
exit 1
}
if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
# Extract the filename extension
EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
"x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
FSTYPE=$EXT
else
echo "Note: Unable to determine filesystem extension for $ROOTFS"
echo "We will use the default FSTYPE for $MACHINE"
# ...which is done further below...
fi
fi
if [ -z "$KERNEL" ]; then
setup_tmpdir
eval kernel_file=\$${machine2}_DEFAULT_KERNEL
KERNEL=$TMPDIR/deploy/images/$kernel_file
if [ -z "$KERNEL" ]; then
echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]"
usage
fi
fi
# KERNEL is now set for all cases
if [ -z "$FSTYPE" ]; then
eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
if [ -z "$FSTYPE" ]; then
echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]"
usage
fi
fi
# FSTYPE is now set for all cases
# Handle cases where a ROOTFS type is given instead of a filename, e.g.
# core-image-sato
if [ "$LAZY_ROOTFS" = "true" ]; then
setup_tmpdir
echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
ROOTFS=$TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
fi
if [ -z "$ROOTFS" ]; then
setup_tmpdir
T=$TMPDIR/deploy/images
eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
findimage $T $MACHINE $FSTYPE
if [ -z "$ROOTFS" ]; then
echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]"
usage
fi
fi
# ROOTFS is now set for all cases
echo ""
echo "Continuing with the following parameters:"
echo "KERNEL: [$KERNEL]"
echo "ROOTFS: [$ROOTFS]"
echo "FSTYPE: [$FSTYPE]"
setup_sysroot
# OECORE_NATIVE_SYSROOT is now set for all cases
# We can't run without a libGL.so
libgl='no'
test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes'
test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes'
test -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so && libgl='yes'
if [ "$libgl" != 'yes' ]; then
echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.
Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev."
exit 1;
fi
INTERNAL_SCRIPT=`which runqemu-internal`
. $INTERNAL_SCRIPT
+51
View File
@@ -0,0 +1,51 @@
#!/bin/sh
# Add a partion table to an ext2 image file
#
# Copyright (C) 2006-2007 OpenedHand Ltd.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
IMAGE=$1
IMAGEOUT=$2
echo $IMAGE
echo $IMAGEOUT
size=`ls -l $IMAGE | awk '{ print $5}'`
size2=`expr $size / 512 / 16 / 63`
echo $size
echo $size2
# MBR Size = 512 * 63 bytes
dd if=/dev/zero of=$IMAGEOUT count=63
echo "x" > /tmp/fdisk.cmds
echo "c" >> /tmp/fdisk.cmds
echo "1024" >> /tmp/fdisk.cmds
echo "h" >> /tmp/fdisk.cmds
echo "16" >> /tmp/fdisk.cmds
echo "r" >> /tmp/fdisk.cmds
echo "n" >> /tmp/fdisk.cmds
echo "p" >> /tmp/fdisk.cmds
echo "1" >> /tmp/fdisk.cmds
echo "1" >> /tmp/fdisk.cmds
echo "$size2" >> /tmp/fdisk.cmds
echo "w" >> /tmp/fdisk.cmds
/sbin/fdisk $IMAGEOUT < /tmp/fdisk.cmds
cat $IMAGE >> $IMAGEOUT
+191
View File
@@ -0,0 +1,191 @@
#!/bin/bash
#
# Copyright (c) 2005-2009 Wind River Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
usage() {
echo "Usage: $0 {start|stop|restart} <nfs-export-dir>"
}
if [ $# != 2 ]; then
usage
exit 1
fi
if [[ "$1" != "start" && "$1" != "stop" && "$1" != "restart" ]]; then
echo "Unknown command '$1'"
usage
exit 1
fi
if [ ! -d "$2" ]; then
echo "Error: '$2' does not exist"
usage
exit 1
fi
# Ensure the nfs-export-dir is an absolute path
NFS_EXPORT_DIR=$(cd "$2" && pwd)
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
echo "Error: Unable to find the oe-find-native-sysroot script"
echo "Did you forget to source your build environment setup script?"
exit 1
fi
. $SYSROOT_SETUP_SCRIPT
if [ ! -e "$OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd" ]; then
echo "Error: Unable to find rpc.mountd binary in $OECORE_NATIVE_SYSROOT/usr/sbin/"
if [ "x$OECORE_DISTRO_VERSION" = "x" ]; then
echo "Have you run 'bitbake meta-ide-support'?"
else
echo "This shouldn't happen - something is missing from your toolchain installation"
fi
exit 1
fi
if [ ! -d ~/.runqemu-sdk ]; then
mkdir -p ~/.runqemu-sdk
fi
NFS_INSTANCE=${NFS_INSTANCE:=0}
EXPORTS=~/.runqemu-sdk/exports$NFS_INSTANCE
RMTAB=~/.runqemu-sdk/rmtab$NFS_INSTANCE
NFSPID=~/.runqemu-sdk/nfs$NFS_INSTANCE.pid
MOUNTPID=~/.runqemu-sdk/mount$NFS_INSTANCE.pid
PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
PSEUDO_LOCALSTATEDIR="$NFS_EXPORT_DIR/var/pseudo"
export PSEUDO_LOCALSTATEDIR
if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then
echo "Error: $PSEUDO_LOCALSTATEDIR does not exist."
echo "Did you create the export directory using runqemu-extract-sdk?"
exit 1
fi
# rpc.mountd RPC port
NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ]
# rpc.nfsd RPC port
NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ]
# NFS port number
NFS_PORT=$[ 3049 + $NFS_INSTANCE ]
# mountd port number
MOUNT_PORT=$[ 3048 + $NFS_INSTANCE ]
## For debugging you would additionally add
## --debug all
MOUNTD_OPTS="--allow-non-root --mount-pid $MOUNTPID -f $EXPORTS --rmtab $RMTAB --prog $NFS_MOUNTPROG -r -P $MOUNT_PORT"
NFSD_OPTS="--allow-non-root --nfs-pid $NFSPID -f $EXPORTS --prog $NFS_NFSPROG -P $NFS_PORT -r"
# Setup the exports file
if [ "$1" = "start" ]; then
echo "Creating exports file..."
echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS
fi
# See how we were called.
case "$1" in
start)
echo "Starting User Mode rpc.mountd"
echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS"
$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.mountd $MOUNTD_OPTS
if [ ! $? = 0 ]; then
echo "====================="
echo "Error starting MOUNTD"
echo "====================="
ps -ef | grep -v grep | grep rpcbind 2>&1 > /dev/null
if [ $? = 0 ] ; then
echo " If you see an error above that says:"
echo " RPC: Authentication error; why = Client credential too weak"
echo " You need to change the startup of rpcbind"
echo " on your host by doing the following as root:"
echo "==============================================="
echo " According to /etc/sysconfig/rpcbind, then "
echo " echo RPCBIND_ARGS=-i >> /etc/sysconfig/rpcbind"
echo " or"
echo " echo RPCBIND_OPTIONS=-i >> /etc/sysconfig/rpcbind"
echo " /etc/init.d/rpcbind restart"
echo "==============================================="
echo "For Ubuntu 11.10 hosts"
echo "Add OPTIONS=\"-i -w\" to /etc/default/rpcbind"
echo "sudo service portmap restart"
fi
exit 1
fi
echo "Starting User Mode nfsd"
echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS"
$PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/sbin/rpc.nfsd $NFSD_OPTS
if [ ! $? = 0 ]; then
echo "Error starting nfsd"
exit 1
fi
# Check to make sure everything started ok.
if [ ! -f $MOUNTPID ]; then
echo "rpc.mountd did not start correctly"
exit 1
fi
if [ ! -f $NFSPID ]; then
echo "rpc.nfsd did not start correctly"
exit 1
fi
ps -fp `cat $MOUNTPID` > /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
echo "rpc.mountd did not start correctly"
exit 1
fi
ps -fp `cat $NFSPID` > /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
echo "rpc.nfsd did not start correctly"
exit 1
fi
echo " "
echo "On your target please remember to add the following options for NFS"
echo "nfsroot=IP_ADDRESS:$NFS_EXPORT_DIR,nfsvers=2,mountprog=$NFS_MOUNTPROG,nfsprog=$NFS_NFSPROG,udp"
;;
stop)
if [ -f "$MOUNTPID" ]; then
echo "Stopping rpc.mountd"
kill `cat $MOUNTPID`
rm -f $MOUNTPID
else
echo "No PID file, not stopping rpc.mountd"
fi
if [ -f "$NFSPID" ]; then
echo "Stopping rpc.nfsd"
kill `cat $NFSPID`
rm -f $NFSPID
else
echo "No PID file, not stopping rpc.nfsd"
fi
if [ -f "$EXPORTS" ]; then
echo "Removing exports file"
rm -f $EXPORTS
fi
;;
restart)
$0 stop $NFS_EXPORT_DIR
$0 start $NFS_EXPORT_DIR
if [ ! $? = 0 ]; then
exit 1
fi
;;
*)
echo "$0 {start|stop|restart} <nfs-export-dir>"
;;
esac
exit 0
+100
View File
@@ -0,0 +1,100 @@
#!/bin/bash
#
# This utility extracts an SDK image tarball using pseudo, and stores
# the pseudo database in var/pseudo within the rootfs. If you want to
# boot QEMU using an nfsroot, you *must* use this script to create the
# rootfs to ensure it is done correctly with pseudo.
#
# Copyright (c) 2010 Intel Corp.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
function usage() {
echo "Usage: $0 <image-tarball> <extract-dir>"
}
if [ $# -ne 2 ]; then
usage
exit 1
fi
SYSROOT_SETUP_SCRIPT=`which oe-find-native-sysroot 2> /dev/null`
if [ -z "$SYSROOT_SETUP_SCRIPT" ]; then
echo "Error: Unable to find the oe-find-native-sysroot script"
echo "Did you forget to source your build system environment setup script?"
exit 1
fi
. $SYSROOT_SETUP_SCRIPT
PSEUDO_OPTS="-P $OECORE_NATIVE_SYSROOT/usr"
ROOTFS_TARBALL=$1
SDK_ROOTFS_DIR=$2
if [ ! -e "$ROOTFS_TARBALL" ]; then
echo "Error: sdk tarball '$ROOTFS_TARBALL' does not exist"
usage
exit 1
fi
# Convert SDK_ROOTFS_DIR to a full pathname
if [[ ${SDK_ROOTFS_DIR:0:1} != "/" ]]; then
SDK_ROOTFS_DIR=$(pwd)/$SDK_ROOTFS_DIR
fi
TAR_OPTS=""
if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then
TAR_OPTS="-xjf"
fi
if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then
TAR_OPTS="-xzf"
fi
if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then
TAR_OPTS="-xf"
fi
if [ -z "$TAR_OPTS" ]; then
echo "Error: Unable to determine sdk tarball format"
echo "Accepted types: .tar / .tar.gz / .tar.bz2"
exit 1
fi
if [ ! -d "$SDK_ROOTFS_DIR" ]; then
echo "Creating directory $SDK_ROOTFS_DIR"
mkdir -p "$SDK_ROOTFS_DIR"
fi
if [ -e "$SDK_ROOTFS_DIR/var/pseudo" ]; then
echo "Error: $SDK_ROOTFS_DIR/var/pseudo already exists!"
echo "Please delete the entire rootfs tree manually if this is really what you want"
exit 1
fi
mkdir -p "$SDK_ROOTFS_DIR/var/pseudo"
touch "$SDK_ROOTFS_DIR/var/pseudo/pseudo.pid"
PSEUDO_LOCALSTATEDIR="$SDK_ROOTFS_DIR/var/pseudo"
export PSEUDO_LOCALSTATEDIR
echo "Extracting rootfs tarball using pseudo..."
echo "$PSEUDO $PSEUDO_OPTS tar -C \"$SDK_ROOTFS_DIR\" $TAR_OPTS \"$ROOTFS_TARBALL\""
$PSEUDO $PSEUDO_OPTS tar -C "$SDK_ROOTFS_DIR" $TAR_OPTS "$ROOTFS_TARBALL"
DIRCHECK=`ls -l "$SDK_ROOTFS_DIR" | wc -l`
if [ "$DIRCHECK" -lt 5 ]; then
echo "Warning: I don't see many files in $SDK_ROOTFS_DIR"
echo "Please double-check the extraction worked as intended"
exit 0
fi
echo "SDK image successfully extracted to $SDK_ROOTFS_DIR"
exit 0
+89
View File
@@ -0,0 +1,89 @@
#!/bin/bash
#
# Create a "bank" of tap network devices that can be used by the
# runqemu script. This script needs to be run as root, and will
# use the tunctl binary from the build system sysroot. Note: many Linux
# distros these days still use an older version of tunctl which does not
# support the group permissions option, hence the need to use the build
# system provided version.
#
# Copyright (C) 2010 Intel Corp.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
usage() {
echo "Usage: sudo $0 <gid> <num> <native-sysroot-basedir>"
echo "Where <gid> is the numeric group id the tap devices will be owned by"
echo "<num> is the number of tap devices to create (0 to remove all)"
echo "<native-sysroot-basedir> is the path to the build system's native sysroot"
exit 1
}
if [ $EUID -ne 0 ]; then
echo "Error: This script must be run with root privileges"
exit
fi
if [ $# -ne 3 ]; then
echo "Error: Incorrect number of arguments"
usage
fi
GID=$1
COUNT=$2
SYSROOT=$3
TUNCTL=$SYSROOT/usr/bin/tunctl
if [[ ! -x "$TUNCTL" || -d "$TUNCTL" ]]; then
echo "Error: $TUNCTL is not an executable"
usage
fi
SCRIPT_DIR=`dirname $0`
RUNQEMU_IFUP="$SCRIPT_DIR/runqemu-ifup"
if [ ! -x "$RUNQEMU_IFUP" ]; then
echo "Error: Unable to find the runqemu-ifup script in $SCRIPT_DIR"
exit 1
fi
IFCONFIG=`which ifconfig 2> /dev/null`
if [ -z "$IFCONFIG" ]; then
# Is it ever anywhere else?
IFCONFIG=/sbin/ifconfig
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
exit 1
fi
# Ensure we start with a clean slate
for tap in `$IFCONFIG | grep ^tap | awk '{ print \$1 }'`; do
echo "Note: Destroying pre-existing tap interface $tap..."
$TUNCTL -d $tap
done
echo "Creating $COUNT tap devices for GID $GID..."
for ((index=0; index < $COUNT; index++)); do
echo "Creating tap$index"
ifup=`$RUNQEMU_IFUP $GID $SYSROOT 2>&1`
if [ $? -ne 0 ]; then
echo "Error running tunctl: $ifup"
exit 1
fi
done
# The runqemu script will check for this file, and if it exists,
# will use the existing bank of tap devices without creating
# additional ones via sudo.
touch /etc/runqemu-nosudo
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
#
# QEMU network configuration script to bring down tap devices. This
# utility needs to be run as root, and will use the tunctl binary
# from the native sysroot.
#
# If you find yourself calling this script a lot, you can add the
# the following to your /etc/sudoers file to be able to run this
# command without entering your password each time:
#
# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
#
# Copyright (c) 2006-2011 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
usage() {
echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>"
}
if [ $EUID -ne 0 ]; then
echo "Error: This script (runqemu-ifdown) must be run with root privileges"
exit 1
fi
if [ $# -ne 2 ]; then
usage
exit 1
fi
TAP=$1
NATIVE_SYSROOT_DIR=$2
TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
if [ ! -e "$TUNCTL" ]; then
echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
exit 1
fi
$TUNCTL -d $TAP
+107
View File
@@ -0,0 +1,107 @@
#!/bin/bash
#
# QEMU network interface configuration script. This utility needs to
# be run as root, and will use the tunctl binary from a native sysroot.
# Note: many Linux distros these days still use an older version of
# tunctl which does not support the group permissions option, hence
# the need to use build system's version.
#
# If you find yourself calling this script a lot, you can add the
# the following to your /etc/sudoers file to be able to run this
# command without entering your password each time:
#
# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifup
# <my-username> ALL=NOPASSWD: /path/to/runqemu-ifdown
#
# If you'd like to create a bank of tap devices at once, you should use
# the runqemu-gen-tapdevs script instead. If tap devices are set up using
# that script, the runqemu script will never end up calling this
# script.
#
# Copyright (c) 2006-2011 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
usage() {
echo "sudo $(basename $0) <gid> <native-sysroot-basedir>"
}
if [ $EUID -ne 0 ]; then
echo "Error: This script (runqemu-ifup) must be run with root privileges"
exit 1
fi
if [ $# -ne 2 ]; then
usage
exit 1
fi
GROUP="-g $1"
NATIVE_SYSROOT_DIR=$2
TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
if [ ! -x "$TUNCTL" ]; then
echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
exit 1
fi
TAP=`$TUNCTL -b $GROUP 2>&1`
STATUS=$?
if [ $STATUS -ne 0 ]; then
echo "tunctl failed:"
echo $TAP
exit 1
fi
IFCONFIG=`which ifconfig 2> /dev/null`
if [ "x$IFCONFIG" = "x" ]; then
# better than nothing...
IFCONFIG=/sbin/ifconfig
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
exit 1
fi
ROUTE=`which route`
if [ "x$ROUTE" = "x" ]; then
# better than nothing...
ROUTE=/sbin/route
fi
if [ ! -x "$ROUTE" ]; then
echo "$ROUTE cannot be executed"
exit 1
fi
IPTABLES=`which iptables 2> /dev/null`
if [ "x$IPTABLES" = "x" ]; then
IPTABLES=/sbin/iptables
fi
if [ ! -x "$IPTABLES" ]; then
echo "$IPTABLES cannot be executed"
exit 1
fi
n=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
$IFCONFIG $TAP 192.168.7.$n netmask 255.255.255.255
dest=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
$ROUTE add -host 192.168.7.$dest $TAP
# setup NAT for tap0 interface to have internet access in QEMU
$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s 192.168.7.0/24
echo 1 > /proc/sys/net/ipv4/ip_forward
$IPTABLES -P FORWARD ACCEPT
echo $TAP
+498
View File
@@ -0,0 +1,498 @@
#!/bin/bash -x
# Handle running OE images under qemu
#
# Copyright (C) 2006-2011 Linux Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# 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.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Call setting:
# QEMU_MEMORY (optional) - set the amount of memory in the emualted system.
# SERIAL_LOGFILE (optional) - log the serial port output to a file
# CROSSPATH - the path to any cross toolchain to use with distcc
#
# Image options:
# MACHINE - the machine to run
# FSTYPE - the image type to run
# KERNEL - the kernel image file to use
# ROOTFS - the disk image file to use
#
mem_size=-1
#Get rid of <> and get the contents of extra qemu running params
SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'`
#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some
# validation check
mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'`
if [ ! -z "$mem_set" ] ; then
#Get memory setting size from user input
mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
else
case "$MACHINE" in
"qemux86")
mem_size=128
;;
"qemux86-64")
mem_size=128
;;
"qemuarm")
mem_size=128
;;
"qemumips")
mem_size=128
;;
"qemuppc")
mem_size=128
;;
*)
mem_size=64
;;
esac
fi
# QEMU_MEMORY has 'M' appended to mem_size
QEMU_MEMORY="$mem_size"M
# Bug 433: qemuarm cannot use > 128 MB RAM
if [ "$MACHINE" = "qemuarm" ]; then
if [[ -z "$mem_size" || $mem_size -gt 128 ]]; then
echo "WARNING: qemuarm does not support > 128M of RAM."
echo "Changing QEMU_MEMORY to default of 128M."
QEMU_MEMORY="128M"
SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 128/" `
fi
fi
# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0
# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480
if [ -z "$mem_set" ] ; then
SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size"
fi
# This file is created when runqemu-gen-tapdevs creates a bank of tap
# devices, indicating that the user should not bring up new ones using
# sudo.
NOSUDO_FLAG="/etc/runqemu-nosudo"
QEMUIFUP=`which runqemu-ifup 2> /dev/null`
QEMUIFDOWN=`which runqemu-ifdown 2> /dev/null`
if [ -z "$QEMUIFUP" -o ! -x "$QEMUIFUP" ]; then
echo "runqemu-ifup cannot be found or executed"
exit 1
fi
if [ -z "$QEMUIFDOWN" -o ! -x "$QEMUIFDOWN" ]; then
echo "runqemu-ifdown cannot be found or executed"
exit 1
fi
NFSRUNNING="false"
acquire_lock() {
lockfile=$1
if [ -z "$lockfile" ]; then
echo "Error: missing lockfile arg passed to acquire_lock()"
return 1
fi
if [ -e "$lockfile.lock" ]; then
# Check that the lockfile is not stale
ps=`ps -ewwo pid | grep $(cat $lockfile.lock)`
if [ -z "$ps" ]; then
echo "WARNING: Stale lock file detected, deleting $lockfile.lock."
rm -f $lockfile.lock
echo $$ > $lockfile.lock
else
return 1
fi
else
echo $$ > $lockfile.lock
fi
return 0
}
release_lock() {
lockfile=$1
if [ -z "$lockfile" ]; then
echo "Error: missing lockfile arg passed to release_lock()"
return 1
fi
rm -f $lockfile.lock
}
LOCKDIR="/tmp/qemu-tap-locks"
if [ ! -d "$LOCKDIR" ]; then
mkdir $LOCKDIR
chmod 777 $LOCKDIR
fi
IFCONFIG=`which ifconfig 2> /dev/null`
if [ -z "$IFCONFIG" ]; then
IFCONFIG=/sbin/ifconfig
fi
if [ ! -x "$IFCONFIG" ]; then
echo "$IFCONFIG cannot be executed"
exit 1
fi
POSSIBLE=`$IFCONFIG -a | grep '^tap' | awk '{print $1}'`
TAP=""
LOCKFILE=""
for tap in $POSSIBLE; do
LOCKFILE="$LOCKDIR/$tap"
echo "Acquiring lockfile for $tap..."
acquire_lock $LOCKFILE
if [ $? -eq 0 ]; then
TAP=$tap
break
fi
done
if [ "$TAP" = "" ]; then
if [ -e "$NOSUDO_FLAG" ]; then
echo "Error: There are no available tap devices to use for networking,"
echo "and I see $NOSUDO_FLAG exists, so I am not going to try creating"
echo "a new one with sudo."
exit 1
fi
GROUPID=`id -g`
echo "Setting up tap interface under sudo"
# Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
# but inactive. This looks scary but is harmless
tap=`sudo $QEMUIFUP $GROUPID $OECORE_NATIVE_SYSROOT 2> /dev/null`
if [ $? -ne 0 ]; then
# Re-run standalone to see verbose errors
sudo $QEMUIFUP $GROUPID $OECORE_NATIVE_SYSROOT
return
fi
LOCKFILE="$LOCKDIR/$tap"
echo "Acquiring lockfile for $tap..."
acquire_lock $LOCKFILE
if [ $? -eq 0 ]; then
TAP=$tap
fi
else
echo "Using preconfigured tap device '$TAP'"
fi
cleanup() {
if [ ! -e "$NOSUDO_FLAG" ]; then
# Redirect stderr since we could see a LD_PRELOAD warning here if pseudo is loaded
# but inactive. This looks scary but is harmless
sudo $QEMUIFDOWN $TAP $OECORE_NATIVE_SYSROOT 2> /dev/null
fi
echo "Releasing lockfile of preconfigured tap device '$TAP'"
release_lock $LOCKFILE
if [ "$NFSRUNNING" = "true" ]; then
echo "Shutting down the userspace NFS server..."
echo "runqemu-export-rootfs stop $ROOTFS"
runqemu-export-rootfs stop $ROOTFS
fi
# If QEMU crashes or somehow tty properties are not restored
# after qemu exits, we need to run stty sane
stty sane
}
n1=$[ (`echo $TAP | sed 's/tap//'` * 2) + 1 ]
n2=$[ (`echo $TAP | sed 's/tap//'` * 2) + 2 ]
KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0"
QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no"
QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD"
KERNCMDLINE="mem=$QEMU_MEMORY"
QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet"
NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
export NFS_INSTANCE
SERIALOPTS=""
if [ "x$SERIAL_LOGFILE" != "x" ]; then
SERIALOPTS="-serial file:$SERIAL_LOGFILE"
fi
case "$MACHINE" in
"qemuarm") ;;
"qemumips") ;;
"qemuppc") ;;
"qemuarmv6") ;;
"qemuarmv7") ;;
"qemux86") ;;
"qemux86-64") ;;
"akita") ;;
"spitz") ;;
*)
echo "Error: Unsupported machine type $MACHINE"
return
;;
esac
if [ ! -f "$KERNEL" ]; then
echo "Error: Kernel image file $KERNEL doesn't exist"
cleanup
return
fi
if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then
echo "Error: Image file $ROOTFS doesn't exist"
cleanup
return
fi
if [ "$FSTYPE" = "nfs" ]; then
NFS_SERVER="192.168.7.1"
NFS_DIR=`echo $ROOTFS | sed 's/^[^:]*:\(.*\)/\1/'`
MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ]
NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ]
NFSD_PORT=$[ 3049 + $NFS_INSTANCE ]
MOUNTD_PORT=$[ 3048 + $NFS_INSTANCE ]
UNFS_OPTS="nfsvers=2,mountprog=$MOUNTD_RPCPORT,nfsprog=$NFSD_RPCPORT,udp,port=$NFSD_PORT,mountport=$MOUNTD_PORT"
PSEUDO_LOCALSTATEDIR=~/.runqemu-sdk/pseudo
export PSEUDO_LOCALSTATEDIR
# Start the userspace NFS server
echo "runqemu-export-rootfs restart $ROOTFS"
runqemu-export-rootfs restart $ROOTFS
if [ $? != 0 ]; then
cleanup
return
fi
NFSRUNNING="true"
fi
if [ "$NFS_SERVER" = "" ]; then
NFS_SERVER="192.168.7.1"
NFS_DIR=$ROOTFS
fi
if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then
QEMU=qemu-system-arm
MACHINE_SUBTYPE=versatilepb
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
# QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer"
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
KERNCMDLINE="root=/dev/sda rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
return
fi
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$MACHINE" = "qemuarmv6" ]; then
QEMUOPTIONS="$QEMUOPTIONS -cpu arm1136"
fi
if [ "$MACHINE" = "qemuarmv7" ]; then
QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
fi
fi
if [ "$MACHINE" = "qemux86" ]; then
QEMU=qemu
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl"
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist."
cleanup
return
fi
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
fi
# Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
# qemux86 and qemux86-64. We can use timer interrupt mode for now.
KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
fi
if [ "$MACHINE" = "qemux86-64" ]; then
QEMU=qemu-system-x86_64
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware -enable-gl"
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "x$ROOTFS" = "x" ]; then
ROOTFS=/srv/nfs/qemux86-64
fi
if [ ! -d "$ROOTFS" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist."
cleanup
return
fi
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
fi
# Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
# qemux86 and qemux86-64. We can use timer interrupt mode for now.
KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
fi
if [ "$MACHINE" = "spitz" ]; then
QEMU=qemu-system-arm
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
echo $ROOTFS
ROOTFS=`readlink -f $ROOTFS`
echo $ROOTFS
if [ ! -e "$ROOTFS.qemudisk" ]; then
echo "Adding a partition table to the ext3 image for use by QEMU, please wait..."
runqemu-addptable2image $ROOTFS $ROOTFS.qemudisk
fi
QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait"
fi
fi
if [ "$MACHINE" = "qemumips" ]; then
QEMU=qemu-system-mips
MACHINE_SUBTYPE=malta
QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS"
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
#KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
return
fi
KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
fi
fi
if [ "$MACHINE" = "qemuppc" ]; then
QEMU=qemu-system-ppc
MACHINE_SUBTYPE=mac99
CPU_SUBTYPE=G4
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
if [ "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then
KERNCMDLINE="root=/dev/hda rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS"
fi
if [ "$FSTYPE" = "nfs" ]; then
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
echo "Error: NFS mount point $ROOTFS doesn't exist"
cleanup
return
fi
KERNCMDLINE="root=/dev/nfs console=ttyS0 nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
fi
fi
if [ "$MACHINE" = "akita" ]; then
QEMU=qemu-system-arm
if [ "$FSTYPE" = "jffs2" ]; then
ROOTFS=`readlink -f $ROOTFS`
if [ ! -e "$ROOTFS.qemuflash" ]; then
echo "Converting raw image into flash image format for use by QEMU, please wait..."
raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash
fi
QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait"
fi
fi
if [ "x$QEMUOPTIONS" = "x" ]; then
echo "Error: Unable to support this combination of options"
cleanup
return
fi
PATH=$CROSSPATH:$OECORE_NATIVE_SYSROOT/usr/bin:$PATH
QEMUBIN=`which $QEMU 2> /dev/null`
if [ ! -x "$QEMUBIN" ]; then
echo "Error: No QEMU binary '$QEMU' could be found."
cleanup
return
fi
function _quit() {
if [ -n "$PIDFILE" ]; then
#echo kill `cat $PIDFILE`
kill `cat $PIDFILE`
fi
cleanup
return
}
DISTCCD=`which distccd 2> /dev/null`
PIDFILE=""
trap _quit INT TERM QUIT
if [ -x "$DISTCCD" ]; then
echo "Starting distccd..."
PIDFILE=`mktemp`
$DISTCCD --allow 192.168.7.2 --daemon --pid-file $PIDFILE &
else
echo "WARNING: distccd not present, no distcc support loaded."
fi
# qemu got segfault if linked with nVidia's libgl
GL_LD_PRELOAD=$LD_PRELOAD
if ldd $QEMUBIN | grep -i nvidia &> /dev/null
then
cat << EOM
WARNING: nVidia proprietary OpenGL libraries detected.
nVidia's OpenGL libraries are known to have compatibility issues with qemu,
resulting in a segfault. Please uninstall these drivers or ensure the mesa libGL
libraries precede nvidia's via LD_PRELOAD(Already do it on Ubuntu).
EOM
# Automatically use Ubuntu system's mesa libGL, other distro can add its own path
if grep -i ubuntu /etc/lsb-release &> /dev/null
then
GL_PATH=""
if test -e /usr/lib/libGL.so
then
GL_PATH="/usr/lib/libGL.so"
elif test -e /usr/lib/x86_64-linux-gnu/libGL.so
then
GL_PATH="/usr/lib/x86_64-linux-gnu/libGL.so"
fi
echo "Skip nVidia's libGL on Ubuntu!"
GL_LD_PRELOAD="$GL_PATH $LD_PRELOAD"
fi
fi
echo "Running $QEMU..."
# -no-reboot is a mandatory option - see bug #100
echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
cleanup
trap - INT TERM QUIT
return

Some files were not shown because too many files have changed in this diff Show More