Skip to contentSkip to conversation

syslinux: Use the host compiler to build extlinux

PATCH Superseded Carlos Santos 3 participants 6 messages Sep 30, 2017 – Apr 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syslinux: Use the host compiler to build extlinux

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

---
Tested with the following defconfig:

BR2_x86_64=y
BR2_x86_atom=y
BR2_DL_DIR="$(HOME)/src"
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-x86-64-core2-full-2017.05-1078-g95b1dae.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS1"
BR2_ENABLE_LOCALE_WHITELIST=""
BR2_ROOTFS_OVERLAY="board/technologic/ts5x00/fs-overlay"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_MBR=y
BR2_TARGET_SYSLINUX_EFI=y

Notice that I did not actualy use a ts5x00 board, just used its defconfig as a base to create my configuration.

---
 ...-extlinux-Use-the-host-toolchain-to-build.patch | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 boot/syslinux/0011-extlinux-Use-the-host-toolchain-to-build.patch
boot/syslinux/0011-extlinux-Use-the-host-toolchain-to-build.patch new file +60 -0
new file mode 100644
index 0000000000..1ce484bd93
@@ -0,0 +1,60 @@
+From 9497112ff28f87ca3c12ca2191e64cdacc5bf8d6 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sat, 30 Sep 2017 19:49:55 -0300
+Subject: [PATCH] extlinux: Use the host toolchain to build.
+
+It is meant to run on the host machine, hence must be built using the
+host toolchain.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ extlinux/Makefile | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/extlinux/Makefile b/extlinux/Makefile
+index 1721ee54..5c4baa5a 100644
+--- a/extlinux/Makefile
++++ b/extlinux/Makefile
+@@ -18,16 +18,15 @@ include $(MAKEDIR)/syslinux.mk
+ 
+ OPTFLAGS = -g -Os
+ INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller
+-CFLAGS	 = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
++CFLAGS	 = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+ 	   $(OPTFLAGS) $(INCLUDES)
+-LDFLAGS	 = 
++LDFLAGS	 = $(LDFLAGS_FOR_BUILD)
+ 
+ SRCS     = main.c \
+ 	   mountinfo.c \
+ 	   ../libinstaller/syslxmod.c \
+ 	   ../libinstaller/syslxopt.c \
+ 	   ../libinstaller/syslxcom.c \
+-	   ../libinstaller/syslxrw.c \
+ 	   ../libinstaller/setadv.c \
+ 	   ../libinstaller/advio.c \
+ 	   ../libinstaller/bootsect_bin.c \
+@@ -53,16 +52,16 @@ spotless: clean
+ installer: extlinux
+ 
+ extlinux: $(OBJS)
+-	$(CC) $(LDFLAGS) -o $@ $^
++	$(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^
+ 
+ strip:
+ 	$(STRIP) extlinux
+ 
+ %.o: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+ %.i: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
+ %.s: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
+ 
+ -include .*.d
+-- 
+2.13.5
+
Signature · 1 line
2.13.5
#1 lore raw

PATCH v2 1/1 syslinux: Use the host compiler to build extlinux

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

---
Changes v1->v2
- Patch for syslinux version 6.03 (the previous one was for the master

    branch (syslinux-6.04-pre1).

---
Tested with the following defconfig:

BR2_x86_64=y
BR2_x86_atom=y
BR2_DL_DIR="$(HOME)/src"
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-x86-64-core2-full-2017.05-1078-g95b1dae.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_4=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS1"
BR2_ENABLE_LOCALE_WHITELIST=""
BR2_ROOTFS_OVERLAY="board/technologic/ts5x00/fs-overlay"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_SYSLINUX=y
BR2_TARGET_SYSLINUX_MBR=y
BR2_TARGET_SYSLINUX_EFI=y

Notice that I did not actualy use a ts5x00 board, just used its defconfig as a base to create my configuration.

---
 ...-extlinux-Use-the-host-toolchain-to-build.patch | 53 ++++++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 boot/syslinux/0011-extlinux-Use-the-host-toolchain-to-build.patch
boot/syslinux/0011-extlinux-Use-the-host-toolchain-to-build.patch new file +53 -0
new file mode 100644
index 0000000000..62675cf6cc
@@ -0,0 +1,53 @@
+From 4df2e7c0ae84bfbdba0ed285c0664aa089b38b7e Mon Sep 17 00:00:00 2001
+From: Carlos Santos <[email protected]>
+Date: Sat, 30 Sep 2017 19:49:55 -0300
+Subject: [PATCH] extlinux: Use the host toolchain to build.
+
+It is meant to run on the host machine, hence must be built using the
+host toolchain.
+
+Signed-off-by: Carlos Santos <[email protected]>
+---
+ extlinux/Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/extlinux/Makefile b/extlinux/Makefile
+index 02d1db51..5c4baa5a 100644
+--- a/extlinux/Makefile
++++ b/extlinux/Makefile
+@@ -18,9 +18,9 @@ include $(MAKEDIR)/syslinux.mk
+ 
+ OPTFLAGS = -g -Os
+ INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller
+-CFLAGS	 = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
++CFLAGS	 = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+ 	   $(OPTFLAGS) $(INCLUDES)
+-LDFLAGS	 = 
++LDFLAGS	 = $(LDFLAGS_FOR_BUILD)
+ 
+ SRCS     = main.c \
+ 	   mountinfo.c \
+@@ -52,16 +52,16 @@ spotless: clean
+ installer: extlinux
+ 
+ extlinux: $(OBJS)
+-	$(CC) $(LDFLAGS) -o $@ $^
++	$(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^
+ 
+ strip:
+ 	$(STRIP) extlinux
+ 
+ %.o: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $<
+ %.i: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -E -o $@ $<
+ %.s: %.c
+-	$(CC) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
++	$(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -S -o $@ $<
+ 
+ -include .*.d
+-- 
+2.13.5
+
Signature · 1 line
2.13.5
#2 lore raw

PATCH v2 1/1 syslinux: Use the host compiler to build extlinux

Hello,

Quoted 4 lines · Carlos Santos

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

It is not entirely clear if everybody agrees that "extlinux" is a host or a target program.

Beno?t Allard, who used to work on the syslinux package in Buildroot wrote in http://www.syslinux.org/archives/2017-April/025755.html:

"""
1. utilities required during the build (prepcore)
2. utilities meant to be run in the target operating-system (isohybrid, memdisk, the extlinux installer, ...)
3. utilities used to boot the operating system
"""

So he was considering the extlinux installer as a program for the target.

A few years earlier, another person on the Buildroot mailing list, also wanted to have the extlinux installer on the target:
http://buildroot-busybox.2317881.n4.nabble.com/syslinux-on-target-td81294.html.

So, I'm not sure. Perhaps we need a host-syslinux package to install those utilities ?

Or perhaps I'm being too complicated here, we should just merge your patch, and adjusts when/if someone complains ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH v2 1/1 syslinux: Use the host compiler to build extlinux

Quoted 34 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Beno?t Allard" <[email protected]>
Sent: Monday, October 2, 2017 4:15:47 PM
Subject: Re: [Buildroot] [PATCH v2] syslinux: Use the host compiler to build extlinux

Hello,

Quoted 4 lines · Carlos Santos

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

It is not entirely clear if everybody agrees that "extlinux" is a host or a target program.

Beno?t Allard, who used to work on the syslinux package in Buildroot wrote in http://www.syslinux.org/archives/2017-April/025755.html:

"""
1. utilities required during the build (prepcore)
2. utilities meant to be run in the target operating-system (isohybrid, memdisk, the extlinux installer, ...)
3. utilities used to boot the operating system
"""

So he was considering the extlinux installer as a program for the target.

A few years earlier, another person on the Buildroot mailing list, also wanted to have the extlinux installer on the target:
http://buildroot-busybox.2317881.n4.nabble.com/syslinux-on-target-td81294.html.

Quoted 5 lines

So, I'm not sure. Perhaps we need a host-syslinux package to install those utilities ?

Or perhaps I'm being too complicated here, we should just merge your patch, and adjusts when/if someone complains ?

Well, there is a chicken-egg problem here because extlinux is a boot loader so you must have it installed on the target partition in order to be able to boot.

On embedded systems this made on the host machine, manipulating the disk image (which was exactly the problem I had when I needed to use extlinux).

Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens
#4 lore raw

PATCH v2 1/1 syslinux: Use the host compiler to build extlinux

Quoted 47 lines

From: "Carlos Santos" <[email protected]>
To: "Thomas Petazzoni" <[email protected]>
Cc: "Beno?t Allard" <[email protected]>, buildroot at buildroot.org
Sent: Monday, October 2, 2017 5:36:39 PM
Subject: Re: [Buildroot] [PATCH v2] syslinux: Use the host compiler to build extlinux

Quoted 35 lines

From: "Thomas Petazzoni" <[email protected]>
To: "Carlos Santos" <[email protected]>
Cc: buildroot at buildroot.org, "Beno?t Allard" <[email protected]>
Sent: Monday, October 2, 2017 4:15:47 PM
Subject: Re: [Buildroot] [PATCH v2] syslinux: Use the host compiler to build extlinux

Hello,

Quoted 4 lines · Carlos Santos

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

It is not entirely clear if everybody agrees that "extlinux" is a host or a target program.

Beno?t Allard, who used to work on the syslinux package in Buildroot wrote in http://www.syslinux.org/archives/2017-April/025755.html:

"""
1. utilities required during the build (prepcore)
2. utilities meant to be run in the target operating-system (isohybrid, memdisk, the extlinux installer, ...)
3. utilities used to boot the operating system
"""

So he was considering the extlinux installer as a program for the target.

A few years earlier, another person on the Buildroot mailing list, also wanted to have the extlinux installer on the target:
http://buildroot-busybox.2317881.n4.nabble.com/syslinux-on-target-td81294.html.

Quoted 5 lines

So, I'm not sure. Perhaps we need a host-syslinux package to install those utilities ?

Or perhaps I'm being too complicated here, we should just merge your patch, and adjusts when/if someone complains ?

Quoted 7 lines

Well, there is a chicken-egg problem here because extlinux is a boot loader so you must have it installed on the target partition in order to be able to boot.

On embedded systems this made on the host machine, manipulating the disk image (which was exactly the problem I had when I needed to use extlinux).

Quick follow-up.

Commit 8e0d4118982ae5a29e462f0a476d82772459cf5c moved the helper programs to the host and 8e0d4118982ae5a29e462f0a476d82772459cf5c removed the host variant of the package, so looks like the original goal was to make extlinux a host utility, since it is installed at $(HOST_DIR)/sbin/.

Signature · 4 lines
Carlos Santos (Casantos) - DATACOM, P&D
?The greatest triumph that modern PR can offer is the transcendent 
success of having your words and actions judged by your reputation, 
rather than the other way about.? ? Christopher Hitchens
#5 lore raw

PATCH v2 1/1 syslinux: Use the host compiler to build extlinux

In reply to Carlos Santos

Hello,

Quoted 10 lines · Carlos Santos

Like the utilities, it is meant to run on the host machine, hence must be built using the host toolchain.

---
Changes v1->v2
- Patch for syslinux version 6.03 (the previous one was for the master

    branch (syslinux-6.04-pre1).

---
Tested with the following defconfig:

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com