public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific
@ 2020-12-14 18:31 Ross Burton
  2020-12-14 18:31 ` [PATCH v2 2/7] wic-image-minimal: only depend on syslinux on x86 targets Ross Burton
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

Currently the syslinux recipe set COMPATIBLE_HOST to 32/64-bit x86.
Whilst this makes sense for the target binaries as syslinux is
x86-specific, this also affects the native recipe which should be able
to be built on non-x86 build hosts (for example, arm64 build host,
qemux86 target).

syslinux itself has a somewhat fragile build system but with care it is
possible to build the installer for native/nativesdk, and the bootloader
for target.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../syslinux/syslinux_6.04-pre2.bb            | 84 +++++++++++--------
 1 file changed, 47 insertions(+), 37 deletions(-)

diff --git a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
index 3e7eef3a75..1b0b45f2fa 100644
--- a/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
+++ b/meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb
@@ -4,10 +4,7 @@ LICENSE = "GPLv2+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
                     file://README;beginline=35;endline=41;md5=558f2c71cb1fb9ba511ccd4858e48e8a"
 
-# If you really want to run syslinux, you need mtools.  We just want the
-# ldlinux.* stuff for now, so skip mtools-native
 DEPENDS = "nasm-native util-linux e2fsprogs"
-PV = "6.04-pre2"
 
 SRC_URI = "https://www.zytor.com/pub/syslinux/Testing/6.04/syslinux-${PV}.tar.xz \
            file://syslinux-remove-clean-script.patch \
@@ -27,64 +24,77 @@ SRC_URI = "https://www.zytor.com/pub/syslinux/Testing/6.04/syslinux-${PV}.tar.xz
 SRC_URI[md5sum] = "2b31c78f087f99179feb357da312d7ec"
 SRC_URI[sha256sum] = "4441a5d593f85bb6e8d578cf6653fb4ec30f9e8f4a2315a3d8f2d0a8b3fadf94"
 
+RECIPE_NO_UPDATE_REASON = "6.04-pre3 is broken"
 UPSTREAM_CHECK_URI = "https://www.zytor.com/pub/syslinux/"
 UPSTREAM_CHECK_REGEX = "syslinux-(?P<pver>.+)\.tar"
 UPSTREAM_VERSION_UNKNOWN = "1"
 
-COMPATIBLE_HOST = '(x86_64|i.86).*-(linux|freebsd.*)'
+# We can build the native parts anywhere, but the target has to be x86
+COMPATIBLE_HOST_class-target = '(x86_64|i.86).*-(linux|freebsd.*)'
+
 # Don't let the sanity checker trip on the 32 bit real mode BIOS binaries
 INSANE_SKIP_${PN}-misc = "arch"
 INSANE_SKIP_${PN}-chain = "arch"
 
+# When building the installer, CC is used to link. When building the bootloader,
+# LD is used. However, these variables assume that GCC is used and break the
+# build, so unset them.
+TARGET_LDFLAGS = ""
+SECURITY_LDFLAGS = ""
+LDFLAGS_SECTION_REMOVAL = ""
+
 EXTRA_OEMAKE = " \
 	BINDIR=${bindir} SBINDIR=${sbindir} LIBDIR=${libdir} \
 	DATADIR=${datadir} MANDIR=${mandir} INCDIR=${includedir} \
+	CC="${CC} ${CFLAGS} ${LDFLAGS}" \
+	LD="${LD} ${LDFLAGS}" \
+	OBJDUMP="${OBJDUMP}" \
+	OBJCOPY="${OBJCOPY}" \
+	AR="${AR}" \
+	STRIP="${STRIP}" \
+	NM="${NM}" \
+	RANLIB="${RANLIB}" \
 "
 
+#
+# Tasks for native/nativesdk which just build the installer.
+#
 do_configure() {
-	# drop win32 targets or build fails
-	sed -e 's,win32/\S*,,g' -i Makefile
-
-	# clean installer executables included in source tarball
-	oe_runmake clean firmware="efi32" EFIINC="${includedir}"
-	# NOTE: There is a temporary work around above to specify
-	#	the efi32 as the firmware else the pre-built bios
-	#	files get erased contrary to the doc/distib.txt
-	#	In the future this should be "bios" and not "efi32".
+	oe_runmake firmware="bios" clean
 }
 
 do_compile() {
-	# Make sure the recompile is OK.
-	# Though the ${B} should always exist, still check it before find and rm.
-	[ -d "${B}" ] && find ${B} -name '.*.d' -type f -exec rm -f {} \;
-
-	# Rebuild only the installer; keep precompiled bootloaders
-	# as per author's request (doc/distrib.txt)
-	oe_runmake CC="${CC} ${CFLAGS}" \
-                   LD="${LD}" LDFLAGS="${LDFLAGS}" \
-                   OBJDUMP="${OBJDUMP}" \
-                   OBJCOPY="${OBJCOPY}" \
-                   AR="${AR}" \
-                   STRIP="${STRIP}" \
-                   NM="${NM}" \
-                   RANLIB="${RANLIB}" \
-                   firmware="bios" installer
+	oe_runmake firmware="bios" installer
 }
 
 do_install() {
-	oe_runmake CC="${CC} ${CFLAGS}" LD="${LD}" \
-                   OBJDUMP="${OBJDUMP}" \
-                   OBJCOPY="${OBJCOPY}" \
-                   AR="${AR}" \
-                   STRIP="${STRIP}" \
-                   NM="${NM}" \
-                   RANLIB="${RANLIB}" \
-                   firmware="bios" install INSTALLROOT="${D}"
+	install -d ${D}${bindir}
+	install \
+		${B}/bios/mtools/syslinux \
+		${B}/bios/extlinux/extlinux \
+		${B}/bios/utils/isohybrid \
+		${D}${bindir}
+}
+
+#
+# Tasks for target which ship the precompiled bootloader and installer
+#
+do_configure_class-target() {
+	# No need to do anything as we're mostly shipping the precompiled binaries
+	:
+}
+
+do_compile_class-target() {
+	# No need to do anything as we're mostly shipping the precompiled binaries
+	:
+}
+
+do_install_class-target() {
+	oe_runmake firmware="bios" install INSTALLROOT="${D}"
 
 	install -d ${D}${datadir}/syslinux/
 	install -m 644 ${S}/bios/core/ldlinux.sys ${D}${datadir}/syslinux/
 	install -m 644 ${S}/bios/core/ldlinux.bss ${D}${datadir}/syslinux/
-	install -m 755 ${S}/bios/linux/syslinux-nomtools ${D}${bindir}/
 }
 
 PACKAGES += "${PN}-nomtools ${PN}-extlinux ${PN}-mbr ${PN}-chain ${PN}-pxelinux ${PN}-isolinux ${PN}-misc"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/7] wic-image-minimal: only depend on syslinux on x86 targets
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  2020-12-14 18:31 ` [PATCH v2 3/7] wic-tools: don't build syslinux-native for targets without syslinux Ross Burton
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

Following other examples, only depend on syslinux when targetting x86.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta-selftest/recipes-test/images/wic-image-minimal.bb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meta-selftest/recipes-test/images/wic-image-minimal.bb b/meta-selftest/recipes-test/images/wic-image-minimal.bb
index e1da203b59..1cb019898d 100644
--- a/meta-selftest/recipes-test/images/wic-image-minimal.bb
+++ b/meta-selftest/recipes-test/images/wic-image-minimal.bb
@@ -6,7 +6,10 @@ IMAGE_INSTALL = "packagegroup-core-boot"
 
 IMAGE_FSTYPES = "wic"
 
-WKS_FILE_DEPENDS = "syslinux syslinux-native dosfstools-native mtools-native gptfdisk-native"
+WKS_FILE_DEPENDS = "dosfstools-native mtools-native gptfdisk-native"
+WKS_FILE_DEPENDS_append_x86 = " syslinux-native syslinux"
+WKS_FILE_DEPENDS_append_x86-64 = " syslinux-native syslinux"
+WKS_FILE_DEPENDS_append_x86-x32 = " syslinux-native syslinux"
 
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/7] wic-tools: don't build syslinux-native for targets without syslinux
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
  2020-12-14 18:31 ` [PATCH v2 2/7] wic-image-minimal: only depend on syslinux on x86 targets Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  2020-12-14 18:31 ` [PATCH v2 4/7] image-uefi.conf: add EFI arch variable Ross Burton
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

If we're not building syslinux, then there's no point building
syslinux-native.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/meta/wic-tools.bb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index 3e7d0ed48d..f04f767646 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -3,14 +3,14 @@ SUMMARY = "A meta recipe to build native tools used by wic."
 LICENSE = "MIT"
 
 DEPENDS = "\
-           parted-native syslinux-native gptfdisk-native dosfstools-native \
+           parted-native gptfdisk-native dosfstools-native \
            mtools-native bmap-tools-native grub-native cdrtools-native \
            btrfs-tools-native squashfs-tools-native pseudo-native \
            e2fsprogs-native util-linux-native tar-native\
            "
-DEPENDS_append_x86 = " syslinux grub-efi systemd-boot"
-DEPENDS_append_x86-64 = " syslinux grub-efi systemd-boot"
-DEPENDS_append_x86-x32 = " syslinux grub-efi"
+DEPENDS_append_x86 = " syslinux-native syslinux grub-efi systemd-boot"
+DEPENDS_append_x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
+DEPENDS_append_x86-x32 = " syslinux-native syslinux grub-efi"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/7] image-uefi.conf: add EFI arch variable
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
  2020-12-14 18:31 ` [PATCH v2 2/7] wic-image-minimal: only depend on syslinux on x86 targets Ross Burton
  2020-12-14 18:31 ` [PATCH v2 3/7] wic-tools: don't build syslinux-native for targets without syslinux Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  2020-12-14 18:31 ` [PATCH v2 5/7] systemd-boot: build the EFI stub Ross Burton
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

Refactor EFI_BOOT_IMAGE so that the EFI name for the architecture
is exposed as EFI_ARCH, so that other recipes (such as bootloaders)
can reuse it.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/conf/image-uefi.conf | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/meta/conf/image-uefi.conf b/meta/conf/image-uefi.conf
index aaeff12ccb..882a0e720c 100644
--- a/meta/conf/image-uefi.conf
+++ b/meta/conf/image-uefi.conf
@@ -8,9 +8,12 @@ EFI_PREFIX ?= "/boot"
 # Location inside rootfs.
 EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}"
 
+# The EFI name for the architecture
+EFI_ARCH ?= "INVALID"
+EFI_ARCH_x86 = "ia32"
+EFI_ARCH_x86-64 = "x64"
+EFI_ARCH_aarch64 = "aa64"
+EFI_ARCH_arm = "arm"
+
 # Determine name of bootloader image
-EFI_BOOT_IMAGE ?= "bootINVALID.efi"
-EFI_BOOT_IMAGE_x86-64 = "bootx64.efi"
-EFI_BOOT_IMAGE_x86 = "bootia32.efi"
-EFI_BOOT_IMAGE_aarch64 = "bootaa64.efi"
-EFI_BOOT_IMAGE_arm = "bootarm.efi"
+EFI_BOOT_IMAGE ?= "boot${EFI_ARCH}.efi"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 5/7] systemd-boot: build the EFI stub
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
                   ` (2 preceding siblings ...)
  2020-12-14 18:31 ` [PATCH v2 4/7] image-uefi.conf: add EFI arch variable Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  2020-12-14 18:31 ` [PATCH v2 6/7] systemd-boot: allow building for Arm targets Ross Burton
  2020-12-14 18:31 ` [PATCH v2 7/7] wic-tools: add grub-efi and systemd-boot on arm64 Ross Burton
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

Also build and deploy the EFI stub.  SYSTEMD_BOOT_EFI_ARCH can be dropped
as image-uefi.conf now sets EFI_ARCH.

Changes originally taken from meta-intel.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/systemd/systemd-boot_246.6.bb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd-boot_246.6.bb b/meta/recipes-core/systemd/systemd-boot_246.6.bb
index f92c639810..97093e4bb2 100644
--- a/meta/recipes-core/systemd/systemd-boot_246.6.bb
+++ b/meta/recipes-core/systemd/systemd-boot_246.6.bb
@@ -47,16 +47,14 @@ RDEPENDS_${PN} += "virtual/systemd-bootconf"
 
 # Imported from the old gummiboot recipe
 TUNE_CCARGS_remove = "-mfpmath=sse"
+
 COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
 COMPATIBLE_HOST_x86-x32 = "null"
 
 do_compile() {
-	SYSTEMD_BOOT_EFI_ARCH="ia32"
-	if [ "${TARGET_ARCH}" = "x86_64" ]; then
-		SYSTEMD_BOOT_EFI_ARCH="x64"
-	fi
-
-	ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE}
+	ninja \
+		src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
+		src/boot/efi/linux${EFI_ARCH}.efi.stub
 }
 
 do_install() {
@@ -66,5 +64,7 @@ do_install() {
 
 do_deploy () {
 	install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
+	install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
 }
+
 addtask deploy before do_build after do_compile
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 6/7] systemd-boot: allow building for Arm targets
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
                   ` (3 preceding siblings ...)
  2020-12-14 18:31 ` [PATCH v2 5/7] systemd-boot: build the EFI stub Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  2020-12-14 18:31 ` [PATCH v2 7/7] wic-tools: add grub-efi and systemd-boot on arm64 Ross Burton
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

systemd-boot works on 32-bit and 64-bit Arm targets (assuming the
firmware does EFI, obviously), so allow it to be built.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/systemd/systemd-boot_246.6.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/systemd/systemd-boot_246.6.bb b/meta/recipes-core/systemd/systemd-boot_246.6.bb
index 97093e4bb2..249e620f4e 100644
--- a/meta/recipes-core/systemd/systemd-boot_246.6.bb
+++ b/meta/recipes-core/systemd/systemd-boot_246.6.bb
@@ -48,7 +48,7 @@ RDEPENDS_${PN} += "virtual/systemd-bootconf"
 # Imported from the old gummiboot recipe
 TUNE_CCARGS_remove = "-mfpmath=sse"
 
-COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
+COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
 COMPATIBLE_HOST_x86-x32 = "null"
 
 do_compile() {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 7/7] wic-tools: add grub-efi and systemd-boot on arm64
  2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
                   ` (4 preceding siblings ...)
  2020-12-14 18:31 ` [PATCH v2 6/7] systemd-boot: allow building for Arm targets Ross Burton
@ 2020-12-14 18:31 ` Ross Burton
  5 siblings, 0 replies; 7+ messages in thread
From: Ross Burton @ 2020-12-14 18:31 UTC (permalink / raw)
  To: openembedded-core

These both now work on arm64, so add them to the dependencies.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-core/meta/wic-tools.bb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index f04f767646..bc6cc0d183 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -11,6 +11,7 @@ DEPENDS = "\
 DEPENDS_append_x86 = " syslinux-native syslinux grub-efi systemd-boot"
 DEPENDS_append_x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
 DEPENDS_append_x86-x32 = " syslinux-native syslinux grub-efi"
+DEPENDS_append_aarch64 = " grub-efi systemd-boot"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-14 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14 18:31 [PATCH v2 1/7] syslinux: rewrite recipe so only target code is x86-specific Ross Burton
2020-12-14 18:31 ` [PATCH v2 2/7] wic-image-minimal: only depend on syslinux on x86 targets Ross Burton
2020-12-14 18:31 ` [PATCH v2 3/7] wic-tools: don't build syslinux-native for targets without syslinux Ross Burton
2020-12-14 18:31 ` [PATCH v2 4/7] image-uefi.conf: add EFI arch variable Ross Burton
2020-12-14 18:31 ` [PATCH v2 5/7] systemd-boot: build the EFI stub Ross Burton
2020-12-14 18:31 ` [PATCH v2 6/7] systemd-boot: allow building for Arm targets Ross Burton
2020-12-14 18:31 ` [PATCH v2 7/7] wic-tools: add grub-efi and systemd-boot on arm64 Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox