Skip to contentSkip to conversation

Bump and improve syslinux (branch yem/syslinux)

PATCH New Yann E. MORIN 2 participants 21 messages May 2, 2014 – May 3, 2014

lore
Share & tools
lore
#0 lore raw

v3 cover Bump and improve syslinux (branch yem/syslinux)

From: "Yann E. MORIN" <[email protected]>

Hello All!

Here are a few patches to bump and enhance syslinux:
- patches 1..4: preparatory fixing and cleanup patches
- patches 5..6: new pacakges, dependency of the new syslinux
- patch 7 : actual syslinux bump
- patches 8..9: new options to install new types of blobs

To be noted, the syslinx build system is, well, a bit weird, to say the least. There is I hope extensive-enough information about this in the bump-patch. Please pay it a bit of attention, it is really convoluted, and would benefit from some in-depth review.

Thanks to Frank for his preliminary work on ucl and upx, and to Thomas L. whose extlinux patch prompted me to look at syslinux. ;-)

Changes v2 -> v3:
- install syslinux files in sub-dir of images/ (Romain)
- install syslinux .c32 modules (Romain)
- typoes

Changes v1 -> v2:
- explain the need for an ia32 compiler (Arnout)
- make the image selection a choice (Arnout)
- improve upx commit log (Arnout)
- typoes (Arnout)
- improve help entry for the mbr option

Regards,
Yann E. MORIN.

The following changes since commit 26132bac8dc4c2d3130c0d239ab4e174dd8b221c:

libwebsockets: disable checks for C++ compiler (2014-05-02 15:07:43 +0200)

are available in the git repository at:

git://gitorious.org/buildroot/buildroot.git yem/syslinux

for you to fetch changes up to fd8cb5b156e73680f07c222dca6a812e47ec8e3c:

  boot/syslinux: install in a sub-dir of $(BINARIES_DIR) (2014-05-02 18:33:53 +0200)

----------------------------------------------------------------
Frank Hunleth (2):
package/ucl: new package
package/upx: new package

Yann E. MORIN (10):
boot/syslinux: needs an ia32-capable compiler boot/syslinux: prepare to install non-core images boot/syslinux: make the sub-options a choice boot/syslinux: rewrite options prompts boot/syslinux: move comments out of define-block boot/syslinux: bump version
boot/syslinux: add option to install the EFI image boot/syslinux: add an option to install an MBR blob boot/syslinux: add option to install c32 modules boot/syslinux: install in a sub-dir of $(BINARIES_DIR)

 boot/syslinux/Config.in                            | 49 +++++++++++++++--
 .../syslinux-000-user-headers-from-sysroot.patch   | 37 +++++++++++++
 boot/syslinux/syslinux.mk                          | 63 ++++++++++++++++++----
 package/ucl/ucl.mk                                 | 12 +++++
 package/upx/upx.mk                                 | 28 ++++++++++
 5 files changed, 173 insertions(+), 16 deletions(-)
 create mode 100644 boot/syslinux/syslinux-000-user-headers-from-sysroot.patch
 create mode 100644 package/ucl/ucl.mk
 create mode 100644 package/upx/upx.mk
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v3 1/12 boot/syslinux: needs an ia32-capable compiler

From: "Yann E. MORIN" <[email protected]>

The pxelinux and isolionux images are 32-bit binaries, so we need a compiler that can generate them (ie. a compiler that understands -m32).

---
Changes v1 -> v2:
- explain why we need it (Arnout)

---
 boot/syslinux/Config.in | 1 +
 1 file changed, 1 insertion(+)
boot/syslinux/Config.in +1 -0
index 2c39e65..5b1122d 100644
@@ -1,6 +1,7 @@
 config BR2_TARGET_SYSLINUX
 	bool "syslinux"
 	depends on BR2_i386 || BR2_x86_64
+	select BR2_HOSTARCH_NEEDS_IA32_COMPILER
 	help
 	  The syslinux bootloader for x86 systems.
 	  This includes: syslinux, pxelinux, extlinux.
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 1/12 boot/syslinux: needs an ia32-capable compiler

Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
The pxelinux and isolionux images are 32-bit binaries, so we need a compiler that can generate them (ie. a compiler that understands -m32).

Quoted 3 lines

---
Changes v1 -> v2:
- explain why we need it (Arnout)

Committed patch 1-4, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH v3 2/12 boot/syslinux: prepare to install non-core images

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

Currently, we hard-code the path to the images we install, and expect them to be from the core/ sub-dir.

Not all images we can install are located in core/. For example, the efi boot images (to come later) are not located in core/.

Prepare the upcoming installation of extlinux by not expecting images be in core/.

---
 boot/syslinux/syslinux.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/syslinux/syslinux.mk +3 -3
index 0faa81f..a1eb394 100644
@@ -28,12 +28,12 @@ define SYSLINUX_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) INSTALLROOT=$(HOST_DIR) install
 endef
 
-SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += isolinux.bin
-SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += pxelinux.bin
+SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += core/isolinux.bin
+SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += core/pxelinux.bin
 
 define SYSLINUX_INSTALL_IMAGES_CMDS
 	for i in $(SYSLINUX_IMAGES-y); do \
-		$(INSTALL) -D -m 0755 $(@D)/core/$$i $(BINARIES_DIR)/$$i; \
+		$(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/$${i##*/}; \
 	done
 endef
 
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH v3 3/12 boot/syslinux: make the sub-options a choice

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

Currently it is possible to choose either, both or none of the pxelinux or isolinux images.

But it does not make sense to build none or both, as we need at least one to boot the target, and the target can not use more than one.

So, we need one and only one image to be selected at once.

---
Changes v1 -> v2:
- make it a choice, not a forced-bool (Arnout)

---
 boot/syslinux/Config.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
boot/syslinux/Config.in +5 -2
index 5b1122d..f7525b8 100644
@@ -10,12 +10,15 @@ config BR2_TARGET_SYSLINUX
 
 if BR2_TARGET_SYSLINUX
 
+choice
+	bool "Image to install"
+
 config BR2_TARGET_SYSLINUX_ISOLINUX
 	bool "Install isolinux"
-	default y
 
 config BR2_TARGET_SYSLINUX_PXELINUX
 	bool "Install pxelinux"
-	default y
+
+endchoice
 
 endif
Signature · 1 line
1.8.3.2
#5 lore raw

PATCH v3 4/12 boot/syslinux: rewrite options prompts

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

Rewrite the options prompt in preparation to adding a new type of image to install.

Add help entries to each option, too.

---
Changes v1 -> v2:
- typo s/medias/media/ (Arnout)
- s/legacy BIOS/legacy-BIOS/ to remove ambiguity (Arnout)

---
 boot/syslinux/Config.in | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
boot/syslinux/Config.in +9 -3
index f7525b8..7263128 100644
@@ -14,11 +14,17 @@ choice
 	bool "Image to install"
 
 config BR2_TARGET_SYSLINUX_ISOLINUX
-	bool "Install isolinux"
+	bool "isolinux"
+	help
+	  Install the legacy-BIOS 'isolinux' image, to boot off
+	  optical media (CDROM, DVD.)
 
 config BR2_TARGET_SYSLINUX_PXELINUX
-	bool "Install pxelinux"
+	bool "pxelinux"
+	help
+	  Install the legacy-BIOS 'pxelinux' image, to boot off
+	  the network using PXE.
 
 endchoice
 
-endif
+endif # BR2_TARGET_SYSLINUX
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH v3 5/12 boot/syslinux: move comments out of define-block

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

The comments are mot really part of the command we want to execute, so move themn out of the define-block. This also cleans up the output, as they will no longer appear.

---
 boot/syslinux/syslinux.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
boot/syslinux/syslinux.mk +2 -2
index a1eb394..ee71a0a 100644
@@ -22,9 +22,9 @@ define SYSLINUX_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" AR="$(HOSTAR)" -C $(@D)
 endef
 
+# While the actual bootloader is compiled for the target, several
+# utilities for installing the bootloader are meant for the host.
 define SYSLINUX_INSTALL_TARGET_CMDS
-	# While the actual bootloader is compiled for the target, several
-	# utilities for installing the bootloader are meant for the host.
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) INSTALLROOT=$(HOST_DIR) install
 endef
 
Signature · 1 line
1.8.3.2
#7 lore raw

PATCH 5/12 boot/syslinux: move comments out of define-block

Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
The comments are mot really part of the command we want to execute,

s/mot/not/

Quoted 1 line

so move themn out of the define-block. This also cleans up the output,

s/themn/them/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw

PATCH v3 6/12 package/ucl: new package

In reply to Yann E. MORIN

From: Frank Hunleth <[email protected]>

UCL implements a number of compression algorithms that achieve an excellent compression ratio while allowing *very* fast decompression. Decompression requires no additional memory.

This is needed for UPX, which is needed for syslinux 6.x.

[yann.morin.1998 at free.fr: don't add a menuconfig entry, since it
currently is for internal use only]

---
 package/ucl/ucl.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 package/ucl/ucl.mk
package/ucl/ucl.mk new file +12 -0
new file mode 100644
index 0000000..225ad7c
@@ -0,0 +1,12 @@
+################################################################################
+#
+# ucl
+#
+################################################################################
+
+UCL_VERSION = 1.03
+UCL_SITE = http://www.oberhumer.com/opensource/ucl/download/
+UCL_LICENSE = GPLv2+
+UCL_LICENSE_FILES = COPYING
+
+$(eval $(host-autotools-package))
Signature · 1 line
1.8.3.2
#9 lore raw

PATCH 6/12 package/ucl: new package

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Frank Hunleth <[email protected]>
UCL implements a number of compression algorithms that achieve an excellent compression ratio while allowing *very* fast decompression. Decompression requires no additional memory.

Quoted 7 lines

This is needed for UPX, which is needed for syslinux 6.x.

[yann.morin.1998 at free.fr: don't add a menuconfig entry, since it
currently is for internal use only]

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#10 lore raw

PATCH v3 7/12 package/upx: new package

In reply to Yann E. MORIN

From: Frank Hunleth <[email protected]>

UPX is a free, portable, extendable, high-performance executable packer for several executable formats.

This is needed for syslinux 6.x.

Note: upx is a host-only package. Although it supports quite a few target architectures, the only use so far will be for use by syslinux, which already has an x86-on-x86 requirement anyway. So we currently do not care to have target-dependencies on host-upx.

[yann.morin.1998 at free.fr: builds fine in parallel; fix build to
locate libucl; fix installation; don't add a menuconfig entry]

---
Changes v1 -> v2:
- slightly improve on the commit log about host <-> target architectutre limitations (Arnout)

---
 package/upx/upx.mk | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 package/upx/upx.mk
package/upx/upx.mk new file +28 -0
new file mode 100644
index 0000000..a039376
@@ -0,0 +1,28 @@
+################################################################################
+#
+# upx
+#
+################################################################################
+
+UPX_VERSION = 3.91
+UPX_SITE = http://upx.sourceforge.net/download/
+UPX_SOURCE = upx-$(UPX_VERSION)-src.tar.bz2
+UPX_LICENSE = GPLv2+
+UPX_LICENSE_FILES = COPYING
+
+HOST_UPX_DEPENDENCIES = host-ucl
+
+# We need to specify all, otherwise the default target only prints a message
+# stating to "please choose a target for 'make'"... :-(
+define HOST_UPX_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) CPPFLAGS="$(HOST_CPPFLAGS)" \
+	    LDFLAGS="$(HOST_LDFLAGS)" UPX_UCLDIR=$(HOST_DIR)/usr \
+	    -C $(@D) all
+endef
+
+# UPX has no install procedure, so install it manually.
+define HOST_UPX_INSTALL_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/src/upx.out $(HOST_DIR)/usr/bin/upx
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
1.8.3.2
#11 lore raw

PATCH 7/12 package/upx: new package

Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: Frank Hunleth <[email protected]> UPX is a free, portable, extendable, high-performance executable packer for several executable formats.

This is needed for syslinux 6.x.

Note: upx is a host-only package. Although it supports quite a few target architectures, the only use so far will be for use by syslinux, which already has an x86-on-x86 requirement anyway. So we currently do not care to have target-dependencies on host-upx.

[yann.morin.1998 at free.fr: builds fine in parallel; fix build to
locate libucl; fix installation; don't add a menuconfig entry]

Quoted 7 lines

---
Changes v1 -> v2:
- slightly improve on the commit log about host <-> target architectutre limitations (Arnout)

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#12 lore raw

PATCH v3 8/12 boot/syslinux: bump version

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

This new version has a very, very weird build system. There are different images that syslinux can now build:
- the plain legacy-bios images we already supported previously
- two new EFI32 and EFI64 applications

To build one or the other, the Makefile accepts one or more of:

    make (bios|efi32|efi64)

Specify all of them, and it builds all. Specify 'install', and it installs all of them, as one may expect.

Still a regular behaviour, is to build only a subset (down to one):
make bios <-- builds just the legacy-bios images
make efi32 bios <-- builds just the legacy-bios and efi32 images

Where it gets weird is the install procedure. Can you guess how it's done?
Hint: the syslinux guys have invented the multiple-argument parsing in pure Makefiles. To build then install only the bios images, one would do:
make bios
make bios install

Yep, that's it. make bios install. Two arguments, one action.

That makes for some funky workarounds in our install procedure...

'bios' is the only image we support so far, with efi to come in a future patch.

Using MAKE1, as there are issues with highly-parallel builds.

---
 boot/syslinux/syslinux.mk | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
boot/syslinux/syslinux.mk +24 -8
index ee71a0a..2c197df 100644
@@ -4,32 +4,48 @@
 #
 ################################################################################
 
-SYSLINUX_VERSION = 4.07
-SYSLINUX_SOURCE  = syslinux-$(SYSLINUX_VERSION).tar.bz2
-SYSLINUX_SITE    = $(BR2_KERNEL_MIRROR)/linux/utils/boot/syslinux/4.xx/
+SYSLINUX_VERSION = 6.02
+SYSLINUX_SOURCE  = syslinux-$(SYSLINUX_VERSION).tar.xz
+SYSLINUX_SITE    = $(BR2_KERNEL_MIRROR)/linux/utils/boot/syslinux/
 
 SYSLINUX_LICENSE = GPLv2+
 SYSLINUX_LICENSE_FILES = COPYING
 
 SYSLINUX_INSTALL_IMAGES = YES
 
-SYSLINUX_DEPENDENCIES = host-nasm host-util-linux
+SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx
+
+# 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.
+# Cleanup the mess even before we attempt a build, so we indeed
+# build everything from source.
+define SYSLINUX_CLEANUP
+	rm -rf $(@D)/bios $(@D)/efi32 $(@D)/efi64
+endef
+SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP
 
 # syslinux build system has no convenient way to pass CFLAGS,
 # and the internal zlib should take precedence so -I shouldn't
 # be used.
 define SYSLINUX_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" AR="$(HOSTAR)" -C $(@D)
+	$(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
+	    AR="$(HOSTAR)" -C $(@D) bios
 endef
 
 # While the actual bootloader is compiled for the target, several
 # utilities for installing the bootloader are meant for the host.
+# Repeat the target, otherwise syslinux will try to build everything
+# Repeat CC and AR, since syslinux really wants to check them at
+# install time
 define SYSLINUX_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) INSTALLROOT=$(HOST_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \
+	    AR="$(HOSTAR)" INSTALLROOT=$(HOST_DIR) \
+	    -C $(@D) bios install
 endef
 
-SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += core/isolinux.bin
-SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += core/pxelinux.bin
+SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_ISOLINUX) += bios/core/isolinux.bin
+SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
 
 define SYSLINUX_INSTALL_IMAGES_CMDS
 	for i in $(SYSLINUX_IMAGES-y); do \
Signature · 1 line
1.8.3.2
#13 lore raw

PATCH 8/12 boot/syslinux: bump version

Quoted 24 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
This new version has a very, very weird build system. There are different images that syslinux can now build:
- the plain legacy-bios images we already supported previously
- two new EFI32 and EFI64 applications

To build one or the other, the Makefile accepts one or more of:

    make (bios|efi32|efi64)

Specify all of them, and it builds all. Specify 'install', and it installs all of them, as one may expect.

Still a regular behaviour, is to build only a subset (down to one):
make bios <-- builds just the legacy-bios images
make efi32 bios <-- builds just the legacy-bios and efi32 images

Where it gets weird is the install procedure. Can you guess how it's done?
Hint: the syslinux guys have invented the multiple-argument parsing in pure Makefiles. To build then install only the bios images, one would do:
make bios
make bios install

Quoted 3 lines

Yep, that's it. make bios install. Two arguments, one action.

That makes for some funky workarounds in our install procedure...

Is that so odd? If you don't have an explicit configure step, then there isn't really anything for the install step to know what configuration you have built (besides looking for what binaries are available).

Committed this and the rest of the series, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#14 lore raw

PATCH v3 8/12 boot/syslinux: bump version

Peter, All,

On 2014-05-03 22:08 +0200, Peter Korsgaard spake thusly:

Quoted 24 lines
Quoted 23 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>
This new version has a very, very weird build system. There are different images that syslinux can now build:
- the plain legacy-bios images we already supported previously
- two new EFI32 and EFI64 applications

To build one or the other, the Makefile accepts one or more of:

    make (bios|efi32|efi64)

Specify all of them, and it builds all. Specify 'install', and it installs all of them, as one may expect.

Still a regular behaviour, is to build only a subset (down to one):
make bios <-- builds just the legacy-bios images
make efi32 bios <-- builds just the legacy-bios and efi32 images

Where it gets weird is the install procedure. Can you guess how it's done?
Hint: the syslinux guys have invented the multiple-argument parsing in pure Makefiles. To build then install only the bios images, one would do:
make bios
make bios install

Quoted 7 lines
Quoted 3 lines

Yep, that's it. make bios install. Two arguments, one action.

That makes for some funky workarounds in our install procedure...

Is that so odd? If you don't have an explicit configure step, then there isn't really anything for the install step to know what configuration you have built (besides looking for what binaries are available).

That's not really the point.

The point is that, to tell what to install, you have to tell it as a _separate_ make argument.

A bit like if you were doing:
make bios
make install-bios

But that last part is in fact spelt:
make install bios (or : make bios install)

Then, internally, the Makefile will look at the MAKECMDGOALS to decide what to do. If none of {bios,efi32,efi64} are specified, it calls itself back with all on the command line. If one or more are specified, it uses that list (called FRIMWARE_LIST) to do what it as to do with it (explained below).

Then, it also look at the other MAKECMDGOALS to see what it has to do:
build or install. If nothing is specified (except the bios/efi32/efi64 targets), then it builds the targets in FIRMWARE_LIST, otherwise it installs the targets in FIRMWARE_LIST.

But our install command is not so funky, indeed. The first time I wrote it, it was way funkier. I just forgot to cool down that part in the commit log.

Quoted 1 line

Committed this and the rest of the series, thanks.

Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#15 lore raw

PATCH v3 9/12 boot/syslinux: add option to install the EFI image

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

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.

---
Changes v1 -> v2:
- move it in the existing choice (Arnout)

---
 boot/syslinux/Config.in                            | 11 +++++++
 .../syslinux-000-user-headers-from-sysroot.patch   | 37 ++++++++++++++++++++++
 boot/syslinux/syslinux.mk                          | 21 ++++++++++--
 3 files changed, 66 insertions(+), 3 deletions(-)
 create mode 100644 boot/syslinux/syslinux-000-user-headers-from-sysroot.patch
boot/syslinux/Config.in +11 -0
index 7263128..5f0fe97 100644
@@ -10,21 +10,32 @@ config BR2_TARGET_SYSLINUX
 
 if BR2_TARGET_SYSLINUX
 
+config BR2_TARGET_SYSLINUX_LEGACY_BIOS
+	bool
+
 choice
 	bool "Image to install"
 
 config BR2_TARGET_SYSLINUX_ISOLINUX
 	bool "isolinux"
+	select BR2_TARGET_SYSLINUX_LEGACY_BIOS
 	help
 	  Install the legacy-BIOS 'isolinux' image, to boot off
 	  optical media (CDROM, DVD.)
 
 config BR2_TARGET_SYSLINUX_PXELINUX
 	bool "pxelinux"
+	select BR2_TARGET_SYSLINUX_LEGACY_BIOS
 	help
 	  Install the legacy-BIOS 'pxelinux' image, to boot off
 	  the network using PXE.
 
+config BR2_TARGET_SYSLINUX_EFI
+	bool "efi"
+	select BR2_PACKAGE_GNU_EFI
+	help
+	  Install the 'efi' image, to boot from an EFI environment.
+
 endchoice
 
 endif # BR2_TARGET_SYSLINUX
boot/syslinux/syslinux-000-user-headers-from-sysroot.patch new file +37 -0
new file mode 100644
index 0000000..5edf79f
@@ -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" <[email protected]>
+
+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
boot/syslinux/syslinux.mk +18 -3
index 2c197df..95ece52 100644
@@ -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
+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
 
 # While the actual bootloader is compiled for the target, several
@@ -40,12 +54,13 @@ endef
 # install time
 define SYSLINUX_INSTALL_TARGET_CMDS
 	$(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 \
Signature · 1 line
1.8.3.2
#16 lore raw

PATCH v3 10/12 boot/syslinux: add an option to install an MBR blob

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

This MBR blob will look for an active partition, and boot the bootcode present in that partition. This can be used to boot an extlinux-prepared partition.

---
Changes v2 -> v3:
- s/legacy BIOS/legacy-BIOS/ to avoid ambiguity

Changes v1 -> v2:
- slightly expand the help entry

---
 boot/syslinux/Config.in   | 8 ++++++++
 boot/syslinux/syslinux.mk | 1 +
 2 files changed, 9 insertions(+)
boot/syslinux/Config.in +8 -0
index 5f0fe97..28c5329 100644
@@ -30,6 +30,14 @@ config BR2_TARGET_SYSLINUX_PXELINUX
 	  Install the legacy-BIOS 'pxelinux' image, to boot off
 	  the network using PXE.
 
+config BR2_TARGET_SYSLINUX_MBR
+	bool "mbr"
+	select BR2_TARGET_SYSLINUX_LEGACY_BIOS
+	help
+	  Install the legacy-BIOS 'mbr' image, to boot off a
+	  local MBR-partition (e.g. prepared with 'extlinux'
+	  or 'syslinux').
+
 config BR2_TARGET_SYSLINUX_EFI
 	bool "efi"
 	select BR2_PACKAGE_GNU_EFI
boot/syslinux/syslinux.mk +1 -0
index 95ece52..5432d0a 100644
@@ -60,6 +60,7 @@ 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_MBR) += bios/mbr/mbr.bin
 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
 
 define SYSLINUX_INSTALL_IMAGES_CMDS
Signature · 1 line
1.8.3.2
#17 lore raw

PATCH v3 11/12 boot/syslinux: add option to install c32 modules

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

---
 boot/syslinux/Config.in   | 10 ++++++++++
 boot/syslinux/syslinux.mk |  9 +++++++++
 2 files changed, 19 insertions(+)
boot/syslinux/Config.in +10 -0
index 28c5329..f4b9870 100644
@@ -46,4 +46,14 @@ config BR2_TARGET_SYSLINUX_EFI
 
 endchoice
 
+if BR2_TARGET_SYSLINUX_LEGACY_BIOS
+
+config BR2_TARGET_SYSLINUX_C32
+	string "modules to install"
+	help
+	  Enter a space-separated list of .c32 modules to install.
+	  Leave empty to install no module.
+
+endif # BR2_TARGET_SYSLINUX_LEGACY_BIOS
+
 endif # BR2_TARGET_SYSLINUX
boot/syslinux/syslinux.mk +9 -0
index 5432d0a..e627f48 100644
@@ -63,10 +63,19 @@ SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_PXELINUX) += bios/core/pxelinux.bin
 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_MBR) += bios/mbr/mbr.bin
 SYSLINUX_IMAGES-$(BR2_TARGET_SYSLINUX_EFI) += $(SYSLINUX_EFI_BITS)/efi/syslinux.efi
 
+SYSLINUX_C32 = $(call qstrip,$(BR2_TARGET_SYSLINUX_C32))
+
+# We install the c32 modules from the host-installed tree, they are all
+# neatly installed in the same location, while they are scaterred around
+# everywhere in the build tree.
 define SYSLINUX_INSTALL_IMAGES_CMDS
 	for i in $(SYSLINUX_IMAGES-y); do \
 		$(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/$${i##*/}; \
 	done
+	for i in $(SYSLINUX_C32); do \
+		$(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \
+				   $(BINARIES_DIR)/$${i}; \
+	done
 endef
 
 $(eval $(generic-package))
Signature · 1 line
1.8.3.2
#18 lore raw

PATCH 11/12 boot/syslinux: add option to install c32 modules

Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>

---
 boot/syslinux/Config.in   | 10 ++++++++++
 boot/syslinux/syslinux.mk |  9 +++++++++
 2 files changed, 19 insertions(+)
boot/syslinux/Config.in +0 -0
index 28c5329..f4b9870 100644

boot/syslinux/Config.in config BR2_TARGET_SYSLINUX_EFI · line 55

Quoted 10 lines
boot/syslinux/Config.in +7 -0
@@ -46,4 +46,14 @@ config BR2_TARGET_SYSLINUX_EFI
 
 endchoice
 
+if BR2_TARGET_SYSLINUX_LEGACY_BIOS
+
+config BR2_TARGET_SYSLINUX_C32
+	string "modules to install"
+	help
+	  Enter a space-separated list of .c32 modules to install.
+	  Leave empty to install no module.

Out of interest, what are those c32 modules? Some kind of loadable libraries?

boot/syslinux/Config.in config BR2_TARGET_SYSLINUX_EFI · line 57

Quoted 2 lines
boot/syslinux/Config.in +2 -0
+# We install the c32 modules from the host-installed tree, they are all
+# neatly installed in the same location, while they are scaterred around

s/scaterred/scattered/

Reworded slightly and committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#19 lore raw

PATCH v3 11/12 boot/syslinux: add option to install c32 modules

Peter, All,

On 2014-05-03 22:05 +0200, Peter Korsgaard spake thusly:

Quoted 18 lines
Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

From: "Yann E. MORIN" <[email protected]>

---
 boot/syslinux/Config.in   | 10 ++++++++++
 boot/syslinux/syslinux.mk |  9 +++++++++
 2 files changed, 19 insertions(+)
boot/syslinux/Config.in +0 -0
index 28c5329..f4b9870 100644
@@ -46,4 +46,14 @@ config BR2_TARGET_SYSLINUX_EFI
 
 endchoice
Quoted 10 lines

boot/syslinux/Config.in config BR2_TARGET_SYSLINUX_EFI · line 55

Quoted 7 lines
boot/syslinux/Config.in +7 -0
+if BR2_TARGET_SYSLINUX_LEGACY_BIOS
+
+config BR2_TARGET_SYSLINUX_C32
+	string "modules to install"
+	help
+	  Enter a space-separated list of .c32 modules to install.
+	  Leave empty to install no module.

Out of interest, what are those c32 modules? Some kind of loadable libraries?

Yes, a kind of plugin. One provides a graphical (vesa) menu, another provides a simple shell, and so on...

Quoted 6 lines

boot/syslinux/Config.in config BR2_TARGET_SYSLINUX_EFI · line 56

Quoted 2 lines
boot/syslinux/Config.in +2 -0
+# We install the c32 modules from the host-installed tree, they are all
+# neatly installed in the same location, while they are scaterred around

s/scaterred/scattered/

Reworded slightly and committed, thanks.

Doh, I really need to do something about my keyboard dislexia... ;-) Thanks for fixing. :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#20 lore raw

PATCH v3 12/12 boot/syslinux: install in a sub-dir of $(BINARIES_DIR)

In reply to Yann E. MORIN

From: "Yann E. MORIN" <[email protected]>

Since syslinux can now install quite a number of files, install them in a sub-directory of $(BINARIES_DIR) for clarity.

It also aligns it to rpi-firmware, grub2, gummiboot, that install all of their files in a sub-dir of $(BINARIES_DIR), too.

---
 boot/syslinux/syslinux.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
boot/syslinux/syslinux.mk +2 -2
index e627f48..c9ad2a8 100644
@@ -70,11 +70,11 @@ SYSLINUX_C32 = $(call qstrip,$(BR2_TARGET_SYSLINUX_C32))
 # everywhere in the build tree.
 define SYSLINUX_INSTALL_IMAGES_CMDS
 	for i in $(SYSLINUX_IMAGES-y); do \
-		$(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/$${i##*/}; \
+		$(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/syslinux/$${i##*/}; \
 	done
 	for i in $(SYSLINUX_C32); do \
 		$(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \
-				   $(BINARIES_DIR)/$${i}; \
+				   $(BINARIES_DIR)/syslinux/$${i}; \
 	done
 endef
 
Signature · 1 line
1.8.3.2