1SUMMARY = "Multi-purpose linux bootloader"
2HOMEPAGE = "http://www.syslinux.org/"
3DESCRIPTION = "The Syslinux Project covers lightweight bootloaders for MS-DOS FAT filesystems (SYSLINUX), network booting (PXELINUX), bootable "El Torito" CD-ROMs (ISOLINUX), and Linux ext2/ext3/ext4 or btrfs filesystems (EXTLINUX). The project also includes MEMDISK, a tool to boot legacy operating systems (such as DOS) from nontraditional media; it is usually used in conjunction with PXELINUX and ISOLINUX."
4LICENSE = "GPL-2.0-or-later"
5LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
6                    file://README;beginline=35;endline=41;md5=558f2c71cb1fb9ba511ccd4858e48e8a"
7
8DEPENDS = "nasm-native util-linux e2fsprogs"
9
10SRC_URI = "https://www.zytor.com/pub/syslinux/Testing/6.04/syslinux-${PV}.tar.xz \
11           file://0001-linux-syslinux-support-ext2-3-4-device.patch \
12           file://0002-linux-syslinux-implement-open_ext2_fs.patch \
13           file://0003-linux-syslinux-implement-install_to_ext2.patch \
14           file://0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch \
15           file://0005-linux-syslinux-implement-handle_adv_on_ext.patch \
16           file://0006-linux-syslinux-implement-write_to_ext-and-add-syslin.patch \
17           file://0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch \
18           file://0008-libinstaller-syslinuxext-implement-syslinux_patch_bo.patch \
19           file://0009-linux-syslinux-implement-install_bootblock.patch \
20           file://0010-Workaround-multiple-definition-of-symbol-errors.patch \
21           file://0011-install-don-t-install-obsolete-file-com32.ld.patch \
22           file://0012-libinstaller-Fix-build-with-glibc-2.36.patch \
23           file://0013-remove-clean-script.patch \
24           file://0014-Fix-reproducibility-issues.patch \
25"
26
27SRC_URI[md5sum] = "2b31c78f087f99179feb357da312d7ec"
28SRC_URI[sha256sum] = "4441a5d593f85bb6e8d578cf6653fb4ec30f9e8f4a2315a3d8f2d0a8b3fadf94"
29
30# remove at next version upgrade or when output changes
31
32RECIPE_NO_UPDATE_REASON = "6.04-pre3 is broken"
33UPSTREAM_CHECK_URI = "https://www.zytor.com/pub/syslinux/"
34UPSTREAM_CHECK_REGEX = "syslinux-(?P<pver>.+)\.tar"
35UPSTREAM_VERSION_UNKNOWN = "1"
36
37# We can build the native parts anywhere, but the target has to be x86
38COMPATIBLE_HOST:class-target = '(x86_64|i.86).*-(linux|freebsd.*)'
39
40# Don't let the sanity checker trip on the 32 bit real mode BIOS binaries
41INSANE_SKIP:${PN}-misc = "arch"
42INSANE_SKIP:${PN}-chain = "arch"
43
44# When building the installer, CC is used to link. When building the bootloader,
45# LD is used. However, these variables assume that GCC is used and break the
46# build, so unset them.
47TARGET_LDFLAGS = ""
48SECURITY_LDFLAGS = ""
49LDFLAGS_SECTION_REMOVAL = ""
50
51CFLAGS:append = " -DNO_INLINE_FUNCS -Wno-error=implicit-function-declaration"
52
53EXTRA_OEMAKE = " \
54	BINDIR=${bindir} SBINDIR=${sbindir} LIBDIR=${libdir} \
55	DATADIR=${datadir} MANDIR=${mandir} INCDIR=${includedir} \
56	CC="${CC} ${CFLAGS} ${LDFLAGS}" \
57	LD="${LD} ${LDFLAGS}" \
58	OBJDUMP="${OBJDUMP}" \
59	OBJCOPY="${OBJCOPY}" \
60	AR="${AR}" \
61	STRIP="${STRIP}" \
62	NM="${NM}" \
63	RANLIB="${RANLIB}" \
64"
65
66# mtools allows non-root users to install syslinux
67PACKAGECONFIG ??= "mtools"
68PACKAGECONFIG[mtools] = ",,,"
69
70#
71# Tasks for native/nativesdk which just build the installer.
72#
73do_configure() {
74	oe_runmake firmware="bios" clean
75}
76
77do_compile() {
78	oe_runmake firmware="bios" installer
79}
80
81do_install() {
82	install -d ${D}${bindir}
83	install \
84		${B}/bios/extlinux/extlinux \
85		${B}/bios/utils/isohybrid \
86		${D}${bindir}
87
88	if ${@bb.utils.contains("PACKAGECONFIG", "mtools", "true", "false", d)}; then
89		install ${B}/bios/mtools/syslinux ${D}${bindir}
90	else
91		install ${B}/bios/linux/syslinux ${D}${bindir}
92	fi
93}
94
95#
96# Tasks for target which ship the precompiled bootloader and installer
97#
98do_configure:class-target() {
99	# No need to do anything as we're mostly shipping the precompiled binaries
100	:
101}
102
103do_compile:class-target() {
104	# No need to do anything as we're mostly shipping the precompiled binaries
105	:
106}
107
108do_install:class-target() {
109	oe_runmake firmware="bios" install INSTALLROOT="${D}"
110
111	install -d ${D}${datadir}/syslinux/
112	install -m 644 ${S}/bios/core/ldlinux.sys ${D}${datadir}/syslinux/
113	install -m 644 ${S}/bios/core/ldlinux.bss ${D}${datadir}/syslinux/
114}
115
116PACKAGES += "${PN}-extlinux ${PN}-mbr ${PN}-chain ${PN}-pxelinux ${PN}-isolinux ${PN}-misc"
117
118RDEPENDS:${PN} += "${@bb.utils.contains("PACKAGECONFIG", "mtools", "mtools", "", d)}"
119RDEPENDS:${PN}-misc += "perl"
120
121FILES:${PN} = "${bindir}/syslinux"
122FILES:${PN}-extlinux = "${sbindir}/extlinux"
123FILES:${PN}-mbr = "${datadir}/${BPN}/mbr.bin"
124FILES:${PN}-chain = "${datadir}/${BPN}/chain.c32"
125FILES:${PN}-isolinux = "${datadir}/${BPN}/isolinux.bin"
126FILES:${PN}-pxelinux = "${datadir}/${BPN}/pxelinux.0"
127FILES:${PN}-dev += "${datadir}/${BPN}/com32/lib*${SOLIBS} ${datadir}/${BPN}/com32/include ${datadir}/${BPN}/com32/com32.ld"
128FILES:${PN}-staticdev += "${datadir}/${BPN}/com32/lib*.a ${libdir}/${BPN}/com32/lib*.a"
129FILES:${PN}-misc = "${datadir}/${BPN}/* ${libdir}/${BPN}/* ${bindir}/*"
130
131BBCLASSEXTEND = "native nativesdk"
132