Skip to contentSkip to conversation

: Add EFI conditional

PATCH In review Francesco Lavra 2 participants 3 messages Jan 26, 2013 – Jan 27, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Add EFI conditional

This patch adds the automake conditional COND_efi, which is true for every configuration using the EFI platform. This conditional is used in grub-core/Makefile.am to remove some duplicated entries in KERNEL_HEADER_FILES.
As the EFI platform is expected to be used in more architectures (work is in progress to port GRUB to ARM using EFI), this patch will allow not to have even more duplicated code in the future.

2013-01-26 Francesco Lavra <[email protected]>

* configure.ac (COND_efi): New condition.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add EFI files under COND_efi and remove duplicated entries.

=== modified file 'configure.ac'

configure.ac +1 -0
@@ -1132,6 +1132,7 @@
 #
 
 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
+AM_CONDITIONAL([COND_efi], [test x$platform = xefi])
 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])

=== modified file 'grub-core/Makefile.am'

Makefile.am +5 -9
@@ -102,8 +102,6 @@
 endif
 
 if COND_i386_efi
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
 endif
@@ -132,17 +130,10 @@
 endif
 
 if COND_x86_64_efi
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
 KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
 endif
 
-if COND_ia64_efi
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
-KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
-endif
-
 if COND_mips
 KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
 endif
@@ -225,6 +216,11 @@
 endif
 endif
 
+if COND_efi
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
+endif
+
 symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES)
 	@list='$^'; \
 	for p in $$list; do \

--
Francesco Lavra

#1 lore raw
Quoted 8 lines · Francesco Lavra

This patch adds the automake conditional COND_efi, which is true for every configuration using the EFI platform. This conditional is used in grub-core/Makefile.am to remove some duplicated entries in KERNEL_HEADER_FILES.
As the EFI platform is expected to be used in more architectures (work is in progress to port GRUB to ARM using EFI), this patch will allow not to have even more duplicated code in the future.

ARM U-Boot port should be a priority, not EFI flavours.
And this patch just moves the problem around. Rather than having to keep different clauses in Makefile.am in sync you have to keep gentpl.py and configure.ac in sync. Doesn't seem to be worth it.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw

Hi,

Quoted 11 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 8 lines · Francesco Lavra

This patch adds the automake conditional COND_efi, which is true for every configuration using the EFI platform. This conditional is used in grub-core/Makefile.am to remove some duplicated entries in KERNEL_HEADER_FILES.
As the EFI platform is expected to be used in more architectures (work is in progress to port GRUB to ARM using EFI), this patch will allow not to have even more duplicated code in the future.

Quoted 4 lines

ARM U-Boot port should be a priority, not EFI flavours.
And this patch just moves the problem around. Rather than having to keep different clauses in Makefile.am in sync you have to keep gentpl.py and configure.ac in sync. Doesn't seem to be worth it.

Well, this patch adds to configure.ac what is already there in gentpl.py (the "efi" group). Group definitions are already used throughout Makefile.core.def to conditionally enable modules and source files, and any new configuration using EFI would already need to be added to the efi group.
In our specific case, if a configuration belongs to a efi group, this enables compilation in the kernel of, among others, disk/efi/efidisk.c and kern/efi/efi.c, which define the global symbols exported by the kernel headers. It just seems easier and more intuitive to add the respective header files in Makefile.am under the same logical condition which enables source file compilation in Makefile.core.def. This patch would avoid having to re-declare the kernel header files for any new configurations using EFI, and wouldn't require any additional boilerplate elsewhere.
Anyway, if you don't feel like it's worth the trouble, no problem for me, I won't insist any further :)

Regards,
Francesco