diff --git a/documentation/conf.py b/documentation/conf.py
index 95bb24002544..210b4ab60595 100644
--- a/documentation/conf.py
+++ b/documentation/conf.py
@@ -81,7 +81,8 @@ extensions = [
     'sphinxcontrib.rsvgconverter',
     'yocto-vars',
     'bitbake-lexer',
-    'bitbake-placeholder'
+    'bitbake-placeholder',
+    'scc-lexer'
 ]
 
 # current_version = "dev"
diff --git a/documentation/sphinx/scc-lexer.py b/documentation/sphinx/scc-lexer.py
new file mode 100644
index 000000000000..dd1166ca7014
--- /dev/null
+++ b/documentation/sphinx/scc-lexer.py
@@ -0,0 +1,116 @@
+"""Lexer for kernel metadata SCC description files.
+
+SCC describes a BSP or a kernel feature: which branch to build on, which
+patches to apply and which configuration fragments to queue. The tooling
+that reads it is ``yocto-kernel-tools``, and the shape of the language
+follows from how that tooling works rather than from how it looks. ``spp``
+rewrites a few line-oriented directives, and then ``scc`` *sources the
+result as a bash script*, having first defined one shell function per
+statement and unset ``PATH`` so nothing else can run.
+
+So an SCC file is not a dialect of bash but bash itself, under a
+preprocessor: the ``spp`` directives have their own, non-shell semantics -
+``#define`` is a comment as far as bash is concerned - while everything
+surviving that pass is ordinary shell with a fixed vocabulary of commands.
+Real metadata relies on it, with conditionals on ``KARCH`` in particular,
+and a lexer built from the manual's statement list rejects them. This one
+extends the bash lexer and marks the vocabulary, so the shell half is
+right by construction and only the command list has to be got right.
+
+That list comes from the implementation: the functions ``scc`` defines
+itself, the functions it sources from ``scc-cmds/*.cmd``, and the
+directives ``spp`` matches before any of that runs. It is wider than the
+"SCC Description File Reference" section of ``kernel-dev/advanced.rst``,
+which omits ``mark``, ``merge``, ``tag``, ``prefix``, and the flags.
+"""
+from pygments.lexer import bygroups, inherit, words
+from pygments.lexers.shell import BashLexer
+from pygments.token import Comment, Keyword, Name, Text, Whitespace
+
+__version__ = '2.0'
+
+# Statements, as the tooling defines them. ``spp`` handles include, patch
+# and kconf itself; the rest are shell functions declared by scc and by
+# scc-cmds/*.cmd before the file is sourced.
+_COMMANDS = (
+    'branch', 'define', 'git', 'include', 'kconf', 'mark', 'merge',
+    'patch', 'prefix', 'reloc_dir', 'set_kernel_version', 'tag',
+)
+
+# spp matches this before bash ever sees the file, so it is a directive
+# wearing a comment's clothes and needs its own rule.
+_DIRECTIVES = ('#define',)
+
+# Words that qualify a statement rather than starting one: the kconf
+# fragment classes kconf.cmd tests for, and the flags spp looks for on an
+# include line.
+_FLAGS = (
+    'as_module', 'hardware', 'non-hardware', 'nocfg', 'nopatch',
+    'optional', 'required',
+)
+
+# spp recognises these only immediately ahead of kconf, at the margin.
+_LEADERS = ('as_module', 'force')
+
+# A statement sits at the margin. Reaching it reliably needs the rule
+# below that stops a run of whitespace at the end of a line.
+_MARGIN = r'^[ \t]*'
+
+
+class SccLexer(BashLexer):
+    """Kernel metadata SCC description files."""
+
+    name = 'SCC'
+    aliases = ['scc']
+    filenames = ['*.scc']
+    mimetypes = []
+    url = 'https://docs.yoctoproject.org/kernel-dev/advanced.html'
+
+    tokens = {
+        'root': [
+            # Both spellings of define name a variable, so mark it.
+            (r'(' + _MARGIN + r')(' + '|'.join(_DIRECTIVES) +
+             r')([ \t]+)([A-Za-z_]\w*)',
+             bygroups(Whitespace, Comment.Preproc, Whitespace,
+                      Name.Variable)),
+            (r'(' + _MARGIN + r')(define)([ \t]+)([A-Za-z_]\w*)',
+             bygroups(Whitespace, Keyword, Whitespace, Name.Variable)),
+
+            # A statement only starts a line. Elsewhere the same word is
+            # an argument: "branch" is a command at the margin and a
+            # subcommand in "git branch pvr master".
+            (r'(' + _MARGIN + r')((?:' + '|'.join(_LEADERS) +
+             r')(?=[ \t]))?([ \t]*)('
+             + '|'.join(_COMMANDS) + r')(?=[ \t]|$)',
+             bygroups(Whitespace, Name.Builtin, Whitespace, Keyword)),
+
+            (words(_FLAGS, prefix=r'(?<=[ \t])', suffix=r'(?=[ \t]|$)'),
+             Name.Builtin),
+
+            # Keep whitespace runs from crossing a line ending, so the
+            # next statement is still at the margin when it is reached.
+            (r'[ \t]*\n', Whitespace),
+
+            # The bash lexer's own copy of this rule swallows the newline
+            # and the indent behind it, which would leave a statement
+            # inside a conditional no longer at the margin and so
+            # unmarked. Match the words alone and leave the rest.
+            (r'\b(if|fi|else|while|in|do|done|for|then|return|function|'
+             r'case|select|break|continue|until|esac|elif)\b', Keyword),
+
+            # Cosmetic: patch filenames conventionally lead with a
+            # sequence number, and bash would colour that as a number.
+            (r'\d+(?=[\w./+-])', Text),
+
+            inherit,
+        ],
+    }
+
+
+def setup(app):
+    app.add_lexer('scc', SccLexer)
+    return {
+        'version': __version__,
+        'parallel_read_safe': True,
+        'parallel_write_safe': True,
+    }
