diff options
Diffstat (limited to 'scripts')
231 files changed, 5434 insertions, 744 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer index 19d64e64e1..5d61fb1c16 100755 --- a/scripts/combo-layer +++ b/scripts/combo-layer @@ -20,12 +20,15 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import fnmatch import os, sys import optparse import logging import subprocess +import tempfile import ConfigParser import re +from collections import OrderedDict __version__ = "0.2.1" @@ -67,6 +70,11 @@ class Configuration(object): if value.startswith("@"): self.repos[repo][name] = eval(value.strip("@")) else: + # Apply special type transformations for some properties. + # Type matches the RawConfigParser.get*() methods. + types = {'signoff': 'boolean'} + if name in types: + value = getattr(parser, 'get' + types[name])(section, name) self.repos[repo][name] = value logger.debug("Loading config file %s" % self.conffile) @@ -108,7 +116,9 @@ class Configuration(object): readsection(self.localparser, section, repo) def update(self, repo, option, value, initmode=False): - if self.localparser: + # If the main config has the option already, that is what we + # are expected to modify. + if self.localparser and not self.parser.has_option(repo, option): parser = self.localparser section = "%s|%s" % (repo, self.combobranch) conffile = self.localconffile @@ -121,6 +131,7 @@ class Configuration(object): parser.set(section, option, value) with open(conffile, "w") as f: parser.write(f) + self.repos[repo][option] = value def sanity_check(self, initmode=False): required_options=["src_uri", "local_repo_dir", "dest_dir", "last_revision"] @@ -133,6 +144,10 @@ class Configuration(object): if option not in self.repos[name]: msg = "%s\nOption %s is not defined for component %s" %(msg, option, name) missing_options.append(option) + # Sanitize dest_dir so that we do not have to deal with edge cases + # (empty string, double slashes) in the rest of the code. + dest_dir = os.path.normpath(self.repos[name]["dest_dir"]) + self.repos[name]["dest_dir"] = "." if not dest_dir else dest_dir if msg != "": logger.error("configuration file %s has the following error: %s" % (self.conffile,msg)) if self.localconffile and 'last_revision' in missing_options: @@ -144,23 +159,27 @@ class Configuration(object): logger.error("ERROR: patchutils package is missing, please install it (e.g. # apt-get install patchutils)") sys.exit(1) -def runcmd(cmd,destdir=None,printerr=True): +def runcmd(cmd,destdir=None,printerr=True,out=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() + if not out: + out = os.tmpfile() + err = out + else: + err = os.tmpfile() try: - subprocess.check_call(cmd, stdout=out, stderr=out, cwd=destdir, shell=True) + subprocess.check_call(cmd, stdout=out, stderr=err, cwd=destdir, shell=isinstance(cmd, str)) except subprocess.CalledProcessError,e: - out.seek(0) + err.seek(0) if printerr: - logger.error("%s" % out.read()) + logger.error("%s" % err.read()) raise e - out.seek(0) - output = out.read() + err.seek(0) + output = err.read() logger.debug("output: %s" % output ) return output @@ -176,6 +195,11 @@ def action_init(conf, args): subprocess.check_call("git clone %s %s" % (conf.repos[name]['src_uri'], ldir), shell=True) if not os.path.exists(".git"): runcmd("git init") + if conf.history: + # Need a common ref for all trees. + runcmd('git commit -m "initial empty commit" --allow-empty') + startrev = runcmd('git rev-parse master').strip() + for name in conf.repos: repo = conf.repos[name] ldir = repo['local_repo_dir'] @@ -191,19 +215,225 @@ def action_init(conf, args): lastrev = None initialrev = branch logger.info("Copying data from %s..." % name) + # Sanity check initialrev and turn it into hash (required for copying history, + # because resolving a name ref only works in the component repo). + rev = runcmd('git rev-parse %s' % initialrev, ldir).strip() + if rev != initialrev: + try: + refs = runcmd('git show-ref -s %s' % initialrev, ldir).split('\n') + if len(set(refs)) > 1: + # Happens for example when configured to track + # "master" and there is a refs/heads/master. The + # traditional behavior from "git archive" (preserved + # here) it to choose the first one. This might not be + # intended, so at least warn about it. + logger.warn("%s: initial revision '%s' not unique, picking result of rev-parse = %s" % + (name, initialrev, refs[0])) + initialrev = rev + except: + # show-ref fails for hashes. Skip the sanity warning in that case. + pass + initialrev = rev dest_dir = repo['dest_dir'] - if dest_dir and dest_dir != ".": + if dest_dir != ".": extract_dir = os.path.join(os.getcwd(), dest_dir) if not os.path.exists(extract_dir): os.makedirs(extract_dir) else: extract_dir = os.getcwd() file_filter = repo.get('file_filter', "") - runcmd("git archive %s | tar -x -C %s %s" % (initialrev, extract_dir, file_filter), ldir) + exclude_patterns = repo.get('file_exclude', '').split() + def copy_selected_files(initialrev, extract_dir, file_filter, exclude_patterns, ldir, + subdir=""): + # When working inside a filtered branch which had the + # files already moved, we need to prepend the + # subdirectory to all filters, otherwise they would + # not match. + if subdir == '.': + subdir = '' + elif subdir: + subdir = os.path.normpath(subdir) + file_filter = ' '.join([subdir + '/' + x for x in file_filter.split()]) + exclude_patterns = [subdir + '/' + x for x in exclude_patterns] + # To handle both cases, we cd into the target + # directory and optionally tell tar to strip the path + # prefix when the files were already moved. + subdir_components = len(subdir.split(os.path.sep)) if subdir else 0 + strip=('--strip-components=%d' % subdir_components) if subdir else '' + # TODO: file_filter wild cards do not work (and haven't worked before either), because + # a) GNU tar requires a --wildcards parameter before turning on wild card matching. + # b) The semantic is not as intendend (src/*.c also matches src/foo/bar.c, + # in contrast to the other use of file_filter as parameter of "git archive" + # where it only matches .c files directly in src). + files = runcmd("git archive %s %s | tar -x -v %s -C %s %s" % + (initialrev, subdir, + strip, extract_dir, file_filter), + ldir) + if exclude_patterns: + # Implement file removal by letting tar create the + # file and then deleting it in the file system + # again. Uses the list of files created by tar (easier + # than walking the tree). + for file in files.split('\n'): + for pattern in exclude_patterns: + if fnmatch.fnmatch(file, pattern): + os.unlink(os.path.join(*([extract_dir] + ['..'] * subdir_components + [file]))) + break + + if not conf.history: + copy_selected_files(initialrev, extract_dir, file_filter, exclude_patterns, ldir) + else: + # First fetch remote history into local repository. + # We need a ref for that, so ensure that there is one. + refname = "combo-layer-init-%s" % name + runcmd("git branch -f %s %s" % (refname, initialrev), ldir) + runcmd("git fetch %s %s" % (ldir, refname)) + runcmd("git branch -D %s" % refname, ldir) + # Make that the head revision. + runcmd("git checkout -b %s %s" % (name, initialrev)) + # Optional: cut the history by replacing the given + # start point(s) with commits providing the same + # content (aka tree), but with commit information that + # makes it clear that this is an artifically created + # commit and nothing the original authors had anything + # to do with. + since_rev = repo.get('since_revision', '') + if since_rev: + committer = runcmd('git var GIT_AUTHOR_IDENT').strip() + # Same time stamp, no name. + author = re.sub('.* (\d+ [+-]\d+)', r'unknown <unknown> \1', committer) + logger.info('author %s' % author) + for rev in since_rev.split(): + # Resolve in component repo... + rev = runcmd('git log --oneline --no-abbrev-commit -n1 %s' % rev, ldir).split()[0] + # ... and then get the tree in current + # one. The commit should be in both repos with + # the same tree, but better check here. + tree = runcmd('git show -s --pretty=format:%%T %s' % rev).strip() + with tempfile.NamedTemporaryFile() as editor: + editor.write('''cat >$1 <<EOF +tree %s +author %s +committer %s + +%s: squashed import of component + +This commit copies the entire set of files as found in +%s %s + +For more information about previous commits, see the +upstream repository. + +Commit created by combo-layer. +EOF +''' % (tree, author, committer, name, name, since_rev)) + editor.flush() + os.environ['GIT_EDITOR'] = 'sh %s' % editor.name + runcmd('git replace --edit %s' % rev) + + # Optional: rewrite history to change commit messages or to move files. + if 'hook' in repo or dest_dir != ".": + filter_branch = ['git', 'filter-branch', '--force'] + with tempfile.NamedTemporaryFile() as hookwrapper: + if 'hook' in repo: + # Create a shell script wrapper around the original hook that + # can be used by git filter-branch. Hook may or may not have + # an absolute path. + hook = repo['hook'] + hook = os.path.join(os.path.dirname(conf.conffile), '..', hook) + # The wrappers turns the commit message + # from stdin into a fake patch header. + # This is good enough for changing Subject + # and commit msg body with normal + # combo-layer hooks. + hookwrapper.write('''set -e +tmpname=$(mktemp) +trap "rm $tmpname" EXIT +echo -n 'Subject: [PATCH] ' >>$tmpname +cat >>$tmpname +if ! [ $(tail -c 1 $tmpname | od -A n -t x1) == '0a' ]; then + echo >>$tmpname +fi +echo '---' >>$tmpname +%s $tmpname $GIT_COMMIT %s +tail -c +18 $tmpname | head -c -4 +''' % (hook, name)) + hookwrapper.flush() + filter_branch.extend(['--msg-filter', 'bash %s' % hookwrapper.name]) + if dest_dir != ".": + parent = os.path.dirname(dest_dir) + if not parent: + parent = '.' + # May run outside of the current directory, so do not assume that .git exists. + filter_branch.extend(['--tree-filter', 'mkdir -p .git/tmptree && mv $(ls -1 -a | grep -v -e ^.git$ -e ^.$ -e ^..$) .git/tmptree && mkdir -p %s && mv .git/tmptree %s' % (parent, dest_dir)]) + filter_branch.append('HEAD') + runcmd(filter_branch) + runcmd('git update-ref -d refs/original/refs/heads/%s' % name) + repo['rewritten_revision'] = runcmd('git rev-parse HEAD').strip() + repo['stripped_revision'] = repo['rewritten_revision'] + # Optional filter files: remove everything and re-populate using the normal filtering code. + # Override any potential .gitignore. + if file_filter or exclude_patterns: + runcmd('git rm -rf .') + if not os.path.exists(extract_dir): + os.makedirs(extract_dir) + copy_selected_files('HEAD', extract_dir, file_filter, exclude_patterns, '.', + subdir=dest_dir) + runcmd('git add --all --force .') + if runcmd('git status --porcelain'): + # Something to commit. + runcmd(['git', 'commit', '-m', + '''%s: select file subset + +Files from the component repository were chosen based on +the following filters: +file_filter = %s +file_exclude = %s''' % (name, file_filter or '<empty>', repo.get('file_exclude', '<empty>'))]) + repo['stripped_revision'] = runcmd('git rev-parse HEAD').strip() + if not lastrev: - lastrev = runcmd("git rev-parse %s" % initialrev, ldir).strip() + lastrev = runcmd('git rev-parse %s' % initialrev, ldir).strip() conf.update(name, "last_revision", lastrev, initmode=True) - runcmd("git add .") + + if not conf.history: + runcmd("git add .") + else: + # Create Octopus merge commit according to http://stackoverflow.com/questions/10874149/git-octopus-merge-with-unrelated-repositoies + runcmd('git checkout master') + merge = ['git', 'merge', '--no-commit'] + for name in conf.repos: + repo = conf.repos[name] + # Use branch created earlier. + merge.append(name) + # Root all commits which have no parent in the common + # ancestor in the new repository. + for start in runcmd('git log --pretty=format:%%H --max-parents=0 %s' % name).split('\n'): + runcmd('git replace --graft %s %s' % (start, startrev)) + try: + runcmd(merge) + except Exception, error: + logger.info('''Merging component repository history failed, perhaps because of merge conflicts. +It may be possible to commit anyway after resolving these conflicts. + +%s''' % error) + # Create MERGE_HEAD and MERGE_MSG. "git merge" itself + # does not create MERGE_HEAD in case of a (harmless) failure, + # and we want certain auto-generated information in the + # commit message for future reference and/or automation. + with open('.git/MERGE_HEAD', 'w') as head: + with open('.git/MERGE_MSG', 'w') as msg: + msg.write('repo: initial import of components\n\n') + # head.write('%s\n' % startrev) + for name in conf.repos: + repo = conf.repos[name] + # <upstream ref> <rewritten ref> <rewritten + files removed> + msg.write('combo-layer-%s: %s %s %s\n' % (name, + repo['last_revision'], + repo['rewritten_revision'], + repo['stripped_revision'])) + rev = runcmd('git rev-parse %s' % name).strip() + head.write('%s\n' % rev) + if conf.localconffile: localadded = True try: @@ -305,18 +535,17 @@ def check_rev_branch(component, repodir, rev, branch): return False return True -def get_repos(conf, args): +def get_repos(conf, repo_names): repos = [] - if len(args) > 1: - for arg in args[1:]: - if arg.startswith('-'): - break - else: - repos.append(arg) - for repo in repos: - if not repo in conf.repos: - logger.error("Specified component '%s' not found in configuration" % repo) - sys.exit(0) + for name in repo_names: + if name.startswith('-'): + break + else: + repos.append(name) + for repo in repos: + if not repo in conf.repos: + logger.error("Specified component '%s' not found in configuration" % repo) + sys.exit(0) if not repos: repos = conf.repos @@ -327,7 +556,7 @@ def action_pull(conf, args): """ update the component repos only """ - repos = get_repos(conf, args) + repos = get_repos(conf, args[1:]) # make sure all repos are clean for name in repos: @@ -348,7 +577,13 @@ def action_update(conf, args): generate the patch list apply the generated patches """ - repos = get_repos(conf, args) + components = [arg.split(':')[0] for arg in args[1:]] + revisions = {} + for arg in args[1:]: + if ':' in arg: + a = arg.split(':', 1) + revisions[a[0]] = a[1] + repos = get_repos(conf, components) # make sure combo repo is clean check_repo_clean(os.getcwd()) @@ -362,9 +597,10 @@ def action_update(conf, args): if conf.nopull: logger.info("Skipping pull (-n)") else: - action_pull(conf, args) + action_pull(conf, ['arg0'] + components) for name in repos: + revision = revisions.get(name, None) repo = conf.repos[name] ldir = repo['local_repo_dir'] dest_dir = repo['dest_dir'] @@ -373,18 +609,21 @@ def action_update(conf, args): # Step 2: generate the patch list and store to patch dir logger.info("Generating patches from %s..." % name) + top_revision = revision or branch + if not check_rev_branch(name, ldir, top_revision, branch): + sys.exit(1) 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 + patch_cmd_range = "--root %s" % top_revision + rev_cmd_range = top_revision else: if not check_rev_branch(name, ldir, repo['last_revision'], branch): sys.exit(1) - patch_cmd_range = "%s..%s" % (repo['last_revision'], branch) + patch_cmd_range = "%s..%s" % (repo['last_revision'], top_revision) rev_cmd_range = patch_cmd_range file_filter = repo.get('file_filter',"") @@ -406,6 +645,38 @@ def action_update(conf, args): runcmd("%s %s %s %s" % (repo['hook'], patch, revlist[count], name)) count=count-1 + # Step 3a: Filter out unwanted files and patches. + exclude = repo.get('file_exclude', '') + if exclude: + filter = ['filterdiff', '-p1'] + for path in exclude.split(): + filter.append('-x') + filter.append('%s/%s' % (dest_dir, path) if dest_dir != '.' else path) + for patch in patchlist[:]: + filtered = patch + '.tmp' + with open(filtered, 'w') as f: + runcmd(filter + [patch], out=f) + # Now check for empty patches. + if runcmd(['filterdiff', '--list', filtered]): + # Possibly modified. + os.unlink(patch) + os.rename(filtered, patch) + else: + # Empty, ignore it. Must also remove from revlist. + with open(patch, 'r') as f: + fromline = f.readline() + if not fromline: + # Patch must have been empty to start with. No need + # to remove it. + continue + m = re.match(r'''^From ([0-9a-fA-F]+) .*\n''', fromline) + rev = m.group(1) + logger.debug('skipping empty patch %s = %s' % (patch, rev)) + os.unlink(patch) + os.unlink(filtered) + patchlist.remove(patch) + revlist.remove(rev) + # 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 @@ -471,7 +742,7 @@ def apply_patchlist(conf, repos): if os.path.getsize(patchfile) == 0: logger.info("(skipping %d/%d %s - no changes)" % (i, linecount, patchdisp)) else: - cmd = "git am --keep-cr -s -p1 %s" % patchfile + cmd = "git am --keep-cr %s-p1 %s" % ('-s ' if repo.get('signoff', True) else '', patchfile) logger.info("Applying %d/%d: %s" % (i, linecount, patchdisp)) try: runcmd(cmd) @@ -570,6 +841,9 @@ Action: parser.add_option("-n", "--no-pull", help = "skip pulling component repos during update", action = "store_true", dest = "nopull", default = False) + parser.add_option("-H", "--history", help = "import full history of components during init", + action = "store_true", default = False) + options, args = parser.parse_args(sys.argv) # Dispatch to action handler diff --git a/scripts/combo-layer-hook-default.sh b/scripts/combo-layer-hook-default.sh index 8b148aca07..1e3a3b9bc8 100755 --- a/scripts/combo-layer-hook-default.sh +++ b/scripts/combo-layer-hook-default.sh @@ -9,5 +9,12 @@ 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 +sed -i -e "0,/^Subject:/s#^Subject: \[PATCH\] \($reponame: \)*\(.*\)#Subject: \[PATCH\] $reponame: \2#" $patchfile +if grep -q '^Signed-off-by:' $patchfile; then + # Insert before Signed-off-by. + sed -i -e "0,/^Signed-off-by:/s#\(^Signed-off-by:.*\)#\(From $reponame rev: $rev\)\n\n\1#" $patchfile +else + # Insert before final --- separator, with extra blank lines removed. + perl -e "\$_ = join('', <>); s/^(.*\S[ \t]*)(\n|\n\s*\n)---\n/\$1\n\nFrom $reponame rev: $rev\n---\n/s; print;" $patchfile >$patchfile.tmp + mv $patchfile.tmp $patchfile +fi diff --git a/scripts/combo-layer.conf.example b/scripts/combo-layer.conf.example index 010a692350..90e2b58723 100644 --- a/scripts/combo-layer.conf.example +++ b/scripts/combo-layer.conf.example @@ -1,7 +1,17 @@ # combo-layer example configuration file +# Default values for all sections. +[DEFAULT] + +# Add 'Signed-off-by' to all commits that get imported automatically. +signoff = True + # component name [bitbake] + +# Override signedoff default above (not very useful, but possible). +signoff = False + # mandatory options # git upstream uri src_uri = git://git.openembedded.org/bitbake @@ -32,6 +42,20 @@ last_revision = # file_filter = src/*.c : only include the src *.c file # file_filter = src/main.c src/Makefile.am : only include these two files +# file_exclude: filter out these file(s) +# file_exclude = [path] [path] ... +# +# Each entry must match a file name. In contrast do file_filter, matching +# a directory has no effect. To achieve that, use append a * wildcard +# at the end. +# +# Wildcards are applied to the complete path and also match slashes. +# +# example: +# file_exclude = src/foobar/* : exclude everything under src/foobar +# file_exclude = src/main.c : filter out main.c after including it with file_filter = src/*.c +# file_exclude = *~ : exclude backup 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. @@ -39,11 +63,24 @@ last_revision = # example: # hook = combo-layer-hook-default.sh +# since_revision: +# since_revision = release-1-2 +# since_revision = 12345 abcdf +# +# If provided, truncate imported history during "combo-layer --history +# init" at the specified revision(s). More than one can be specified +# to cut off multiple component branches. +# +# The specified commits themselves do not get imported. Instead, an +# artificial commit with "unknown" author is created with a content +# that matches the original commit. + [oe-core] src_uri = git://git.openembedded.org/openembedded-core local_repo_dir = /home/kyu3/src/test/oecore dest_dir = . last_revision = +since_revision = some-tag-or-commit-on-master-branch # 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 diff --git a/scripts/contrib/list-packageconfig-flags.py b/scripts/contrib/list-packageconfig-flags.py index 598b5c3fc6..2f3b8b06a6 100755 --- a/scripts/contrib/list-packageconfig-flags.py +++ b/scripts/contrib/list-packageconfig-flags.py @@ -65,7 +65,6 @@ def get_recipesdata(bbhandler, preferred): data = bb.cache.Cache.loadDataFull(fn, bbhandler.cooker.collection.get_file_appends(fn), bbhandler.config_data) flags = data.getVarFlags("PACKAGECONFIG") flags.pop('doc', None) - flags.pop('defaultval', None) if flags: data_dict[fn] = data @@ -78,7 +77,6 @@ def collect_pkgs(data_dict): for fn in data_dict: pkgconfigflags = data_dict[fn].getVarFlags("PACKAGECONFIG") pkgconfigflags.pop('doc', None) - pkgconfigflags.pop('defaultval', None) pkgname = data_dict[fn].getVar("P", True) pkg_dict[pkgname] = sorted(pkgconfigflags.keys()) @@ -135,7 +133,7 @@ def display_all(data_dict): print('PACKAGECONFIG %s' % packageconfig) for flag,flag_val in data_dict[fn].getVarFlags("PACKAGECONFIG").iteritems(): - if flag in ["defaultval", "doc"]: + if flag == "doc": continue print('PACKAGECONFIG[%s] %s' % (flag, flag_val)) print '' diff --git a/scripts/contrib/python/generate-manifest-2.7.py b/scripts/contrib/python/generate-manifest-2.7.py index 68c42b0a54..99bdca8994 100755 --- a/scripts/contrib/python/generate-manifest-2.7.py +++ b/scripts/contrib/python/generate-manifest-2.7.py @@ -170,8 +170,8 @@ if __name__ == "__main__": "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 " + + "lib-dynload/xreadlines.so types.* platform.* ${bindir}/python* " + + "_weakrefset.* sysconfig.* _sysconfigdata.* config/Makefile " + "${includedir}/python${PYTHON_MAJMIN}/pyconfig*.h " + "${libdir}/python${PYTHON_MAJMIN}/sitecustomize.py ") @@ -388,4 +388,11 @@ if __name__ == "__main__": m.addPackage( "${PN}-mailbox", "Python mailbox format support", "${PN}-core ${PN}-mime", "mailbox.*" ) + m.addPackage( "${PN}-argparse", "Python command line argument parser", "${PN}-core ${PN}-codecs ${PN}-textutils", + "argparse.*" ) + + m.addPackage( "${PN}-contextlib", "Python utilities for with-statement" + + "contexts.", "${PN}-core", + "${libdir}/python${PYTHON_MAJMIN}/contextlib.*" ) + m.make() diff --git a/scripts/create-pull-request b/scripts/create-pull-request index 503248bbf0..97ed874e7f 100755 --- a/scripts/create-pull-request +++ b/scripts/create-pull-request @@ -178,7 +178,13 @@ git format-patch -M40 --subject-prefix="$PREFIX" -n -o $ODIR --thread=shallow -- # Customize the cover letter CL="$ODIR/0000-cover-letter.patch" PM="$ODIR/pull-msg" -git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM" +GIT_VERSION=$(`git --version` | tr -d '[:alpha:][:space:].' | sed 's/\(...\).*/\1/') +NEWER_GIT_VERSION=210 +if [ $GIT_VERSION -lt $NEWER_GIT_VERSION ]; then + git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM" +else + git request-pull $RELATIVE_TO $REMOTE_URL :$BRANCH >> "$PM" +fi if [ $? -ne 0 ]; then echo "ERROR: git request-pull reported an error" exit 1 diff --git a/scripts/devtool b/scripts/devtool new file mode 100755 index 0000000000..981ff515d3 --- /dev/null +++ b/scripts/devtool @@ -0,0 +1,257 @@ +#!/usr/bin/env python + +# OpenEmbedded Development tool +# +# Copyright (C) 2014 Intel Corporation +# +# 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 sys +import os +import argparse +import glob +import re +import ConfigParser +import subprocess +import logging + +basepath = '' +workspace = {} +config = None +context = None + + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +logger = scriptutils.logger_create('devtool') + +plugins = [] + + +class ConfigHandler(object): + config_file = '' + config_obj = None + init_path = '' + workspace_path = '' + + def __init__(self, filename): + self.config_file = filename + self.config_obj = ConfigParser.SafeConfigParser() + + def get(self, section, option, default=None): + try: + ret = self.config_obj.get(section, option) + except (ConfigParser.NoOptionError, ConfigParser.NoSectionError): + if default != None: + ret = default + else: + raise + return ret + + def read(self): + if os.path.exists(self.config_file): + self.config_obj.read(self.config_file) + + if self.config_obj.has_option('General', 'init_path'): + pth = self.get('General', 'init_path') + self.init_path = os.path.join(basepath, pth) + if not os.path.exists(self.init_path): + logger.error('init_path %s specified in config file cannot be found' % pth) + return False + else: + self.config_obj.add_section('General') + + self.workspace_path = self.get('General', 'workspace_path', os.path.join(basepath, 'workspace')) + return True + + + def write(self): + logger.debug('writing to config file %s' % self.config_file) + self.config_obj.set('General', 'workspace_path', self.workspace_path) + with open(self.config_file, 'w') as f: + self.config_obj.write(f) + +class Context: + def __init__(self, **kwargs): + self.__dict__.update(kwargs) + + +def read_workspace(): + global workspace + workspace = {} + if not os.path.exists(os.path.join(config.workspace_path, 'conf', 'layer.conf')): + if context.fixed_setup: + logger.error("workspace layer not set up") + sys.exit(1) + else: + logger.info('Creating workspace layer in %s' % config.workspace_path) + _create_workspace(config.workspace_path, config, basepath) + + logger.debug('Reading workspace in %s' % config.workspace_path) + externalsrc_re = re.compile(r'^EXTERNALSRC(_pn-[a-zA-Z0-9-]*)? =.*$') + for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): + pn = os.path.splitext(os.path.basename(fn))[0].split('_')[0] + with open(fn, 'r') as f: + for line in f: + if externalsrc_re.match(line.rstrip()): + splitval = line.split('=', 2) + workspace[pn] = splitval[1].strip('" \n\r\t') + break + +def create_workspace(args, config, basepath, workspace): + if args.layerpath: + workspacedir = os.path.abspath(args.layerpath) + else: + workspacedir = os.path.abspath(os.path.join(basepath, 'workspace')) + _create_workspace(workspacedir, config, basepath, args.create_only) + +def _create_workspace(workspacedir, config, basepath, create_only=False): + import bb + + confdir = os.path.join(workspacedir, 'conf') + if os.path.exists(os.path.join(confdir, 'layer.conf')): + logger.info('Specified workspace already set up, leaving as-is') + else: + # Add a config file + bb.utils.mkdirhier(confdir) + with open(os.path.join(confdir, 'layer.conf'), 'w') as f: + f.write('# ### workspace layer auto-generated by devtool ###\n') + f.write('BBPATH =. "$' + '{LAYERDIR}:"\n') + f.write('BBFILES += "$' + '{LAYERDIR}/recipes/*/*.bb \\\n') + f.write(' $' + '{LAYERDIR}/appends/*.bbappend"\n') + f.write('BBFILE_COLLECTIONS += "workspacelayer"\n') + f.write('BBFILE_PATTERN_workspacelayer = "^$' + '{LAYERDIR}/"\n') + f.write('BBFILE_PATTERN_IGNORE_EMPTY_workspacelayer = "1"\n') + f.write('BBFILE_PRIORITY_workspacelayer = "99"\n') + # Add a README file + with open(os.path.join(workspacedir, 'README'), 'w') as f: + f.write('This layer was created by the OpenEmbedded devtool utility in order to\n') + f.write('contain recipes and bbappends. In most instances you should use the\n') + f.write('devtool utility to manage files within it rather than modifying files\n') + f.write('directly (although recipes added with "devtool add" will often need\n') + f.write('direct modification.)\n') + f.write('\nIf you no longer need to use devtool you can remove the path to this\n') + f.write('workspace layer from your conf/bblayers.conf file (and then delete the\n') + f.write('layer, if you wish).\n') + if not create_only: + # Add the workspace layer to bblayers.conf + bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf') + if not os.path.exists(bblayers_conf): + logger.error('Unable to find bblayers.conf') + return -1 + bb.utils.edit_bblayers_conf(bblayers_conf, workspacedir, config.workspace_path) + if config.workspace_path != workspacedir: + # Update our config to point to the new location + config.workspace_path = workspacedir + config.write() + + +def main(): + global basepath + global config + global context + + context = Context(fixed_setup=False) + + # Default basepath + basepath = os.path.dirname(os.path.abspath(__file__)) + pth = basepath + while pth != '' and pth != os.sep: + if os.path.exists(os.path.join(pth, '.devtoolbase')): + context.fixed_setup = True + basepath = pth + break + pth = os.path.dirname(pth) + + parser = argparse.ArgumentParser(description="OpenEmbedded development tool", + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('--basepath', help='Base directory of SDK / build directory') + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') + + subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') + + if not context.fixed_setup: + parser_create_workspace = subparsers.add_parser('create-workspace', + help='Set up a workspace', + description='Sets up a new workspace. NOTE: other devtool subcommands will create a workspace automatically as needed, so you only need to use %(prog)s if you want to specify where the workspace should be located.') + parser_create_workspace.add_argument('layerpath', nargs='?', help='Path in which the workspace layer should be created') + parser_create_workspace.add_argument('--create-only', action="store_true", help='Only create the workspace layer, do not alter configuration') + parser_create_workspace.set_defaults(func=create_workspace) + + scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'devtool')) + for plugin in plugins: + if hasattr(plugin, 'register_commands'): + plugin.register_commands(subparsers, context) + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + elif args.quiet: + logger.setLevel(logging.ERROR) + + if args.basepath: + # Override + basepath = args.basepath + elif not context.fixed_setup: + basepath = os.environ.get('BUILDDIR') + if not basepath: + logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)") + sys.exit(1) + + logger.debug('Using basepath %s' % basepath) + + config = ConfigHandler(os.path.join(basepath, 'conf', 'devtool.conf')) + if not config.read(): + return -1 + + bitbake_subdir = config.get('General', 'bitbake_subdir', '') + if bitbake_subdir: + # Normally set for use within the SDK + logger.debug('Using bitbake subdir %s' % bitbake_subdir) + sys.path.insert(0, os.path.join(basepath, bitbake_subdir, 'lib')) + core_meta_subdir = config.get('General', 'core_meta_subdir') + sys.path.insert(0, os.path.join(basepath, core_meta_subdir, 'lib')) + else: + # Standard location + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Using standard bitbake path %s' % bitbakepath) + scriptpath.add_oe_lib_path() + + scriptutils.logger_setup_color(logger, args.color) + + if args.subparser_name != 'create-workspace': + read_workspace() + + ret = args.func(args, config, basepath, workspace) + + return ret + + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc(5) + sys.exit(ret) diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache index dfb282efd4..c93b2c0b99 100755 --- a/scripts/gen-lockedsig-cache +++ b/scripts/gen-lockedsig-cache @@ -35,6 +35,12 @@ for s in sigs: for f in files: dst = f.replace(sys.argv[2], sys.argv[3]) - mkdir(os.path.dirname(dst)) - os.link(f, dst) + destdir = os.path.dirname(dst) + mkdir(destdir) + if os.path.exists(dst): + os.remove(dst) + if (os.stat(f).st_dev == os.stat(destdir).st_dev): + os.link(f, dst) + else: + shutil.copyfile(f, dst) diff --git a/scripts/help2man b/scripts/help2man deleted file mode 100755 index 2bb8d868bd..0000000000 --- a/scripts/help2man +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exit 1 diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py index 681720d20a..7d6be239da 100644 --- a/scripts/lib/bsp/engine.py +++ b/scripts/lib/bsp/engine.py @@ -756,6 +756,8 @@ class CheckInputLine(ListValInputLine): return None +dirname_substitutions = {} + class SubstrateBase(object): """ Base class for both expanded and unexpanded file and dir container @@ -764,6 +766,7 @@ class SubstrateBase(object): def __init__(self, filename, filebase, out_filebase): self.filename = filename self.filebase = filebase + self.translated_filename = filename self.out_filebase = out_filebase self.raw_lines = [] self.expanded_lines = [] @@ -869,6 +872,167 @@ class SubstrateBase(object): return self.expand_input_tag(tag, lineno) + def append_translated_filename(self, filename): + """ + Simply append filename to translated_filename + """ + self.translated_filename = os.path.join(self.translated_filename, filename) + + def get_substituted_file_or_dir_name(self, first_line, tag): + """ + If file or dir names contain name substitutions, return the name + to substitute. Note that this is just the file or dirname and + doesn't include the path. + """ + filename = first_line.find(tag) + if filename != -1: + filename += len(tag) + substituted_filename = first_line[filename:].strip() + this = substituted_filename.find(" this") + if this != -1: + head, tail = os.path.split(self.filename) + substituted_filename = substituted_filename[:this + 1] + tail + if tag == DIRNAME_TAG: # get rid of .noinstall in dirname + substituted_filename = substituted_filename.split('.')[0] + + return substituted_filename + + def get_substituted_filename(self, first_line): + """ + If a filename contains a name substitution, return the name to + substitute. Note that this is just the filename and doesn't + include the path. + """ + return self.get_substituted_file_or_dir_name(first_line, FILENAME_TAG) + + def get_substituted_dirname(self, first_line): + """ + If a dirname contains a name substitution, return the name to + substitute. Note that this is just the dirname and doesn't + include the path. + """ + return self.get_substituted_file_or_dir_name(first_line, DIRNAME_TAG) + + def substitute_filename(self, first_line): + """ + Find the filename in first_line and append it to translated_filename. + """ + substituted_filename = self.get_substituted_filename(first_line) + self.append_translated_filename(substituted_filename); + + def substitute_dirname(self, first_line): + """ + Find the dirname in first_line and append it to translated_filename. + """ + substituted_dirname = self.get_substituted_dirname(first_line) + self.append_translated_filename(substituted_dirname); + + def is_filename_substitution(self, line): + """ + Do we have a filename subustition? + """ + if line.find(FILENAME_TAG) != -1: + return True + return False + + def is_dirname_substitution(self, line): + """ + Do we have a dirname subustition? + """ + if line.find(DIRNAME_TAG) != -1: + return True + return False + + def translate_dirname(self, first_line): + """ + Just save the first_line mapped by filename. The later pass + through the directories will look for a dirname.noinstall + match and grab the substitution line. + """ + dirname_substitutions[self.filename] = first_line + + def translate_dirnames_in_path(self, path): + """ + Translate dirnames below this file or dir, not including tail. + dirname_substititions is keyed on actual untranslated filenames. + translated_path contains the subsititutions for each element. + """ + remainder = path[len(self.filebase)+1:] + translated_path = untranslated_path = self.filebase + + untranslated_dirs = remainder.split(os.sep) + + for dir in untranslated_dirs: + key = os.path.join(untranslated_path, dir + '.noinstall') + try: + first_line = dirname_substitutions[key] + except KeyError: + translated_path = os.path.join(translated_path, dir) + untranslated_path = os.path.join(untranslated_path, dir) + continue + substituted_dir = self.get_substituted_dirname(first_line) + translated_path = os.path.join(translated_path, substituted_dir) + untranslated_path = os.path.join(untranslated_path, dir) + + return translated_path + + def translate_file_or_dir_name(self): + """ + Originally we were allowed to use open/close/assign tags and python + code in the filename, which fit in nicely with the way we + processed the templates and generated code. Now that we can't + do that, we make those tags proper file contents and have this + pass substitute the nice but non-functional names with those + 'strange' ones, and then proceed as usual. + + So, if files or matching dir<.noinstall> files contain + filename substitutions, this function translates them into the + corresponding 'strange' names, which future passes will expand + as they always have. The resulting pathname is kept in the + file or directory's translated_filename. Another way to think + about it is that self.filename is the input filename, and + translated_filename is the output filename before expansion. + """ + # remove leaf file or dirname + head, tail = os.path.split(self.filename) + translated_path = self.translate_dirnames_in_path(head) + self.translated_filename = translated_path + + # This is a dirname - does it have a matching .noinstall with + # a substitution? If so, apply the dirname subsititution. + if not os.path.isfile(self.filename): + key = self.filename + ".noinstall" + try: + first_line = dirname_substitutions[key] + except KeyError: + self.append_translated_filename(tail) + return + self.substitute_dirname(first_line) + return + + f = open(self.filename) + first_line = f.readline() + f.close() + + # This is a normal filename not needing translation, just use + # it as-is. + if not first_line or not first_line.startswith("#"): + self.append_translated_filename(tail) + return + + # If we have a filename substitution (first line in the file + # is a FILENAME_TAG line) do the substitution now. If we have + # a dirname substitution (DIRNAME_TAG in dirname.noinstall + # meta-file), hash it so we can apply it when we see the + # matching dirname later. Otherwise we have a regular + # filename, just use it as-is. + if self.is_filename_substitution(first_line): + self.substitute_filename(first_line) + elif self.is_dirname_substitution(first_line): + self.translate_dirname(first_line) + else: + self.append_translated_filename(tail) + def expand_file_or_dir_name(self): """ Expand file or dir names into codeline. Dirnames and @@ -878,7 +1042,7 @@ class SubstrateBase(object): """ lineno = 0 - line = self.filename[len(self.filebase):] + line = self.translated_filename[len(self.filebase):] if line.startswith("/"): line = line[1:] opentag_start = -1 @@ -897,7 +1061,6 @@ class SubstrateBase(object): self.parse_error("No close tag found for open tag", lineno, line) # we have a {{ tag i.e. code tag = line[opentag_start + len(OPEN_TAG):end].strip() - if not tag.lstrip().startswith(IF_TAG): self.parse_error("Only 'if' tags are allowed in file or directory names", lineno, line) @@ -933,6 +1096,7 @@ class SubstrateBase(object): Expand the file or dir name first, eventually this ends up creating the file or dir. """ + self.translate_file_or_dir_name() self.expand_file_or_dir_name() @@ -955,6 +1119,9 @@ class SubstrateFile(SubstrateBase): self.read() for lineno, line in enumerate(self.raw_lines): + # only first line can be a filename substitition + if lineno == 0 and line.startswith("#") and FILENAME_TAG in line: + continue # skip it - we've already expanded it expanded_line = self.expand_tag(line, lineno + 1) # humans not 0-based if not expanded_line: expanded_line = NormalLine(line.rstrip()) @@ -1141,7 +1308,7 @@ def gather_inputlines(files): for file in files: if isinstance(file, SubstrateFile): group = None - basename = os.path.basename(file.filename) + basename = os.path.basename(file.translated_filename) codeline = conditional_filename(basename) if codeline: diff --git a/scripts/lib/bsp/help.py b/scripts/lib/bsp/help.py index 7c436d6be0..4cce100d16 100644 --- a/scripts/lib/bsp/help.py +++ b/scripts/lib/bsp/help.py @@ -230,6 +230,7 @@ DESCRIPTION powerpc i386 mips + mips64 x86_64 qemu diff --git a/scripts/lib/bsp/substrate/target/arch/arm/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/arm/conf/machine/machine.conf index 44a80d226c..588367a05e 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/arm/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} @@ -9,19 +10,13 @@ PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg" XSERVER ?= "xserver-xorg \ xf86-input-evdev \ xf86-input-mouse \ - xf86-video-omapfb \ + xf86-video-fbdev \ xf86-input-keyboard" -# Ship all kernel modules by default -MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" +MACHINE_EXTRA_RRECOMMENDS = " kernel-modules kernel-devicetree" -# Allow for MMC booting (required by the NAND-less Beagleboard XM) EXTRA_IMAGEDEPENDS += "u-boot" -# Uncomment the following line to enable the hard floating point abi. Note that -# this breaks some binary libraries and 3D (neither of which ship with -# meta-yocto). For maximum compatibility, leave this disabled. -#DEFAULTTUNE ?= "cortexa8hf-neon" {{ input type:"choicelist" name:"tunefile" prio:"40" msg:"Which machine tuning would you like to use?" default:"tune_cortexa8" }} {{ input type:"choice" val:"tune_arm1136jf_s" msg:"arm1136jf-s tuning optimizations" }} {{ input type:"choice" val:"tune_arm920t" msg:"arm920t tuning optimizations" }} @@ -52,6 +47,7 @@ include conf/machine/include/tune-cortexa5.inc {{ if tunefile == "tune_cortexa7": }} include conf/machine/include/tune-cortexa7.inc {{ if tunefile == "tune_cortexa8": }} +DEFAULTTUNE ?= "cortexa8hf-neon" include conf/machine/include/tune-cortexa8.inc {{ if tunefile == "tune_cortexa9": }} include conf/machine/include/tune-cortexa9.inc @@ -75,9 +71,7 @@ include conf/machine/include/tune-xscale.inc IMAGE_FSTYPES += "tar.bz2 jffs2" EXTRA_IMAGECMD_jffs2 = "-lnp " -# 2.6.37 and later kernels use OMAP_SERIAL, ttyO2 -# earlier kernels use ttyS2 -SERIAL_CONSOLE = "115200 ttyO2" +SERIAL_CONSOLE = "115200 ttyO0" {{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} {{ if kernel_choice == "linux-yocto-dev": preferred_kernel = "linux-yocto-dev" }} @@ -90,12 +84,13 @@ PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%" -KERNEL_IMAGETYPE = "zImage" -KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/omap3-beagle.dts ${S}/arch/arm/boot/dts/omap3-beagle-xm.dts" +KERNEL_IMAGETYPE = "uImage" +KERNEL_DEVICETREE = "am335x-bone.dtb am335x-boneblack.dtb" +KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}" SPL_BINARY = "MLO" UBOOT_SUFFIX = "img" -{{ input type:"edit" name:"uboot_machine" prio:"40" msg:"Please specify a value for UBOOT_MACHINE:" default:"omap3_beagle_config" }} +{{ input type:"edit" name:"uboot_machine" prio:"40" msg:"Please specify a value for UBOOT_MACHINE:" default:"am335x_evm_config" }} UBOOT_MACHINE = "{{=uboot_machine}}" {{ input type:"edit" name:"uboot_entrypoint" prio:"40" msg:"Please specify a value for UBOOT_ENTRYPOINT:" default:"0x80008000" }} UBOOT_ENTRYPOINT = "{{=uboot_entrypoint}}" @@ -103,3 +98,5 @@ UBOOT_ENTRYPOINT = "{{=uboot_entrypoint}}" UBOOT_LOADADDRESS = "{{=uboot_loadaddress}}" MACHINE_FEATURES = "usbgadget usbhost vfat alsa" + +IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf index 264f3c91ad..bc52893e2a 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this Section "Module" Load "extmod" Load "dbe" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend new file mode 100644 index 0000000000..30830031ed --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend @@ -0,0 +1,2 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend deleted file mode 100644 index 72d991c7e5..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend +++ /dev/null @@ -1 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-non_hardware.cfg b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-non_hardware.cfg index 361343bb58..9bfc90c6f2 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-non_hardware.cfg +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-non_hardware.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-non_hardware.cfg # # Miscellaneous filesystems # diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-preempt-rt.scc index 56f7f0f1e3..ca5f3b5be9 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH arm diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-standard.scc index 80640db4a2..9014c2c97e 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH arm diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-tiny.scc index 51eaf2d32c..3f1c252232 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH arm diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..47489e44e9 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..582759e612 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..97f747fa07 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.cfg index 10134c81f5..a2e1ae0f75 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.cfg # # System Type # diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc index 24196e6f67..828400df40 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg kconf non-hardware {{machine}}-non_hardware.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend index 25c87a85ac..2fa6231cbf 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend index 08b1f88d1b..5f8db03c64 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-preempt-rt.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" #SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.9" +#LINUX_VERSION = "3.14" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index d221d5f2a4..471ccbcc3e 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend new file mode 100644 index 0000000000..4de82fad00 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_3.14.bbappend index ca7f8c5978..1e1cc51315 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_3.19.bbappend index ca7f8c5978..97e1bb8432 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-standard.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" #SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.14"
\ No newline at end of file +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/{{=machine}}/machconfig b/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/machine/machconfig index 3b85d3821f..3b85d3821f 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/{{=machine}}/machconfig +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-bsp/formfactor/formfactor/machine/machconfig diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall index 03b7d84ec2..663dddbb0f 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/kernel-list.noinstall @@ -2,22 +2,22 @@ {{ input type:"boolean" name:"custom_kernel_remote" prio:"20" msg:"Is the custom kernel you'd like to use in a remote git repo? (y/n)" default:"y"}} {{ if kernel_choice == "custom" and custom_kernel_remote == "y": }} -{{ input type:"edit-git-repo" name:"custom_kernel_remote_path" prio:"20" msg:"Please enter the full URI to the remote git repo (the default corresponds to linux-stable v3.13.9)" default:"git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"}} +{{ input type:"edit-git-repo" name:"custom_kernel_remote_path" prio:"20" msg:"Please enter the full URI to the remote git repo (the default corresponds to linux-stable v3.16.3)" default:"git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"}} {{ if kernel_choice == "custom" and custom_kernel_remote == "n": }} -{{ input type:"edit-git-repo" name:"custom_kernel_local_path" prio:"20" msg:"You've indicated that you're not using a remote git repo. Please enter the full path to the local git repo you want to use (the default assumes a local linux-stable v3.13.9)" default:"/home/trz/yocto/kernels/linux-stable.git"}} +{{ input type:"edit-git-repo" name:"custom_kernel_local_path" prio:"20" msg:"You've indicated that you're not using a remote git repo. Please enter the full path to the local git repo you want to use (the default assumes a local linux-stable v3.16.3)" default:"/home/trz/yocto/kernels/linux-stable.git"}} {{ if kernel_choice == "custom": }} {{ input type:"boolean" name:"custom_kernel_need_kbranch" prio:"20" msg:"Do you need to use a specific (non-master) branch? (y/n)" default:"n"}} {{ if kernel_choice == "custom" and custom_kernel_need_kbranch == "y": }} -{{ input type:"edit" name:"custom_kernel_kbranch" prio:"20" msg:"Please enter the branch you want to use (the default branch corresponds to the linux-stable 'linux-3.13.y' branch):" default:"linux-3.13.y"}} +{{ input type:"edit" name:"custom_kernel_kbranch" prio:"20" msg:"Please enter the branch you want to use (the default branch corresponds to the linux-stable 'linux-3.16.y' branch):" default:"linux-3.16.y"}} {{ if kernel_choice == "custom": }} {{ input type:"edit" name:"custom_kernel_srcrev" prio:"20" msg:"Please enter the SRCREV (commit id) you'd like to use (use '${AUTOREV}' to track the current HEAD):" default:"${AUTOREV}"}} {{ if kernel_choice == "custom": }} -{{ input type:"edit" name:"custom_kernel_linux_version" prio:"20" msg:"Please enter the Linux version of the kernel you've specified:" default:"3.13.9"}} +{{ input type:"edit" name:"custom_kernel_linux_version" prio:"20" msg:"Please enter the Linux version of the kernel you've specified:" default:"3.16.3"}} {{ if kernel_choice == "custom": }} {{ input type:"edit" name:"custom_kernel_linux_version_extension" prio:"20" msg:"Please enter a Linux version extension if you want (it will show up at the end of the kernel name shown by uname):" default:"-custom"}} diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom.bb b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb index 6d3cc6f743..80a52e7cae 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom.bb +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.bb @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "custom": }} this # This file was derived from the linux-yocto-custom.bb recipe in # oe-core. # @@ -31,9 +32,9 @@ inherit kernel require recipes-kernel/linux/linux-yocto.inc {{ if kernel_choice == "custom" and custom_kernel_remote == "y": }} -SRC_URI = "{{=custom_kernel_remote_path}};protocol=git;bareclone=1" +SRC_URI = "{{=custom_kernel_remote_path}};protocol=git;bareclone=1;branch=${KBRANCH}" {{ if kernel_choice == "custom" and custom_kernel_remote == "n": }} -SRC_URI = "git://{{=custom_kernel_local_path}};protocol=file;bareclone=1" +SRC_URI = "git://{{=custom_kernel_local_path}};protocol=file;bareclone=1;branch=${KBRANCH}" SRC_URI += "file://defconfig" diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.noinstall b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.noinstall new file mode 100644 index 0000000000..017d206c24 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice == "custom": }} linux-yocto-custom diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/defconfig b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/defconfig index ceb0ffa30c..ceb0ffa30c 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/defconfig +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/defconfig diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-config.cfg index 17c8b503da..922309d5ab 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}-user-config.cfg +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-config.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg # # Used by yocto-kernel to manage config options. # diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-patches.scc index 7a598d9118..6d1138f42a 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}-user-patches.scc +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine-user-patches.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc # # Used by yocto-kernel to manage patches. # diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.cfg index 95170b12eb..1ba8201f16 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}.cfg +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.cfg # # A convenient place to add config options, nothing more. # diff --git a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc index 2e3ca90793..0b6b413377 100644 --- a/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/{{ if kernel_choice == "custom": }} linux-yocto-custom/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/common/recipes-kernel/linux/linux-yocto-custom/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc # # The top-level 'feature' for the {{=machine}} custom kernel. # diff --git a/scripts/lib/bsp/substrate/target/arch/i386/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/i386/conf/machine/machine.conf index 0df4dc2035..7189341909 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/i386/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} @@ -32,19 +33,23 @@ MACHINE_FEATURES += "wifi efi pcbios" {{ input type:"boolean" name:"xserver" prio:"50" msg:"Do you need support for X? (y/n)" default:"y" }} -{{ if xserver == "y" and (kernel_choice == "linux-yocto_3.14" or kernel_choice == "linux-yocto_3.10"): }} -{{ input type:"choicelist" name:"xserver_choice" prio:"50" msg:"Please select an xserver for this machine:" default:"xserver_i915" }} +{{ if xserver == "y" and (kernel_choice == "linux-yocto_3.19" or kernel_choice == "linux-yocto_3.14"): }} +{{ input type:"choicelist" name:"xserver_choice" prio:"50" msg:"Please select an xserver for this machine:" default:"xserver_vesa" }} {{ input type:"choice" val:"xserver_vesa" msg:"VESA xserver support" }} {{ input type:"choice" val:"xserver_i915" msg:"i915 xserver support" }} {{ input type:"choice" val:"xserver_i965" msg:"i965 xserver support" }} +{{ input type:"choice" val:"xserver_fbdev" msg:"fbdev xserver support" }} +{{ input type:"choice" val:"xserver_modesetting" msg:"modesetting xserver support" }} {{ if xserver == "y" and kernel_choice == "custom": }} -{{ input type:"choicelist" name:"xserver_choice" prio:"50" msg:"Please select an xserver for this machine:" default:"xserver_i915" }} +{{ input type:"choicelist" name:"xserver_choice" prio:"50" msg:"Please select an xserver for this machine:" default:"xserver_vesa" }} {{ input type:"choice" val:"xserver_vesa" msg:"VESA xserver support" }} {{ input type:"choice" val:"xserver_i915" msg:"i915 xserver support" }} {{ input type:"choice" val:"xserver_i965" msg:"i965 xserver support" }} +{{ input type:"choice" val:"xserver_fbdev" msg:"fbdev xserver support" }} +{{ input type:"choice" val:"xserver_modesetting" msg:"modesetting xserver support" }} -{{ if xserver == "y" and kernel_choice != "linux-yocto_3.14" and kernel_choice != "linux-yocto_3.10" and kernel_choice != "custom": xserver_choice = "xserver_i915" }} +{{ if xserver == "y" and kernel_choice != "linux-yocto_3.19" and kernel_choice != "linux-yocto_3.14" and kernel_choice != "custom": xserver_choice = "xserver_i915" }} {{ if xserver == "y": }} XSERVER ?= "${XSERVER_X86_BASE} \ @@ -55,12 +60,18 @@ XSERVER ?= "${XSERVER_X86_BASE} \ ${XSERVER_X86_I915} \ {{ if xserver == "y" and xserver_choice == "xserver_i965": }} ${XSERVER_X86_I965} \ +{{ if xserver == "y" and xserver_choice == "xserver_fbdev": }} + ${XSERVER_X86_FBDEV} \ +{{ if xserver == "y" and xserver_choice == "xserver_modesetting": }} + ${XSERVER_X86_MODESETTING} \ {{ if xserver == "y": }} " -MACHINE_EXTRA_RRECOMMENDS += "linux-firmware v86d" +MACHINE_EXTRA_RRECOMMENDS += "linux-firmware v86d eee-acpi-scripts" EXTRA_OECONF_append_pn-matchbox-panel-2 = " --with-battery=acpi" +GLIBC_ADDONS = "nptl" + {{ if xserver == "y" and xserver_choice == "xserver_vesa": }} APPEND += "video=vesafb vga=0x318" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf new file mode 100644 index 0000000000..ac9a0f1bb0 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf @@ -0,0 +1 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend new file mode 100644 index 0000000000..30830031ed --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend @@ -0,0 +1,2 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend deleted file mode 100644 index 72d991c7e5..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend +++ /dev/null @@ -1 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-preempt-rt.scc index bfefb0d0a0..619ee3f367 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH i386 diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-standard.scc index 60b670dffc..682012fafc 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH i386 diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-tiny.scc index ec44ef9485..cc7519699a 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH i386 diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..69efdcc759 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..85be26de97 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..4c59daac46 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.cfg index e93c0b8a08..3b168b7e36 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.cfg CONFIG_X86_32=y CONFIG_MATOM=y CONFIG_PRINTK=y diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc index eda1d62f11..3d32f111b0 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg include features/intel-e1xxxx/intel-e100.scc diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend index 25c87a85ac..2fa6231cbf 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend index 00c8c68933..5f8db03c64 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-preempt-rt.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" #SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file +#LINUX_VERSION = "3.14" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index d221d5f2a4..471ccbcc3e 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend new file mode 100644 index 0000000000..4de82fad00 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_3.14.bbappend index 948d568cd1..fbb49edb26 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_3.19.bbappend index c1f26540a7..0c2cb5af62 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -27,6 +28,6 @@ SRC_URI += "file://{{=machine}}-standard.scc \ # uncomment and replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "19f7e43b54aef08d58135ed2a897d77b624b320a" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "459165c1dd61c4e843c36e6a1abeb30949a20ba7" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend.noinstall b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend.noinstall new file mode 100644 index 0000000000..3594e6583c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if create_example_bbappend == "y": }} recipes-example-bbappend diff --git a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_bbappend == "y": }} recipes-example-bbappend/example-bbappend/{{=example_bbappend_name}}_{{=example_bbappend_version}}.bbappend b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version.bbappend index 2e50ff668d..353133080a 100644 --- a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_bbappend == "y": }} recipes-example-bbappend/example-bbappend/{{=example_bbappend_name}}_{{=example_bbappend_version}}.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=example_bbappend_name}}_{{=example_bbappend_version}}.bbappend FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" # diff --git a/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version.noinstall b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version.noinstall new file mode 100644 index 0000000000..46df8a8e04 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=example_bbappend_name}}-{{=example_bbappend_version}} diff --git a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_bbappend == "y": }} recipes-example-bbappend/example-bbappend/{{=example_bbappend_name}}-{{=example_bbappend_version}}/example.patch b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version/example.patch index 2000a34da5..2000a34da5 100644 --- a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_bbappend == "y": }} recipes-example-bbappend/example-bbappend/{{=example_bbappend_name}}-{{=example_bbappend_version}}/example.patch +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example-bbappend/example-bbappend/example-bbappend-version/example.patch diff --git a/scripts/lib/bsp/substrate/target/arch/layer/recipes-example.noinstall b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example.noinstall new file mode 100644 index 0000000000..b0069b1a5a --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if create_example_recipe == "y": }} recipes-example diff --git a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}_0.1.bb b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1.bb index 14bf344da5..ba1ccb16c6 100644 --- a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}_0.1.bb +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1.bb @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=example_recipe_name}}_0.1.bb # # This file was derived from the 'Hello World!' example recipe in the # Yocto Project Development Manual. diff --git a/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1.noinstall b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1.noinstall new file mode 100644 index 0000000000..c319c19c57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=example_recipe_name}}-0.1 diff --git a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}-0.1/example.patch b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1/example.patch index 2000a34da5..2000a34da5 100644 --- a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}-0.1/example.patch +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1/example.patch diff --git a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}-0.1/helloworld.c b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1/helloworld.c index 71f2e46b4e..71f2e46b4e 100644 --- a/scripts/lib/bsp/substrate/target/arch/layer/{{ if create_example_recipe == "y": }} recipes-example/example/{{=example_recipe_name}}-0.1/helloworld.c +++ b/scripts/lib/bsp/substrate/target/arch/layer/recipes-example/example/example-recipe-0.1/helloworld.c diff --git a/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf index 9ea411933c..b319d626f4 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-preempt-rt.scc index b0fb63ac6a..176190cd2e 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH mips diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-standard.scc index 326663a509..f05dd851d2 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH mips diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-tiny.scc index 4514765eb3..f71c775397 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH mips diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..47489e44e9 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..85be26de97 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..97f747fa07 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.cfg b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.cfg new file mode 100644 index 0000000000..2fe476691c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.cfg @@ -0,0 +1,2 @@ +# yocto-bsp-filename {{=machine}}.cfg +CONFIG_MIPS=y diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc index 1ef01b6e3c..f39dc3edf1 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg include cfg/usb-mass-storage.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend index 25c87a85ac..2fa6231cbf 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend new file mode 100644 index 0000000000..5f8db03c64 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-preempt-rt.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" +#SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" +#LINUX_VERSION = "3.14" diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index bc6968d832..c7e7989821 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" #SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.9" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend index bc6968d832..a9ba0ae457 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" #SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.9" +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_3.14.bbappend index 1e814c54d7..1e1cc51315 100644 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -27,6 +28,6 @@ SRC_URI += "file://{{=machine}}-standard.scc \ # uncomment and replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "19f7e43b54aef08d58135ed2a897d77b624b320a" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "459165c1dd61c4e843c36e6a1abeb30949a20ba7" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_3.19.bbappend new file mode 100644 index 0000000000..97e1bb8432 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-standard.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg deleted file mode 100644 index a1b333ca56..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ /dev/null @@ -1 +0,0 @@ -CONFIG_MIPS=y diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend deleted file mode 100644 index bc6968d832..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" -#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.9" diff --git a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend deleted file mode 100644 index 85544e812c..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/mips/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" -#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/mips64/.gitignore index e69de29bb2..e69de29bb2 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ b/scripts/lib/bsp/substrate/target/arch/mips64/.gitignore diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf b/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf new file mode 100644 index 0000000000..3afc5e093e --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf @@ -0,0 +1,39 @@ +# yocto-bsp-filename {{=machine}}.conf +#@TYPE: Machine +#@NAME: {{=machine}} + +#@DESCRIPTION: Machine configuration for {{=machine}} systems + +require conf/machine/include/tune-mips64.inc + +MACHINE_FEATURES = "pci ext2 ext3 serial" + +KERNEL_IMAGETYPE = "vmlinux" +KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" + +{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} +{{ if kernel_choice == "linux-yocto-dev": preferred_kernel = "linux-yocto-dev" }} +{{ if kernel_choice == "custom" or kernel_choice == "linux-yocto-dev" : }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" + +{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": preferred_kernel = kernel_choice.split('_')[0] }} +{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": preferred_kernel_version = kernel_choice.split('_')[1] }} +{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": }} +PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}" +PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%" + +{{ input type:"boolean" name:"xserver" prio:"50" msg:"Do you need support for X? (y/n)" default:"y" }} +{{ if xserver == "y": }} +PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg" +XSERVER ?= "xserver-xorg \ + xf86-input-evdev \ + xf86-video-fbdev" + +SERIAL_CONSOLE = "115200 ttyS0" +USE_VT ?= "0" + +MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" + +IMAGE_FSTYPES ?= "jffs2 tar.bz2" +JFFS2_ERASEBLOCK = "0x10000" diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-preempt-rt.scc new file mode 100644 index 0000000000..176190cd2e --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -0,0 +1,10 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc +define KMACHINE {{=machine}} +define KTYPE preempt-rt +define KARCH mips + +include {{=map_preempt_rt_kbranch(need_new_kbranch, new_kbranch, existing_kbranch)}} +{{ if need_new_kbranch == "y": }} +branch {{=machine}} + +include {{=machine}}.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-standard.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-standard.scc new file mode 100644 index 0000000000..f05dd851d2 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-standard.scc @@ -0,0 +1,10 @@ +# yocto-bsp-filename {{=machine}}-standard.scc +define KMACHINE {{=machine}} +define KTYPE standard +define KARCH mips + +include {{=map_standard_kbranch(need_new_kbranch, new_kbranch, existing_kbranch)}} +{{ if need_new_kbranch == "y": }} +branch {{=machine}} + +include {{=machine}}.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-tiny.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-tiny.scc new file mode 100644 index 0000000000..f71c775397 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-tiny.scc @@ -0,0 +1,10 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc +define KMACHINE {{=machine}} +define KTYPE tiny +define KARCH mips + +include {{=map_tiny_kbranch(need_new_kbranch, new_kbranch, existing_kbranch)}} +{{ if need_new_kbranch == "y": }} +branch {{=machine}} + +include {{=machine}}.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..69efdcc759 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..85be26de97 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..4c59daac46 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.cfg b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.cfg new file mode 100644 index 0000000000..0cc906bbf0 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.cfg @@ -0,0 +1,66 @@ +# yocto-bsp-filename {{=machine}}.cfg +#SOC +CONFIG_CAVIUM_OCTEON_SOC=y +CONFIG_CAVIUM_CN63XXP1=y +CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE=2 + +#Kernel +CONFIG_SMP=y +CONFIG_NR_CPUS=32 +#Executable file formats +CONFIG_MIPS32_COMPAT=y +CONFIG_MIPS32_O32=y +CONFIG_MIPS32_N32=y + + +#PCI +CONFIG_PCI=y +CONFIG_PCI_MSI=y + +#I2C +CONFIG_I2C=y +CONFIG_I2C_OCTEON=y + +CONFIG_HW_RANDOM_OCTEON=y + +#SPI +CONFIG_SPI=y +CONFIG_SPI_OCTEON=y + +#Misc +CONFIG_EEPROM_AT24=y +CONFIG_EEPROM_AT25=y +CONFIG_OCTEON_WDT=y + +CONFIG_STAGING=y + +#Ethernet +CONFIG_OCTEON_ETHERNET=y +CONFIG_OCTEON_MGMT_ETHERNET=y +CONFIG_MDIO_OCTEON=y + +#PHY +CONFIG_MARVELL_PHY=y +CONFIG_BROADCOM_PHY=y +CONFIG_BCM87XX_PHY=y + + +#USB +CONFIG_USB=y +CONFIG_OCTEON_USB=y +CONFIG_USB_OCTEON_EHCI=y +CONFIG_USB_OCTEON_OHCI=y +CONFIG_USB_OCTEON2_COMMON=y + +CONFIG_MTD=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_CMDLINE_PARTS=y + +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=2 +CONFIG_SERIAL_8250_RUNTIME_UARTS=2 +CONFIG_SERIAL_8250_DW=y + diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc new file mode 100644 index 0000000000..f39dc3edf1 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/files/machine.scc @@ -0,0 +1,8 @@ +# yocto-bsp-filename {{=machine}}.scc +kconf hardware {{=machine}}.cfg + +include cfg/usb-mass-storage.scc +include cfg/fs/vfat.scc + +kconf hardware {{=machine}}-user-config.cfg +include {{=machine}}-user-patches.scc diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall new file mode 100644 index 0000000000..a04e6c7852 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/kernel-list.noinstall @@ -0,0 +1,5 @@ +{{ if kernel_choice != "custom": }} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} + +{{ if kernel_choice != "custom" and use_default_kernel == "n": }} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend index 25c87a85ac..2fa6231cbf 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend new file mode 100644 index 0000000000..5f8db03c64 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-preempt-rt.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" +#SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" +#LINUX_VERSION = "3.14" diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend new file mode 100644 index 0000000000..c7e7989821 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend new file mode 100644 index 0000000000..a9ba0ae457 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_3.14.bbappend index 1e814c54d7..fb6cdef18b 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -7,10 +8,10 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} {{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} {{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" @@ -27,6 +28,6 @@ SRC_URI += "file://{{=machine}}-standard.scc \ # uncomment and replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "19f7e43b54aef08d58135ed2a897d77b624b320a" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "459165c1dd61c4e843c36e6a1abeb30949a20ba7" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file +SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "dbe5b52e93ff114b2c0f5da6f6af91f52c18f2b8" +SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "6eddbf47875ef48ddc5864957a7b63363100782b" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_3.19.bbappend new file mode 100644 index 0000000000..134aeecc51 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/mips64/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/edgerouter" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-standard.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/powerpc/conf/machine/machine.conf index 78fb5db22b..c94f7f9e3f 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} @@ -16,6 +17,9 @@ TARGET_FPU = "" {{ input type:"choice" val:"tune_ppce500v2" msg:"ppce500v2 tuning optimizations" }} {{ input type:"choice" val:"tune_ppce5500" msg:"ppce5500 tuning optimizations" }} {{ input type:"choice" val:"tune_ppce6500" msg:"ppce6500 tuning optimizations" }} +{{ input type:"choice" val:"tune_power5" msg:"power5 tuning optimizations" }} +{{ input type:"choice" val:"tune_power6" msg:"power6 tuning optimizations" }} +{{ input type:"choice" val:"tune_power7" msg:"power7 tuning optimizations" }} {{ if tunefile == "tune_ppc476": }} include conf/machine/include/tune-ppc476.inc {{ if tunefile == "tune_ppc603e": }} @@ -36,6 +40,12 @@ include conf/machine/include/tune-ppce500v2.inc include conf/machine/include/tune-ppce5500.inc {{ if tunefile == "tune_ppce6500": }} include conf/machine/include/tune-ppce6500.inc +{{ if tunefile == "tune_power5": }} +include conf/machine/include/tune-power5.inc +{{ if tunefile == "tune_power6": }} +include conf/machine/include/tune-power6.inc +{{ if tunefile == "tune_power7": }} +include conf/machine/include/tune-power7.inc KERNEL_IMAGETYPE = "uImage" @@ -64,7 +74,7 @@ XSERVER ?= "xserver-xorg \ xf86-input-evdev \ xf86-video-fbdev" -PREFERRED_VERSION_u-boot ?= "v2013.07%" +PREFERRED_VERSION_u-boot ?= "v2015.01%" {{ input type:"edit" name:"uboot_entrypoint" prio:"40" msg:"Please specify a value for UBOOT_ENTRYPOINT:" default:"0x00000000" }} UBOOT_ENTRYPOINT = "{{=uboot_entrypoint}}" @@ -72,3 +82,6 @@ UBOOT_ENTRYPOINT = "{{=uboot_entrypoint}}" KERNEL_DEVICETREE = "${S}/arch/powerpc/boot/dts/{{=kernel_devicetree}}" MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" + +IMAGE_FSTYPES ?= "jffs2 tar.bz2" +JFFS2_ERASEBLOCK = "0x4000" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-preempt-rt.scc index 1da7b0c892..40c9267831 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH powerpc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-standard.scc index 53a74a6ca2..7a1d35be1e 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH powerpc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-tiny.scc index 4ca6224774..1bf94b2d05 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH powerpc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..47489e44e9 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..582759e612 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..97f747fa07 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.cfg index 9f37d07553..5bfe1fe4b0 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.cfg .......................................................................... . WARNING . diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc index c9fd468180..7aac8b0801 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg include cfg/usb-mass-storage.scc diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 0000000000..2fa6231cbf --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -0,0 +1,26 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-standard.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " diff --git a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend index 08b1f88d1b..7a2544617f 100644 --- a/scripts/lib/bsp/substrate/target/arch/i386/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-preempt-rt.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" #SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.9" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index d221d5f2a4..471ccbcc3e 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend new file mode 100644 index 0000000000..4de82fad00 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_3.14.bbappend index aebda9b3a5..e688384020 100644 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_3.19.bbappend new file mode 100644 index 0000000000..ded9e85db5 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-standard.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend deleted file mode 100644 index bc6968d832..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" -#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.9" diff --git a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend deleted file mode 100644 index a61f5ccb80..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/powerpc/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "19f7e43b54aef08d58135ed2a897d77b624b320a" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "459165c1dd61c4e843c36e6a1abeb30949a20ba7" -#LINUX_VERSION = "3.10.9" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf index d53b6f57b7..67e1cbd997 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} @@ -26,6 +27,7 @@ PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa" {{ input type:"choice" val:"arm" msg:"ARM (32-bit)" }} {{ input type:"choice" val:"powerpc" msg:"PowerPC (32-bit)" }} {{ input type:"choice" val:"mips" msg:"MIPS (32-bit)" }} +{{ input type:"choice" val:"mips64" msg:"MIPS64 (64-bit)" }} {{ if qemuarch == "i386": }} require conf/machine/include/qemu.inc require conf/machine/include/tune-i586.inc @@ -42,6 +44,9 @@ require conf/machine/include/tune-ppc7400.inc {{ if qemuarch == "mips": }} require conf/machine/include/qemu.inc require conf/machine/include/tune-mips32.inc +{{ if qemuarch == "mips64": }} +require conf/machine/include/qemu.inc +require conf/machine/include/tune-mips64.inc {{ if qemuarch == "i386" or qemuarch == "x86_64": }} MACHINE_FEATURES += "x86" @@ -62,7 +67,7 @@ SERIAL_CONSOLE = "115200 ttyAMA0" KERNEL_IMAGETYPE = "vmlinux" SERIAL_CONSOLE = "115200 ttyS0" -{{ if qemuarch == "mips": }} +{{ if qemuarch == "mips" or qemuarch == "mips64": }} KERNEL_IMAGETYPE = "vmlinux" KERNEL_ALT_IMAGETYPE = "vmlinux.bin" SERIAL_CONSOLE = "115200 ttyS0" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/{{=machine}}/interfaces b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/machine/interfaces index 16967763e5..16967763e5 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/{{=machine}}/interfaces +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-core/init-ifupdown/init-ifupdown/machine/interfaces diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/xorg.conf b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf index 13519804bc..3bdde79e6f 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/xorg.conf +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf @@ -14,7 +14,7 @@ EndSection Section "InputDevice" Identifier "Configured Mouse" -{{ if qemuarch == "arm" or qemuarch == "powerpc" or qemuarch == "mips": }} +{{ if qemuarch == "arm" or qemuarch == "powerpc" or qemuarch == "mips" or qemuarch == "mips64": }} Driver "mouse" {{ if qemuarch == "i386" or qemuarch == "x86_64": }} Driver "vmmouse" @@ -36,7 +36,7 @@ EndSection Section "Device" Identifier "Graphics Controller" -{{ if qemuarch == "arm" or qemuarch == "powerpc" or qemuarch == "mips": }} +{{ if qemuarch == "arm" or qemuarch == "powerpc" or qemuarch == "mips" or qemuarch == "mips64": }} Driver "fbdev" {{ if qemuarch == "i386" or qemuarch == "x86_64": }} Driver "vmware" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..0fb5283a8d --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-preempt-rt.scc index af34437d0a..6aaffb8184 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH {{=qemuarch}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-standard.scc index 0e20023764..d2a03ec209 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH {{=qemuarch}} @@ -10,6 +11,8 @@ include bsp/arm-versatile-926ejs/arm-versatile-926ejs-standard include bsp/qemu-ppc32/qemu-ppc32-standard {{ if qemuarch == "mips": }} include bsp/mti-malta32/mti-malta32-be-standard +{{ if qemuarch == "mips64": }} +include bsp/mti-malta64/mti-malta64-be-standard {{ if need_new_kbranch == "y": }} branch {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-tiny.scc index 10c4dac44d..6c098fed21 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH {{=qemuarch}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..69efdcc759 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..582759e612 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..4c59daac46 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.cfg b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.cfg new file mode 100644 index 0000000000..d560784b56 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}.cfg
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc index f3739be1e6..8301e05f7d 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg kconf hardware {{=machine}}-user-config.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend index 392ace6694..be479bee67 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -18,10 +19,10 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ input type:"choicelist" name:"existing_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/qemuppc" }} {{ if need_new_kbranch == "y" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "n" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "y" and qemuarch == "x86_64": }} {{ input type:"choicelist" name:"new_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc-64" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc-64/base" }} @@ -35,6 +36,12 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "mips": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta32" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta64" }} + {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" @@ -47,9 +54,3 @@ SRC_URI += "file://{{=machine}}-standard.scc \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "b170394a475b96ecc92cbc9e4b002bed0a9f69c5" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "c2ed0f16fdec628242a682897d5d86df4547cf24" -#LINUX_VERSION = "3.10.35" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend index 73b6e34839..ce5e1a09b3 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -35,6 +36,12 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "mips": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} + {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" @@ -52,4 +59,4 @@ SRC_URI += "file://{{=machine}}-preempt-rt.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" #SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.35" +#LINUX_VERSION = "3.14" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.4.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index 013883ffeb..7879ce205c 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.4.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -35,6 +36,12 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "mips": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend index da4e61ef83..f7ef4bb4a1 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -35,6 +36,12 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "mips": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" @@ -50,6 +57,6 @@ SRC_URI += "file://{{=machine}}-tiny.scc \ # uncomment and replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" -#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.35" +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "0143c6ebb4a2d63b241df5f608b19f483f7eb9e0" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "8f55bee2403176a50cc0dd41811aa60fcf07243c" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_3.14.bbappend index 2cc9b87cf2..626019c40a 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -18,10 +19,10 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ input type:"choicelist" name:"existing_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/qemuppc" }} {{ if need_new_kbranch == "y" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "n" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "y" and qemuarch == "x86_64": }} {{ input type:"choicelist" name:"new_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc-64" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc-64/base" }} @@ -35,6 +36,12 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "mips": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta32" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta64" }} + {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_3.19.bbappend index 7599ecb0a5..b4798b7d69 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -18,10 +19,10 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ input type:"choicelist" name:"existing_kbranch" nameappend:"powerpc" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/qemuppc" }} {{ if need_new_kbranch == "y" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "n" and qemuarch == "i386": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc/base" }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc" }} {{ if need_new_kbranch == "y" and qemuarch == "x86_64": }} {{ input type:"choicelist" name:"new_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc-64" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc-64/base" }} @@ -29,11 +30,17 @@ COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" {{ if need_new_kbranch == "n" and qemuarch == "x86_64": }} {{ input type:"choicelist" name:"existing_kbranch" nameappend:"x86_64" gen:"bsp.kernel.all_branches" branches_base:"standard:standard/common-pc-64" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/common-pc-64/base" }} +{{ if need_new_kbranch == "n" and qemuarch == "mips": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta32" }} + +{{ if need_new_kbranch == "n" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta64" }} + {{ if need_new_kbranch == "y" and qemuarch == "mips": }} {{ input type:"choicelist" name:"new_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} -{{ if need_new_kbranch == "n" and qemuarch == "mips": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"mips" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/mti-malta32" }} +{{ if need_new_kbranch == "y" and qemuarch == "mips64": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"mips64" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} {{ if need_new_kbranch == "n": }} KBRANCH_{{=machine}} = "{{=existing_kbranch}}" @@ -47,3 +54,9 @@ SRC_URI += "file://{{=machine}}-standard.scc \ file://{{=machine}}-user-patches.scc \ file://{{=machine}}-user-features.scc \ " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "0143c6ebb4a2d63b241df5f608b19f483f7eb9e0" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "8f55bee2403176a50cc0dd41811aa60fcf07243c" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/qemu/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/conf/machine/{{=machine}}.conf b/scripts/lib/bsp/substrate/target/arch/x86_64/conf/machine/machine.conf index 0780af90da..e4b825104f 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/conf/machine/{{=machine}}.conf +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/conf/machine/machine.conf @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.conf #@TYPE: Machine #@NAME: {{=machine}} @@ -36,6 +37,8 @@ MACHINE_FEATURES += "wifi efi pcbios" {{ input type:"choice" val:"xserver_vesa" msg:"VESA xserver support" }} {{ input type:"choice" val:"xserver_i915" msg:"i915 xserver support" }} {{ input type:"choice" val:"xserver_i965" msg:"i965 xserver support" }} +{{ input type:"choice" val:"xserver_fbdev" msg:"fbdev xserver support" }} +{{ input type:"choice" val:"xserver_modesetting" msg:"modesetting xserver support" }} {{ if xserver == "y": }} XSERVER ?= "${XSERVER_X86_BASE} \ ${XSERVER_X86_EXT} \ @@ -45,12 +48,18 @@ XSERVER ?= "${XSERVER_X86_BASE} \ ${XSERVER_X86_I915} \ {{ if xserver == "y" and xserver_choice == "xserver_i965": }} ${XSERVER_X86_I965} \ +{{ if xserver == "y" and xserver_choice == "xserver_fbdev": }} + ${XSERVER_X86_FBDEV} \ +{{ if xserver == "y" and xserver_choice == "xserver_modesetting": }} + ${XSERVER_X86_MODESETTING} \ {{ if xserver == "y": }} " -MACHINE_EXTRA_RRECOMMENDS += "linux-firmware v86d" +MACHINE_EXTRA_RRECOMMENDS += "linux-firmware v86d eee-acpi-scripts" EXTRA_OECONF_append_pn-matchbox-panel-2 = " --with-battery=acpi" +GLIBC_ADDONS = "nptl" + {{ if xserver == "y" and xserver_choice == "xserver_vesa": }} APPEND += "video=vesafb vga=0x318" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall new file mode 100644 index 0000000000..b442d02d57 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{=machine}} diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf new file mode 100644 index 0000000000..ac9a0f1bb0 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/machine/xorg.conf @@ -0,0 +1 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config/{{=machine}}/{{ if xserver == "y": }} xorg.conf +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend new file mode 100644 index 0000000000..30830031ed --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend @@ -0,0 +1,2 @@ +# yocto-bsp-filename {{ if xserver == "y": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend deleted file mode 100644 index 72d991c7e5..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-graphics/xorg-xserver/{{ if xserver == "y": }} xserver-xf86-config_0.1.bbappend +++ /dev/null @@ -1 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files.noinstall b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files.noinstall new file mode 100644 index 0000000000..1e0d92c55c --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files.noinstall @@ -0,0 +1 @@ +# yocto-bsp-dirname {{ if kernel_choice != "custom": }} files diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-preempt-rt.scc index c9882590a8..fd5320ba1e 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-preempt-rt.scc +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-preempt-rt.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-preempt-rt.scc define KMACHINE {{=machine}} define KTYPE preempt-rt define KARCH x86_64 diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-standard.scc index e500bad4b2..569f967c6a 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-standard.scc +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-standard.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-standard.scc define KMACHINE {{=machine}} define KTYPE standard define KARCH x86_64 diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-tiny.scc index e8e3c1c04d..fb21432a4f 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-tiny.scc +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-tiny.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}-tiny.scc define KMACHINE {{=machine}} define KTYPE tiny define KARCH x86_64 diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-config.cfg new file mode 100644 index 0000000000..47489e44e9 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-config.cfg @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-config.cfg diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-features.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-features.scc new file mode 100644 index 0000000000..582759e612 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-features.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-features.scc diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-patches.scc new file mode 100644 index 0000000000..97f747fa07 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine-user-patches.scc @@ -0,0 +1 @@ +# yocto-bsp-filename {{=machine}}-user-patches.scc diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.cfg index b4b82d7ca0..3290ddefe7 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.cfg +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.cfg @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.cfg CONFIG_PRINTK=y # Basic hardware support for the box - network, USB, PCI, sound diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc index db45140381..9b7c291a8f 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}.scc +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/files/machine.scc @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{=machine}}.scc kconf hardware {{=machine}}.cfg include features/serial/8250.scc diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall index a04e6c7852..811d695478 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/kernel-list.noinstall @@ -1,5 +1,5 @@ {{ if kernel_choice != "custom": }} -{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.14) kernel? (y/n)" default:"y"}} +{{ input type:"boolean" name:"use_default_kernel" prio:"10" msg:"Would you like to use the default (3.19) kernel? (y/n)" default:"y"}} {{ if kernel_choice != "custom" and use_default_kernel == "n": }} -{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.14"}} +{{ input type:"choicelist" name:"kernel_choice" gen:"bsp.kernel.kernels" prio:"10" msg:"Please choose the kernel to use in this BSP:" default:"linux-yocto_3.19"}} diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend new file mode 100644 index 0000000000..2fa6231cbf --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -0,0 +1,26 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-dev": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-standard.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend index 08b1f88d1b..7a2544617f 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-rt_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -29,4 +30,4 @@ SRC_URI += "file://{{=machine}}-preempt-rt.scc \ # the appropriate changes committed to the upstream linux-yocto repo #SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" #SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.9" +#LINUX_VERSION = "3.14"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend index d221d5f2a4..471ccbcc3e 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.14": }} linux-yocto-tiny_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend new file mode 100644 index 0000000000..4de82fad00 --- /dev/null +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto-tiny_3.19.bbappend @@ -0,0 +1,33 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto-tiny_3.19": }} this +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +PR := "${PR}.1" + +COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" + +{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} + +{{ if need_new_kbranch == "y": }} +{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} + +{{ if need_new_kbranch == "n": }} +KBRANCH_{{=machine}} = "{{=existing_kbranch}}" + +{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} +{{ if smp == "y": }} +KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" + +SRC_URI += "file://{{=machine}}-tiny.scc \ + file://{{=machine}}-user-config.cfg \ + file://{{=machine}}-user-patches.scc \ + file://{{=machine}}-user-features.scc \ + " + +# uncomment and replace these SRCREVs with the real commit ids once you've had +# the appropriate changes committed to the upstream linux-yocto repo +#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_3.14.bbappend index 81e528bc33..ca0b497ff4 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.14": }} linux-yocto_3.14.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_3.14.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.14": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_3.19.bbappend index 162348114f..dba63c3df5 100644 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto_3.10": }} linux-yocto_3.10.bbappend +++ b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/linux-yocto_3.19.bbappend @@ -1,3 +1,4 @@ +# yocto-bsp-filename {{ if kernel_choice == "linux-yocto_3.19": }} this FILESEXTRAPATHS_prepend := "${THISDIR}/files:" PR := "${PR}.1" @@ -27,6 +28,6 @@ SRC_URI += "file://{{=machine}}-standard.scc \ # uncomment and replace these SRCREVs with the real commit ids once you've had # the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "b170394a475b96ecc92cbc9e4b002bed0a9f69c5" -#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "c2ed0f16fdec628242a682897d5d86df4547cf24" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file +#SRCREV_machine_pn-linux-yocto_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" +#SRCREV_meta_pn-linux-yocto_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" +#LINUX_VERSION = "3.19" diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-config.cfg +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc deleted file mode 100644 index e69de29bb2..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-patches.scc +++ /dev/null diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend deleted file mode 100644 index 25c87a85ac..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-dev": }} linux-yocto-dev.bbappend +++ /dev/null @@ -1,25 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" nameappend:"i386" gen:"bsp.kernel.all_branches" branches_base:"standard" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Would you like SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-standard.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend deleted file mode 100644 index 00c8c68933..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-rt_3.10": }} linux-yocto-rt_3.10.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/preempt-rt" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/preempt-rt/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-preempt-rt.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-rt_{{=machine}} ?= "f35992f80c81dc5fa1a97165dfd5cbb84661f7cb" -#SRCREV_meta_pn-linux-yocto-rt_{{=machine}} ?= "1b534b2f8bbe9b8a773268cfa30a4850346f6f5f" -#LINUX_VERSION = "3.10.9"
\ No newline at end of file diff --git a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend b/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend deleted file mode 100644 index bc6968d832..0000000000 --- a/scripts/lib/bsp/substrate/target/arch/x86_64/recipes-kernel/linux/{{ if kernel_choice == "linux-yocto-tiny_3.10": }} linux-yocto-tiny_3.10.bbappend +++ /dev/null @@ -1,32 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -PR := "${PR}.1" - -COMPATIBLE_MACHINE_{{=machine}} = "{{=machine}}" - -{{ input type:"boolean" name:"need_new_kbranch" prio:"20" msg:"Do you need a new machine branch for this BSP (the alternative is to re-use an existing branch)? [y/n]" default:"y" }} - -{{ if need_new_kbranch == "y": }} -{{ input type:"choicelist" name:"new_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -{{ input type:"choicelist" name:"existing_kbranch" gen:"bsp.kernel.all_branches" branches_base:"standard/tiny" prio:"20" msg:"Please choose a machine branch to base this BSP on:" default:"standard/tiny/base" }} - -{{ if need_new_kbranch == "n": }} -KBRANCH_{{=machine}} = "{{=existing_kbranch}}" - -{{ input type:"boolean" name:"smp" prio:"30" msg:"Do you need SMP support? (y/n)" default:"y"}} -{{ if smp == "y": }} -KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc" - -SRC_URI += "file://{{=machine}}-tiny.scc \ - file://{{=machine}}-user-config.cfg \ - file://{{=machine}}-user-patches.scc \ - file://{{=machine}}-user-features.scc \ - " - -# uncomment and replace these SRCREVs with the real commit ids once you've had -# the appropriate changes committed to the upstream linux-yocto repo -#SRCREV_machine_pn-linux-yocto-tiny_{{=machine}} ?= "840bb8c059418c4753415df56c9aff1c0d5354c8" -#SRCREV_meta_pn-linux-yocto-tiny_{{=machine}} ?= "4fd76cc4f33e0afd8f906b1e8f231b6d13b6c993" -#LINUX_VERSION = "3.10.9" diff --git a/scripts/lib/bsp/tags.py b/scripts/lib/bsp/tags.py index 6d5feb0a59..3719427884 100644 --- a/scripts/lib/bsp/tags.py +++ b/scripts/lib/bsp/tags.py @@ -25,11 +25,13 @@ # Tom Zanussi <tom.zanussi (at] intel.com> # -OPEN_TAG = "{{" -CLOSE_TAG = "}}" -ASSIGN_TAG = "{{=" -INPUT_TAG = "input" -IF_TAG = "if" +OPEN_TAG = "{{" +CLOSE_TAG = "}}" +ASSIGN_TAG = "{{=" +INPUT_TAG = "input" +IF_TAG = "if" +FILENAME_TAG = "yocto-bsp-filename" +DIRNAME_TAG = "yocto-bsp-dirname" INDENT_STR = " " diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py new file mode 100644 index 0000000000..3f8158e24a --- /dev/null +++ b/scripts/lib/devtool/__init__.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +# Development tool - utility functions for plugins +# +# Copyright (C) 2014 Intel Corporation +# +# 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 +import sys +import subprocess +import logging + +logger = logging.getLogger('devtool') + +def exec_build_env_command(init_path, builddir, cmd, watch=False, **options): + import bb + if not 'cwd' in options: + options["cwd"] = builddir + if init_path: + logger.debug('Executing command: "%s" using init path %s' % (cmd, init_path)) + init_prefix = '. %s %s > /dev/null && ' % (init_path, builddir) + else: + logger.debug('Executing command "%s"' % cmd) + init_prefix = '' + if watch: + if sys.stdout.isatty(): + # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly) + cmd = 'script -q -c "%s" /dev/null' % cmd + return exec_watch('%s%s' % (init_prefix, cmd), **options) + else: + return bb.process.run('%s%s' % (init_prefix, cmd), **options) + +def exec_watch(cmd, **options): + if isinstance(cmd, basestring) and not "shell" in options: + options["shell"] = True + + process = subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **options + ) + + buf = '' + while True: + out = process.stdout.read(1) + if out: + sys.stdout.write(out) + sys.stdout.flush() + buf += out + elif out == '' and process.poll() != None: + break + return buf + +def setup_tinfoil(): + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + + import bb.tinfoil + import logging + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare(False) + tinfoil.logger.setLevel(logging.WARNING) + return tinfoil + diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py new file mode 100644 index 0000000000..f016b23dba --- /dev/null +++ b/scripts/lib/devtool/deploy.py @@ -0,0 +1,140 @@ +# Development tool - deploy/undeploy command plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# 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 +import subprocess +import logging +from devtool import exec_build_env_command + +logger = logging.getLogger('devtool') + +def plugin_init(pluginlist): + pass + + +def deploy(args, config, basepath, workspace): + import re + from devtool import exec_build_env_command + + if not args.recipename in workspace: + logger.error("no recipe named %s in your workspace" % args.recipename) + return -1 + try: + host, destdir = args.target.split(':') + except ValueError: + destdir = '/' + else: + args.target = host + + deploy_dir = os.path.join(basepath, 'target_deploy', args.target) + deploy_file = os.path.join(deploy_dir, args.recipename + '.list') + + stdout, stderr = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True) + recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1) + if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): + logger.error('No files to deploy - have you built the %s recipe? If so, the install step has not installed any files.' % args.recipename) + return -1 + + if args.dry_run: + print('Files to be deployed for %s on target %s:' % (args.recipename, args.target)) + for root, dirs, files in os.walk(recipe_outdir): + for fn in files: + print(' %s' % os.path.join(destdir, os.path.relpath(root, recipe_outdir), fn)) + return 0 + + if os.path.exists(deploy_file): + if undeploy(args, config, basepath, workspace): + # Error already shown + return -1 + + extraoptions = '' + if args.no_host_check: + extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + if not args.show_status: + extraoptions += ' -q' + ret = subprocess.call('scp -r %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True) + if ret != 0: + logger.error('Deploy failed - rerun with -s to get a complete error message') + return ret + + logger.info('Successfully deployed %s' % recipe_outdir) + + if not os.path.exists(deploy_dir): + os.makedirs(deploy_dir) + + files_list = [] + for root, _, files in os.walk(recipe_outdir): + for filename in files: + filename = os.path.relpath(os.path.join(root, filename), recipe_outdir) + files_list.append(os.path.join(destdir, filename)) + + with open(deploy_file, 'w') as fobj: + fobj.write('\n'.join(files_list)) + + return 0 + +def undeploy(args, config, basepath, workspace): + + deploy_file = os.path.join(basepath, 'target_deploy', args.target, args.recipename + '.list') + if not os.path.exists(deploy_file): + logger.error('%s has not been deployed' % args.recipename) + return -1 + + if args.dry_run: + print('Previously deployed files to be un-deployed for %s on target %s:' % (args.recipename, args.target)) + with open(deploy_file, 'r') as f: + for line in f: + print(' %s' % line.rstrip()) + return 0 + + extraoptions = '' + if args.no_host_check: + extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + if not args.show_status: + extraoptions += ' -q' + + ret = subprocess.call("scp %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True) + if ret != 0: + logger.error('Failed to copy file list to %s - rerun with -s to get a complete error message' % args.target) + return -1 + + ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) + if ret == 0: + logger.info('Successfully undeployed %s' % args.recipename) + os.remove(deploy_file) + else: + logger.error('Undeploy failed - rerun with -s to get a complete error message') + + return ret + + +def register_commands(subparsers, context): + parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine') + parser_deploy.add_argument('recipename', help='Recipe to deploy') + parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') + parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') + parser_deploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true') + parser_deploy.add_argument('-n', '--dry-run', help='List files to be deployed only', action='store_true') + parser_deploy.set_defaults(func=deploy) + + parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine') + parser_undeploy.add_argument('recipename', help='Recipe to undeploy') + parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') + parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') + parser_undeploy.add_argument('-s', '--show-status', help='Show progress/status output', action='store_true') + parser_undeploy.add_argument('-n', '--dry-run', help='List files to be undeployed only', action='store_true') + parser_undeploy.set_defaults(func=undeploy) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py new file mode 100644 index 0000000000..54920b26f8 --- /dev/null +++ b/scripts/lib/devtool/standard.py @@ -0,0 +1,697 @@ +# Development tool - standard commands plugin +# +# Copyright (C) 2014-2015 Intel Corporation +# +# 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 +import sys +import re +import shutil +import glob +import tempfile +import logging +import argparse +from devtool import exec_build_env_command, setup_tinfoil + +logger = logging.getLogger('devtool') + +def plugin_init(pluginlist): + pass + + +def add(args, config, basepath, workspace): + import bb + import oe.recipeutils + + if args.recipename in workspace: + logger.error("recipe %s is already in your workspace" % args.recipename) + return -1 + + reason = oe.recipeutils.validate_pn(args.recipename) + if reason: + logger.error(reason) + return -1 + + srctree = os.path.abspath(args.srctree) + appendpath = os.path.join(config.workspace_path, 'appends') + if not os.path.exists(appendpath): + os.makedirs(appendpath) + + recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename) + bb.utils.mkdirhier(recipedir) + if args.version: + if '_' in args.version or ' ' in args.version: + logger.error('Invalid version string "%s"' % args.version) + return -1 + bp = "%s_%s" % (args.recipename, args.version) + else: + bp = args.recipename + recipefile = os.path.join(recipedir, "%s.bb" % bp) + if sys.stdout.isatty(): + color = 'always' + else: + color = args.color + stdout, stderr = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create -o %s %s' % (color, recipefile, srctree)) + logger.info('Recipe %s has been automatically created; further editing may be required to make it fully functional' % recipefile) + + _add_md5(config, args.recipename, recipefile) + + initial_rev = None + if os.path.exists(os.path.join(srctree, '.git')): + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) + initial_rev = stdout.rstrip() + + appendfile = os.path.join(appendpath, '%s.bbappend' % args.recipename) + with open(appendfile, 'w') as f: + f.write('inherit externalsrc\n') + f.write('EXTERNALSRC = "%s"\n' % srctree) + if args.same_dir: + f.write('EXTERNALSRC_BUILD = "%s"\n' % srctree) + if initial_rev: + f.write('\n# initial_rev: %s\n' % initial_rev) + + _add_md5(config, args.recipename, appendfile) + + return 0 + + +def _check_compatible_recipe(pn, d): + if pn == 'perf': + logger.error("The perf recipe does not actually check out source and thus cannot be supported by this tool") + return False + + if pn in ['gcc-source', 'kernel-devsrc', 'package-index']: + logger.error("The %s recipe is not supported by this tool" % pn) + return False + + if bb.data.inherits_class('image', d): + logger.error("The %s recipe is an image, and therefore is not supported by this tool" % pn) + return False + + if bb.data.inherits_class('populate_sdk', d): + logger.error("The %s recipe is an SDK, and therefore is not supported by this tool" % pn) + return False + + if bb.data.inherits_class('packagegroup', d): + logger.error("The %s recipe is a packagegroup, and therefore is not supported by this tool" % pn) + return False + + if bb.data.inherits_class('meta', d): + logger.error("The %s recipe is a meta-recipe, and therefore is not supported by this tool" % pn) + return False + + if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): + logger.error("externalsrc is currently enabled for the %s recipe. This prevents the normal do_patch task from working. You will need to disable this first." % pn) + return False + + return True + + +def _get_recipe_file(cooker, pn): + import oe.recipeutils + recipefile = oe.recipeutils.pn_to_recipe(cooker, pn) + if not recipefile: + skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn) + if skipreasons: + logger.error('\n'.join(skipreasons)) + else: + logger.error("Unable to find any recipe file matching %s" % pn) + return recipefile + + +def extract(args, config, basepath, workspace): + import bb + import oe.recipeutils + + tinfoil = setup_tinfoil() + + recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) + if not recipefile: + # Error already logged + return -1 + rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + + srctree = os.path.abspath(args.srctree) + initial_rev = _extract_source(srctree, args.keep_temp, args.branch, rd) + if initial_rev: + return 0 + else: + return -1 + + +def _extract_source(srctree, keep_temp, devbranch, d): + import bb.event + + def eventfilter(name, handler, event, d): + if name == 'base_eventhandler': + return True + else: + return False + + if hasattr(bb.event, 'set_eventfilter'): + bb.event.set_eventfilter(eventfilter) + + pn = d.getVar('PN', True) + + if not _check_compatible_recipe(pn, d): + return None + + if os.path.exists(srctree): + if not os.path.isdir(srctree): + logger.error("output path %s exists and is not a directory" % srctree) + return None + elif os.listdir(srctree): + logger.error("output path %s already exists and is non-empty" % srctree) + return None + + # Prepare for shutil.move later on + bb.utils.mkdirhier(srctree) + os.rmdir(srctree) + + initial_rev = None + tempdir = tempfile.mkdtemp(prefix='devtool') + try: + crd = d.createCopy() + # Make a subdir so we guard against WORKDIR==S + workdir = os.path.join(tempdir, 'workdir') + crd.setVar('WORKDIR', workdir) + crd.setVar('T', os.path.join(tempdir, 'temp')) + if not crd.getVar('S', True).startswith(workdir): + # Usually a shared workdir recipe (kernel, gcc) + # Try to set a reasonable default + if bb.data.inherits_class('kernel', d): + crd.setVar('S', '${WORKDIR}/source') + else: + crd.setVar('S', '${WORKDIR}/${BP}') + if bb.data.inherits_class('kernel', d): + # We don't want to move the source to STAGING_KERNEL_DIR here + crd.setVar('STAGING_KERNEL_DIR', '${S}') + + # FIXME: This is very awkward. Unfortunately it's not currently easy to properly + # execute tasks outside of bitbake itself, until then this has to suffice if we + # are to handle e.g. linux-yocto's extra tasks + executed = [] + def exec_task_func(func, report): + if not func in executed: + deps = crd.getVarFlag(func, 'deps') + if deps: + for taskdepfunc in deps: + exec_task_func(taskdepfunc, True) + if report: + logger.info('Executing %s...' % func) + fn = d.getVar('FILE', True) + localdata = bb.build._task_data(fn, func, crd) + bb.build.exec_func(func, localdata) + executed.append(func) + + logger.info('Fetching %s...' % pn) + exec_task_func('do_fetch', False) + logger.info('Unpacking...') + exec_task_func('do_unpack', False) + srcsubdir = crd.getVar('S', True) + if srcsubdir != workdir and os.path.dirname(srcsubdir) != workdir: + # Handle if S is set to a subdirectory of the source + srcsubdir = os.path.join(workdir, os.path.relpath(srcsubdir, workdir).split(os.sep)[0]) + + if os.path.exists(os.path.join(srcsubdir, '.git')): + alternatesfile = os.path.join(srcsubdir, '.git', 'objects', 'info', 'alternates') + if os.path.exists(alternatesfile): + # This will have been cloned with -s, so we need to convert it to a full clone + bb.process.run('git repack -a', cwd=srcsubdir) + os.remove(alternatesfile) + + patchdir = os.path.join(srcsubdir, 'patches') + haspatches = False + if os.path.exists(patchdir): + if os.listdir(patchdir): + haspatches = True + else: + os.rmdir(patchdir) + + if bb.data.inherits_class('kernel-yocto', d): + (stdout, _) = bb.process.run('git --git-dir="%s" rev-parse HEAD' % crd.expand('${WORKDIR}/git'), cwd=srcsubdir) + initial_rev = stdout.rstrip() + else: + if not os.listdir(srcsubdir): + logger.error("no source unpacked to S, perhaps the %s recipe doesn't use any source?" % pn) + return None + + if not os.path.exists(os.path.join(srcsubdir, '.git')): + bb.process.run('git init', cwd=srcsubdir) + bb.process.run('git add .', cwd=srcsubdir) + bb.process.run('git commit -q -m "Initial commit from upstream at version %s"' % crd.getVar('PV', True), cwd=srcsubdir) + + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) + initial_rev = stdout.rstrip() + + bb.process.run('git checkout -b %s' % devbranch, cwd=srcsubdir) + bb.process.run('git tag -f devtool-base', cwd=srcsubdir) + + crd.setVar('PATCHTOOL', 'git') + + logger.info('Patching...') + exec_task_func('do_patch', False) + + bb.process.run('git tag -f devtool-patched', cwd=srcsubdir) + + if os.path.exists(patchdir): + shutil.rmtree(patchdir) + if haspatches: + bb.process.run('git checkout patches', cwd=srcsubdir) + + shutil.move(srcsubdir, srctree) + logger.info('Source tree extracted to %s' % srctree) + finally: + if keep_temp: + logger.info('Preserving temporary directory %s' % tempdir) + else: + shutil.rmtree(tempdir) + return initial_rev + +def _add_md5(config, recipename, filename): + import bb.utils + md5 = bb.utils.md5_file(filename) + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: + f.write('%s|%s|%s\n' % (recipename, os.path.relpath(filename, config.workspace_path), md5)) + +def _check_preserve(config, recipename): + import bb.utils + origfile = os.path.join(config.workspace_path, '.devtool_md5') + newfile = os.path.join(config.workspace_path, '.devtool_md5_new') + preservepath = os.path.join(config.workspace_path, 'attic') + with open(origfile, 'r') as f: + with open(newfile, 'w') as tf: + for line in f.readlines(): + splitline = line.rstrip().split('|') + if splitline[0] == recipename: + removefile = os.path.join(config.workspace_path, splitline[1]) + md5 = bb.utils.md5_file(removefile) + if splitline[2] != md5: + bb.utils.mkdirhier(preservepath) + preservefile = os.path.basename(removefile) + logger.warn('File %s modified since it was written, preserving in %s' % (preservefile, preservepath)) + shutil.move(removefile, os.path.join(preservepath, preservefile)) + else: + os.remove(removefile) + else: + tf.write(line) + os.rename(newfile, origfile) + + return False + + +def modify(args, config, basepath, workspace): + import bb + import oe.recipeutils + + if args.recipename in workspace: + logger.error("recipe %s is already in your workspace" % args.recipename) + return -1 + + if not args.extract: + if not os.path.isdir(args.srctree): + logger.error("directory %s does not exist or not a directory (specify -x to extract source from recipe)" % args.srctree) + return -1 + + tinfoil = setup_tinfoil() + + recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) + if not recipefile: + # Error already logged + return -1 + rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + + if not _check_compatible_recipe(args.recipename, rd): + return -1 + + initial_rev = None + commits = [] + srctree = os.path.abspath(args.srctree) + if args.extract: + initial_rev = _extract_source(args.srctree, False, args.branch, rd) + if not initial_rev: + return -1 + # Get list of commits since this revision + (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=args.srctree) + commits = stdout.split() + else: + if os.path.exists(os.path.join(args.srctree, '.git')): + # Check if it's a tree previously extracted by us + try: + (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=args.srctree) + except bb.process.ExecutionError: + stdout = '' + for line in stdout.splitlines(): + if line.startswith('*'): + (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=args.srctree) + initial_rev = stdout.rstrip() + if not initial_rev: + # Otherwise, just grab the head revision + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=args.srctree) + initial_rev = stdout.rstrip() + + # Check that recipe isn't using a shared workdir + s = rd.getVar('S', True) + workdir = rd.getVar('WORKDIR', True) + if s.startswith(workdir): + # Handle if S is set to a subdirectory of the source + if s != workdir and os.path.dirname(s) != workdir: + srcsubdir = os.sep.join(os.path.relpath(s, workdir).split(os.sep)[1:]) + srctree = os.path.join(srctree, srcsubdir) + + appendpath = os.path.join(config.workspace_path, 'appends') + if not os.path.exists(appendpath): + os.makedirs(appendpath) + + appendname = os.path.splitext(os.path.basename(recipefile))[0] + if args.wildcard: + appendname = re.sub(r'_.*', '_%', appendname) + appendfile = os.path.join(appendpath, appendname + '.bbappend') + with open(appendfile, 'w') as f: + f.write('FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n\n') + f.write('inherit externalsrc\n') + f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where the recipe uses BBCLASSEXTEND\n') + f.write('EXTERNALSRC_pn-%s = "%s"\n' % (args.recipename, srctree)) + if args.same_dir or bb.data.inherits_class('autotools-brokensep', rd): + if args.same_dir: + logger.info('using source tree as build directory since --same-dir specified') + else: + logger.info('using source tree as build directory since original recipe inherits autotools-brokensep') + f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (args.recipename, srctree)) + if initial_rev: + f.write('\n# initial_rev: %s\n' % initial_rev) + for commit in commits: + f.write('# commit: %s\n' % commit) + + _add_md5(config, args.recipename, appendfile) + + logger.info('Recipe %s now set up to build from %s' % (args.recipename, srctree)) + + return 0 + + +def update_recipe(args, config, basepath, workspace): + if not args.recipename in workspace: + logger.error("no recipe named %s in your workspace" % args.recipename) + return -1 + + # Get initial revision from bbappend + appends = glob.glob(os.path.join(config.workspace_path, 'appends', '%s_*.bbappend' % args.recipename)) + if not appends: + logger.error('unable to find workspace bbappend for recipe %s' % args.recipename) + return -1 + + tinfoil = setup_tinfoil() + import bb + from oe.patch import GitApplyTree + import oe.recipeutils + + recipefile = _get_recipe_file(tinfoil.cooker, args.recipename) + if not recipefile: + # Error already logged + return -1 + rd = oe.recipeutils.parse_recipe(recipefile, tinfoil.config_data) + + orig_src_uri = rd.getVar('SRC_URI', False) or '' + if args.mode == 'auto': + if 'git://' in orig_src_uri: + mode = 'srcrev' + else: + mode = 'patch' + else: + mode = args.mode + + def remove_patches(srcuri, patchlist): + # Remove any patches that we don't need + updated = False + for patch in patchlist: + patchfile = os.path.basename(patch) + for i in xrange(len(srcuri)): + if srcuri[i].startswith('file://') and os.path.basename(srcuri[i]).split(';')[0] == patchfile: + logger.info('Removing patch %s' % patchfile) + srcuri.pop(i) + # FIXME "git rm" here would be nice if the file in question is tracked + # FIXME there's a chance that this file is referred to by another recipe, in which case deleting wouldn't be the right thing to do + if patch.startswith(os.path.dirname(recipefile)): + os.remove(patch) + updated = True + break + return updated + + srctree = workspace[args.recipename] + if mode == 'srcrev': + (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) + srcrev = stdout.strip() + if len(srcrev) != 40: + logger.error('Invalid hash returned by git: %s' % stdout) + return 1 + + logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) + patchfields = {} + patchfields['SRCREV'] = srcrev + if not args.no_remove: + # Find list of existing patches in recipe file + existing_patches = oe.recipeutils.get_recipe_patches(rd) + + old_srcrev = (rd.getVar('SRCREV', False) or '') + tempdir = tempfile.mkdtemp(prefix='devtool') + removepatches = [] + try: + GitApplyTree.extractPatches(srctree, old_srcrev, tempdir) + newpatches = os.listdir(tempdir) + for patch in existing_patches: + patchfile = os.path.basename(patch) + if patchfile in newpatches: + removepatches.append(patch) + finally: + shutil.rmtree(tempdir) + if removepatches: + srcuri = (rd.getVar('SRC_URI', False) or '').split() + if remove_patches(srcuri, removepatches): + patchfields['SRC_URI'] = ' '.join(srcuri) + + oe.recipeutils.patch_recipe(rd, recipefile, patchfields) + + if not 'git://' in orig_src_uri: + logger.info('You will need to update SRC_URI within the recipe to point to a git repository where you have pushed your changes') + + elif mode == 'patch': + commits = [] + update_rev = None + if args.initial_rev: + initial_rev = args.initial_rev + else: + initial_rev = None + with open(appends[0], 'r') as f: + for line in f: + if line.startswith('# initial_rev:'): + initial_rev = line.split(':')[-1].strip() + elif line.startswith('# commit:'): + commits.append(line.split(':')[-1].strip()) + + if initial_rev: + # Find first actually changed revision + (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree) + newcommits = stdout.split() + for i in xrange(min(len(commits), len(newcommits))): + if newcommits[i] == commits[i]: + update_rev = commits[i] + + if not initial_rev: + logger.error('Unable to find initial revision - please specify it with --initial-rev') + return -1 + + if not update_rev: + update_rev = initial_rev + + # Find list of existing patches in recipe file + existing_patches = oe.recipeutils.get_recipe_patches(rd) + + removepatches = [] + if not args.no_remove: + # Get all patches from source tree and check if any should be removed + tempdir = tempfile.mkdtemp(prefix='devtool') + try: + GitApplyTree.extractPatches(srctree, initial_rev, tempdir) + newpatches = os.listdir(tempdir) + for patch in existing_patches: + patchfile = os.path.basename(patch) + if patchfile not in newpatches: + removepatches.append(patch) + finally: + shutil.rmtree(tempdir) + + # Get updated patches from source tree + tempdir = tempfile.mkdtemp(prefix='devtool') + try: + GitApplyTree.extractPatches(srctree, update_rev, tempdir) + + # Match up and replace existing patches with corresponding new patches + updatepatches = False + updaterecipe = False + newpatches = os.listdir(tempdir) + for patch in existing_patches: + patchfile = os.path.basename(patch) + if patchfile in newpatches: + logger.info('Updating patch %s' % patchfile) + shutil.move(os.path.join(tempdir, patchfile), patch) + newpatches.remove(patchfile) + updatepatches = True + srcuri = (rd.getVar('SRC_URI', False) or '').split() + if newpatches: + # Add any patches left over + patchdir = os.path.join(os.path.dirname(recipefile), rd.getVar('BPN', True)) + bb.utils.mkdirhier(patchdir) + for patchfile in newpatches: + logger.info('Adding new patch %s' % patchfile) + shutil.move(os.path.join(tempdir, patchfile), os.path.join(patchdir, patchfile)) + srcuri.append('file://%s' % patchfile) + updaterecipe = True + if removepatches: + if remove_patches(srcuri, removepatches): + updaterecipe = True + if updaterecipe: + logger.info('Updating recipe %s' % os.path.basename(recipefile)) + oe.recipeutils.patch_recipe(rd, recipefile, {'SRC_URI': ' '.join(srcuri)}) + elif not updatepatches: + # Neither patches nor recipe were updated + logger.info('No patches need updating') + finally: + shutil.rmtree(tempdir) + + else: + logger.error('update_recipe: invalid mode %s' % mode) + return 1 + + return 0 + + +def status(args, config, basepath, workspace): + if workspace: + for recipe, value in workspace.iteritems(): + print("%s: %s" % (recipe, value)) + else: + logger.info('No recipes currently in your workspace - you can use "devtool modify" to work on an existing recipe or "devtool add" to add a new one') + return 0 + + +def reset(args, config, basepath, workspace): + import bb.utils + if args.recipename: + if args.all: + logger.error("Recipe cannot be specified if -a/--all is used") + return -1 + elif not args.recipename in workspace: + logger.error("no recipe named %s in your workspace" % args.recipename) + return -1 + elif not args.all: + logger.error("Recipe must be specified, or specify -a/--all to reset all recipes") + return -1 + + if args.all: + recipes = workspace + else: + recipes = [args.recipename] + + for pn in recipes: + if not args.no_clean: + logger.info('Cleaning sysroot for recipe %s...' % pn) + exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % pn) + + _check_preserve(config, pn) + + preservepath = os.path.join(config.workspace_path, 'attic', pn) + def preservedir(origdir): + if os.path.exists(origdir): + for fn in os.listdir(origdir): + logger.warn('Preserving %s in %s' % (fn, preservepath)) + bb.utils.mkdirhier(preservepath) + shutil.move(os.path.join(origdir, fn), os.path.join(preservepath, fn)) + os.rmdir(origdir) + + preservedir(os.path.join(config.workspace_path, 'recipes', pn)) + # We don't automatically create this dir next to appends, but the user can + preservedir(os.path.join(config.workspace_path, 'appends', pn)) + + return 0 + + +def build(args, config, basepath, workspace): + import bb + if not args.recipename in workspace: + logger.error("no recipe named %s in your workspace" % args.recipename) + return -1 + build_task = config.get('Build', 'build_task', 'populate_sysroot') + exec_build_env_command(config.init_path, basepath, 'bitbake -c %s %s' % (build_task, args.recipename), watch=True) + + return 0 + + +def register_commands(subparsers, context): + parser_add = subparsers.add_parser('add', help='Add a new recipe', + description='Adds a new recipe', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_add.add_argument('recipename', help='Name for new recipe to add') + parser_add.add_argument('srctree', help='Path to external source tree') + parser_add.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)') + parser_add.set_defaults(func=add) + + parser_modify = subparsers.add_parser('modify', help='Modify the source for an existing recipe', + description='Enables modifying the source for an existing recipe', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_modify.add_argument('recipename', help='Name for recipe to edit') + parser_modify.add_argument('srctree', help='Path to external source tree') + parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversioned bbappend') + parser_modify.add_argument('--extract', '-x', action="store_true", help='Extract source as well') + parser_modify.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_true") + parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (only when using -x)') + parser_modify.set_defaults(func=modify) + + parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', + description='Extracts the source for an existing recipe', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_extract.add_argument('recipename', help='Name for recipe to extract the source for') + parser_extract.add_argument('srctree', help='Path to where to extract the source tree') + parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout') + parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') + parser_extract.set_defaults(func=extract) + + parser_update_recipe = subparsers.add_parser('update-recipe', help='Apply changes from external source tree to recipe', + description='Applies changes from external source tree to a recipe (updating/adding/removing patches as necessary, or by updating SRCREV)') + parser_update_recipe.add_argument('recipename', help='Name of recipe to update') + parser_update_recipe.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', help='Update mode (where %(metavar)s is %(choices)s; default is %(default)s)', metavar='MODE') + parser_update_recipe.add_argument('--initial-rev', help='Starting revision for patches') + parser_update_recipe.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove patches, only add or update') + parser_update_recipe.set_defaults(func=update_recipe) + + parser_status = subparsers.add_parser('status', help='Show workspace status', + description='Lists recipes currently in your workspace and the paths to their respective external source trees', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_status.set_defaults(func=status) + + parser_build = subparsers.add_parser('build', help='Build a recipe', + description='Builds the specified recipe using bitbake', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_build.add_argument('recipename', help='Recipe to build') + parser_build.set_defaults(func=build) + + parser_reset = subparsers.add_parser('reset', help='Remove a recipe from your workspace', + description='Removes the specified recipe from your workspace (resetting its state)', + formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser_reset.add_argument('recipename', nargs='?', help='Recipe to reset') + parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear workspace)') + parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot to remove recipe output') + parser_reset.set_defaults(func=reset) diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py index e794545e94..68d1ce2659 100644 --- a/scripts/lib/image/engine.py +++ b/scripts/lib/image/engine.py @@ -73,8 +73,8 @@ def find_artifacts(image_name): if (get_line_val(line, "IMAGE_ROOTFS")): rootfs_dir = get_line_val(line, "IMAGE_ROOTFS") continue - if (get_line_val(line, "STAGING_KERNEL_DIR")): - kernel_dir = get_line_val(line, "STAGING_KERNEL_DIR") + if (get_line_val(line, "DEPLOY_DIR_IMAGE")): + kernel_dir = get_line_val(line, "DEPLOY_DIR_IMAGE") continue if (get_line_val(line, "STAGING_DIR_NATIVE")): native_sysroot = get_line_val(line, "STAGING_DIR_NATIVE") @@ -200,7 +200,7 @@ def wic_create(args, wks_file, rootfs_dir, bootimg_dir, kernel_dir, values from the output of 'bitbake -e': rootfs_dir: IMAGE_ROOTFS - kernel_dir: STAGING_KERNEL_DIR + kernel_dir: DEPLOY_DIR_IMAGE native_sysroot: STAGING_DIR_NATIVE In the above case, bootimg_dir remains unset and the diff --git a/scripts/lib/image/help.py b/scripts/lib/image/help.py index 6b74f57662..e1eb265979 100644 --- a/scripts/lib/image/help.py +++ b/scripts/lib/image/help.py @@ -673,10 +673,10 @@ DESCRIPTION The following are supported 'part' options: - --size: The minimum partition size in MBytes. Specify an - integer value such as 500. Do not append the number - with "MB". You do not need this option if you use - --source. + --size: The minimum partition size. Specify an integer value + such as 500. Multipliers k, M ang G can be used. If + not specified, the size is in MB. + You do not need this option if you use --source. --source: This option is a wic-specific option that names the source of the data that will populate the @@ -737,6 +737,24 @@ DESCRIPTION to start a partition on an x KBytes boundary. + --no-table: This option is specific to wic. Space will be + reserved for the partition and it will be + populated but it will not be added to the + partition table. It may be useful for + bootloaders. + + --extra-space: This option is specific to wic. It adds extra + space after the space filled by the content + of the partition. The final size can go + beyond the size specified by --size. + By default, 10MB. + + --overhead-factor: This option is specific to wic. The + size of the partition is multiplied by + this factor. It has to be greater than or + equal to 1. + The default value is 1.3. + * bootloader This command allows the user to specify various bootloader diff --git a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc b/scripts/lib/recipetool/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/scripts/lib/bsp/substrate/target/arch/arm/recipes-kernel/linux/{{ if kernel_choice != "custom": }} files/{{=machine}}-user-features.scc +++ b/scripts/lib/recipetool/__init__.py diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py new file mode 100644 index 0000000000..1c71b24bfb --- /dev/null +++ b/scripts/lib/recipetool/create.py @@ -0,0 +1,419 @@ +# Recipe creation tool - create command plugin +# +# Copyright (C) 2014 Intel Corporation +# +# 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 sys +import os +import argparse +import glob +import fnmatch +import re +import logging + +logger = logging.getLogger('recipetool') + +tinfoil = None +plugins = None + +def plugin_init(pluginlist): + # Take a reference to the list so we can use it later + global plugins + plugins = pluginlist + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + +class RecipeHandler(): + @staticmethod + def checkfiles(path, speclist): + results = [] + for spec in speclist: + results.extend(glob.glob(os.path.join(path, spec))) + return results + + def genfunction(self, outlines, funcname, content): + outlines.append('%s () {' % funcname) + for line in content: + outlines.append('\t%s' % line) + outlines.append('}') + outlines.append('') + + def process(self, srctree, classes, lines_before, lines_after, handled): + return False + + + +def fetch_source(uri, destdir): + import bb.data + bb.utils.mkdirhier(destdir) + localdata = bb.data.createCopy(tinfoil.config_data) + bb.data.update_data(localdata) + localdata.setVar('BB_STRICT_CHECKSUM', '') + localdata.setVar('SRCREV', '${AUTOREV}') + ret = (None, None) + olddir = os.getcwd() + try: + fetcher = bb.fetch2.Fetch([uri], localdata) + for u in fetcher.ud: + ud = fetcher.ud[u] + ud.ignore_checksums = True + fetcher.download() + fetcher.unpack(destdir) + for u in fetcher.ud: + ud = fetcher.ud[u] + if ud.method.recommends_checksum(ud): + md5value = bb.utils.md5_file(ud.localpath) + sha256value = bb.utils.sha256_file(ud.localpath) + ret = (md5value, sha256value) + except bb.fetch2.BBFetchException, e: + raise bb.build.FuncFailed(e) + finally: + os.chdir(olddir) + return ret + +def supports_srcrev(uri): + localdata = bb.data.createCopy(tinfoil.config_data) + bb.data.update_data(localdata) + fetcher = bb.fetch2.Fetch([uri], localdata) + urldata = fetcher.ud + for u in urldata: + if urldata[u].method.supports_srcrev(): + return True + return False + +def create_recipe(args): + import bb.process + import tempfile + import shutil + + pkgarch = "" + if args.machine: + pkgarch = "${MACHINE_ARCH}" + + checksums = (None, None) + tempsrc = '' + srcsubdir = '' + if '://' in args.source: + # Fetch a URL + srcuri = args.source + if args.extract_to: + srctree = args.extract_to + else: + tempsrc = tempfile.mkdtemp(prefix='recipetool-') + srctree = tempsrc + logger.info('Fetching %s...' % srcuri) + checksums = fetch_source(args.source, srctree) + dirlist = os.listdir(srctree) + if 'git.indirectionsymlink' in dirlist: + dirlist.remove('git.indirectionsymlink') + if len(dirlist) == 1 and os.path.isdir(os.path.join(srctree, dirlist[0])): + # We unpacked a single directory, so we should use that + srcsubdir = dirlist[0] + srctree = os.path.join(srctree, srcsubdir) + else: + # Assume we're pointing to an existing source tree + if args.extract_to: + logger.error('--extract-to cannot be specified if source is a directory') + sys.exit(1) + if not os.path.isdir(args.source): + logger.error('Invalid source directory %s' % args.source) + sys.exit(1) + srcuri = '' + srctree = args.source + + outfile = args.outfile + if outfile and outfile != '-': + if os.path.exists(outfile): + logger.error('Output file %s already exists' % outfile) + sys.exit(1) + + lines_before = [] + lines_after = [] + + lines_before.append('# Recipe created by %s' % os.path.basename(sys.argv[0])) + lines_before.append('# This is the basis of a recipe and may need further editing in order to be fully functional.') + lines_before.append('# (Feel free to remove these comments when editing.)') + lines_before.append('#') + + licvalues = guess_license(srctree) + lic_files_chksum = [] + if licvalues: + licenses = [] + for licvalue in licvalues: + if not licvalue[0] in licenses: + licenses.append(licvalue[0]) + lic_files_chksum.append('file://%s;md5=%s' % (licvalue[1], licvalue[2])) + lines_before.append('# WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is') + lines_before.append('# your responsibility to verify that the values are complete and correct.') + if len(licvalues) > 1: + lines_before.append('#') + lines_before.append('# NOTE: multiple licenses have been detected; if that is correct you should separate') + lines_before.append('# these in the LICENSE value using & if the multiple licenses all apply, or | if there') + lines_before.append('# is a choice between the multiple licenses. If in doubt, check the accompanying') + lines_before.append('# documentation to determine which situation is applicable.') + else: + lines_before.append('# Unable to find any files that looked like license statements. Check the accompanying') + lines_before.append('# documentation and source headers and set LICENSE and LIC_FILES_CHKSUM accordingly.') + lines_before.append('#') + lines_before.append('# NOTE: LICENSE is being set to "CLOSED" to allow you to at least start building - if') + lines_before.append('# this is not accurate with respect to the licensing of the software being built (it') + lines_before.append('# will not be in most cases) you must specify the correct value before using this') + lines_before.append('# recipe for anything other than initial testing/development!') + licenses = ['CLOSED'] + lines_before.append('LICENSE = "%s"' % ' '.join(licenses)) + lines_before.append('LIC_FILES_CHKSUM = "%s"' % ' \\\n '.join(lic_files_chksum)) + lines_before.append('') + + # FIXME This is kind of a hack, we probably ought to be using bitbake to do this + # we'd also want a way to automatically set outfile based upon auto-detecting these values from the source if possible + recipefn = os.path.splitext(os.path.basename(outfile))[0] + fnsplit = recipefn.split('_') + if len(fnsplit) > 1: + pn = fnsplit[0] + pv = fnsplit[1] + else: + pn = recipefn + pv = None + + if srcuri: + if pv and pv not in 'git svn hg'.split(): + srcuri = srcuri.replace(pv, '${PV}') + else: + lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') + lines_before.append('SRC_URI = "%s"' % srcuri) + (md5value, sha256value) = checksums + if md5value: + lines_before.append('SRC_URI[md5sum] = "%s"' % md5value) + if sha256value: + lines_before.append('SRC_URI[sha256sum] = "%s"' % sha256value) + if srcuri and supports_srcrev(srcuri): + lines_before.append('') + lines_before.append('# Modify these as desired') + lines_before.append('PV = "1.0+git${SRCPV}"') + lines_before.append('SRCREV = "${AUTOREV}"') + lines_before.append('') + + if srcsubdir and pv: + if srcsubdir == "%s-%s" % (pn, pv): + # This would be the default, so we don't need to set S in the recipe + srcsubdir = '' + if srcsubdir: + if pv and pv not in 'git svn hg'.split(): + srcsubdir = srcsubdir.replace(pv, '${PV}') + lines_before.append('S = "${WORKDIR}/%s"' % srcsubdir) + lines_before.append('') + + if pkgarch: + lines_after.append('PACKAGE_ARCH = "%s"' % pkgarch) + lines_after.append('') + + # Find all plugins that want to register handlers + handlers = [] + for plugin in plugins: + if hasattr(plugin, 'register_recipe_handlers'): + plugin.register_recipe_handlers(handlers) + + # Apply the handlers + classes = [] + handled = [] + for handler in handlers: + handler.process(srctree, classes, lines_before, lines_after, handled) + + outlines = [] + outlines.extend(lines_before) + if classes: + outlines.append('inherit %s' % ' '.join(classes)) + outlines.append('') + outlines.extend(lines_after) + + if outfile == '-': + sys.stdout.write('\n'.join(outlines) + '\n') + else: + with open(outfile, 'w') as f: + f.write('\n'.join(outlines) + '\n') + logger.info('Recipe %s has been created; further editing may be required to make it fully functional' % outfile) + + if tempsrc: + shutil.rmtree(tempsrc) + + return 0 + +def get_license_md5sums(d, static_only=False): + import bb.utils + md5sums = {} + if not static_only: + # Gather md5sums of license files in common license dir + commonlicdir = d.getVar('COMMON_LICENSE_DIR', True) + for fn in os.listdir(commonlicdir): + md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn)) + md5sums[md5value] = fn + # The following were extracted from common values in various recipes + # (double checking the license against the license file itself, not just + # the LICENSE value in the recipe) + md5sums['94d55d512a9ba36caa9b7df079bae19f'] = 'GPLv2' + md5sums['b234ee4d69f5fce4486a80fdaf4a4263'] = 'GPLv2' + md5sums['59530bdf33659b29e73d4adb9f9f6552'] = 'GPLv2' + md5sums['0636e73ff0215e8d672dc4c32c317bb3'] = 'GPLv2' + md5sums['eb723b61539feef013de476e68b5c50a'] = 'GPLv2' + md5sums['751419260aa954499f7abaabaa882bbe'] = 'GPLv2' + md5sums['393a5ca445f6965873eca0259a17f833'] = 'GPLv2' + md5sums['12f884d2ae1ff87c09e5b7ccc2c4ca7e'] = 'GPLv2' + md5sums['8ca43cbc842c2336e835926c2166c28b'] = 'GPLv2' + md5sums['ebb5c50ab7cab4baeffba14977030c07'] = 'GPLv2' + md5sums['c93c0550bd3173f4504b2cbd8991e50b'] = 'GPLv2' + md5sums['9ac2e7cff1ddaf48b6eab6028f23ef88'] = 'GPLv2' + md5sums['4325afd396febcb659c36b49533135d4'] = 'GPLv2' + md5sums['18810669f13b87348459e611d31ab760'] = 'GPLv2' + md5sums['d7810fab7487fb0aad327b76f1be7cd7'] = 'GPLv2' # the Linux kernel's COPYING file + md5sums['bbb461211a33b134d42ed5ee802b37ff'] = 'LGPLv2.1' + md5sums['7fbc338309ac38fefcd64b04bb903e34'] = 'LGPLv2.1' + md5sums['4fbd65380cdd255951079008b364516c'] = 'LGPLv2.1' + md5sums['2d5025d4aa3495befef8f17206a5b0a1'] = 'LGPLv2.1' + md5sums['fbc093901857fcd118f065f900982c24'] = 'LGPLv2.1' + md5sums['a6f89e2100d9b6cdffcea4f398e37343'] = 'LGPLv2.1' + md5sums['d8045f3b8f929c1cb29a1e3fd737b499'] = 'LGPLv2.1' + md5sums['fad9b3332be894bab9bc501572864b29'] = 'LGPLv2.1' + md5sums['3bf50002aefd002f49e7bb854063f7e7'] = 'LGPLv2' + md5sums['9f604d8a4f8e74f4f5140845a21b6674'] = 'LGPLv2' + md5sums['5f30f0716dfdd0d91eb439ebec522ec2'] = 'LGPLv2' + md5sums['55ca817ccb7d5b5b66355690e9abc605'] = 'LGPLv2' + md5sums['252890d9eee26aab7b432e8b8a616475'] = 'LGPLv2' + md5sums['d32239bcb673463ab874e80d47fae504'] = 'GPLv3' + md5sums['f27defe1e96c2e1ecd4e0c9be8967949'] = 'GPLv3' + md5sums['6a6a8e020838b23406c81b19c1d46df6'] = 'LGPLv3' + md5sums['3b83ef96387f14655fc854ddc3c6bd57'] = 'Apache-2.0' + md5sums['385c55653886acac3821999a3ccd17b3'] = 'Artistic-1.0 | GPL-2.0' # some perl modules + return md5sums + +def guess_license(srctree): + import bb + md5sums = get_license_md5sums(tinfoil.config_data) + + licenses = [] + licspecs = ['LICENSE*', 'COPYING*', '*[Ll]icense*', 'LICENCE*', 'LEGAL*', '[Ll]egal*', '*GPL*', 'README.lic*', 'COPYRIGHT*', '[Cc]opyright*'] + licfiles = [] + for root, dirs, files in os.walk(srctree): + for fn in files: + for spec in licspecs: + if fnmatch.fnmatch(fn, spec): + fullpath = os.path.join(root, fn) + if not fullpath in licfiles: + licfiles.append(fullpath) + for licfile in licfiles: + md5value = bb.utils.md5_file(licfile) + license = md5sums.get(md5value, 'Unknown') + licenses.append((license, os.path.relpath(licfile, srctree), md5value)) + + # FIXME should we grab at least one source file with a license header and add that too? + + return licenses + +def read_pkgconfig_provides(d): + pkgdatadir = d.getVar('PKGDATA_DIR', True) + pkgmap = {} + for fn in glob.glob(os.path.join(pkgdatadir, 'shlibs2', '*.pclist')): + with open(fn, 'r') as f: + for line in f: + pkgmap[os.path.basename(line.rstrip())] = os.path.splitext(os.path.basename(fn))[0] + recipemap = {} + for pc, pkg in pkgmap.iteritems(): + pkgdatafile = os.path.join(pkgdatadir, 'runtime', pkg) + if os.path.exists(pkgdatafile): + with open(pkgdatafile, 'r') as f: + for line in f: + if line.startswith('PN: '): + recipemap[pc] = line.split(':', 1)[1].strip() + return recipemap + +def convert_pkginfo(pkginfofile): + values = {} + with open(pkginfofile, 'r') as f: + indesc = False + for line in f: + if indesc: + if line.strip(): + values['DESCRIPTION'] += ' ' + line.strip() + else: + indesc = False + else: + splitline = line.split(': ', 1) + key = line[0] + value = line[1] + if key == 'LICENSE': + for dep in value.split(','): + dep = dep.split()[0] + mapped = depmap.get(dep, '') + if mapped: + depends.append(mapped) + elif key == 'License': + values['LICENSE'] = value + elif key == 'Summary': + values['SUMMARY'] = value + elif key == 'Description': + values['DESCRIPTION'] = value + indesc = True + return values + +def convert_debian(debpath): + # FIXME extend this mapping - perhaps use distro_alias.inc? + depmap = {'libz-dev': 'zlib'} + + values = {} + depends = [] + with open(os.path.join(debpath, 'control')) as f: + indesc = False + for line in f: + if indesc: + if line.strip(): + if line.startswith(' This package contains'): + indesc = False + else: + values['DESCRIPTION'] += ' ' + line.strip() + else: + indesc = False + else: + splitline = line.split(':', 1) + key = line[0] + value = line[1] + if key == 'Build-Depends': + for dep in value.split(','): + dep = dep.split()[0] + mapped = depmap.get(dep, '') + if mapped: + depends.append(mapped) + elif key == 'Section': + values['SECTION'] = value + elif key == 'Description': + values['SUMMARY'] = value + indesc = True + + if depends: + values['DEPENDS'] = ' '.join(depends) + + return values + + +def register_command(subparsers): + parser_create = subparsers.add_parser('create', + help='Create a new recipe', + description='Creates a new recipe from a source tree') + parser_create.add_argument('source', help='Path or URL to source') + parser_create.add_argument('-o', '--outfile', help='Specify filename for recipe to create', required=True) + parser_create.add_argument('-m', '--machine', help='Make recipe machine-specific as opposed to architecture-specific', action='store_true') + parser_create.add_argument('-x', '--extract-to', metavar='EXTRACTPATH', help='Assuming source is a URL, fetch it and extract it to the directory specified as %(metavar)s') + parser_create.set_defaults(func=create_recipe) + diff --git a/scripts/lib/recipetool/create_buildsys.py b/scripts/lib/recipetool/create_buildsys.py new file mode 100644 index 0000000000..6c9e0efa2a --- /dev/null +++ b/scripts/lib/recipetool/create_buildsys.py @@ -0,0 +1,319 @@ +# Recipe creation tool - create command build system handlers +# +# Copyright (C) 2014 Intel Corporation +# +# 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 re +import logging +from recipetool.create import RecipeHandler, read_pkgconfig_provides + +logger = logging.getLogger('recipetool') + +tinfoil = None + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + +class CmakeRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['CMakeLists.txt']): + classes.append('cmake') + lines_after.append('# Specify any options you want to pass to cmake using EXTRA_OECMAKE:') + lines_after.append('EXTRA_OECMAKE = ""') + lines_after.append('') + handled.append('buildsystem') + return True + return False + +class SconsRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['SConstruct', 'Sconstruct', 'sconstruct']): + classes.append('scons') + lines_after.append('# Specify any options you want to pass to scons using EXTRA_OESCONS:') + lines_after.append('EXTRA_OESCONS = ""') + lines_after.append('') + handled.append('buildsystem') + return True + return False + +class QmakeRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + if RecipeHandler.checkfiles(srctree, ['*.pro']): + classes.append('qmake2') + handled.append('buildsystem') + return True + return False + +class AutotoolsRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + autoconf = False + if RecipeHandler.checkfiles(srctree, ['configure.ac', 'configure.in']): + autoconf = True + values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree) + classes.extend(values.pop('inherit', '').split()) + for var, value in values.iteritems(): + lines_before.append('%s = "%s"' % (var, value)) + else: + conffile = RecipeHandler.checkfiles(srctree, ['configure']) + if conffile: + # Check if this is just a pre-generated autoconf configure script + with open(conffile[0], 'r') as f: + for i in range(1, 10): + if 'Generated by GNU Autoconf' in f.readline(): + autoconf = True + break + + if autoconf: + lines_before.append('# NOTE: if this software is not capable of being built in a separate build directory') + lines_before.append('# from the source, you should replace autotools with autotools-brokensep in the') + lines_before.append('# inherit line') + classes.append('autotools') + lines_after.append('# Specify any options you want to pass to the configure script using EXTRA_OECONF:') + lines_after.append('EXTRA_OECONF = ""') + lines_after.append('') + handled.append('buildsystem') + return True + + return False + + @staticmethod + def extract_autotools_deps(outlines, srctree, acfile=None): + import shlex + import oe.package + + values = {} + inherits = [] + + # FIXME this mapping is very thin + progmap = {'flex': 'flex-native', + 'bison': 'bison-native', + 'm4': 'm4-native'} + progclassmap = {'gconftool-2': 'gconf', + 'pkg-config': 'pkgconfig'} + + ignoredeps = ['gcc-runtime', 'glibc', 'uclibc'] + + pkg_re = re.compile('PKG_CHECK_MODULES\(\[?[a-zA-Z0-9]*\]?, \[?([^,\]]*)[),].*') + lib_re = re.compile('AC_CHECK_LIB\(\[?([a-zA-Z0-9]*)\]?, .*') + progs_re = re.compile('_PROGS?\(\[?[a-zA-Z0-9]*\]?, \[?([^,\]]*)\]?[),].*') + dep_re = re.compile('([^ ><=]+)( [<>=]+ [^ ><=]+)?') + + # Build up lib library->package mapping + shlib_providers = oe.package.read_shlib_providers(tinfoil.config_data) + libdir = tinfoil.config_data.getVar('libdir', True) + base_libdir = tinfoil.config_data.getVar('base_libdir', True) + libpaths = list(set([base_libdir, libdir])) + libname_re = re.compile('^lib(.+)\.so.*$') + pkglibmap = {} + for lib, item in shlib_providers.iteritems(): + for path, pkg in item.iteritems(): + if path in libpaths: + res = libname_re.match(lib) + if res: + libname = res.group(1) + if not libname in pkglibmap: + pkglibmap[libname] = pkg[0] + else: + logger.debug('unable to extract library name from %s' % lib) + + # Now turn it into a library->recipe mapping + recipelibmap = {} + pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) + for libname, pkg in pkglibmap.iteritems(): + try: + with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: + for line in f: + if line.startswith('PN:'): + recipelibmap[libname] = line.split(':', 1)[-1].strip() + break + except IOError as ioe: + if ioe.errno == 2: + logger.warn('unable to find a pkgdata file for package %s' % pkg) + else: + raise + + # Since a configure.ac file is essentially a program, this is only ever going to be + # a hack unfortunately; but it ought to be enough of an approximation + if acfile: + srcfiles = [acfile] + else: + srcfiles = RecipeHandler.checkfiles(srctree, ['configure.ac', 'configure.in']) + pcdeps = [] + deps = [] + unmapped = [] + unmappedlibs = [] + with open(srcfiles[0], 'r') as f: + for line in f: + if 'PKG_CHECK_MODULES' in line: + res = pkg_re.search(line) + if res: + res = dep_re.findall(res.group(1)) + if res: + pcdeps.extend([x[0] for x in res]) + inherits.append('pkgconfig') + if line.lstrip().startswith('AM_GNU_GETTEXT'): + inherits.append('gettext') + elif 'AC_CHECK_PROG' in line or 'AC_PATH_PROG' in line: + res = progs_re.search(line) + if res: + for prog in shlex.split(res.group(1)): + prog = prog.split()[0] + progclass = progclassmap.get(prog, None) + if progclass: + inherits.append(progclass) + else: + progdep = progmap.get(prog, None) + if progdep: + deps.append(progdep) + else: + if not prog.startswith('$'): + unmapped.append(prog) + elif 'AC_CHECK_LIB' in line: + res = lib_re.search(line) + if res: + lib = res.group(1) + libdep = recipelibmap.get(lib, None) + if libdep: + deps.append(libdep) + else: + if libdep is None: + if not lib.startswith('$'): + unmappedlibs.append(lib) + elif 'AC_PATH_X' in line: + deps.append('libx11') + + if unmapped: + outlines.append('# NOTE: the following prog dependencies are unknown, ignoring: %s' % ' '.join(unmapped)) + + if unmappedlibs: + outlines.append('# NOTE: the following library dependencies are unknown, ignoring: %s' % ' '.join(unmappedlibs)) + outlines.append('# (this is based on recipes that have previously been built and packaged)') + + recipemap = read_pkgconfig_provides(tinfoil.config_data) + unmapped = [] + for pcdep in pcdeps: + recipe = recipemap.get(pcdep, None) + if recipe: + deps.append(recipe) + else: + if not pcdep.startswith('$'): + unmapped.append(pcdep) + + deps = set(deps).difference(set(ignoredeps)) + + if unmapped: + outlines.append('# NOTE: unable to map the following pkg-config dependencies: %s' % ' '.join(unmapped)) + outlines.append('# (this is based on recipes that have previously been built and packaged)') + + if deps: + values['DEPENDS'] = ' '.join(deps) + + if inherits: + values['inherit'] = ' '.join(list(set(inherits))) + + return values + + +class MakefileRecipeHandler(RecipeHandler): + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + makefile = RecipeHandler.checkfiles(srctree, ['Makefile']) + if makefile: + lines_after.append('# NOTE: this is a Makefile-only piece of software, so we cannot generate much of the') + lines_after.append('# recipe automatically - you will need to examine the Makefile yourself and ensure') + lines_after.append('# that the appropriate arguments are passed in.') + lines_after.append('') + + scanfile = os.path.join(srctree, 'configure.scan') + skipscan = False + try: + stdout, stderr = bb.process.run('autoscan', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + skipscan = True + if scanfile and os.path.exists(scanfile): + values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, acfile=scanfile) + classes.extend(values.pop('inherit', '').split()) + for var, value in values.iteritems(): + if var == 'DEPENDS': + lines_before.append('# NOTE: some of these dependencies may be optional, check the Makefile and/or upstream documentation') + lines_before.append('%s = "%s"' % (var, value)) + lines_before.append('') + for f in ['configure.scan', 'autoscan.log']: + fp = os.path.join(srctree, f) + if os.path.exists(fp): + os.remove(fp) + + self.genfunction(lines_after, 'do_configure', ['# Specify any needed configure commands here']) + + func = [] + func.append('# You will almost certainly need to add additional arguments here') + func.append('oe_runmake') + self.genfunction(lines_after, 'do_compile', func) + + installtarget = True + try: + stdout, stderr = bb.process.run('make -qn install', cwd=srctree, shell=True) + except bb.process.ExecutionError as e: + if e.exitcode != 1: + installtarget = False + func = [] + if installtarget: + func.append('# This is a guess; additional arguments may be required') + makeargs = '' + with open(makefile[0], 'r') as f: + for i in range(1, 100): + if 'DESTDIR' in f.readline(): + makeargs += " 'DESTDIR=${D}'" + break + func.append('oe_runmake install%s' % makeargs) + else: + func.append('# NOTE: unable to determine what to put here - there is a Makefile but no') + func.append('# target named "install", so you will need to define this yourself') + self.genfunction(lines_after, 'do_install', func) + + handled.append('buildsystem') + else: + lines_after.append('# NOTE: no Makefile found, unable to determine what needs to be done') + lines_after.append('') + self.genfunction(lines_after, 'do_configure', ['# Specify any needed configure commands here']) + self.genfunction(lines_after, 'do_compile', ['# Specify compilation commands here']) + self.genfunction(lines_after, 'do_install', ['# Specify install commands here']) + + +def plugin_init(pluginlist): + pass + +def register_recipe_handlers(handlers): + # These are in a specific order so that the right one is detected first + handlers.append(CmakeRecipeHandler()) + handlers.append(AutotoolsRecipeHandler()) + handlers.append(SconsRecipeHandler()) + handlers.append(QmakeRecipeHandler()) + handlers.append(MakefileRecipeHandler()) diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py new file mode 100644 index 0000000000..f4f4212559 --- /dev/null +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -0,0 +1,720 @@ +# Recipe creation tool - create build system handler for python +# +# Copyright (C) 2015 Mentor Graphics Corporation +# +# 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 ast +import codecs +import collections +import distutils.command.build_py +import email +import imp +import glob +import itertools +import logging +import os +import re +import sys +import subprocess +from recipetool.create import RecipeHandler + +logger = logging.getLogger('recipetool') + +tinfoil = None + + +def tinfoil_init(instance): + global tinfoil + tinfoil = instance + + +class PythonRecipeHandler(RecipeHandler): + base_pkgdeps = ['python-core'] + excluded_pkgdeps = ['python-dbg'] + # os.path is provided by python-core + assume_provided = ['builtins', 'os.path'] + # Assumes that the host python builtin_module_names is sane for target too + assume_provided = assume_provided + list(sys.builtin_module_names) + + bbvar_map = { + 'Name': 'PN', + 'Version': 'PV', + 'Home-page': 'HOMEPAGE', + 'Summary': 'SUMMARY', + 'Description': 'DESCRIPTION', + 'License': 'LICENSE', + 'Requires': 'RDEPENDS_${PN}', + 'Provides': 'RPROVIDES_${PN}', + 'Obsoletes': 'RREPLACES_${PN}', + } + # PN/PV are already set by recipetool core & desc can be extremely long + excluded_fields = [ + 'Name', + 'Version', + 'Description', + ] + setup_parse_map = { + 'Url': 'Home-page', + 'Classifiers': 'Classifier', + 'Description': 'Summary', + } + setuparg_map = { + 'Home-page': 'url', + 'Classifier': 'classifiers', + 'Summary': 'description', + 'Description': 'long-description', + } + # Values which are lists, used by the setup.py argument based metadata + # extraction method, to determine how to process the setup.py output. + setuparg_list_fields = [ + 'Classifier', + 'Requires', + 'Provides', + 'Obsoletes', + 'Platform', + 'Supported-Platform', + ] + setuparg_multi_line_values = ['Description'] + replacements = [ + ('License', r' ', '-'), + ('License', r'-License$', ''), + ('License', r'^UNKNOWN$', ''), + + # Remove currently unhandled version numbers from these variables + ('Requires', r' *\([^)]*\)', ''), + ('Provides', r' *\([^)]*\)', ''), + ('Obsoletes', r' *\([^)]*\)', ''), + ('Install-requires', r'^([^><= ]+).*', r'\1'), + ('Extras-require', r'^([^><= ]+).*', r'\1'), + ('Tests-require', r'^([^><= ]+).*', r'\1'), + + # Remove unhandled dependency on particular features (e.g. foo[PDF]) + ('Install-requires', r'\[[^\]]+\]$', ''), + ] + + classifier_license_map = { + 'License :: OSI Approved :: Academic Free License (AFL)': 'AFL', + 'License :: OSI Approved :: Apache Software License': 'Apache', + 'License :: OSI Approved :: Apple Public Source License': 'APSL', + 'License :: OSI Approved :: Artistic License': 'Artistic', + 'License :: OSI Approved :: Attribution Assurance License': 'AAL', + 'License :: OSI Approved :: BSD License': 'BSD', + 'License :: OSI Approved :: Common Public License': 'CPL', + 'License :: OSI Approved :: Eiffel Forum License': 'EFL', + 'License :: OSI Approved :: European Union Public Licence 1.0 (EUPL 1.0)': 'EUPL-1.0', + 'License :: OSI Approved :: European Union Public Licence 1.1 (EUPL 1.1)': 'EUPL-1.1', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)': 'AGPL-3.0+', + 'License :: OSI Approved :: GNU Affero General Public License v3': 'AGPL-3.0', + 'License :: OSI Approved :: GNU Free Documentation License (FDL)': 'GFDL', + 'License :: OSI Approved :: GNU General Public License (GPL)': 'GPL', + 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)': 'GPL-2.0', + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)': 'GPL-2.0+', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)': 'GPL-3.0', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)': 'GPL-3.0+', + 'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)': 'LGPL-2.0', + 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)': 'LGPL-2.0+', + 'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)': 'LGPL-3.0', + 'License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)': 'LGPL-3.0+', + 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)': 'LGPL', + 'License :: OSI Approved :: IBM Public License': 'IPL', + 'License :: OSI Approved :: ISC License (ISCL)': 'ISC', + 'License :: OSI Approved :: Intel Open Source License': 'Intel', + 'License :: OSI Approved :: Jabber Open Source License': 'Jabber', + 'License :: OSI Approved :: MIT License': 'MIT', + 'License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW)': 'CVWL', + 'License :: OSI Approved :: Motosoto License': 'Motosoto', + 'License :: OSI Approved :: Mozilla Public License 1.0 (MPL)': 'MPL-1.0', + 'License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1)': 'MPL-1.1', + 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)': 'MPL-2.0', + 'License :: OSI Approved :: Nethack General Public License': 'NGPL', + 'License :: OSI Approved :: Nokia Open Source License': 'Nokia', + 'License :: OSI Approved :: Open Group Test Suite License': 'OGTSL', + 'License :: OSI Approved :: Python License (CNRI Python License)': 'CNRI-Python', + 'License :: OSI Approved :: Python Software Foundation License': 'PSF', + 'License :: OSI Approved :: Qt Public License (QPL)': 'QPL', + 'License :: OSI Approved :: Ricoh Source Code Public License': 'RSCPL', + 'License :: OSI Approved :: Sleepycat License': 'Sleepycat', + 'License :: OSI Approved :: Sun Industry Standards Source License (SISSL)': '-- Sun Industry Standards Source License (SISSL)', + 'License :: OSI Approved :: Sun Public License': 'SPL', + 'License :: OSI Approved :: University of Illinois/NCSA Open Source License': 'NCSA', + 'License :: OSI Approved :: Vovida Software License 1.0': 'VSL-1.0', + 'License :: OSI Approved :: W3C License': 'W3C', + 'License :: OSI Approved :: X.Net License': 'Xnet', + 'License :: OSI Approved :: Zope Public License': 'ZPL', + 'License :: OSI Approved :: zlib/libpng License': 'Zlib', + } + + def __init__(self): + pass + + def process(self, srctree, classes, lines_before, lines_after, handled): + if 'buildsystem' in handled: + return False + + if not RecipeHandler.checkfiles(srctree, ['setup.py']): + return + + # setup.py is always parsed to get at certain required information, such as + # distutils vs setuptools + # + # If egg info is available, we use it for both its PKG-INFO metadata + # and for its requires.txt for install_requires. + # If PKG-INFO is available but no egg info is, we use that for metadata in preference to + # the parsed setup.py, but use the install_requires info from the + # parsed setup.py. + + setupscript = os.path.join(srctree, 'setup.py') + try: + setup_info, uses_setuptools, setup_non_literals, extensions = self.parse_setup_py(setupscript) + except Exception: + logger.exception("Failed to parse setup.py") + setup_info, uses_setuptools, setup_non_literals, extensions = {}, True, [], [] + + egginfo = glob.glob(os.path.join(srctree, '*.egg-info')) + if egginfo: + info = self.get_pkginfo(os.path.join(egginfo[0], 'PKG-INFO')) + requires_txt = os.path.join(egginfo[0], 'requires.txt') + if os.path.exists(requires_txt): + with codecs.open(requires_txt) as f: + inst_req = [] + extras_req = collections.defaultdict(list) + current_feature = None + for line in f.readlines(): + line = line.rstrip() + if not line: + continue + + if line.startswith('['): + current_feature = line[1:-1] + elif current_feature: + extras_req[current_feature].append(line) + else: + inst_req.append(line) + info['Install-requires'] = inst_req + info['Extras-require'] = extras_req + elif RecipeHandler.checkfiles(srctree, ['PKG-INFO']): + info = self.get_pkginfo(os.path.join(srctree, 'PKG-INFO')) + + if setup_info: + if 'Install-requires' in setup_info: + info['Install-requires'] = setup_info['Install-requires'] + if 'Extras-require' in setup_info: + info['Extras-require'] = setup_info['Extras-require'] + else: + if setup_info: + info = setup_info + else: + info = self.get_setup_args_info(setupscript) + + self.apply_info_replacements(info) + + if uses_setuptools: + classes.append('setuptools') + else: + classes.append('distutils') + + if 'Classifier' in info: + licenses = [] + for classifier in info['Classifier']: + if classifier in self.classifier_license_map: + license = self.classifier_license_map[classifier] + licenses.append(license) + + if licenses: + info['License'] = ' & '.join(licenses) + + + # Map PKG-INFO & setup.py fields to bitbake variables + bbinfo = {} + for field, values in info.iteritems(): + if field in self.excluded_fields: + continue + + if field not in self.bbvar_map: + continue + + if isinstance(values, basestring): + value = values + else: + value = ' '.join(str(v) for v in values if v) + + bbvar = self.bbvar_map[field] + if bbvar not in bbinfo and value: + bbinfo[bbvar] = value + + comment_lic_line = None + for pos, line in enumerate(list(lines_before)): + if line.startswith('#') and 'LICENSE' in line: + comment_lic_line = pos + elif line.startswith('LICENSE =') and 'LICENSE' in bbinfo: + if line in ('LICENSE = "Unknown"', 'LICENSE = "CLOSED"'): + lines_before[pos] = 'LICENSE = "{}"'.format(bbinfo['LICENSE']) + if line == 'LICENSE = "CLOSED"' and comment_lic_line: + lines_before[comment_lic_line:pos] = [ + '# WARNING: the following LICENSE value is a best guess - it is your', + '# responsibility to verify that the value is complete and correct.' + ] + del bbinfo['LICENSE'] + + src_uri_line = None + for pos, line in enumerate(lines_before): + if line.startswith('SRC_URI ='): + src_uri_line = pos + + if bbinfo: + mdinfo = [''] + for k in sorted(bbinfo): + v = bbinfo[k] + mdinfo.append('{} = "{}"'.format(k, v)) + lines_before[src_uri_line-1:src_uri_line-1] = mdinfo + + mapped_deps, unmapped_deps = self.scan_setup_python_deps(srctree, setup_info, setup_non_literals) + + extras_req = set() + if 'Extras-require' in info: + extras_req = info['Extras-require'] + if extras_req: + lines_after.append('# The following configs & dependencies are from setuptools extras_require.') + lines_after.append('# These dependencies are optional, hence can be controlled via PACKAGECONFIG.') + lines_after.append('# The upstream names may not correspond exactly to bitbake package names.') + lines_after.append('#') + lines_after.append('# Uncomment this line to enable all the optional features.') + lines_after.append('#PACKAGECONFIG ?= "{}"'.format(' '.join(k.lower() for k in extras_req.iterkeys()))) + for feature, feature_reqs in extras_req.iteritems(): + unmapped_deps.difference_update(feature_reqs) + + feature_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(feature_reqs)) + lines_after.append('PACKAGECONFIG[{}] = ",,,{}"'.format(feature.lower(), ' '.join(feature_req_deps))) + + inst_reqs = set() + if 'Install-requires' in info: + if extras_req: + lines_after.append('') + inst_reqs = info['Install-requires'] + if inst_reqs: + unmapped_deps.difference_update(inst_reqs) + + inst_req_deps = ('python-' + r.replace('.', '-').lower() for r in sorted(inst_reqs)) + lines_after.append('# WARNING: the following rdepends are from setuptools install_requires. These') + lines_after.append('# upstream names may not correspond exactly to bitbake package names.') + lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(inst_req_deps))) + + if mapped_deps: + name = info.get('Name') + if name and name[0] in mapped_deps: + # Attempt to avoid self-reference + mapped_deps.remove(name[0]) + mapped_deps -= set(self.excluded_pkgdeps) + if inst_reqs or extras_req: + lines_after.append('') + lines_after.append('# WARNING: the following rdepends are determined through basic analysis of the') + lines_after.append('# python sources, and might not be 100% accurate.') + lines_after.append('RDEPENDS_${{PN}} += "{}"'.format(' '.join(sorted(mapped_deps)))) + + unmapped_deps -= set(extensions) + unmapped_deps -= set(self.assume_provided) + if unmapped_deps: + if mapped_deps: + lines_after.append('') + lines_after.append('# WARNING: We were unable to map the following python package/module') + lines_after.append('# dependencies to the bitbake packages which include them:') + lines_after.extend('# {}'.format(d) for d in sorted(unmapped_deps)) + + handled.append('buildsystem') + + def get_pkginfo(self, pkginfo_fn): + msg = email.message_from_file(open(pkginfo_fn, 'r')) + msginfo = {} + for field in msg.keys(): + values = msg.get_all(field) + if len(values) == 1: + msginfo[field] = values[0] + else: + msginfo[field] = values + return msginfo + + def parse_setup_py(self, setupscript='./setup.py'): + with codecs.open(setupscript) as f: + info, imported_modules, non_literals, extensions = gather_setup_info(f) + + def _map(key): + key = key.replace('_', '-') + key = key[0].upper() + key[1:] + if key in self.setup_parse_map: + key = self.setup_parse_map[key] + return key + + # Naive mapping of setup() arguments to PKG-INFO field names + for d in [info, non_literals]: + for key, value in d.items(): + new_key = _map(key) + if new_key != key: + del d[key] + d[new_key] = value + + return info, 'setuptools' in imported_modules, non_literals, extensions + + def get_setup_args_info(self, setupscript='./setup.py'): + cmd = ['python', setupscript] + info = {} + keys = set(self.bbvar_map.keys()) + keys |= set(self.setuparg_list_fields) + keys |= set(self.setuparg_multi_line_values) + grouped_keys = itertools.groupby(keys, lambda k: (k in self.setuparg_list_fields, k in self.setuparg_multi_line_values)) + for index, keys in grouped_keys: + if index == (True, False): + # Splitlines output for each arg as a list value + for key in keys: + arg = self.setuparg_map.get(key, key.lower()) + try: + arg_info = self.run_command(cmd + ['--' + arg], cwd=os.path.dirname(setupscript)) + except (OSError, subprocess.CalledProcessError): + pass + else: + info[key] = [l.rstrip() for l in arg_info.splitlines()] + elif index == (False, True): + # Entire output for each arg + for key in keys: + arg = self.setuparg_map.get(key, key.lower()) + try: + arg_info = self.run_command(cmd + ['--' + arg], cwd=os.path.dirname(setupscript)) + except (OSError, subprocess.CalledProcessError): + pass + else: + info[key] = arg_info + else: + info.update(self.get_setup_byline(list(keys), setupscript)) + return info + + def get_setup_byline(self, fields, setupscript='./setup.py'): + info = {} + + cmd = ['python', setupscript] + cmd.extend('--' + self.setuparg_map.get(f, f.lower()) for f in fields) + try: + info_lines = self.run_command(cmd, cwd=os.path.dirname(setupscript)).splitlines() + except (OSError, subprocess.CalledProcessError): + pass + else: + if len(fields) != len(info_lines): + logger.error('Mismatch between setup.py output lines and number of fields') + sys.exit(1) + + for lineno, line in enumerate(info_lines): + line = line.rstrip() + info[fields[lineno]] = line + return info + + def apply_info_replacements(self, info): + for variable, search, replace in self.replacements: + if variable not in info: + continue + + def replace_value(search, replace, value): + if replace is None: + if re.search(search, value): + return None + else: + new_value = re.sub(search, replace, value) + if value != new_value: + return new_value + return value + + value = info[variable] + if isinstance(value, basestring): + new_value = replace_value(search, replace, value) + if new_value is None: + del info[variable] + elif new_value != value: + info[variable] = new_value + elif hasattr(value, 'iteritems'): + for dkey, dvalue in value.iteritems(): + new_list = [] + for pos, a_value in enumerate(dvalue): + new_value = replace_value(search, replace, a_value) + if new_value is not None and new_value != value: + new_list.append(new_value) + + if value != new_list: + value[dkey] = new_list + else: + new_list = [] + for pos, a_value in enumerate(value): + new_value = replace_value(search, replace, a_value) + if new_value is not None and new_value != value: + new_list.append(new_value) + + if value != new_list: + info[variable] = new_list + + def scan_setup_python_deps(self, srctree, setup_info, setup_non_literals): + if 'Package-dir' in setup_info: + package_dir = setup_info['Package-dir'] + else: + package_dir = {} + + class PackageDir(distutils.command.build_py.build_py): + def __init__(self, package_dir): + self.package_dir = package_dir + + pd = PackageDir(package_dir) + to_scan = [] + if not any(v in setup_non_literals for v in ['Py-modules', 'Scripts', 'Packages']): + if 'Py-modules' in setup_info: + for module in setup_info['Py-modules']: + try: + package, module = module.rsplit('.', 1) + except ValueError: + package, module = '.', module + module_path = os.path.join(pd.get_package_dir(package), module + '.py') + to_scan.append(module_path) + + if 'Packages' in setup_info: + for package in setup_info['Packages']: + to_scan.append(pd.get_package_dir(package)) + + if 'Scripts' in setup_info: + to_scan.extend(setup_info['Scripts']) + else: + logger.info("Scanning the entire source tree, as one or more of the following setup keywords are non-literal: py_modules, scripts, packages.") + + if not to_scan: + to_scan = ['.'] + + logger.info("Scanning paths for packages & dependencies: %s", ', '.join(to_scan)) + + provided_packages = self.parse_pkgdata_for_python_packages() + scanned_deps = self.scan_python_dependencies([os.path.join(srctree, p) for p in to_scan]) + mapped_deps, unmapped_deps = set(self.base_pkgdeps), set() + for dep in scanned_deps: + mapped = provided_packages.get(dep) + if mapped: + mapped_deps.add(mapped) + else: + unmapped_deps.add(dep) + return mapped_deps, unmapped_deps + + def scan_python_dependencies(self, paths): + deps = set() + try: + dep_output = self.run_command(['pythondeps', '-d'] + paths) + except (OSError, subprocess.CalledProcessError): + pass + else: + for line in dep_output.splitlines(): + line = line.rstrip() + dep, filename = line.split('\t', 1) + if filename.endswith('/setup.py'): + continue + deps.add(dep) + + try: + provides_output = self.run_command(['pythondeps', '-p'] + paths) + except (OSError, subprocess.CalledProcessError): + pass + else: + provides_lines = (l.rstrip() for l in provides_output.splitlines()) + provides = set(l for l in provides_lines if l and l != 'setup') + deps -= provides + + return deps + + def parse_pkgdata_for_python_packages(self): + suffixes = [t[0] for t in imp.get_suffixes()] + pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) + + ldata = tinfoil.config_data.createCopy() + bb.parse.handle('classes/python-dir.bbclass', ldata, True) + python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR', True) + + dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload') + python_dirs = [python_sitedir + os.sep, + os.path.join(os.path.dirname(python_sitedir), 'dist-packages') + os.sep, + os.path.dirname(python_sitedir) + os.sep] + packages = {} + for pkgdatafile in glob.glob('{}/runtime/*'.format(pkgdata_dir)): + files_info = None + with open(pkgdatafile, 'r') as f: + for line in f.readlines(): + field, value = line.split(': ', 1) + if field == 'FILES_INFO': + files_info = ast.literal_eval(value) + break + else: + continue + + for fn in files_info.iterkeys(): + for suffix in suffixes: + if fn.endswith(suffix): + break + else: + continue + + if fn.startswith(dynload_dir + os.sep): + base = os.path.basename(fn) + provided = base.split('.', 1)[0] + packages[provided] = os.path.basename(pkgdatafile) + continue + + for python_dir in python_dirs: + if fn.startswith(python_dir): + relpath = fn[len(python_dir):] + relstart, _, relremaining = relpath.partition(os.sep) + if relstart.endswith('.egg'): + relpath = relremaining + base, _ = os.path.splitext(relpath) + + if '/.debug/' in base: + continue + if os.path.basename(base) == '__init__': + base = os.path.dirname(base) + base = base.replace(os.sep + os.sep, os.sep) + provided = base.replace(os.sep, '.') + packages[provided] = os.path.basename(pkgdatafile) + return packages + + @classmethod + def run_command(cls, cmd, **popenargs): + if 'stderr' not in popenargs: + popenargs['stderr'] = subprocess.STDOUT + try: + return subprocess.check_output(cmd, **popenargs) + except OSError as exc: + logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc) + raise + except subprocess.CalledProcessError as exc: + logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc.output) + raise + + +def gather_setup_info(fileobj): + parsed = ast.parse(fileobj.read(), fileobj.name) + visitor = SetupScriptVisitor() + visitor.visit(parsed) + + non_literals, extensions = {}, [] + for key, value in visitor.keywords.items(): + if key == 'ext_modules': + if isinstance(value, list): + for ext in value: + if (isinstance(ext, ast.Call) and + isinstance(ext.func, ast.Name) and + ext.func.id == 'Extension' and + not has_non_literals(ext.args)): + extensions.append(ext.args[0]) + elif has_non_literals(value): + non_literals[key] = value + del visitor.keywords[key] + + return visitor.keywords, visitor.imported_modules, non_literals, extensions + + +class SetupScriptVisitor(ast.NodeVisitor): + def __init__(self): + ast.NodeVisitor.__init__(self) + self.keywords = {} + self.non_literals = [] + self.imported_modules = set() + + def visit_Expr(self, node): + if isinstance(node.value, ast.Call) and \ + isinstance(node.value.func, ast.Name) and \ + node.value.func.id == 'setup': + self.visit_setup(node.value) + + def visit_setup(self, node): + call = LiteralAstTransform().visit(node) + self.keywords = call.keywords + for k, v in self.keywords.iteritems(): + if has_non_literals(v): + self.non_literals.append(k) + + def visit_Import(self, node): + for alias in node.names: + self.imported_modules.add(alias.name) + + def visit_ImportFrom(self, node): + self.imported_modules.add(node.module) + + +class LiteralAstTransform(ast.NodeTransformer): + """Simplify the ast through evaluation of literals.""" + excluded_fields = ['ctx'] + + def visit(self, node): + if not isinstance(node, ast.AST): + return node + else: + return ast.NodeTransformer.visit(self, node) + + def generic_visit(self, node): + try: + return ast.literal_eval(node) + except ValueError: + for field, value in ast.iter_fields(node): + if field in self.excluded_fields: + delattr(node, field) + if value is None: + continue + + if isinstance(value, list): + if field in ('keywords', 'kwargs'): + new_value = dict((kw.arg, self.visit(kw.value)) for kw in value) + else: + new_value = [self.visit(i) for i in value] + else: + new_value = self.visit(value) + setattr(node, field, new_value) + return node + + def visit_Name(self, node): + if hasattr('__builtins__', node.id): + return getattr(__builtins__, node.id) + else: + return self.generic_visit(node) + + def visit_Tuple(self, node): + return tuple(self.visit(v) for v in node.elts) + + def visit_List(self, node): + return [self.visit(v) for v in node.elts] + + def visit_Set(self, node): + return set(self.visit(v) for v in node.elts) + + def visit_Dict(self, node): + keys = (self.visit(k) for k in node.keys) + values = (self.visit(v) for v in node.values) + return dict(zip(keys, values)) + + +def has_non_literals(value): + if isinstance(value, ast.AST): + return True + elif isinstance(value, basestring): + return False + elif hasattr(value, 'itervalues'): + return any(has_non_literals(v) for v in value.itervalues()) + elif hasattr(value, '__iter__'): + return any(has_non_literals(v) for v in value) + + +def plugin_init(pluginlist): + pass + + +def register_recipe_handlers(handlers): + # We need to make sure this is ahead of the makefile fallback handler + handlers.insert(0, PythonRecipeHandler()) diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py new file mode 100644 index 0000000000..e7861268a5 --- /dev/null +++ b/scripts/lib/scriptutils.py @@ -0,0 +1,60 @@ +# Script utility functions +# +# Copyright (C) 2014 Intel Corporation +# +# 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 sys +import os +import logging +import glob + +def logger_create(name): + logger = logging.getLogger(name) + loggerhandler = logging.StreamHandler() + loggerhandler.setFormatter(logging.Formatter("%(levelname)s: %(message)s")) + logger.addHandler(loggerhandler) + logger.setLevel(logging.INFO) + return logger + +def logger_setup_color(logger, color='auto'): + from bb.msg import BBLogFormatter + console = logging.StreamHandler(sys.stdout) + formatter = BBLogFormatter("%(levelname)s: %(message)s") + console.setFormatter(formatter) + logger.handlers = [console] + if color == 'always' or (color=='auto' and console.stream.isatty()): + formatter.enable_color() + + +def load_plugins(logger, plugins, pluginpath): + import imp + + def load_plugin(name): + logger.debug('Loading plugin %s' % name) + fp, pathname, description = imp.find_module(name, [pluginpath]) + try: + return imp.load_module(name, fp, pathname, description) + finally: + if fp: + fp.close() + + logger.debug('Loading plugins from %s...' % pluginpath) + for fn in glob.glob(os.path.join(pluginpath, '*.py')): + name = os.path.splitext(os.path.basename(fn))[0] + if name != '__init__': + plugin = load_plugin(name) + if hasattr(plugin, 'plugin_init'): + plugin.plugin_init(plugins) + plugins.append(plugin) diff --git a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py index 56b91aa9d9..b564b1a7ab 100644 --- a/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py +++ b/scripts/lib/wic/3rdparty/pykickstart/commands/partition.py @@ -78,7 +78,7 @@ class FC3_PartData(BaseData): if self.recommended: retval += " --recommended" if self.size and self.size != 0: - retval += " --size=%s" % self.size + retval += " --size=%sk" % self.size if hasattr(self, "start") and self.start != 0: retval += " --start=%s" % self.start @@ -216,7 +216,7 @@ class FC3_Partition(KickstartCommand): callback=part_cb, nargs=1, type="string") op.add_option("--recommended", dest="recommended", action="store_true", default=False) - op.add_option("--size", dest="size", action="store", type="int", + op.add_option("--size", dest="size", action="store", type="size", nargs=1) op.add_option("--start", dest="start", action="store", type="int", nargs=1) diff --git a/scripts/lib/wic/3rdparty/pykickstart/options.py b/scripts/lib/wic/3rdparty/pykickstart/options.py index 341c5d7298..b2d8e3e516 100644 --- a/scripts/lib/wic/3rdparty/pykickstart/options.py +++ b/scripts/lib/wic/3rdparty/pykickstart/options.py @@ -143,6 +143,24 @@ def _check_string(option, opt, value): else: return value +def _check_size(option, opt, value): + # Former default was MB + if (value.isdigit()): + return int(value) * 1024L + + mapping = {"opt": opt, "value": value} + if (not value[:-1].isdigit()): + raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) + + size = int(value[:-1]) + if (value.endswith("k") or value.endswith("K")): + return size + if (value.endswith("M")): + return size * 1024L + if (value.endswith("G")): + return size * 1024L * 1024L + raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) + # Creates a new Option class that supports several new attributes: # - required: any option with this attribute must be supplied or an exception # is thrown @@ -169,10 +187,11 @@ class KSOption (Option): ACTIONS = Option.ACTIONS + ("map", "map_extend",) STORE_ACTIONS = Option.STORE_ACTIONS + ("map", "map_extend",) - TYPES = Option.TYPES + ("ksboolean", "string") + TYPES = Option.TYPES + ("ksboolean", "string", "size") TYPE_CHECKER = copy(Option.TYPE_CHECKER) TYPE_CHECKER["ksboolean"] = _check_ksboolean TYPE_CHECKER["string"] = _check_string + TYPE_CHECKER["size"] = _check_size def _check_required(self): if self.required and not self.takes_value(): diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 6b2ab3368e..d368401af4 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -74,6 +74,22 @@ class DirectImageCreator(BaseImageCreator): self.kernel_dir = kernel_dir self.native_sysroot = native_sysroot + def __get_part_num(self, num, parts): + """calculate the real partition number, accounting for partitions not + in the partition table and logical partitions + """ + realnum = 0 + for n, p in enumerate(parts, 1): + if not p.no_table: + realnum += 1 + if n == num: + if p.no_table: + return 0 + if self._ptable_format == 'msdos' and realnum > 3: + # account for logical partition numbering, ex. sda5.. + return realnum + 1 + return realnum + def __write_fstab(self, image_rootfs): """overriden to generate fstab (temporarily) in rootfs. This is called from _create, make sure it doesn't get called from @@ -98,12 +114,16 @@ class DirectImageCreator(BaseImageCreator): def _update_fstab(self, fstab_lines, parts): """Assume partition order same as in wks""" for num, p in enumerate(parts, 1): - if not p.mountpoint or p.mountpoint == "/" or p.mountpoint == "/boot": + pnum = self.__get_part_num(num, parts) + if not p.mountpoint or p.mountpoint == "/" or p.mountpoint == "/boot" or pnum == 0: continue - if self._ptable_format == 'msdos' and num > 3: - device_name = "/dev/" + p.disk + str(num + 1) - else: - device_name = "/dev/" + p.disk + str(num) + + part = '' + # mmc device partitions are named mmcblk0p1, mmcblk0p2.. + if p.disk.startswith('mmcblk'): + part = 'p' + + device_name = "/dev/" + p.disk + part + str(pnum) opts = "defaults" if p.fsopts: @@ -230,6 +250,8 @@ class DirectImageCreator(BaseImageCreator): if not self.ks.handler.bootloader.source and p.mountpoint == "/boot": self.ks.handler.bootloader.source = p.source + fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) + for p in parts: # need to create the filesystems in order to get their # sizes before we can add them and do the layout. @@ -238,12 +260,9 @@ class DirectImageCreator(BaseImageCreator): # self.assemble() calls Image.assemble() which calls # __write_partitition() for each partition to dd the fs # into the partitions. - fstab = self.__write_fstab(self.rootfs_dir.get("ROOTFS_DIR")) - p.prepare(self, self.workdir, self.oe_builddir, self.rootfs_dir, self.bootimg_dir, self.kernel_dir, self.native_sysroot) - self._restore_fstab(fstab) self.__image.add_partition(int(p.size), p.disk, @@ -254,8 +273,11 @@ class DirectImageCreator(BaseImageCreator): fsopts = p.fsopts, boot = p.active, align = p.align, + no_table = p.no_table, part_type = p.part_type) + self._restore_fstab(fstab) + self.__image.layout_partitions(self._ptable_format) self.__imgdir = self.workdir @@ -342,10 +364,8 @@ class DirectImageCreator(BaseImageCreator): if p.disk.startswith('mmcblk'): part = 'p' - if self._ptable_format == 'msdos' and num > 3: - rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1) - else: - rootdev = "/dev/%s%s%-d" % (p.disk, part, num) + pnum = self.__get_part_num(num, parts) + rootdev = "/dev/%s%s%-d" % (p.disk, part, pnum) root_part_uuid = p.part_type return (rootdev, root_part_uuid) diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py index 600098293a..10959213d1 100644 --- a/scripts/lib/wic/kickstart/__init__.py +++ b/scripts/lib/wic/kickstart/__init__.py @@ -58,16 +58,13 @@ def read_kickstart(path): def __init__(self): superclass.__init__(self, mapping=commandMap[using_version]) - ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=False) + ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True) try: ks.readKickstart(path) except (kserrors.KickstartParseError, kserrors.KickstartError), err: - if msger.ask("Errors occured on kickstart file, skip and continue?"): - msger.warning("%s" % err) - pass - else: - raise errors.KsError("%s" % err) + msger.warning("Errors occurred when parsing kickstart file: %s\n" % path) + msger.error("%s" % err) return ks @@ -77,7 +74,7 @@ def get_image_size(ks, default = None): if p.mountpoint == "/" and p.size: __size = p.size if __size > 0: - return int(__size) * 1024L * 1024L + return int(__size) * 1024L else: return default diff --git a/scripts/lib/wic/kickstart/custom_commands/micpartition.py b/scripts/lib/wic/kickstart/custom_commands/micpartition.py index 43d04f1294..d6be008ceb 100644 --- a/scripts/lib/wic/kickstart/custom_commands/micpartition.py +++ b/scripts/lib/wic/kickstart/custom_commands/micpartition.py @@ -32,7 +32,7 @@ class Mic_PartData(FC4_PartData): retval = FC4_PartData._getArgsAsStr(self) if self.align: - retval += " --align" + retval += " --align=%d" % self.align if self.extopts: retval += " --extoptions=%s" % self.extopts if self.part_type: diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py index 54a494e033..f3d553b885 100644 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py @@ -49,6 +49,9 @@ class Wic_PartData(Mic_PartData): self.source = kwargs.get("source", None) self.sourceparams = kwargs.get("sourceparams", None) self.rootfs = kwargs.get("rootfs-dir", None) + self.no_table = kwargs.get("no-table", False) + self.extra_space = kwargs.get("extra-space", "10M") + self.overhead_factor = kwargs.get("overhead-factor", 1.3) self.source_file = "" self.size = 0 @@ -61,6 +64,10 @@ class Wic_PartData(Mic_PartData): retval += " --sourceparams=%s" % self.sourceparams if self.rootfs: retval += " --rootfs-dir=%s" % self.rootfs + if self.no_table: + retval += " --no-table" + retval += " --extra-space=%d" % self.extra_space + retval += " --overhead-factor=%f" % self.overhead_factor return retval @@ -99,7 +106,7 @@ class Wic_PartData(Mic_PartData): def get_extra_block_count(self, current_blocks): """ - The --size param is reflected in self.size (in MB), and we already + The --size param is reflected in self.size (in kB), and we already have current_blocks (1k) blocks, calculate and return the number of (1k) blocks we need to add to get to --size, 0 if we're already there or beyond. @@ -110,7 +117,7 @@ class Wic_PartData(Mic_PartData): if not self.size: return 0 - requested_blocks = self.size * 1024 + requested_blocks = self.size msger.debug("Requested blocks %d, current_blocks %d" % \ (requested_blocks, current_blocks)) @@ -171,7 +178,7 @@ class Wic_PartData(Mic_PartData): Handle an already-created partition e.g. xxx.ext3 """ rootfs = oe_builddir - du_cmd = "du -Lbms %s" % rootfs + du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) rootfs_size = out.split()[0] @@ -186,10 +193,15 @@ class Wic_PartData(Mic_PartData): Currently handles ext2/3/4, btrfs and vfat. """ - pseudo = "export PSEUDO_PREFIX=%s/usr;" % native_sysroot - pseudo += "export PSEUDO_LOCALSTATEDIR=%s/../pseudo;" % rootfs_dir - pseudo += "export PSEUDO_PASSWD=%s;" % rootfs_dir - pseudo += "export PSEUDO_NOSYMLINKEXP=1;" + p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot) + p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR", + "%s/../pseudo" % rootfs_dir) + p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir) + p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1") + pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix + pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir + pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd + pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp pseudo += "%s/usr/bin/pseudo " % native_sysroot if self.fstype.startswith("ext"): @@ -224,12 +236,11 @@ class Wic_PartData(Mic_PartData): actual_rootfs_size = int(out.split()[0]) extra_blocks = self.get_extra_block_count(actual_rootfs_size) - - if extra_blocks < IMAGE_EXTRA_SPACE: - extra_blocks = IMAGE_EXTRA_SPACE + if extra_blocks < self.extra_space: + extra_blocks = self.extra_space rootfs_size = actual_rootfs_size + extra_blocks - rootfs_size *= IMAGE_OVERHEAD_FACTOR + rootfs_size *= self.overhead_factor msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, self.mountpoint, rootfs_size)) @@ -240,15 +251,19 @@ class Wic_PartData(Mic_PartData): extra_imagecmd = "-i 8192" - mkfs_cmd = "mkfs.%s -F %s %s -d %s" % \ - (self.fstype, extra_imagecmd, rootfs, image_rootfs) + label_str = "" + if (self.label): + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ + (self.fstype, extra_imagecmd, rootfs, label_str, image_rootfs) (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) if rc: print "rootfs_dir: %s" % rootfs_dir msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) - # get the rootfs size in the right units for kickstart (Mb) - du_cmd = "du -Lbms %s" % rootfs + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) rootfs_size = out.split()[0] @@ -272,12 +287,11 @@ class Wic_PartData(Mic_PartData): actual_rootfs_size = int(out.split()[0]) extra_blocks = self.get_extra_block_count(actual_rootfs_size) - - if extra_blocks < IMAGE_EXTRA_SPACE: - extra_blocks = IMAGE_EXTRA_SPACE + if extra_blocks < self.extra_space: + extra_blocks = self.extra_space rootfs_size = actual_rootfs_size + extra_blocks - rootfs_size *= IMAGE_OVERHEAD_FACTOR + rootfs_size *= self.overhead_factor msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ (extra_blocks, self.mountpoint, rootfs_size)) @@ -286,14 +300,18 @@ class Wic_PartData(Mic_PartData): (rootfs, rootfs_size) exec_cmd(dd_cmd) - mkfs_cmd = "mkfs.%s -b %d -r %s %s" % \ - (self.fstype, rootfs_size * 1024, image_rootfs, rootfs) + label_str = "" + if (self.label): + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ + (self.fstype, rootfs_size * 1024, image_rootfs, label_str, rootfs) (rc, out) = exec_native_cmd(pseudo + mkfs_cmd, native_sysroot) if rc: msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details) when creating filesystem from rootfs directory: %s" % (self.fstype, rc, rootfs_dir)) - # get the rootfs size in the right units for kickstart (Mb) - du_cmd = "du -Lbms %s" % rootfs + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) rootfs_size = out.split()[0] @@ -313,9 +331,8 @@ class Wic_PartData(Mic_PartData): blocks = int(out.split()[0]) extra_blocks = self.get_extra_block_count(blocks) - - if extra_blocks < IMAGE_EXTRA_SPACE: - extra_blocks = IMAGE_EXTRA_SPACE + if extra_blocks < self.extra_space: + extra_blocks = self.extra_space blocks += extra_blocks @@ -330,7 +347,11 @@ class Wic_PartData(Mic_PartData): if blocks % 16 != 0: blocks += (16 - (blocks % 16)) - dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (rootfs, blocks) + label_str = "-n boot" + if (self.label): + label_str = "-n %s" % self.label + + dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, image_rootfs) @@ -341,8 +362,8 @@ class Wic_PartData(Mic_PartData): chmod_cmd = "chmod 644 %s" % rootfs exec_cmd(chmod_cmd) - # get the rootfs size in the right units for kickstart (Mb) - du_cmd = "du -Lbms %s" % rootfs + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) rootfs_size = out.split()[0] @@ -361,8 +382,8 @@ class Wic_PartData(Mic_PartData): (image_rootfs, rootfs) exec_native_cmd(pseudo + squashfs_cmd, native_sysroot) - # get the rootfs size in the right units for kickstart (Mb) - du_cmd = "du -Lbms %s" % rootfs + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) rootfs_size = out.split()[0] @@ -395,13 +416,18 @@ class Wic_PartData(Mic_PartData): """ fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ + dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ (fs, self.size) exec_cmd(dd_cmd) extra_imagecmd = "-i 8192" - mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) + label_str = "" + if (self.label): + label_str = "-L %s" % self.label + + mkfs_cmd = "mkfs.%s -F %s %s %s" % \ + (self.fstype, extra_imagecmd, label_str, fs) (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) if rc: msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) @@ -417,16 +443,16 @@ class Wic_PartData(Mic_PartData): """ fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ + dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ (fs, self.size) exec_cmd(dd_cmd) - mkfs_cmd = "mkfs.%s -b %d %s" % (self.fstype, self.size * 1024, rootfs) - (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) - if rc: - msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) + label_str = "" + if (self.label): + label_str = "-L %s" % self.label - mkfs_cmd = "mkfs.%s -F %s %s" % (self.fstype, extra_imagecmd, fs) + mkfs_cmd = "mkfs.%s -b %d %s %s" % \ + (self.fstype, self.size * 1024, label_str, fs) (rc, out) = exec_native_cmd(mkfs_cmd, native_sysroot) if rc: msger.error("ERROR: mkfs.%s returned '%s' instead of 0 (which you probably don't want to ignore, use --debug for details)" % (self.fstype, rc)) @@ -442,9 +468,13 @@ class Wic_PartData(Mic_PartData): """ fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype) - blocks = self.size * 1024 + blocks = self.size - dosfs_cmd = "mkdosfs -n boot -S 512 -C %s %d" % (fs, blocks) + label_str = "-n boot" + if (self.label): + label_str = "-n %s" % self.label + + dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks) exec_native_cmd(dosfs_cmd, native_sysroot) chmod_cmd = "chmod 644 %s" % fs @@ -474,8 +504,8 @@ class Wic_PartData(Mic_PartData): os.rmdir(tmpdir) - # get the rootfs size in the right units for kickstart (Mb) - du_cmd = "du -Lbms %s" % fs + # get the rootfs size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % fs out = exec_cmd(du_cmd) fs_size = out.split()[0] @@ -490,7 +520,7 @@ class Wic_PartData(Mic_PartData): """ fs = "%s/fs.%s" % (cr_workdir, self.fstype) - dd_cmd = "dd if=/dev/zero of=%s bs=1M seek=%d count=0" % \ + dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \ (fs, self.size) exec_cmd(dd_cmd) @@ -510,6 +540,11 @@ class Wic_Partition(Mic_Partition): removedAttrs = Mic_Partition.removedAttrs def _getParser(self): + def overhead_cb (option, opt_str, value, parser): + if (value < 1): + raise OptionValueError("Option %s: invalid value: %r" % (option, value)) + setattr(parser.values, option.dest, value) + op = Mic_Partition._getParser(self) # use specified source file to fill the partition # and calculate partition size @@ -521,4 +556,13 @@ class Wic_Partition(Mic_Partition): # use specified rootfs path to fill the partition op.add_option("--rootfs-dir", type="string", action="store", dest="rootfs", default=None) + # wether to add the partition in the partition table + op.add_option("--no-table", dest="no_table", action="store_true", + default=False) + # extra space beyond the partition size + op.add_option("--extra-space", dest="extra_space", action="store", + type="size", nargs=1, default="10M") + op.add_option("--overhead-factor", dest="overhead_factor", + action="callback", callback=overhead_cb, type="float", + nargs=1, default=1.3) return op diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index e4067b6dbf..ee57881e90 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -228,7 +228,7 @@ class BootimgEFIPlugin(SourcePlugin): chmod_cmd = "chmod 644 %s" % bootimg exec_cmd(chmod_cmd) - du_cmd = "du -Lbms %s" % bootimg + du_cmd = "du -Lbks %s" % bootimg out = exec_cmd(du_cmd) bootimg_size = out.split()[0] diff --git a/scripts/lib/wic/plugins/source/bootimg-partition.py b/scripts/lib/wic/plugins/source/bootimg-partition.py index abf24942e8..c5eb7b8b80 100644 --- a/scripts/lib/wic/plugins/source/bootimg-partition.py +++ b/scripts/lib/wic/plugins/source/bootimg-partition.py @@ -29,6 +29,7 @@ import re from wic import msger from wic.pluginbase import SourcePlugin from wic.utils.oe.misc import * +from glob import glob class BootimgPartitionPlugin(SourcePlugin): name = 'bootimg-partition' @@ -65,7 +66,7 @@ class BootimgPartitionPlugin(SourcePlugin): - copies all files listed in IMAGE_BOOT_FILES variable """ hdddir = "%s/boot" % cr_workdir - rm_cmd = "rm -rf %s" % cr_workdir + rm_cmd = "rm -rf %s/boot" % cr_workdir exec_cmd(rm_cmd) install_cmd = "install -d %s" % hdddir @@ -87,9 +88,11 @@ class BootimgPartitionPlugin(SourcePlugin): # list of tuples (src_name, dst_name) deploy_files = [] - for src_entry in re.findall(r'[\w;\-\./]+', boot_files): + for src_entry in re.findall(r'[\w;\-\./\*]+', boot_files): if ';' in src_entry: dst_entry = tuple(src_entry.split(';')) + if not dst_entry[0] or not dst_entry[1]: + msger.error('Malformed boot file entry: %s' % (src_entry)) else: dst_entry = (src_entry, src_entry) @@ -98,14 +101,36 @@ class BootimgPartitionPlugin(SourcePlugin): for deploy_entry in deploy_files: src, dst = deploy_entry - src_path = os.path.join(bootimg_dir, src) - dst_path = os.path.join(hdddir, dst) - - msger.debug('Install %s as %s' % (os.path.basename(src_path), - dst_path)) - install_cmd = "install -m 0644 -D %s %s" \ - % (src_path, dst_path) - exec_cmd(install_cmd) + install_task = [] + if '*' in src: + # by default install files under their basename + entry_name_fn = os.path.basename + if dst != src: + # unless a target name was given, then treat name + # as a directory and append a basename + entry_name_fn = lambda name: \ + os.path.join(dst, + os.path.basename(name)) + + srcs = glob(os.path.join(bootimg_dir, src)) + + msger.debug('Globbed sources: %s' % (', '.join(srcs))) + for entry in srcs: + entry_dst_name = entry_name_fn(entry) + install_task.append((entry, + os.path.join(hdddir, + entry_dst_name))) + else: + install_task = [(os.path.join(bootimg_dir, src), + os.path.join(hdddir, dst))] + + for task in install_task: + src_path, dst_path = task + msger.debug('Install %s as %s' % (os.path.basename(src_path), + dst_path)) + install_cmd = "install -m 0644 -D %s %s" \ + % (src_path, dst_path) + exec_cmd(install_cmd) msger.debug('Prepare boot partition using rootfs in %s' % (hdddir)) part.prepare_rootfs(cr_workdir, oe_builddir, hdddir, diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 8a1aca1ad1..c4786a6e0e 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -190,7 +190,7 @@ class BootimgPcbiosPlugin(SourcePlugin): chmod_cmd = "chmod 644 %s" % bootimg exec_cmd(chmod_cmd) - du_cmd = "du -Lbms %s" % bootimg + du_cmd = "du -Lbks %s" % bootimg out = exec_cmd(du_cmd) bootimg_size = out.split()[0] diff --git a/scripts/lib/wic/plugins/source/fsimage.py b/scripts/lib/wic/plugins/source/fsimage.py new file mode 100644 index 0000000000..0967883afa --- /dev/null +++ b/scripts/lib/wic/plugins/source/fsimage.py @@ -0,0 +1,70 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# 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 +import re + +from wic import msger +from wic.pluginbase import SourcePlugin +from wic.utils.oe.misc import * + +class FSImagePlugin(SourcePlugin): + name = 'fsimage' + + @classmethod + def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. Do nothing. + """ + pass + + @classmethod + def do_configure_partition(self, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(). Possibly prepare + configuration files of some sort. + """ + pass + + @classmethod + def do_prepare_partition(self, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + """ + if not bootimg_dir: + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + + msger.debug('Bootimg dir: %s' % bootimg_dir) + + if ('file' not in source_params): + msger.error("No file specified\n") + return + + src = os.path.join(bootimg_dir, source_params['file']) + + + msger.debug('Preparing partition using image %s' % (src)) + part.prepare_rootfs_from_fs_image(cr_workdir, src, "") diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py new file mode 100644 index 0000000000..cf6236a04f --- /dev/null +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -0,0 +1,84 @@ +# ex:ts=4:sw=4:sts=4:et +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- +# +# 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 +import re + +from wic import msger +from wic.pluginbase import SourcePlugin +from wic.utils.oe.misc import * + +class RawCopyPlugin(SourcePlugin): + name = 'rawcopy' + + @classmethod + def do_install_disk(self, disk, disk_name, cr, workdir, oe_builddir, + bootimg_dir, kernel_dir, native_sysroot): + """ + Called after all partitions have been prepared and assembled into a + disk image. Do nothing. + """ + pass + + @classmethod + def do_configure_partition(self, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + native_sysroot): + """ + Called before do_prepare_partition(). Possibly prepare + configuration files of some sort. + """ + pass + + @classmethod + def do_prepare_partition(self, part, source_params, cr, cr_workdir, + oe_builddir, bootimg_dir, kernel_dir, + rootfs_dir, native_sysroot): + """ + Called to do the actual content population for a partition i.e. it + 'prepares' the partition to be incorporated into the image. + """ + if not bootimg_dir: + bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") + if not bootimg_dir: + msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") + + msger.debug('Bootimg dir: %s' % bootimg_dir) + + if ('file' not in source_params): + msger.error("No file specified\n") + return + + src = os.path.join(bootimg_dir, source_params['file']) + dst = src + + if ('skip' in source_params): + dst = os.path.join(cr_workdir, source_params['file']) + dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \ + (src, dst, source_params['skip']) + exec_cmd(dd_cmd) + + # get the size in the right units for kickstart (kB) + du_cmd = "du -Lbks %s" % dst + out = exec_cmd(du_cmd) + filesize = out.split()[0] + + if filesize > part.size: + part.size = filesize + + part.source_file = dst + diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py index b0b5baab73..ea9b6e8ec4 100644 --- a/scripts/lib/wic/utils/oe/misc.py +++ b/scripts/lib/wic/utils/oe/misc.py @@ -122,8 +122,6 @@ def add_wks_var(key, val): wks_vars[key] = val BOOTDD_EXTRA_SPACE = 16384 -IMAGE_EXTRA_SPACE = 10240 -IMAGE_OVERHEAD_FACTOR = 1.3 __bitbake_env_lines = "" diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index fb95cc790e..162f8e1b9c 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -29,6 +29,9 @@ from wic.utils.oe.misc import * # Overhead of the MBR partitioning scheme (just one sector) MBR_OVERHEAD = 1 +# Overhead of the GPT partitioning scheme +GPT_OVERHEAD = 34 + # Size of a sector in bytes SECTOR_SIZE = 512 @@ -61,6 +64,7 @@ class Image: self.disks[disk_name] = \ { 'disk': None, # Disk object 'numpart': 0, # Number of allocate partitions + 'realpart': 0, # Number of partitions in the partition table 'partitions': [], # Indexes to self.partitions 'offset': 0, # Offset of next partition (in sectors) # Minimum required disk size to fit all partitions (in bytes) @@ -85,15 +89,15 @@ class Image: self.__add_disk(part['disk_name']) def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None, - label=None, fsopts = None, boot = False, align = None, + label=None, fsopts = None, boot = False, align = None, no_table=False, part_type = None): """ Add the next partition. Prtitions have to be added in the first-to-last order. """ ks_pnum = len(self.partitions) - # Converting MB to sectors for parted - size = size * 1024 * 1024 / self.sector_size + # Converting kB to sectors for parted + size = size * 1024 / self.sector_size # We still need partition for "/" or non-subvolume if mountpoint == "/" or not fsopts: @@ -109,6 +113,7 @@ class Image: 'num': None, # Partition number 'boot': boot, # Bootable flag 'align': align, # Partition alignment + 'no_table' : no_table, # Partition does not appear in partition table 'part_type' : part_type } # Partition type self.__add_partition(part) @@ -120,7 +125,7 @@ class Image: msger.debug("Assigning %s partitions to disks" % ptable_format) - if ptable_format not in ('msdos'): + if ptable_format not in ('msdos', 'gpt'): raise ImageError("Unknown partition table format '%s', supported " \ "formats are: 'msdos'" % ptable_format) @@ -147,15 +152,26 @@ class Image: # Get the disk where the partition is located d = self.disks[p['disk_name']] d['numpart'] += 1 + if not p['no_table']: + d['realpart'] += 1 d['ptable_format'] = ptable_format if d['numpart'] == 1: if ptable_format == "msdos": overhead = MBR_OVERHEAD + elif ptable_format == "gpt": + overhead = GPT_OVERHEAD # Skip one sector required for the partitioning scheme overhead d['offset'] += overhead + if d['realpart'] > 3: + # Reserve a sector for EBR for every logical partition + # before alignment is performed. + if ptable_format == "msdos": + d['offset'] += 1 + + if p['align']: # If not first partition and we do have alignment set we need # to align the partition. @@ -182,20 +198,15 @@ class Image: d['offset'] += p['size'] p['type'] = 'primary' - p['num'] = d['numpart'] + if not p['no_table']: + p['num'] = d['realpart'] + else: + p['num'] = 0 if d['ptable_format'] == "msdos": - if d['numpart'] > 2: - # Every logical partition requires an additional sector for - # the EBR, so steal the last sector from the end of each - # partition starting from the 3rd one for the EBR. This - # will make sure the logical partitions are aligned - # correctly. - p['size'] -= 1 - - if d['numpart'] > 3: + if d['realpart'] > 3: p['type'] = 'logical' - p['num'] = d['numpart'] + 1 + p['num'] = d['realpart'] + 1 d['partitions'].append(n) msger.debug("Assigned %s to %s%d, sectors range %d-%d size %d " @@ -208,6 +219,8 @@ class Image: # minumim disk sizes. for disk_name, d in self.disks.items(): d['min_size'] = d['offset'] + if d['ptable_format'] == "gpt": + d['min_size'] += GPT_OVERHEAD d['min_size'] *= self.sector_size @@ -257,15 +270,25 @@ class Image: msger.debug("Creating partitions") for p in self.partitions: + if p['num'] == 0: + continue + d = self.disks[p['disk_name']] if d['ptable_format'] == "msdos" and p['num'] == 5: - # The last sector of the 3rd partition was reserved for the EBR - # of the first _logical_ partition. This is why the extended - # partition should start one sector before the first logical - # partition. + # Create an extended partition (note: extended + # partition is described in MBR and contains all + # logical partitions). The logical partitions save a + # sector for an EBR just before the start of a + # partition. The extended partition must start one + # sector before the start of the first logical + # partition. This way the first EBR is inside of the + # extended partition. Since the extended partitions + # starts a sector before the first logical partition, + # add a sector at the back, so that there is enough + # room for all logical partitions. self.__create_partition(d['disk'].device, "extended", None, p['start'] - 1, - d['offset'] - p['start']) + d['offset'] - p['start'] + 1) if p['fstype'] == "swap": parted_fs_type = "linux-swap" @@ -338,14 +361,6 @@ class Image: for p in self.partitions: d = self.disks[p['disk_name']] - if d['ptable_format'] == "msdos" and p['num'] == 5: - # The last sector of the 3rd partition was reserved for the EBR - # of the first _logical_ partition. This is why the extended - # partition should start one sector before the first logical - # partition. - self.__write_partition(p['num'], p['source_file'], - p['start'] - 1, - d['offset'] - p['start']) self.__write_partition(p['num'], p['source_file'], p['start'], p['size']) diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal index bba6f8fea3..9ed2721536 100755 --- a/scripts/oe-buildenv-internal +++ b/scripts/oe-buildenv-internal @@ -24,7 +24,7 @@ if [ -z "$OEROOT" ]; then return 1 fi -if [ ! -z "$OECORE_SDK_VERSION" ]; then +if [ -z "$OE_SKIP_SDK_CHECK" -a ! -z "$OECORE_SDK_VERSION" ]; then echo >&2 "Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script." return 1 fi diff --git a/scripts/oe-git-proxy b/scripts/oe-git-proxy index 0ce7ed090e..48734556a1 100755 --- a/scripts/oe-git-proxy +++ b/scripts/oe-git-proxy @@ -19,7 +19,7 @@ # Locate the netcat binary SOCAT=$(which socat 2>/dev/null) if [ $? -ne 0 ]; then - echo "ERROR: socat binary not in PATH" + echo "ERROR: socat binary not in PATH" 1>&2 exit 1 fi METHOD="" diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index bf8754749e..b075775b8f 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util @@ -4,7 +4,7 @@ # # Written by: Paul Eggleton <paul.eggleton@linux.intel.com> # -# Copyright 2012-2013 Intel Corporation +# Copyright 2012-2015 Intel Corporation # # 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 @@ -25,30 +25,43 @@ import os import os.path import fnmatch import re -import optparse -from collections import defaultdict - -def glob(args, usage, debug=False): - if len(args) < 3: - usage() - sys.exit(1) - - pkgdata_dir = args[0] - pkglist_file = args[1] - globs = args[2].split() - - if not os.path.exists(pkgdata_dir): - print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) - sys.exit(1) - - if not os.path.exists(pkglist_file): - print('ERROR: Unable to find package list file %s' % pkglist_file) +import argparse +import logging +from collections import defaultdict, OrderedDict + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +logger = scriptutils.logger_create('pkgdatautil') + +def tinfoil_init(): + import bb.tinfoil + import logging + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare(True) + + tinfoil.logger.setLevel(logging.WARNING) + return tinfoil + + +def glob(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + globs = [] + for globitem in args.glob: + globs.extend(globitem.split()) + + if not os.path.exists(args.pkglistfile): + logger.error('Unable to find package list file %s' % args.pkglistfile) sys.exit(1) - skipregex = re.compile("-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-") + skipval = "-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-" + if args.exclude: + skipval += "|" + args.exclude + skipregex = re.compile(skipval) mappedpkgs = set() - with open(pkglist_file, 'r') as f: + with open(args.pkglistfile, 'r') as f: for line in f: fields = line.rstrip().split() if not fields: @@ -59,8 +72,7 @@ def glob(args, usage, debug=False): # Skip packages for which there is no point applying globs if skipregex.search(pkg): - if debug: - print("%s -> !!" % pkg) + logger.debug("%s -> !!" % pkg) continue # Skip packages that already match the globs, so if e.g. a dev package @@ -72,15 +84,14 @@ def glob(args, usage, debug=False): already = True break if already: - if debug: - print("%s -> !" % pkg) + logger.debug("%s -> !" % pkg) continue # Define some functions def revpkgdata(pkgn): - return os.path.join(pkgdata_dir, "runtime-reverse", pkgn) + return os.path.join(args.pkgdata_dir, "runtime-reverse", pkgn) def fwdpkgdata(pkgn): - return os.path.join(pkgdata_dir, "runtime", pkgn) + return os.path.join(args.pkgdata_dir, "runtime", pkgn) def readpn(pkgdata_file): pn = "" with open(pkgdata_file, 'r') as f: @@ -130,113 +141,104 @@ def glob(args, usage, debug=False): mappedpkg = "" else: # Package doesn't even exist... - if debug: - print "%s is not a valid package!" % (pkg) + logger.debug("%s is not a valid package!" % (pkg)) break if mappedpkg: - if debug: - print "%s (%s) -> %s" % (pkg, g, mappedpkg) + logger.debug("%s (%s) -> %s" % (pkg, g, mappedpkg)) mappedpkgs.add(mappedpkg) else: - if debug: - print "%s (%s) -> ?" % (pkg, g) + logger.debug("%s (%s) -> ?" % (pkg, g)) - if debug: - print "------" + logger.debug("------") print("\n".join(mappedpkgs)) -def read_value(args, usage, debug=False): - if len(args) < 3: - usage() - sys.exit(1) - - pkgdata_dir = args[0] - var = args[1] - packages = args[2].split() - - if not os.path.exists(pkgdata_dir): - print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) - sys.exit(1) +def read_value(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + packages = [] + for pkgitem in args.pkg: + packages.extend(pkgitem.split()) - def readvar(pkgdata_file, var): + def readvar(pkgdata_file, valuename): val = "" with open(pkgdata_file, 'r') as f: for line in f: - if line.startswith(var + ":"): - val = line.split(': ')[1].rstrip() + if line.startswith(valuename + ":"): + val = line.split(': ', 1)[1].rstrip() return val - if debug: - print "read-value('%s', '%s' '%s'" % (pkgdata_dir, var, packages) + logger.debug("read-value('%s', '%s' '%s'" % (args.pkgdata_dir, args.valuename, packages)) for package in packages: pkg_split = package.split('_') pkg_name = pkg_split[0] - if debug: - print "package: '%s'" % pkg_name - revlink = os.path.join(pkgdata_dir, "runtime-reverse", pkg_name) - if debug: - print(revlink) + logger.debug("package: '%s'" % pkg_name) + revlink = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg_name) + logger.debug(revlink) if os.path.exists(revlink): mappedpkg = os.path.basename(os.readlink(revlink)) - qvar = var + qvar = args.valuename if qvar == "PKGSIZE": # append packagename - qvar = "%s_%s" % (var, mappedpkg) + qvar = "%s_%s" % (args.valuename, mappedpkg) # PKGSIZE is now in bytes, but we we want it in KB pkgsize = (int(readvar(revlink, qvar)) + 1024 // 2) // 1024 print("%d" % pkgsize) else: print(readvar(revlink, qvar)) -def lookup_pkg(args, usage, debug=False): - if len(args) < 2: - usage() - sys.exit(1) +def lookup_pkglist(pkgs, pkgdata_dir, reverse): + if reverse: + mappings = OrderedDict() + for pkg in pkgs: + revlink = os.path.join(pkgdata_dir, "runtime-reverse", pkg) + logger.debug(revlink) + if os.path.exists(revlink): + mappings[pkg] = os.path.basename(os.readlink(revlink)) + else: + mappings = defaultdict(list) + for pkg in pkgs: + pkgfile = os.path.join(pkgdata_dir, 'runtime', pkg) + if os.path.exists(pkgfile): + with open(pkgfile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0] == 'PKG_%s' % pkg: + mappings[pkg].append(fields[1]) + break + return mappings - pkgdata_dir = args[0] - pkgs = args[1].split() +def lookup_pkg(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + pkgs = [] + for pkgitem in args.pkg: + pkgs.extend(pkgitem.split()) - if not os.path.exists(pkgdata_dir): - print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) - sys.exit(1) + mappings = lookup_pkglist(pkgs, args.pkgdata_dir, args.reverse) - mappings = defaultdict(list) - for pkg in pkgs: - pkgfile = os.path.join(pkgdata_dir, 'runtime', pkg) - if os.path.exists(pkgfile): - with open(pkgfile, 'r') as f: - for line in f: - fields = line.rstrip().split(': ') - if fields[0] == 'PKG_%s' % pkg: - mappings[pkg].append(fields[1]) - break if len(mappings) < len(pkgs): missing = list(set(pkgs) - set(mappings.keys())) - sys.stderr.write("ERROR: the following packages could not be found: %s\n" % ', '.join(missing)) + logger.error("The following packages could not be found: %s" % ', '.join(missing)) sys.exit(1) - items = [] - for pkg in pkgs: - items.extend(mappings.get(pkg, [])) - print '\n'.join(items) - -def lookup_recipe(args, usage, debug=False): - if len(args) < 2: - usage() - sys.exit(1) + if args.reverse: + items = mappings.values() + else: + items = [] + for pkg in pkgs: + items.extend(mappings.get(pkg, [])) - pkgdata_dir = args[0] - pkgs = args[1].split() + print('\n'.join(items)) - if not os.path.exists(pkgdata_dir): - print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) - sys.exit(1) +def lookup_recipe(args): + # Handle both multiple arguments and multiple values within an arg (old syntax) + pkgs = [] + for pkgitem in args.pkg: + pkgs.extend(pkgitem.split()) mappings = defaultdict(list) for pkg in pkgs: - pkgfile = os.path.join(pkgdata_dir, 'runtime-reverse', pkg) + pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg) if os.path.exists(pkgfile): with open(pkgfile, 'r') as f: for line in f: @@ -246,30 +248,155 @@ def lookup_recipe(args, usage, debug=False): break if len(mappings) < len(pkgs): missing = list(set(pkgs) - set(mappings.keys())) - sys.stderr.write("ERROR: the following packages could not be found: %s\n" % ', '.join(missing)) + logger.error("The following packages could not be found: %s" % ', '.join(missing)) sys.exit(1) items = [] for pkg in pkgs: items.extend(mappings.get(pkg, [])) - print '\n'.join(items) + print('\n'.join(items)) -def find_path(args, usage, debug=False): - if len(args) < 2: - usage() +def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged): + recipedatafile = os.path.join(pkgdata_dir, recipe) + if not os.path.exists(recipedatafile): + logger.error("Unable to find packaged recipe with name %s" % recipe) sys.exit(1) + packages = [] + with open(recipedatafile, 'r') as f: + for line in f: + fields = line.rstrip().split(': ') + if fields[0] == 'PACKAGES': + packages = fields[1].split() + break + + if not unpackaged: + pkglist = [] + for pkg in packages: + if os.path.exists(os.path.join(pkgdata_dir, 'runtime', '%s.packaged' % pkg)): + pkglist.append(pkg) + return pkglist + else: + return packages - pkgdata_dir = args[0] - targetpath = args[1] +def list_pkgs(args): + found = False - if not os.path.exists(pkgdata_dir): - print('ERROR: Unable to find pkgdata directory %s' % pkgdata_dir) + def matchpkg(pkg): + if args.pkgspec: + matched = False + for pkgspec in args.pkgspec: + if fnmatch.fnmatchcase(pkg, pkgspec): + matched = True + break + if not matched: + return False + if not args.unpackaged: + if args.runtime: + revlink = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg) + if os.path.exists(revlink): + # We're unlikely to get here if the package was not packaged, but just in case + # we add the symlinks for unpackaged files in the future + mappedpkg = os.path.basename(os.readlink(revlink)) + if not os.path.exists(os.path.join(args.pkgdata_dir, 'runtime', '%s.packaged' % mappedpkg)): + return False + else: + return False + else: + if not os.path.exists(os.path.join(args.pkgdata_dir, 'runtime', '%s.packaged' % pkg)): + return False + return True + + if args.recipe: + packages = get_recipe_pkgs(args.pkgdata_dir, args.recipe, args.unpackaged) + + if args.runtime: + pkglist = [] + runtime_pkgs = lookup_pkglist(packages, args.pkgdata_dir, False) + for rtpkgs in runtime_pkgs.values(): + pkglist.extend(rtpkgs) + else: + pkglist = packages + + for pkg in pkglist: + if matchpkg(pkg): + found = True + print("%s" % pkg) + else: + if args.runtime: + searchdir = 'runtime-reverse' + else: + searchdir = 'runtime' + + for root, dirs, files in os.walk(os.path.join(args.pkgdata_dir, searchdir)): + for fn in files: + if fn.endswith('.packaged'): + continue + if matchpkg(fn): + found = True + print("%s" % fn) + if not found: + if args.pkgspec: + logger.error("Unable to find any package matching %s" % args.pkgspec) + else: + logger.error("No packages found") sys.exit(1) +def list_pkg_files(args): import json - import fnmatch - for root, dirs, files in os.walk(os.path.join(pkgdata_dir, 'runtime')): + if args.recipe: + if args.pkg: + logger.error("list-pkg-files: If -p/--recipe is specified then a package name cannot be specified") + sys.exit(1) + recipepkglist = get_recipe_pkgs(args.pkgdata_dir, args.recipe, args.unpackaged) + if args.runtime: + pkglist = [] + runtime_pkgs = lookup_pkglist(recipepkglist, args.pkgdata_dir, False) + for rtpkgs in runtime_pkgs.values(): + pkglist.extend(rtpkgs) + else: + pkglist = recipepkglist + else: + if not args.pkg: + logger.error("list-pkg-files: If -p/--recipe is not specified then at least one package name must be specified") + sys.exit(1) + pkglist = args.pkg + + for pkg in pkglist: + print("%s:" % pkg) + if args.runtime: + pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg) + if not os.path.exists(pkgdatafile): + if args.recipe: + # This package was empty and thus never packaged, ignore + continue + logger.error("Unable to find any built runtime package named %s" % pkg) + sys.exit(1) + else: + pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg) + if not os.path.exists(pkgdatafile): + logger.error("Unable to find any built recipe-space package named %s" % pkg) + sys.exit(1) + + with open(pkgdatafile, 'r') as f: + found = False + for line in f: + if line.startswith('FILES_INFO:'): + found = True + val = line.split(':', 1)[1].strip() + dictval = json.loads(val) + for fullpth in sorted(dictval): + print("\t%s" % fullpth) + break + if not found: + logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile) + sys.exit(1) + +def find_path(args): + import json + + found = False + for root, dirs, files in os.walk(os.path.join(args.pkgdata_dir, 'runtime')): for fn in files: with open(os.path.join(root,fn)) as f: for line in f: @@ -277,55 +404,101 @@ def find_path(args, usage, debug=False): val = line.split(':', 1)[1].strip() dictval = json.loads(val) for fullpth in dictval.keys(): - if fnmatch.fnmatchcase(fullpth, targetpath): + if fnmatch.fnmatchcase(fullpth, args.targetpath): + found = True print("%s: %s" % (fn, fullpth)) break + if not found: + logger.error("Unable to find any package producing path %s" % args.targetpath) + sys.exit(1) def main(): - parser = optparse.OptionParser( - usage = '''%prog [options] <command> <arguments> - -Available commands: - glob <pkgdatadir> <pkglistfile> "<globs>" - expand one or more glob expressions over the packages listed in - pkglistfile (one package per line) - lookup-pkg <pkgdatadir> "<recipe-pkgs>" - look up the specified recipe-space package name(s) to see what the - final runtime package name is (e.g. eglibc becomes libc6) - lookup-recipe <pkgdatadir> "<pkgs>" - look up the specified package(s) to see which recipe they were - produced by - find-path <pkgdatadir> <path> - find the package providing the specified path (wildcards * ? allowed) - read-value <pkgdatadir> <value-name> "<pkgs>" - read the named value from the pkgdata files for the specified - packages''') - - parser.add_option("-d", "--debug", - help = "Enable debug output", - action="store_true", dest="debug", default=False) - - options, args = parser.parse_args(sys.argv) - args = args[1:] - - if len(args) < 1: - parser.print_help() + parser = argparse.ArgumentParser(description="OpenEmbedded pkgdata tool - queries the pkgdata files written out during do_package", + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-p', '--pkgdata-dir', help='Path to pkgdata directory (determined automatically if not specified)') + subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') + + parser_lookup_pkg = subparsers.add_parser('lookup-pkg', + help='Translate between recipe-space package names and runtime package names', + description='Looks up the specified recipe-space package name(s) to see what the final runtime package name is (e.g. glibc becomes libc6), or with -r/--reverse looks up the other way.') + parser_lookup_pkg.add_argument('pkg', nargs='+', help='Package name to look up') + parser_lookup_pkg.add_argument('-r', '--reverse', help='Switch to looking up recipe-space package names from runtime package names', action='store_true') + parser_lookup_pkg.set_defaults(func=lookup_pkg) + + parser_list_pkgs = subparsers.add_parser('list-pkgs', + help='List packages', + description='Lists packages that have been built') + parser_list_pkgs.add_argument('pkgspec', nargs='*', help='Package name to search for (wildcards * ? allowed, use quotes to avoid shell expansion)') + parser_list_pkgs.add_argument('-r', '--runtime', help='Show runtime package names instead of recipe-space package names', action='store_true') + parser_list_pkgs.add_argument('-p', '--recipe', help='Limit to packages produced by the specified recipe') + parser_list_pkgs.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages', action='store_true') + parser_list_pkgs.set_defaults(func=list_pkgs) + + parser_list_pkg_files = subparsers.add_parser('list-pkg-files', + help='List files within a package', + description='Lists files included in one or more packages') + parser_list_pkg_files.add_argument('pkg', nargs='*', help='Package name to report on (if -p/--recipe is not specified)') + parser_list_pkg_files.add_argument('-r', '--runtime', help='Specified package(s) are runtime package names instead of recipe-space package names', action='store_true') + parser_list_pkg_files.add_argument('-p', '--recipe', help='Report on all packages produced by the specified recipe') + parser_list_pkg_files.add_argument('-u', '--unpackaged', help='Include unpackaged (i.e. empty) packages (only useful with -p/--recipe)', action='store_true') + parser_list_pkg_files.set_defaults(func=list_pkg_files) + + parser_lookup_recipe = subparsers.add_parser('lookup-recipe', + help='Find recipe producing one or more packages', + description='Looks up the specified runtime package(s) to see which recipe they were produced by') + parser_lookup_recipe.add_argument('pkg', nargs='+', help='Runtime package name to look up') + parser_lookup_recipe.set_defaults(func=lookup_recipe) + + parser_find_path = subparsers.add_parser('find-path', + help='Find package providing a target path', + description='Finds the recipe-space package providing the specified target path') + parser_find_path.add_argument('targetpath', help='Path to find (wildcards * ? allowed, use quotes to avoid shell expansion)') + parser_find_path.set_defaults(func=find_path) + + parser_read_value = subparsers.add_parser('read-value', + help='Read any pkgdata value for one or more packages', + description='Reads the named value from the pkgdata files for the specified packages') + parser_read_value.add_argument('valuename', help='Name of the value to look up') + parser_read_value.add_argument('pkg', nargs='+', help='Runtime package name to look up') + parser_read_value.set_defaults(func=read_value) + + parser_glob = subparsers.add_parser('glob', + help='Expand package name glob expression', + description='Expands one or more glob expressions over the packages listed in pkglistfile') + parser_glob.add_argument('pkglistfile', help='File listing packages (one package name per line)') + parser_glob.add_argument('glob', nargs="+", help='Glob expression for package names, e.g. *-dev') + parser_glob.add_argument('-x', '--exclude', help='Exclude packages matching specified regex from the glob operation') + parser_glob.set_defaults(func=glob) + + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + + if not args.pkgdata_dir: + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Found bitbake path: %s' % bitbakepath) + tinfoil = tinfoil_init() + args.pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) + logger.debug('Value of PKGDATA_DIR is "%s"' % args.pkgdata_dir) + if not args.pkgdata_dir: + logger.error('Unable to determine pkgdata directory from PKGDATA_DIR') + sys.exit(1) + + if not os.path.exists(args.pkgdata_dir): + logger.error('Unable to find pkgdata directory %s' % pkgdata_dir) sys.exit(1) - if args[0] == "glob": - glob(args[1:], parser.print_help, options.debug) - elif args[0] == "lookup-pkg": - lookup_pkg(args[1:], parser.print_help, options.debug) - elif args[0] == "lookup-recipe": - lookup_recipe(args[1:], parser.print_help, options.debug) - elif args[0] == "find-path": - find_path(args[1:], parser.print_help, options.debug) - elif args[0] == "read-value": - read_value(args[1:], parser.print_help, options.debug) - else: - parser.print_help() - sys.exit(1) + ret = args.func(args) + + return ret if __name__ == "__main__": diff --git a/scripts/oe-selftest b/scripts/oe-selftest index 2332b224ee..a04e9fc96c 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -66,6 +66,7 @@ def get_args_parser(): group.add_argument('--run-tests', required=False, action='store', nargs='*', dest="run_tests", default=None, help='Select what tests to run (modules, classes or test methods). Format should be: <module>.<class>.<test_method>') group.add_argument('--run-all-tests', required=False, action="store_true", dest="run_all_tests", default=False, help='Run all (unhidden) tests') group.add_argument('--list-modules', required=False, action="store_true", dest="list_modules", default=False, help='List all available test modules.') + group.add_argument('--list-classes', required=False, action="store_true", dest="list_allclasses", default=False, help='List all available test classes.') return parser @@ -102,6 +103,8 @@ def add_include(): def remove_include(): builddir = os.environ.get("BUILDDIR") + if builddir is None: + return if "#include added by oe-selftest.py" \ in ftools.read_file(os.path.join(builddir, "conf/local.conf")): log.info("Removing the include from local.conf") @@ -116,7 +119,7 @@ def remove_inc_files(): for f in files: if f == 'test_recipe.inc': os.remove(os.path.join(root, f)) - except OSError as e: + except (AttributeError, OSError,) as e: # AttributeError may happen if BUILDDIR is not set pass def get_tests(exclusive_modules=[], include_hidden=False): @@ -136,6 +139,9 @@ def main(): parser = get_args_parser() args = parser.parse_args() + if args.list_allclasses: + args.list_modules = True + if args.list_modules: log.info('Listing all available test modules:') testslist = get_tests(include_hidden=True) @@ -145,6 +151,22 @@ def main(): if module.startswith('_'): info = ' (hidden)' print module + info + if args.list_allclasses: + try: + import importlib + modlib = importlib.import_module(test) + for v in vars(modlib): + t = vars(modlib)[v] + if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest: + print " --", v + for method in dir(t): + if method.startswith("test_"): + print " -- --", method + + except (AttributeError, ImportError) as e: + print e + pass + if args.run_tests or args.run_all_tests: if not preflight_check(): diff --git a/scripts/oe-setup-builddir b/scripts/oe-setup-builddir index c91e079512..f73aa3416d 100755 --- a/scripts/oe-setup-builddir +++ b/scripts/oe-setup-builddir @@ -66,6 +66,7 @@ if [ -n "$TEMPLATECONF" ]; then OECORENOTESCONF="$TEMPLATECONF/conf-notes.txt" fi +unset SHOWYPDOC if [ -z "$OECORELOCALCONF" ]; then OECORELOCALCONF="$OEROOT/meta/conf/local.conf.sample" fi @@ -77,15 +78,9 @@ 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 + SHOWYPDOC=yes fi if [ -z "$OECORELAYERCONF" ]; then @@ -97,14 +92,6 @@ 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 @@ -114,12 +101,27 @@ EOM sed -e "s|##OEROOT##|$OEROOT|g" \ -e "s|##COREBASE##|$OEROOT|g" \ $OECORELAYERCONF > $BUILDDIR/conf/bblayers.conf + SHOWYPDOC=yes fi # Prevent disturbing a new GIT clone in same console unset OECORELOCALCONF unset OECORELAYERCONF +# Ending the first-time run message. Show the YP Documentation banner. +if [ ! -z "$SHOWYPDOC" ]; then + cat <<EOM +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 +# unset SHOWYPDOC +fi + cat <<EOM ### Shell environment set up for builds. ### diff --git a/scripts/postinst-intercepts/postinst_intercept b/scripts/postinst-intercepts/postinst_intercept index 27c256834c..a257198bbd 100755 --- a/scripts/postinst-intercepts/postinst_intercept +++ b/scripts/postinst-intercepts/postinst_intercept @@ -41,7 +41,7 @@ fi chmod +x "$intercept_script" -pkgs_line="$(cat $intercept_script|grep "##PKGS:")" +pkgs_line=$(grep "##PKGS:" $intercept_script) if [ -n "$pkgs_line" ]; then # line exists, add this package to the list only if it's not already there if [ -z "$(echo "$pkgs_line" | grep " $package_name ")" ]; then diff --git a/scripts/postinst-intercepts/update_font_cache b/scripts/postinst-intercepts/update_font_cache index 78f33651e9..c8c6018f27 100644 --- a/scripts/postinst-intercepts/update_font_cache +++ b/scripts/postinst-intercepts/update_font_cache @@ -2,5 +2,4 @@ PSEUDO_UNLOAD=1 qemuwrapper -L $D -E LD_LIBRARY_PATH=$D/${libdir}:$D/${base_libdir}\ $D${bindir}/fc-cache --sysroot=$D - - +chown -R root:root $D${fontconfigcachedir} diff --git a/scripts/pythondeps b/scripts/pythondeps new file mode 100755 index 0000000000..ff92e747ed --- /dev/null +++ b/scripts/pythondeps @@ -0,0 +1,250 @@ +#!/usr/bin/env python +# +# Determine dependencies of python scripts or available python modules in a search path. +# +# Given the -d argument and a filename/filenames, returns the modules imported by those files. +# Given the -d argument and a directory/directories, recurses to find all +# python packages and modules, returns the modules imported by these. +# Given the -p argument and a path or paths, scans that path for available python modules/packages. + +import argparse +import ast +import imp +import logging +import os.path +import sys + + +logger = logging.getLogger('pythondeps') + +suffixes = [] +for triple in imp.get_suffixes(): + suffixes.append(triple[0]) + + +class PythonDepError(Exception): + pass + + +class DependError(PythonDepError): + def __init__(self, path, error): + self.path = path + self.error = error + PythonDepError.__init__(self, error) + + def __str__(self): + return "Failure determining dependencies of {}: {}".format(self.path, self.error) + + +class ImportVisitor(ast.NodeVisitor): + def __init__(self): + self.imports = set() + self.importsfrom = [] + + def visit_Import(self, node): + for alias in node.names: + self.imports.add(alias.name) + + def visit_ImportFrom(self, node): + self.importsfrom.append((node.module, [a.name for a in node.names], node.level)) + + +def walk_up(path): + while path: + yield path + path, _, _ = path.rpartition(os.sep) + + +def get_provides(path): + path = os.path.realpath(path) + + def get_fn_name(fn): + for suffix in suffixes: + if fn.endswith(suffix): + return fn[:-len(suffix)] + + isdir = os.path.isdir(path) + if isdir: + pkg_path = path + walk_path = path + else: + pkg_path = get_fn_name(path) + if pkg_path is None: + return + walk_path = os.path.dirname(path) + + for curpath in walk_up(walk_path): + if not os.path.exists(os.path.join(curpath, '__init__.py')): + libdir = curpath + break + else: + libdir = '' + + package_relpath = pkg_path[len(libdir)+1:] + package = '.'.join(package_relpath.split(os.sep)) + if not isdir: + yield package, path + else: + if os.path.exists(os.path.join(path, '__init__.py')): + yield package, path + + for dirpath, dirnames, filenames in os.walk(path): + relpath = dirpath[len(path)+1:] + if relpath: + if '__init__.py' not in filenames: + dirnames[:] = [] + continue + else: + context = '.'.join(relpath.split(os.sep)) + if package: + context = package + '.' + context + yield context, dirpath + else: + context = package + + for fn in filenames: + adjusted_fn = get_fn_name(fn) + if not adjusted_fn or adjusted_fn == '__init__': + continue + + fullfn = os.path.join(dirpath, fn) + if context: + yield context + '.' + adjusted_fn, fullfn + else: + yield adjusted_fn, fullfn + + +def get_code_depends(code_string, path=None, provide=None, ispkg=False): + try: + code = ast.parse(code_string, path) + except TypeError as exc: + raise DependError(path, exc) + except SyntaxError as exc: + raise DependError(path, exc) + + visitor = ImportVisitor() + visitor.visit(code) + for builtin_module in sys.builtin_module_names: + if builtin_module in visitor.imports: + visitor.imports.remove(builtin_module) + + if provide: + provide_elements = provide.split('.') + if ispkg: + provide_elements.append("__self__") + context = '.'.join(provide_elements[:-1]) + package_path = os.path.dirname(path) + else: + context = None + package_path = None + + levelzero_importsfrom = (module for module, names, level in visitor.importsfrom + if level == 0) + for module in visitor.imports | set(levelzero_importsfrom): + if context and path: + module_basepath = os.path.join(package_path, module.replace('.', '/')) + if os.path.exists(module_basepath): + # Implicit relative import + yield context + '.' + module, path + continue + + for suffix in suffixes: + if os.path.exists(module_basepath + suffix): + # Implicit relative import + yield context + '.' + module, path + break + else: + yield module, path + else: + yield module, path + + for module, names, level in visitor.importsfrom: + if level == 0: + continue + elif not provide: + raise DependError("Error: ImportFrom non-zero level outside of a package: {0}".format((module, names, level)), path) + elif level > len(provide_elements): + raise DependError("Error: ImportFrom level exceeds package depth: {0}".format((module, names, level)), path) + else: + context = '.'.join(provide_elements[:-level]) + if module: + if context: + yield context + '.' + module, path + else: + yield module, path + + +def get_file_depends(path): + try: + code_string = open(path, 'r').read() + except (OSError, IOError) as exc: + raise DependError(path, exc) + + return get_code_depends(code_string, path) + + +def get_depends_recursive(directory): + directory = os.path.realpath(directory) + + provides = dict((v, k) for k, v in get_provides(directory)) + for filename, provide in provides.iteritems(): + if os.path.isdir(filename): + filename = os.path.join(filename, '__init__.py') + ispkg = True + elif not filename.endswith('.py'): + continue + else: + ispkg = False + + with open(filename, 'r') as f: + source = f.read() + + depends = get_code_depends(source, filename, provide, ispkg) + for depend, by in depends: + yield depend, by + + +def get_depends(path): + if os.path.isdir(path): + return get_depends_recursive(path) + else: + return get_file_depends(path) + + +def main(): + logging.basicConfig() + + parser = argparse.ArgumentParser(description='Determine dependencies and provided packages for python scripts/modules') + parser.add_argument('path', nargs='+', help='full path to content to be processed') + group = parser.add_mutually_exclusive_group() + group.add_argument('-p', '--provides', action='store_true', + help='given a path, display the provided python modules') + group.add_argument('-d', '--depends', action='store_true', + help='given a filename, display the imported python modules') + + args = parser.parse_args() + if args.provides: + modules = set() + for path in args.path: + for provide, fn in get_provides(path): + modules.add(provide) + + for module in sorted(modules): + print(module) + elif args.depends: + for path in args.path: + try: + modules = get_depends(path) + except PythonDepError as exc: + logger.error(str(exc)) + sys.exit(1) + + for module, imp_by in modules: + print("{}\t{}".format(module, imp_by)) + else: + parser.print_help() + sys.exit(2) + + +if __name__ == '__main__': + main() diff --git a/scripts/recipetool b/scripts/recipetool new file mode 100755 index 0000000000..2cfa763201 --- /dev/null +++ b/scripts/recipetool @@ -0,0 +1,99 @@ +#!/usr/bin/env python + +# Recipe creation tool +# +# Copyright (C) 2014 Intel Corporation +# +# 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 sys +import os +import argparse +import glob +import logging + +scripts_path = os.path.dirname(os.path.realpath(__file__)) +lib_path = scripts_path + '/lib' +sys.path = sys.path + [lib_path] +import scriptutils +logger = scriptutils.logger_create('recipetool') + +plugins = [] + +def tinfoil_init(): + import bb.tinfoil + import logging + tinfoil = bb.tinfoil.Tinfoil() + tinfoil.prepare(True) + + for plugin in plugins: + if hasattr(plugin, 'tinfoil_init'): + plugin.tinfoil_init(tinfoil) + tinfoil.logger.setLevel(logging.WARNING) + +def main(): + + if not os.environ.get('BUILDDIR', ''): + logger.error("This script can only be run after initialising the build environment (e.g. by using oe-init-build-env)") + sys.exit(1) + + parser = argparse.ArgumentParser(description="OpenEmbedded recipe tool", + epilog="Use %(prog)s <subcommand> --help to get help on a specific command") + parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') + parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true') + parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR') + subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') + + scriptutils.load_plugins(logger, plugins, os.path.join(scripts_path, 'lib', 'recipetool')) + registered = False + for plugin in plugins: + if hasattr(plugin, 'register_command'): + registered = True + plugin.register_command(subparsers) + + if not registered: + logger.error("No commands registered - missing plugins?") + sys.exit(1) + + args = parser.parse_args() + + if args.debug: + logger.setLevel(logging.DEBUG) + elif args.quiet: + logger.setLevel(logging.ERROR) + + import scriptpath + bitbakepath = scriptpath.add_bitbake_lib_path() + if not bitbakepath: + logger.error("Unable to find bitbake by searching parent directory of this script or PATH") + sys.exit(1) + logger.debug('Found bitbake path: %s' % bitbakepath) + + scriptutils.logger_setup_color(logger, args.color) + + tinfoil_init() + + ret = args.func(args) + + return ret + + +if __name__ == "__main__": + try: + ret = main() + except Exception: + ret = 1 + import traceback + traceback.print_exc(5) + sys.exit(ret) diff --git a/scripts/runqemu b/scripts/runqemu index ff64a1d4c2..84ece4d7e4 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -21,7 +21,7 @@ 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 "of the following environment variables (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" @@ -39,7 +39,7 @@ usage() { echo "" echo "Examples:" echo " $MYNAME qemuarm" - echo " $MYNAME qemux86-64 core-image-sato ext3" + echo " $MYNAME qemux86-64 core-image-sato ext4" echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" echo " $MYNAME qemux86 ramfs" echo " $MYNAME qemux86 iso" @@ -62,7 +62,7 @@ MACHINE=${MACHINE:=""} KERNEL=${KERNEL:=""} ROOTFS=${ROOTFS:=""} VM=${VM:=""} -FSTYPE="" +FSTYPE=${FSTYPE:=""} LAZY_ROOTFS="" SCRIPT_QEMU_OPT="" SCRIPT_QEMU_EXTRA_OPT="" @@ -108,7 +108,7 @@ process_filename() { while true; do arg=${1} case "$arg" in - "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemumipsel" | \ + "qemux86" | "qemux86-64" | "qemuarm" | "qemuarm64" | "qemumips" | "qemumipsel" | \ "qemumips64" | "qemush4" | "qemuppc" | "qemumicroblaze" | "qemuzynq") [ -z "$MACHINE" ] && MACHINE=$arg || \ error "conflicting MACHINE types [$MACHINE] and [$arg]" @@ -153,6 +153,9 @@ while true; do "biosdir="*) CUSTOMBIOSDIR="${arg##biosdir=}" ;; + "biosfilename="*) + SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -bios ${arg##biosfilename=}" + ;; "qemuparams="*) SCRIPT_QEMU_EXTRA_OPT="${arg##qemuparams=}" @@ -293,28 +296,31 @@ machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` # Defaults used when these vars need to be inferred QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin -QEMUX86_DEFAULT_FSTYPE=ext3 +QEMUX86_DEFAULT_FSTYPE=ext4 QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin -QEMUX86_64_DEFAULT_FSTYPE=ext3 +QEMUX86_64_DEFAULT_FSTYPE=ext4 QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin -QEMUARM_DEFAULT_FSTYPE=ext3 +QEMUARM_DEFAULT_FSTYPE=ext4 + +QEMUARM64_DEFAULT_KERNEL=Image-qemuarm64.bin +QEMUARM64_DEFAULT_FSTYPE=ext4 QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUMIPS_DEFAULT_FSTYPE=ext3 +QEMUMIPS_DEFAULT_FSTYPE=ext4 QEMUMIPSEL_DEFAULT_KERNEL=vmlinux-qemumipsel.bin -QEMUMIPSEL_DEFAULT_FSTYPE=ext3 +QEMUMIPSEL_DEFAULT_FSTYPE=ext4 QEMUMIPS64_DEFAULT_KERNEL=vmlinux-qemumips64.bin -QEMUMIPS64_DEFAULT_FSTYPE=ext3 +QEMUMIPS64_DEFAULT_FSTYPE=ext4 QEMUSH4_DEFAULT_KERNEL=vmlinux-qemumips.bin -QEMUSH4_DEFAULT_FSTYPE=ext3 +QEMUSH4_DEFAULT_FSTYPE=ext4 QEMUPPC_DEFAULT_KERNEL=vmlinux-qemuppc.bin -QEMUPPC_DEFAULT_FSTYPE=ext3 +QEMUPPC_DEFAULT_FSTYPE=ext4 QEMUMICROBLAZE_DEFAULT_KERNEL=linux.bin.ub QEMUMICROBLAZE_DEFAULT_FSTYPE=cpio diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index 38745dd126..2db55660ce 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal @@ -50,6 +50,9 @@ else "qemuarm") mem_size=128 ;; + "qemuarm64") + mem_size=512 + ;; "qemumicroblaze") mem_size=64 ;; @@ -135,7 +138,11 @@ else return 1 fi - touch $lockfile.lock + touch $lockfile.lock 2>/dev/null + if [ $? -ne 0 ]; then + echo "Acquiring lockfile for $lockfile.lock failed" + return 1 + fi exec 8>$lockfile.lock flock -n -x 8 if [ $? -ne 0 ]; then @@ -260,8 +267,17 @@ else DROOT="/dev/hda" ROOTFS_OPTIONS="-hda $ROOTFS" fi + if [ "$MACHINE" = "qemuarm64" ]; then + QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 " + DROOT="/dev/vda" + ROOTFS_OPTIONS="-drive id=disk0,file=$ROOTFS -device virtio-blk-device,drive=disk0" + fi + KERNCMDLINE="mem=$QEMU_MEMORY" QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" + if [ $MACHINE = 'qemuarm64' ]; then + QEMU_UI_OPTIONS="-nographic" + fi NFS_INSTANCE=`echo $TAP | sed 's/tap//'` export NFS_INSTANCE @@ -274,6 +290,7 @@ fi case "$MACHINE" in "qemuarm") ;; + "qemuarm64") ;; "qemumicroblaze") ;; "qemumips") ;; "qemumipsel") ;; @@ -362,6 +379,19 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm fi fi +if [ "$MACHINE" = "qemuarm64" ]; then + QEMU=qemu-system-aarch64 + + export QEMU_AUDIO_DRV="none" + QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS" + if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then + KERNCMDLINE="root=/dev/vda rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD" + # qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now + QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" + fi +fi + + if [ "$MACHINE" = "qemux86" ]; then QEMU=qemu-system-i386 if [ "$KVM_ACTIVE" = "yes" ]; then @@ -378,6 +408,11 @@ if [ "$MACHINE" = "qemux86" ]; then KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" fi + if [ "${FSTYPE:0:4}" = "cpio" ]; then + KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=/dev/ram0 rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" + QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -initrd $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." @@ -516,6 +551,10 @@ if [ "$MACHINE" = "qemush4" ]; then fi fi +if [ "${FSTYPE:0:3}" = "ext" ]; then + KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE" +fi + if [ "$MACHINE" = "akita" ]; then QEMU=qemu-system-arm if [ "$FSTYPE" = "jffs2" ]; then diff --git a/scripts/send-error-report b/scripts/send-error-report index c99d3876d7..1a1b96580d 100755 --- a/scripts/send-error-report +++ b/scripts/send-error-report @@ -1,110 +1,196 @@ #!/usr/bin/env python -# Sends an error report (if the report-error class was enabled) to a remote server. +# Sends an error report (if the report-error class was enabled) to a +# remote server. # # Copyright (C) 2013 Intel Corporation # Author: Andreea Proca <andreea.b.proca@intel.com> +# Author: Michael Wood <michael.g.wood@intel.com> + +import urllib2 +import sys +import json +import os +import subprocess +import argparse +import logging + +version = "0.3" + +log = logging.getLogger("send-error-report") +logging.basicConfig(format='%(levelname)s: %(message)s') + +def getPayloadLimit(url): + req = urllib2.Request(url, None) + try: + response = urllib2.urlopen(req) + except urllib2.URLError as e: + # Use this opportunity to bail out if we can't even contact the server + log.error("Could not contact server: " + url) + log.error(e.reason) + sys.exit(1) + try: + ret = json.loads(response.read()) + max_log_size = ret.get('max_log_size', 0) + return int(max_log_size) + except: + pass + + return 0 + +def ask_for_contactdetails(): + print("Please enter your name and your email (optionally), they'll be saved in the file you send.") + username = raw_input("Name (required): ") + email = raw_input("E-mail (not required): ") + return username, email + +def edit_content(json_file_path): + edit = raw_input("Review information before sending? (y/n): ") + if 'y' in edit or 'Y' in edit: + editor = os.environ.get('EDITOR', None) + if editor: + subprocess.check_call([editor, json_file_path]) + else: + log.error("Please set your EDITOR value") + sys.exit(1) + return True + return False + +def prepare_data(args): + # attempt to get the max_log_size from the server's settings + max_log_size = getPayloadLimit("http://"+args.server+"/ClientPost/JSON") + + if not os.path.isfile(args.error_file): + log.error("No data file found.") + sys.exit(1) + + home = os.path.expanduser("~") + userfile = os.path.join(home, ".oe-send-error") + + try: + with open(userfile, 'r') as userfile_fp: + if len(args.name) == 0: + args.name = userfile_fp.readline() + else: + #use empty readline to increment the fp + userfile_fp.readline() + if len(args.email) == 0: + args.email = userfile_fp.readline() + except: + pass + if args.assume_yes == True and len(args.name) == 0: + log.error("Name needs to be provided either via "+userfile+" or as an argument (-n).") + sys.exit(1) -import httplib, urllib, os, sys, json, base64 -from urllib2 import _parse_proxy as parseproxy - - -def handle_connection(server, data): - params = urllib.urlencode({'data': data}) - headers = {"Content-type": "application/json"} - proxyrequired = False - if os.environ.get("http_proxy") or os.environ.get("HTTP_PROXY"): - proxyrequired = True - # we need to check that the server isn't a local one, as in no_proxy - try: - temp = httplib.HTTPConnection(server, strict=True, timeout=5) - temp.request("GET", "/Errors/") - tempres = temp.getresponse() - if tempres.status == 200: - proxyrequired = False - temp.close() - except: - pass - - if proxyrequired: - proxy = parseproxy(os.environ.get("http_proxy") or os.environ.get("HTTP_PROXY")) - if proxy[1] and proxy[2]: - auth = base64.encodestring("%s:%s" % (proxy[1], proxy[2])) - headers["Authorization"] = "Basic %s" % auth - conn = httplib.HTTPConnection(proxy[3]) - conn.request("POST", "http://%s/ClientPost/" % server, params, headers) - else: - conn = httplib.HTTPConnection(server) - conn.request("POST", "/ClientPost/", params, headers) + while len(args.name) <= 0 and len(args.name) < 50: + print("\nName needs to be given and must not more than 50 characters.") + args.name, args.email = ask_for_contactdetails() - return conn + with open(userfile, 'w') as userfile_fp: + userfile_fp.write(args.name.strip() + "\n") + userfile_fp.write(args.email.strip() + "\n") + with open(args.error_file, 'r') as json_fp: + data = json_fp.read() -def sendData(json_file, server): + jsondata = json.loads(data) + jsondata['username'] = args.name.strip() + jsondata['email'] = args.email.strip() + jsondata['link_back'] = args.link_back.strip() + # If we got a max_log_size then use this to truncate to get the last + # max_log_size bytes from the end + if max_log_size != 0: + for fail in jsondata['failures']: + if len(fail['log']) > max_log_size: + print "Truncating log to allow for upload" + fail['log'] = fail['log'][-max_log_size:] - if os.path.isfile(json_file): + data = json.dumps(jsondata, indent=4, sort_keys=True) + + # Write back the result which will contain all fields filled in and + # any post processing done on the log data + with open(args.error_file, "w") as json_fp: + if data: + json_fp.write(data) - home = os.path.expanduser("~") - userfile = os.path.join(home, ".oe-send-error") - if os.path.isfile(userfile): - with open(userfile) as g: - username = g.readline() - email = g.readline() - else: - print("Please enter your name and your email (optionally), they'll be saved in the file you send.") - username = raw_input("Name: ") - email = raw_input("E-mail (not required): ") - if len(username) > 0 and len(username) < 50: - with open(userfile, "w") as g: - g.write(username + "\n") - g.write(email + "\n") - else: - print("Invalid inputs, try again.") - return - - with open(json_file) as f: - data = f.read() - - try: - jsondata = json.loads(data) - jsondata['username'] = username.strip() - jsondata['email'] = email.strip() - data = json.dumps(jsondata, indent=4, sort_keys=True) - except: - print("Invalid json data") - return - - try: - conn = handle_connection(server, data) - response = conn.getresponse() - print response.status, response.reason - res = response.read() - if response.status == 200: - print(res) - else: - print("There was a problem submiting your data, response written in %s.response.html" % json_file) - with open("%s.response.html" % json_file, "w") as f: - f.write(res) - conn.close() - except Exception as e: - print("Server connection failed: %s" % e) + if args.assume_yes == False and edit_content(args.error_file): + #We'll need to re-read the content if we edited it + with open(args.error_file, 'r') as json_fp: + data = json_fp.read() + + return data + + +def send_data(data, args): + headers={'Content-type': 'application/json', 'User-Agent': "send-error-report/"+version} + + if args.json: + url = "http://"+args.server+"/ClientPost/JSON/" else: - print("No data file found.") + url = "http://"+args.server+"/ClientPost/" + + req = urllib2.Request(url, data=data, headers=headers) + try: + response = urllib2.urlopen(req) + except urllib2.HTTPError, e: + logging.error(e.reason) + sys.exit(1) + + print response.read() if __name__ == '__main__': - print ("\nSends an error report (if the report-error class was enabled) to a remote server.") - print("\nThis scripts sends the contents of the error to a public upstream server.") - print("\nPlease remove any identifying information before sending.") - if len(sys.argv) < 2: - print("\nUsage: send-error-report <error_fileName> [server]") - print("\nIf this is the first when sending a report you'll be asked for your name and optionally your email address.") - print("They will be associated with your report.\n") - - elif len(sys.argv) == 3: - sendData(sys.argv[1], sys.argv[2]) - else: - sendData(sys.argv[1], "errors.yoctoproject.org") + arg_parse = argparse.ArgumentParser(description="This scripts will send an error report to your specified error-report-web server.") + + arg_parse.add_argument("error_file", + help="Generated error report file location", + type=str) + + arg_parse.add_argument("-y", + "--assume-yes", + help="Assume yes to all queries and do not prompt", + action="store_true") + + arg_parse.add_argument("-s", + "--server", + help="Server to send error report to", + type=str, + default="errors.yoctoproject.org") + + arg_parse.add_argument("-e", + "--email", + help="Email address to be used for contact", + type=str, + default="") + + arg_parse.add_argument("-n", + "--name", + help="Submitter name used to identify your error report", + type=str, + default="") + + arg_parse.add_argument("-l", + "--link-back", + help="A url to link back to this build from the error report server", + type=str, + default="") + + arg_parse.add_argument("-j", + "--json", + help="Return the result in json format, silences all other output", + action="store_true") + + + + args = arg_parse.parse_args() + + if (args.json == False): + print "Preparing to send errors to: "+args.server + + data = prepare_data(args) + send_data(data, args) + + sys.exit(0) diff --git a/scripts/test-dependencies.sh b/scripts/test-dependencies.sh index 2bcc2ca4f6..0170947f0e 100755 --- a/scripts/test-dependencies.sh +++ b/scripts/test-dependencies.sh @@ -141,7 +141,7 @@ build_all() { bitbake -k $targets 2>&1 | tee -a ${OUTPUT1}/complete.log RESULT+=${PIPESTATUS[0]} grep "ERROR: Task.*failed" ${OUTPUT1}/complete.log > ${OUTPUT1}/failed-tasks.log - cat ${OUTPUT1}/failed-tasks.log | sed 's@.*/@@g; s@_.*@@g; s@\..*@@g' | sort -u > ${OUTPUT1}/failed-recipes.log + cat ${OUTPUT1}/failed-tasks.log | sed 's@.*/@@g; s@_.*@@g; s@\.bb, .*@@g' | sort -u > ${OUTPUT1}/failed-recipes.log } build_every_recipe() { @@ -178,7 +178,7 @@ build_every_recipe() { RESULT+=${RECIPE_RESULT} mv ${OUTPUTB}/${recipe}.log ${OUTPUTB}/failed/ grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | tee -a ${OUTPUTB}/failed-tasks.log - grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | sed 's@.*/@@g; s@_.*@@g; s@\..*@@g' >> ${OUTPUTB}/failed-recipes.log + grep "ERROR: Task.*failed" ${OUTPUTB}/failed/${recipe}.log | sed 's@.*/@@g; s@_.*@@g; s@\.bb, .*@@g' >> ${OUTPUTB}/failed-recipes.log # and append also ${recipe} in case the failed task was from some dependency echo ${recipe} >> ${OUTPUTB}/failed-recipes.log else |