Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 8/9] boot/syslinux: add option to install the EFI image
Date: Mon, 28 Apr 2014 08:18:53 +0200	[thread overview]
Message-ID: <535DF2CD.3000100@mind.be> (raw)
In-Reply-To: <b21bd8bd922ebfb71a12cf929f953f384216f43f.1398378217.git.yann.morin.1998@free.fr>

On 25/04/14 00:30, Yann E. MORIN wrote:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> syslinux can now also build an EFI application.
> 
> If the target is 64-bit, we build the 64-bit EFI app,
> otherwise we build the 32-bit EFI app.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Frank Hunleth <fhunleth@troodon-software.com>
> ---
>  boot/syslinux/Config.in                            | 24 +++++++++++++-
>  .../syslinux-000-user-headers-from-sysroot.patch   | 37 ++++++++++++++++++++++
>  boot/syslinux/syslinux.mk                          | 21 ++++++++++--
>  3 files changed, 78 insertions(+), 4 deletions(-)
>  create mode 100644 boot/syslinux/syslinux-000-user-headers-from-sysroot.patch
> 
> diff --git a/boot/syslinux/Config.in b/boot/syslinux/Config.in
> index b92f28f..d556c55 100644
> --- a/boot/syslinux/Config.in
> +++ b/boot/syslinux/Config.in
> @@ -2,7 +2,6 @@ config BR2_TARGET_SYSLINUX
>  	bool "syslinux"
>  	depends on BR2_i386 || BR2_x86_64
>  	select BR2_HOSTARCH_NEEDS_IA32_COMPILER
> -	select BR2_TARGET_SYSLINUX_ISOLINUX if !BR2_TARGET_SYSLINUX_PXELINUX
>  	help
>  	  The syslinux bootloader for x86 systems.
>  	  This includes: syslinux, pxelinux, extlinux.
> @@ -11,6 +10,27 @@ config BR2_TARGET_SYSLINUX
>  
>  if BR2_TARGET_SYSLINUX
>  
> +choice
> +	bool "Image type"

 Why is this a choice? It's possible to build both, no? Similar to
iso/pxe. So it makes more sense to me to add efi as a third option after
iso and pxe.

> +
> +config BR2_TARGET_SYSLINUX_LEGACY_BIOS
> +	bool "bios (legacy)"
> +	select BR2_TARGET_SYSLINUX_ISOLINUX if !BR2_TARGET_SYSLINUX_PXELINUX
> +	help
> +	  Install one or more of the the legacy BIOS images:
> +	    - isolinux
> +	    - pxelinux
> +
> +config BR2_TARGET_SYSLINUX_EFI
> +	bool "efi"
> +	select BR2_PACKAGE_GNU_EFI
> +	help
> +	  Install the 'efi' image, to boot from an EFI environment.
> +
> +endchoice
> +
> +if BR2_TARGET_SYSLINUX_LEGACY_BIOS
> +
>  config BR2_TARGET_SYSLINUX_ISOLINUX
>  	bool "isolinux"
>  	default y
> @@ -24,4 +44,6 @@ config BR2_TARGET_SYSLINUX_PXELINUX
>  	  Install the legacy BIOS 'pxelinux' image, to boot off
>  	  the network using PXE.
>  
> +endif # BR2_TARGET_SYSLINUX_LEGACY_BIOS
> +
>  endif # BR2_TARGET_SYSLINUX
> diff --git a/boot/syslinux/syslinux-000-user-headers-from-sysroot.patch b/boot/syslinux/syslinux-000-user-headers-from-sysroot.patch
> new file mode 100644
> index 0000000..5edf79f
> --- /dev/null
> +++ b/boot/syslinux/syslinux-000-user-headers-from-sysroot.patch
> @@ -0,0 +1,37 @@
> +efi: look for headers and libs in the sysroot
> +
> +Currently, syslinux hard-codes search paths to /usr/.... directories.
> +This does not play well in cross-compilation.
> +
> +If $SYSROOT is defined, prepend it to the search paths.
> +
> +Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> +
> +diff -durN syslinux-6.02.orig/efi/find-gnu-efi.sh syslinux-6.02/efi/find-gnu-efi.sh
> +--- syslinux-6.02.orig/efi/find-gnu-efi.sh	2013-10-13 19:59:03.000000000 +0200
> ++++ syslinux-6.02/efi/find-gnu-efi.sh	2014-04-22 00:19:23.638483887 +0200
> +@@ -9,7 +9,7 @@
> + find_include()
> + {
> +     for d in $include_dirs; do
> +-	found=`find $d -name efi -type d 2> /dev/null`
> ++	found=`find $SYSROOT$d -name efi -type d 2> /dev/null`
> + 	if [ "$found"x != "x" ] && [ -e $found/$ARCH/efibind.h ]; then
> + 	    echo $found
> + 	    break;
> +@@ -20,12 +20,12 @@
> + find_lib()
> + {
> +     for d in $lib_dirs; do
> +-	found=`find $d -name libgnuefi.a 2> /dev/null`
> ++	found=`find $SYSROOT$d -name libgnuefi.a 2> /dev/null`
> + 	if [ "$found"x != "x" ]; then
> + 	    crt_name='crt0-efi-'$ARCH'.o'
> +-	    crt=`find $d -name $crt_name 2> /dev/null`
> ++	    crt=`find $SYSROOT$d -name $crt_name 2> /dev/null`
> + 	    if [ "$crt"x != "x" ]; then
> +-		echo $d
> ++		echo $SYSROOT$d
> + 		break;
> + 	    fi
> + 	fi
> diff --git a/boot/syslinux/syslinux.mk b/boot/syslinux/syslinux.mk
> index bec132f..bf0bae5 100644
> --- a/boot/syslinux/syslinux.mk
> +++ b/boot/syslinux/syslinux.mk
> @@ -15,6 +15,20 @@ SYSLINUX_INSTALL_IMAGES = YES
>  
>  SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx
>  
> +ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y)
> +SYSLINUX_TARGET = bios

 If you follow my suggestion, this would become SYSLINUX_TARGETS of
course. And +=


 Regards,
 Arnout

> +endif
> +
> +ifeq ($(BR2_TARGET_SYSLINUX_EFI),y)
> +ifeq ($(BR2_ARCH_IS_64),y)
> +SYSLINUX_EFI_BITS = efi64
> +else
> +SYSLINUX_EFI_BITS = efi32
> +endif # 64-bit
> +SYSLINUX_DEPENDENCIES += gnu-efi
> +SYSLINUX_TARGET = $(SYSLINUX_EFI_BITS)
> +endif # EFI
> +
>  # The syslinux tarball comes with pre-compiled binaries.
>  # Since timestamps might not be in the correct order, a rebuild is
>  # not always triggered for all the different images.
> @@ -30,7 +44,7 @@ SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
>  # be used.
>  define SYSLINUX_BUILD_CMDS
>  	$(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
> -	    AR="$(HOSTAR)" -C $(@D) bios
> +	    AR="$(HOSTAR)" SYSROOT=$(STAGING_DIR) -C $(@D) $(SYSLINUX_TARGET)
>  endef
>  
>  define SYSLINUX_INSTALL_TARGET_CMDS
> @@ -40,12 +54,13 @@ define SYSLINUX_INSTALL_TARGET_CMDS
>  	# Repeat CC and AR, since syslinux really wants to check them at
>  	# install time
>  	$(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
> -	    AR="$(HOSTAR)" INSTALLROOT=$(HOST_DIR) \
> -	    -C $(@D) bios install
> +	    AR="$(HOSTAR)" SYSROOT=$(STAGING_DIR) INSTALLROOT=$(HOST_DIR) \
> +	    -C $(@D) $(SYSLINUX_TARGET) install
>  endef
>  
>  SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
>  SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
> +SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
>  
>  define SYSLINUX_INSTALL_IMAGES_CMDS
>  	for i in $(SYSLINUX_IMAGES-y); do \
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

  reply	other threads:[~2014-04-28  6:18 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24 22:30 [Buildroot] [PATCH 0/9] Bump and improve syslinux (branch yem/adopted) Yann E. MORIN
2014-04-24 22:29 ` [Buildroot] [PATCH 1/9] boot/syslinux: needs an ia32-capable compiler Yann E. MORIN
2014-04-28  5:55   ` Arnout Vandecappelle
2014-04-28 17:51     ` Yann E. MORIN
2014-04-24 22:29 ` [Buildroot] [PATCH 2/9] boot/syslinux: prepare to install non-core images Yann E. MORIN
2014-04-24 22:29 ` [Buildroot] [PATCH 3/9] boot/syslinux: remove 'default y' in sub-options Yann E. MORIN
2014-04-24 22:55   ` Arnout Vandecappelle
2014-04-25 14:54     ` Yann E. MORIN
2014-04-24 22:29 ` [Buildroot] [PATCH 4/9] boot/syslinux: rewrite options prompts Yann E. MORIN
2014-04-28  5:57   ` Arnout Vandecappelle
2014-04-28 17:36     ` Yann E. MORIN
2014-04-28 19:17       ` Arnout Vandecappelle
2014-04-24 22:30 ` [Buildroot] [PATCH 5/9] package/ucl: new package Yann E. MORIN
2014-04-24 22:30 ` [Buildroot] [PATCH 6/9] package/upx: " Yann E. MORIN
2014-04-28  6:03   ` Arnout Vandecappelle
2014-04-28 17:43     ` Yann E. MORIN
2014-04-24 22:30 ` [Buildroot] [PATCH 7/9] boot/syslinux: bump version Yann E. MORIN
2014-04-28  6:14   ` Arnout Vandecappelle
2014-04-28 17:26     ` Yann E. MORIN
2014-04-24 22:30 ` [Buildroot] [PATCH 8/9] boot/syslinux: add option to install the EFI image Yann E. MORIN
2014-04-28  6:18   ` Arnout Vandecappelle [this message]
2014-04-28 17:15     ` Yann E. MORIN
2014-04-28 19:16       ` Arnout Vandecappelle
2014-04-28 19:45         ` Yann E. MORIN
2014-04-28 19:51           ` Arnout Vandecappelle
2014-04-24 22:30 ` [Buildroot] [PATCH 9/9] boot/syslinux: add an option to install an MBR blob Yann E. MORIN
2014-04-28 16:23   ` Arnout Vandecappelle
2014-04-28 19:52     ` Yann E. MORIN
2014-04-28 19:58       ` Frank Hunleth
2014-04-28 20:39         ` Yann E. MORIN
2014-04-28 20:45           ` Frank Hunleth
2014-04-28 20:57       ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2014-04-29 16:49 [Buildroot] [PATCH 0/9 v2] Bump and improve syslinux (branch yem/syslinux) Yann E. MORIN
2014-04-29 16:49 ` [Buildroot] [PATCH 8/9] boot/syslinux: add option to install the EFI image Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535DF2CD.3000100@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox