summaryrefslogtreecommitdiffstats
path: root/yocto-poky/scripts
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2015-09-22 08:09:05 -0500
committerPatrick Williams <patrick@stwcx.xyz>2015-09-22 08:09:05 -0500
commit3445365503e1e4d5601acf7c05609cc9673ec414 (patch)
tree7eb70c5bab200b0515a1b4d16873a75855df4c89 /yocto-poky/scripts
parentd10502479a70bd72ca4e09569b6ee738875e4823 (diff)
parentd7e963193b4e6541206a320316a158a65f1fee89 (diff)
downloadtalos-openbmc-3445365503e1e4d5601acf7c05609cc9673ec414.tar.gz
talos-openbmc-3445365503e1e4d5601acf7c05609cc9673ec414.zip
Merge commit 'd7e963193b4e6541206a320316a158a65f1fee89' into HEAD
Diffstat (limited to 'yocto-poky/scripts')
-rwxr-xr-xyocto-poky/scripts/contrib/mkefidisk.sh63
-rw-r--r--yocto-poky/scripts/lib/recipetool/newappend.py111
2 files changed, 169 insertions, 5 deletions
diff --git a/yocto-poky/scripts/contrib/mkefidisk.sh b/yocto-poky/scripts/contrib/mkefidisk.sh
index 55f72b0f5..cd4de0533 100755
--- a/yocto-poky/scripts/contrib/mkefidisk.sh
+++ b/yocto-poky/scripts/contrib/mkefidisk.sh
@@ -152,8 +152,55 @@ unmount() {
# Parse and validate arguments
#
if [ $# -lt 3 ] || [ $# -gt 4 ]; then
- usage
- exit 1
+ if [ $# -eq 1 ]; then
+ AVAILABLE_DISK=`lsblk | grep "disk" | cut -f 1 -d " "`
+ X=0
+ for disk in `echo $AVAILABLE_DISK`; do
+ mounted=`lsblk /dev/$disk | awk {'print $7'} | sed "s/MOUNTPOINT//"`
+ if [ -z "$mounted" ]; then
+ UNMOUNTED_AVAILABLES="$UNMOUNTED_AVAILABLES /dev/$disk"
+ info "$X - /dev/$disk"
+ X=`expr $X + 1`
+ fi
+ done
+ if [ $X -eq 0 ]; then
+ die "No unmounted device found."
+ fi
+ read -p "Choose unmounted device number: " DISK_NUMBER
+ X=0
+ for line in `echo $UNMOUNTED_AVAILABLES`; do
+ if [ $DISK_NUMBER -eq $X ]; then
+ DISK_TO_BE_FLASHED=$line
+ break
+ else
+ X=`expr $X + 1`
+ fi
+ done
+ if [ -z "$DISK_TO_BE_FLASHED" ]; then
+ die "Option \"$DISK_NUMBER\" is invalid. Choose a valid option"
+ else
+ if [ -z `echo $DISK_TO_BE_FLASHED | grep "mmc"` ]; then
+ TARGET_TO_BE_BOOT="/dev/sda"
+ else
+ TARGET_TO_BE_BOOT="/dev/mmcblk0"
+ fi
+ fi
+ echo ""
+ echo "Choose a name of the device that will be boot from"
+ echo -n "Recommended name is: "
+ info "$TARGET_TO_BE_BOOT"
+ read -p "Is target device okay? [y/N]: " RESPONSE
+ if [ "$RESPONSE" != "y" ]; then
+ read -p "Choose target device name: " TARGET_TO_BE_BOOT
+ fi
+ echo ""
+ if [ -z "$TARGET_TO_BE_BOOT" ]; then
+ die "Error: choose a valid target name"
+ fi
+ else
+ usage
+ exit 1
+ fi
fi
if [ "$1" = "-v" ]; then
@@ -162,9 +209,15 @@ if [ "$1" = "-v" ]; then
shift
fi
-DEVICE=$1
-HDDIMG=$2
-TARGET_DEVICE=$3
+if [ -z "$AVAILABLE_DISK" ]; then
+ DEVICE=$1
+ HDDIMG=$2
+ TARGET_DEVICE=$3
+else
+ DEVICE=$DISK_TO_BE_FLASHED
+ HDDIMG=$1
+ TARGET_DEVICE=$TARGET_TO_BE_BOOT
+fi
LINK=$(readlink $DEVICE)
if [ $? -eq 0 ]; then
diff --git a/yocto-poky/scripts/lib/recipetool/newappend.py b/yocto-poky/scripts/lib/recipetool/newappend.py
new file mode 100644
index 000000000..77b74cb73
--- /dev/null
+++ b/yocto-poky/scripts/lib/recipetool/newappend.py
@@ -0,0 +1,111 @@
+# Recipe creation tool - newappend plugin
+#
+# This sub-command creates a bbappend for the specified target and prints the
+# path to the bbappend.
+#
+# Example: recipetool newappend meta-mylayer busybox
+#
+# Copyright (C) 2015 Christopher Larson <kergoth@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import argparse
+import errno
+import logging
+import os
+import re
+import sys
+
+
+logger = logging.getLogger('recipetool')
+tinfoil = None
+
+
+def plugin_init(pluginlist):
+ # Don't need to do anything here right now, but plugins must have this function defined
+ pass
+
+
+def tinfoil_init(instance):
+ global tinfoil
+ tinfoil = instance
+
+
+def _provide_to_pn(cooker, provide):
+ """Get the name of the preferred recipe for the specified provide."""
+ import bb.providers
+ filenames = cooker.recipecache.providers[provide]
+ eligible, foundUnique = bb.providers.filterProviders(filenames, provide, cooker.expanded_data, cooker.recipecache)
+ filename = eligible[0]
+ pn = cooker.recipecache.pkg_fn[filename]
+ return pn
+
+
+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 layer(layerpath):
+ if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')):
+ raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath))
+ return layerpath
+
+
+def newappend(args):
+ import oe.recipeutils
+
+ pn = _provide_to_pn(tinfoil.cooker, args.target)
+ recipe_path = _get_recipe_file(tinfoil.cooker, pn)
+
+ rd = tinfoil.config_data.createCopy()
+ rd.setVar('FILE', recipe_path)
+ append_path, path_ok = oe.recipeutils.get_bbappend_path(rd, args.destlayer, args.wildcard_version)
+ if not append_path:
+ logger.error('Unable to determine layer directory containing %s', recipe_path)
+ return 1
+
+ if not path_ok:
+ logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(destlayerdir, 'conf', 'layer.conf'), os.path.dirname(appendpath))
+
+ layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS', True).split()]
+ if not os.path.abspath(args.destlayer) in layerdirs:
+ logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active')
+
+ if not os.path.exists(append_path):
+ bb.utils.mkdirhier(os.path.dirname(append_path))
+
+ try:
+ open(append_path, 'a')
+ except (OSError, IOError) as exc:
+ logger.critical(str(exc))
+ return 1
+
+ print(append_path)
+
+
+def register_command(subparsers):
+ parser = subparsers.add_parser('newappend',
+ help='Create a bbappend for the specified target in the specified layer')
+ parser.add_argument('-w', '--wildcard-version', help='Use wildcard to make the bbappend apply to any recipe version', action='store_true')
+ parser.add_argument('destlayer', help='Base directory of the destination layer to write the bbappend to', type=layer)
+ parser.add_argument('target', help='Target recipe/provide to append')
+ parser.set_defaults(func=newappend, parserecipes=True)
OpenPOWER on IntegriCloud