[PATCH 08/30] common: move EFI code into new efi/ top level directory

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Nov 22 00:47:10 PST 2021


So far, barebox EFI meant EFI payload support on x86. Upcoming changes
will extend barebox to support EFI payload _and_ loader on ARM64.
Prepare for this by renaming files and directories appropriately, so
it's immediately clear whether a file is about paylaod, loader or common
support.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/Kconfig                                   | 10 ++--------
 common/Makefile                                  |  4 +---
 common/efi/Kconfig                               | 16 ++++++++++++++++
 common/efi/Makefile                              |  9 +++++----
 common/{efi-devicepath.c => efi/devicepath.c}    |  0
 common/{efi-guid.c => efi/guid.c}                |  0
 common/efi/payload/Makefile                      |  6 ++++++
 .../{ => payload}/env-efi/network/eth0-discover  |  0
 common/efi/{efi-image.c => payload/image.c}      |  2 +-
 common/efi/{efi.c => payload/init.c}             |  2 +-
 common/efi/{efi-iomem.c => payload/iomem.c}      |  0
 drivers/efi/Kconfig                              |  1 +
 12 files changed, 33 insertions(+), 17 deletions(-)
 create mode 100644 common/efi/Kconfig
 rename common/{efi-devicepath.c => efi/devicepath.c} (100%)
 rename common/{efi-guid.c => efi/guid.c} (100%)
 create mode 100644 common/efi/payload/Makefile
 rename common/efi/{ => payload}/env-efi/network/eth0-discover (100%)
 rename common/efi/{efi-image.c => payload/image.c} (99%)
 rename common/efi/{efi.c => payload/init.c} (99%)
 rename common/efi/{efi-iomem.c => payload/iomem.c} (100%)

diff --git a/common/Kconfig b/common/Kconfig
index f4120b2083ee..42240ae8411b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -78,14 +78,6 @@ config MENUTREE
 	select GLOB
 	select GLOB_SORT
 
-config EFI_GUID
-	bool
-	help
-	  With this option a table of EFI guids is compiled in.
-
-config EFI_DEVICEPATH
-	bool
-
 config ARCH_DMA_ADDR_T_64BIT
 	bool
 
@@ -1538,6 +1530,8 @@ config COMPILE_TEST
 
 endmenu
 
+source "common/efi/Kconfig"
+
 config HAS_DEBUG_LL
 	bool
 
diff --git a/common/Makefile b/common/Makefile
index 4b45f678c7de..9ed279806a08 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -63,9 +63,7 @@ obj-$(CONFIG_BOOTCHOOSER)	+= bootchooser.o
 obj-$(CONFIG_UIMAGE)		+= image.o uimage.o
 obj-$(CONFIG_FITIMAGE)		+= image-fit.o
 obj-$(CONFIG_MENUTREE)		+= menutree.o
-obj-$(CONFIG_EFI_BOOTUP)	+= efi/
-obj-$(CONFIG_EFI_GUID)		+= efi-guid.o
-obj-$(CONFIG_EFI_DEVICEPATH)	+= efi-devicepath.o
+obj-$(CONFIG_EFI)		+= efi/
 lwl-$(CONFIG_IMD)		+= imd-barebox.o
 obj-$(CONFIG_IMD)		+= imd.o
 obj-y				+= file-list.o
diff --git a/common/efi/Kconfig b/common/efi/Kconfig
new file mode 100644
index 000000000000..a0565854c2f5
--- /dev/null
+++ b/common/efi/Kconfig
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0
+
+menu "EFI (Extensible Firmware Interface) Support"
+
+config EFI
+	bool
+
+config EFI_GUID
+	bool
+	help
+	  With this option a table of EFI guids is compiled in.
+
+config EFI_DEVICEPATH
+	bool
+
+endmenu
diff --git a/common/efi/Makefile b/common/efi/Makefile
index d746fabe2109..1ed5d45c1f5e 100644
--- a/common/efi/Makefile
+++ b/common/efi/Makefile
@@ -1,4 +1,5 @@
-obj-y += efi.o
-obj-y += efi-image.o
-bbenv-y += env-efi
-obj-$(CONFIG_CMD_IOMEM) += efi-iomem.o
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-$(CONFIG_EFI_BOOTUP)	+= payload/
+obj-$(CONFIG_EFI_GUID)		+= guid.o
+obj-$(CONFIG_EFI_DEVICEPATH)	+= devicepath.o
diff --git a/common/efi-devicepath.c b/common/efi/devicepath.c
similarity index 100%
rename from common/efi-devicepath.c
rename to common/efi/devicepath.c
diff --git a/common/efi-guid.c b/common/efi/guid.c
similarity index 100%
rename from common/efi-guid.c
rename to common/efi/guid.c
diff --git a/common/efi/payload/Makefile b/common/efi/payload/Makefile
new file mode 100644
index 000000000000..bcbdda335f06
--- /dev/null
+++ b/common/efi/payload/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-y += init.o
+obj-y += image.o
+bbenv-y += env-efi
+obj-$(CONFIG_CMD_IOMEM) += iomem.o
diff --git a/common/efi/env-efi/network/eth0-discover b/common/efi/payload/env-efi/network/eth0-discover
similarity index 100%
rename from common/efi/env-efi/network/eth0-discover
rename to common/efi/payload/env-efi/network/eth0-discover
diff --git a/common/efi/efi-image.c b/common/efi/payload/image.c
similarity index 99%
rename from common/efi/efi-image.c
rename to common/efi/payload/image.c
index bd1c58438e84..3c55a457eae3 100644
--- a/common/efi/efi-image.c
+++ b/common/efi/payload/image.c
@@ -1,5 +1,5 @@
 /*
- * efi-image.c - barebox EFI payload support
+ * image.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer at pengutronix.de>, Pengutronix
  *
diff --git a/common/efi/efi.c b/common/efi/payload/init.c
similarity index 99%
rename from common/efi/efi.c
rename to common/efi/payload/init.c
index 7f12342cf91b..88d0bfa939ec 100644
--- a/common/efi/efi.c
+++ b/common/efi/payload/init.c
@@ -1,5 +1,5 @@
 /*
- * efi.c - barebox EFI payload support
+ * init.c - barebox EFI payload support
  *
  * Copyright (c) 2014 Sascha Hauer <s.hauer at pengutronix.de>, Pengutronix
  *
diff --git a/common/efi/efi-iomem.c b/common/efi/payload/iomem.c
similarity index 100%
rename from common/efi/efi-iomem.c
rename to common/efi/payload/iomem.c
diff --git a/drivers/efi/Kconfig b/drivers/efi/Kconfig
index dd3ac7525f9f..e8abc2709e26 100644
--- a/drivers/efi/Kconfig
+++ b/drivers/efi/Kconfig
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 config EFI_BOOTUP
 	bool
+	select EFI
 	select BLOCK
 	select PARTITION_DISK
 	select HW_HAS_PCI
-- 
2.30.2




More information about the barebox mailing list