Blame SOURCES/0373-kern-Add-lockdown-support.patch

9723a8
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
9723a8
From: Javier Martinez Canillas <javierm@redhat.com>
9723a8
Date: Fri, 19 Feb 2021 10:33:54 +0100
9723a8
Subject: [PATCH] kern: Add lockdown support
9723a8
9723a8
When the GRUB starts on a secure boot platform, some commands can be
9723a8
used to subvert the protections provided by the verification mechanism and
9723a8
could lead to booting untrusted system.
9723a8
9723a8
To prevent that situation, allow GRUB to be locked down. That way the code
9723a8
may check if GRUB has been locked down and further restrict the commands
9723a8
that are registered or what subset of their functionality could be used.
9723a8
9723a8
The lockdown support adds the following components:
9723a8
9723a8
* The grub_lockdown() function which can be used to lockdown GRUB if,
9723a8
  e.g., UEFI Secure Boot is enabled.
9723a8
9723a8
* The grub_is_lockdown() function which can be used to check if the GRUB
9723a8
  was locked down.
9723a8
9723a8
* A verifier that flags OS kernels, the GRUB modules, Device Trees and ACPI
9723a8
  tables as GRUB_VERIFY_FLAGS_DEFER_AUTH to defer verification to other
9723a8
  verifiers. These files are only successfully verified if another registered
9723a8
  verifier returns success. Otherwise, the whole verification process fails.
9723a8
9723a8
  For example, PE/COFF binaries verification can be done by the shim_lock
9723a8
  verifier which validates the signatures using the shim_lock protocol.
9723a8
  However, the verification is not deferred directly to the shim_lock verifier.
9723a8
  The shim_lock verifier is hooked into the verification process instead.
9723a8
9723a8
* A set of grub_{command,extcmd}_lockdown functions that can be used by
9723a8
  code registering command handlers, to only register unsafe commands if
9723a8
  the GRUB has not been locked down.
9723a8
9723a8
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
9723a8
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
9723a8
---
9723a8
 grub-core/Makefile.core.def |  1 +
9723a8
 grub-core/commands/extcmd.c | 23 +++++++++++
9723a8
 grub-core/kern/command.c    | 24 ++++++++++++
9723a8
 grub-core/kern/lockdown.c   | 93 +++++++++++++++++++++++++++++++++++++++++++++
9723a8
 include/grub/command.h      |  5 +++
9723a8
 include/grub/extcmd.h       |  7 ++++
9723a8
 include/grub/lockdown.h     | 44 +++++++++++++++++++++
9723a8
 conf/Makefile.common        |  2 +
9723a8
 docs/grub-dev.texi          | 27 +++++++++++++
3efed6
 docs/grub.texi              |  8 ++++
9723a8
 grub-core/Makefile.am       |  5 ++-
3efed6
 11 files changed, 238 insertions(+), 1 deletion(-)
9723a8
 create mode 100644 grub-core/kern/lockdown.c
9723a8
 create mode 100644 include/grub/lockdown.h
9723a8
9723a8
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
3efed6
index 8914083d13f..02fbecd4b81 100644
9723a8
--- a/grub-core/Makefile.core.def
9723a8
+++ b/grub-core/Makefile.core.def
9723a8
@@ -197,6 +197,7 @@ kernel = {
9723a8
   efi = term/efi/console.c;
9723a8
   efi = kern/acpi.c;
9723a8
   efi = kern/efi/acpi.c;
9723a8
+  efi = kern/lockdown.c;
9723a8
   efi = lib/envblk.c;
9723a8
   efi = kern/efi/tpm.c;
9723a8
   i386_coreboot = kern/i386/pc/acpi.c;
9723a8
diff --git a/grub-core/commands/extcmd.c b/grub-core/commands/extcmd.c
9723a8
index 69574e2b05b..90a5ca24a64 100644
9723a8
--- a/grub-core/commands/extcmd.c
9723a8
+++ b/grub-core/commands/extcmd.c
9723a8
@@ -19,6 +19,7 @@
9723a8
 
9723a8
 #include <grub/mm.h>
9723a8
 #include <grub/list.h>
9723a8
+#include <grub/lockdown.h>
9723a8
 #include <grub/misc.h>
9723a8
 #include <grub/extcmd.h>
9723a8
 #include <grub/script_sh.h>
9723a8
@@ -110,6 +111,28 @@ grub_register_extcmd (const char *name, grub_extcmd_func_t func,
9723a8
 				    summary, description, parser, 1);
9723a8
 }
9723a8
 
9723a8
+static grub_err_t
9723a8
+grub_extcmd_lockdown (grub_extcmd_context_t ctxt __attribute__ ((unused)),
9723a8
+                      int argc __attribute__ ((unused)),
9723a8
+                      char **argv __attribute__ ((unused)))
9723a8
+{
9723a8
+  return grub_error (GRUB_ERR_ACCESS_DENIED,
9723a8
+                     N_("%s: the command is not allowed when lockdown is enforced"),
9723a8
+                     ctxt->extcmd->cmd->name);
9723a8
+}
9723a8
+
9723a8
+grub_extcmd_t
9723a8
+grub_register_extcmd_lockdown (const char *name, grub_extcmd_func_t func,
9723a8
+                               grub_command_flags_t flags, const char *summary,
9723a8
+                               const char *description,
9723a8
+                               const struct grub_arg_option *parser)
9723a8
+{
9723a8
+  if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
9723a8
+    func = grub_extcmd_lockdown;
9723a8
+
9723a8
+  return grub_register_extcmd (name, func, flags, summary, description, parser);
9723a8
+}
9723a8
+
9723a8
 void
9723a8
 grub_unregister_extcmd (grub_extcmd_t ext)
9723a8
 {
9723a8
diff --git a/grub-core/kern/command.c b/grub-core/kern/command.c
9723a8
index acd72187992..4aabcd4b5f9 100644
9723a8
--- a/grub-core/kern/command.c
9723a8
+++ b/grub-core/kern/command.c
9723a8
@@ -17,6 +17,7 @@
9723a8
  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
9723a8
  */
9723a8
 
9723a8
+#include <grub/lockdown.h>
9723a8
 #include <grub/mm.h>
9723a8
 #include <grub/command.h>
9723a8
 
9723a8
@@ -77,6 +78,29 @@ grub_register_command_prio (const char *name,
9723a8
   return cmd;
9723a8
 }
9723a8
 
9723a8
+static grub_err_t
9723a8
+grub_cmd_lockdown (grub_command_t cmd __attribute__ ((unused)),
9723a8
+                   int argc __attribute__ ((unused)),
9723a8
+                   char **argv __attribute__ ((unused)))
9723a8
+
9723a8
+{
9723a8
+  return grub_error (GRUB_ERR_ACCESS_DENIED,
9723a8
+                     N_("%s: the command is not allowed when lockdown is enforced"),
9723a8
+                     cmd->name);
9723a8
+}
9723a8
+
9723a8
+grub_command_t
9723a8
+grub_register_command_lockdown (const char *name,
9723a8
+                                grub_command_func_t func,
9723a8
+                                const char *summary,
9723a8
+                                const char *description)
9723a8
+{
9723a8
+  if (grub_is_lockdown () == GRUB_LOCKDOWN_ENABLED)
9723a8
+    func = grub_cmd_lockdown;
9723a8
+
9723a8
+  return grub_register_command_prio (name, func, summary, description, 0);
9723a8
+}
9723a8
+
9723a8
 void
9723a8
 grub_unregister_command (grub_command_t cmd)
9723a8
 {
9723a8
diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c
9723a8
new file mode 100644
9723a8
index 00000000000..f87ddaeb1ee
9723a8
--- /dev/null
9723a8
+++ b/grub-core/kern/lockdown.c
9723a8
@@ -0,0 +1,93 @@
9723a8
+/*
9723a8
+ *  GRUB  --  GRand Unified Bootloader
9723a8
+ *  Copyright (C) 2020  Free Software Foundation, Inc.
9723a8
+ *
9723a8
+ *  GRUB is free software: you can redistribute it and/or modify
9723a8
+ *  it under the terms of the GNU General Public License as published by
9723a8
+ *  the Free Software Foundation, either version 3 of the License, or
9723a8
+ *  (at your option) any later version.
9723a8
+ *
9723a8
+ *  GRUB is distributed in the hope that it will be useful,
9723a8
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9723a8
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9723a8
+ *  GNU General Public License for more details.
9723a8
+ *
9723a8
+ *  You should have received a copy of the GNU General Public License
9723a8
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
9723a8
+ *
9723a8
+ */
9723a8
+
9723a8
+#include <grub/dl.h>
9723a8
+#include <grub/file.h>
9723a8
+#include <grub/lockdown.h>
9723a8
+
9723a8
+/* There is no verifier framework in grub 2.02 */
9723a8
+#if 0
9723a8
+#include <grub/verify.h>
9723a8
+#endif
9723a8
+
9723a8
+static int lockdown = GRUB_LOCKDOWN_DISABLED;
9723a8
+
9723a8
+/* There is no verifier framework in grub 2.02 */
9723a8
+#if 0
9723a8
+static grub_err_t
9723a8
+lockdown_verifier_init (grub_file_t io __attribute__ ((unused)),
9723a8
+                    enum grub_file_type type,
9723a8
+                    void **context __attribute__ ((unused)),
9723a8
+                    enum grub_verify_flags *flags)
9723a8
+{
9723a8
+  *flags = GRUB_VERIFY_FLAGS_SKIP_VERIFICATION;
9723a8
+
9723a8
+  switch (type & GRUB_FILE_TYPE_MASK)
9723a8
+    {
9723a8
+    case GRUB_FILE_TYPE_GRUB_MODULE:
9723a8
+    case GRUB_FILE_TYPE_LINUX_KERNEL:
9723a8
+    case GRUB_FILE_TYPE_MULTIBOOT_KERNEL:
9723a8
+    case GRUB_FILE_TYPE_XEN_HYPERVISOR:
9723a8
+    case GRUB_FILE_TYPE_BSD_KERNEL:
9723a8
+    case GRUB_FILE_TYPE_XNU_KERNEL:
9723a8
+    case GRUB_FILE_TYPE_PLAN9_KERNEL:
9723a8
+    case GRUB_FILE_TYPE_NTLDR:
9723a8
+    case GRUB_FILE_TYPE_TRUECRYPT:
9723a8
+    case GRUB_FILE_TYPE_FREEDOS:
9723a8
+    case GRUB_FILE_TYPE_PXECHAINLOADER:
9723a8
+    case GRUB_FILE_TYPE_PCCHAINLOADER:
9723a8
+    case GRUB_FILE_TYPE_COREBOOT_CHAINLOADER:
9723a8
+    case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
9723a8
+    case GRUB_FILE_TYPE_ACPI_TABLE:
9723a8
+    case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
9723a8
+      *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
9723a8
+
9723a8
+      /* Fall through. */
9723a8
+
9723a8
+    default:
9723a8
+      return GRUB_ERR_NONE;
9723a8
+    }
9723a8
+}
9723a8
+
9723a8
+struct grub_file_verifier lockdown_verifier =
9723a8
+  {
9723a8
+    .name = "lockdown_verifier",
9723a8
+    .init = lockdown_verifier_init,
9723a8
+  };
9723a8
+#endif
9723a8
+
9723a8
+void
9723a8
+grub_lockdown (void)
9723a8
+{
9723a8
+  lockdown = GRUB_LOCKDOWN_ENABLED;
9723a8
+
9723a8
+  /*
9723a8
+   * XXX: The lockdown verifier doesn't make sense until
9723a8
+   * GRUB has moved to the shim_lock verifier.
9723a8
+   */
9723a8
+#if 0
9723a8
+  grub_verifier_register (&lockdown_verifier);
9723a8
+#endif
9723a8
+}
9723a8
+
9723a8
+int
9723a8
+grub_is_lockdown (void)
9723a8
+{
9723a8
+  return lockdown;
9723a8
+}
9723a8
diff --git a/include/grub/command.h b/include/grub/command.h
9723a8
index eee4e847ee4..2a6f7f84697 100644
9723a8
--- a/include/grub/command.h
9723a8
+++ b/include/grub/command.h
9723a8
@@ -86,6 +86,11 @@ EXPORT_FUNC(grub_register_command_prio) (const char *name,
9723a8
 					 const char *summary,
9723a8
 					 const char *description,
9723a8
 					 int prio);
9723a8
+grub_command_t
9723a8
+EXPORT_FUNC(grub_register_command_lockdown) (const char *name,
9723a8
+                                             grub_command_func_t func,
9723a8
+                                             const char *summary,
9723a8
+                                             const char *description);
9723a8
 void EXPORT_FUNC(grub_unregister_command) (grub_command_t cmd);
9723a8
 
9723a8
 static inline grub_command_t
9723a8
diff --git a/include/grub/extcmd.h b/include/grub/extcmd.h
9723a8
index 19fe592669e..fe9248b8bb6 100644
9723a8
--- a/include/grub/extcmd.h
9723a8
+++ b/include/grub/extcmd.h
9723a8
@@ -62,6 +62,13 @@ grub_extcmd_t EXPORT_FUNC(grub_register_extcmd) (const char *name,
9723a8
 						 const char *description,
9723a8
 						 const struct grub_arg_option *parser);
9723a8
 
9723a8
+grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_lockdown) (const char *name,
9723a8
+                                                          grub_extcmd_func_t func,
9723a8
+                                                          grub_command_flags_t flags,
9723a8
+                                                          const char *summary,
9723a8
+                                                          const char *description,
9723a8
+                                                          const struct grub_arg_option *parser);
9723a8
+
9723a8
 grub_extcmd_t EXPORT_FUNC(grub_register_extcmd_prio) (const char *name,
9723a8
 						      grub_extcmd_func_t func,
9723a8
 						      grub_command_flags_t flags,
9723a8
diff --git a/include/grub/lockdown.h b/include/grub/lockdown.h
9723a8
new file mode 100644
9723a8
index 00000000000..40531fa823b
9723a8
--- /dev/null
9723a8
+++ b/include/grub/lockdown.h
9723a8
@@ -0,0 +1,44 @@
9723a8
+/*
9723a8
+ *  GRUB  --  GRand Unified Bootloader
9723a8
+ *  Copyright (C) 2020  Free Software Foundation, Inc.
9723a8
+ *
9723a8
+ *  GRUB is free software: you can redistribute it and/or modify
9723a8
+ *  it under the terms of the GNU General Public License as published by
9723a8
+ *  the Free Software Foundation, either version 3 of the License, or
9723a8
+ *  (at your option) any later version.
9723a8
+ *
9723a8
+ *  GRUB is distributed in the hope that it will be useful,
9723a8
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9723a8
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9723a8
+ *  GNU General Public License for more details.
9723a8
+ *
9723a8
+ *  You should have received a copy of the GNU General Public License
9723a8
+ *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
9723a8
+ */
9723a8
+
9723a8
+#ifndef GRUB_LOCKDOWN_H
9723a8
+#define GRUB_LOCKDOWN_H 1
9723a8
+
9723a8
+#include <grub/symbol.h>
9723a8
+
9723a8
+#define GRUB_LOCKDOWN_DISABLED       0
9723a8
+#define GRUB_LOCKDOWN_ENABLED        1
9723a8
+
9723a8
+#ifdef GRUB_MACHINE_EFI
9723a8
+extern void
9723a8
+EXPORT_FUNC (grub_lockdown) (void);
9723a8
+extern int
9723a8
+EXPORT_FUNC (grub_is_lockdown) (void);
9723a8
+#else
9723a8
+static inline void
9723a8
+grub_lockdown (void)
9723a8
+{
9723a8
+}
9723a8
+
9723a8
+static inline int
9723a8
+grub_is_lockdown (void)
9723a8
+{
9723a8
+  return GRUB_LOCKDOWN_DISABLED;
9723a8
+}
9723a8
+#endif
9723a8
+#endif /* ! GRUB_LOCKDOWN_H */
9723a8
diff --git a/conf/Makefile.common b/conf/Makefile.common
9723a8
index b93879804c0..521cdda1f5a 100644
9723a8
--- a/conf/Makefile.common
9723a8
+++ b/conf/Makefile.common
9723a8
@@ -85,7 +85,9 @@ CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
9723a8
 CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
9723a8
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_lockdown(...)=COMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
9723a8
+CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd_lockdown(...)=EXTCOMMAND_LOCKDOWN_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_FDT_LIST := '-Dgrub_fdtbus_register(...)=FDT_DRIVER_LIST_MARKER(__VA_ARGS__)'
9723a8
 CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
9723a8
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
9723a8
index 3ce827ab726..421dd410e50 100644
9723a8
--- a/docs/grub-dev.texi
9723a8
+++ b/docs/grub-dev.texi
9723a8
@@ -84,6 +84,7 @@ This edition documents version @value{VERSION}.
9723a8
 * Video Subsystem::
9723a8
 * PFF2 Font File Format::
9723a8
 * Graphical Menu Software Design::
9723a8
+* Lockdown framework::
9723a8
 * Copying This Manual::         Copying This Manual
9723a8
 * Index::
9723a8
 @end menu
9723a8
@@ -1949,6 +1950,32 @@ the graphics mode that was in use before @code{grub_video_setup()} was called
9723a8
 might fix some of the problems.
9723a8
 
9723a8
 
9723a8
+@node Lockdown framework
9723a8
+@chapter Lockdown framework
9723a8
+
9723a8
+The GRUB can be locked down, which is a restricted mode where some operations
9723a8
+are not allowed. For instance, some commands cannot be used when the GRUB is
9723a8
+locked down.
9723a8
+
9723a8
+The function
9723a8
+@code{grub_lockdown()} is used to lockdown GRUB and the function
9723a8
+@code{grub_is_lockdown()} function can be used to check whether lockdown is
9723a8
+enabled or not. When enabled, the function returns @samp{GRUB_LOCKDOWN_ENABLED}
9723a8
+and @samp{GRUB_LOCKDOWN_DISABLED} when is not enabled.
9723a8
+
9723a8
+The following functions can be used to register the commands that can only be
9723a8
+used when lockdown is disabled:
9723a8
+
9723a8
+@itemize
9723a8
+
9723a8
+@item @code{grub_cmd_lockdown()} registers command which should not run when the
9723a8
+GRUB is in lockdown mode.
9723a8
+
9723a8
+@item @code{grub_cmd_lockdown()} registers extended command which should not run
9723a8
+when the GRUB is in lockdown mode.
9723a8
+
9723a8
+@end itemize
9723a8
+
9723a8
 @node Copying This Manual
9723a8
 @appendix Copying This Manual
9723a8
 
9723a8
diff --git a/docs/grub.texi b/docs/grub.texi
3efed6
index 97f0f47e082..f957535dbea 100644
9723a8
--- a/docs/grub.texi
9723a8
+++ b/docs/grub.texi
3efed6
@@ -5687,6 +5687,7 @@ environment variables and commands are listed in the same order.
3efed6
 * Using GPG-style digital signatures:: Booting digitally signed code
3efed6
 * Using appended signatures::          An alternative approach to booting digitally signed code
3efed6
 * Signing GRUB itself::                Ensuring the integrity of the GRUB core image
9723a8
+* Lockdown::                           Lockdown when booting on a secure setup
9723a8
 @end menu
9723a8
 
9723a8
 @node Authentication and authorisation
3efed6
@@ -5977,6 +5978,13 @@ As with UEFI secure boot, it is necessary to build in the required modules,
3efed6
 or sign them separately.
3efed6
 
9723a8
 
9723a8
+@node Lockdown
9723a8
+@section Lockdown when booting on a secure setup
9723a8
+
9723a8
+The GRUB can be locked down when booted on a secure boot environment, for example
9723a8
+if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
9723a8
+be restricted and some operations/commands cannot be executed.
9723a8
+
9723a8
 @node Platform limitations
9723a8
 @chapter Platform limitations
9723a8
 
9723a8
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
9723a8
index 4062652506d..a6f1b0dcd06 100644
9723a8
--- a/grub-core/Makefile.am
9723a8
+++ b/grub-core/Makefile.am
9723a8
@@ -82,6 +82,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
9723a8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
9723a8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
9723a8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
9723a8
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lockdown.h
9723a8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
9723a8
 if COND_emu
9723a8
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
9723a8
@@ -350,8 +351,10 @@ command.lst: $(MARKER_FILES)
9723a8
 	  b=`basename $$pp .marker`; \
9723a8
 	  sed -n \
9723a8
 	    -e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
9723a8
+	    -e "/EXTCOMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
9723a8
 	    -e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
9723a8
-	    -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
9723a8
+	    -e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" \
9723a8
+	    -e "/COMMAND_LOCKDOWN_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
9723a8
 	done) | sort -u > $@
9723a8
 platform_DATA += command.lst
9723a8
 CLEANFILES += command.lst