diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index ff32cf115f8..5a9ac5cd005 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -26,6 +26,12 @@ WORKSPACE_LAYERDEPENDS = 'oe-core'
 # to match that pattern.
 WORKSPACE_APPENDS_DIR = 'recipes-appends'
 
+# Written to the bbappend for recipes which live in the workspace (from
+# 'devtool add' and 'devtool upgrade'). Layers no longer have priorities so
+# without this a recipe elsewhere with the same name and an equal or higher
+# version would be used instead.
+WORKSPACE_PREFERENCE_LINES = 'DEFAULT_PREFERENCE = "99"\n'
+
 def get_workspace_appends_dir(workspace_path):
     """Return the directory within the workspace layer holding bbappends"""
     return os.path.join(workspace_path, WORKSPACE_APPENDS_DIR)
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 37ee404c176..ca90e8089ea 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -21,7 +21,7 @@ import glob
 from collections import OrderedDict
 
 from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, check_prerelease_version, check_git_repo_dirty, check_git_repo_op, DevtoolError
-from devtool import parse_recipe, get_workspace_appends_dir
+from devtool import parse_recipe, get_workspace_appends_dir, WORKSPACE_PREFERENCE_LINES
 
 import bb.utils
 
@@ -255,6 +255,7 @@ def add(args, config, basepath, workspace):
         with open(appendfile, 'w') as f:
             f.write('inherit externalsrc\n')
             f.write('EXTERNALSRC = "%s"\n' % srctree)
+            f.write(WORKSPACE_PREFERENCE_LINES)
 
             b_is_s = use_external_build(args.same_dir, args.no_same_dir, rd)
             if b_is_s:
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 1923b5a7b6b..3b5db4f2bf0 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -26,7 +26,7 @@ sys.path = sys.path + [devtool_path]
 
 import oe.recipeutils
 from devtool import standard
-from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs, check_prerelease_version, get_workspace_appends_dir
+from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build, update_unlockedsigs, check_prerelease_version, get_workspace_appends_dir, WORKSPACE_PREFERENCE_LINES
 
 logger = logging.getLogger('devtool')
 
@@ -158,6 +158,7 @@ def _write_append(rc, srctreebase, srctree, same_dir, no_same_dir, revs, copied,
         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' % (pn, srctree))
+        f.write(WORKSPACE_PREFERENCE_LINES)
         b_is_s = use_external_build(same_dir, no_same_dir, d)
         if b_is_s:
             f.write('EXTERNALSRC_BUILD:pn-%s = "%s"\n' % (pn, srctree))
