summaryrefslogtreecommitdiff
path: root/sub/syslinux
diff options
context:
space:
mode:
Diffstat (limited to 'sub/syslinux')
-rw-r--r--sub/syslinux/Makefile106
-rw-r--r--sub/syslinux/syslinux-extraflags.patch39
-rw-r--r--sub/syslinux/syslinux-gcc5-1.patch81
-rw-r--r--sub/syslinux/syslinux-gcc5-2.patch292
-rw-r--r--sub/syslinux/syslinux-gcc5-3.patch35
-rw-r--r--sub/syslinux/syslinux-inttypes.patch310
-rw-r--r--sub/syslinux/syslinux-oknogit.patch22
7 files changed, 885 insertions, 0 deletions
diff --git a/sub/syslinux/Makefile b/sub/syslinux/Makefile
new file mode 100644
index 0000000..1a0b100
--- /dev/null
+++ b/sub/syslinux/Makefile
@@ -0,0 +1,106 @@
+LIBUUID_NAME := libuuid
+LIBUUID_VERSION := 1.0.3
+LIBUUID_URLDIR := http://skarnet.org/archive
+LIBUUID_TAREXT := tar.gz
+LIBUUID_TARLETTER := z
+
+NASM_NAME := nasm
+NASM_VERSION := 2.12.02
+NASM_TAREXT := tar.xz
+NASM_TARLETTER := J
+NASM_URLDIR = http://www.nasm.us/pub/nasm/releasebuilds/$(NASM_VERSION)
+
+SYSLINUX_NAME := syslinux
+SYSLINUX_VERSION := 6.03
+SYSLINUX_URLDIR := https://cdn.kernel.org/pub/linux/utils/boot/$(SYSLINUX_NAME)
+SYSLINUX_TAREXT := tar.xz
+SYSLINUX_TARLETTER := J
+
+SYSLINUX_CFLAGS := "-I $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)/include"
+SYSLINUX_LDFLAGS := "-s -static -L $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)/lib"
+SYSLINUX_INSTALLROOT := $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)
+
+
+
+$(OUTPUT)/sources/$(LIBUUID_NAME)-$(LIBUUID_VERSION).$(LIBUUID_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(LIBUUID_URLDIR)/$(LIBUUID_NAME)-$(LIBUUID_VERSION).$(LIBUUID_TAREXT)
+
+$(OUTPUT)/sources/.lh_$(LIBUUID_NAME)_dled: $(OUTPUT)/sources/$(LIBUUID_NAME)-$(LIBUUID_VERSION).$(LIBUUID_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/sources/$(NASM_NAME)-$(NASM_VERSION).$(NASM_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(NASM_URLDIR)/$(NASM_NAME)-$(NASM_VERSION).$(NASM_TAREXT)
+
+$(OUTPUT)/sources/.lh_$(NASM_NAME)_dled: $(OUTPUT)/sources/$(NASM_NAME)-$(NASM_VERSION).$(NASM_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/sources/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION).$(SYSLINUX_TAREXT): | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/sources wget $(SYSLINUX_URLDIR)/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION).$(SYSLINUX_TAREXT)
+
+$(OUTPUT)/sources/.lh_$(SYSLINUX_NAME)_dled: $(OUTPUT)/sources/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION).$(SYSLINUX_TAREXT) | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+
+$(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_copied: $(OUTPUT)/sources/.lh_$(LIBUUID_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)
+ exec setuidgid $(NORMALUSER) s6-mkdir -p $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION) tar $(LIBUUID_TARLETTER)xpvf $(OUTPUT)/sources/$(LIBUUID_NAME)-$(LIBUUID_VERSION).$(LIBUUID_TAREXT)
+ exec setuidgid $(NORMALUSER) s6-rename $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)/$(LIBUUID_NAME)-$(LIBUUID_VERSION) $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)/src
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_configured: $(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_copied $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)/src ./configure --prefix=$(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION) --enable-static --disable-shared
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_built: $(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_configured $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)/src $(MAKE)
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_installed: $(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_built $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(LIBUUID_NAME)-$(LIBUUID_VERSION)/src $(MAKE) install
+ exec setuidgid $(NORMALUSER) makenamelink $(OUTPUT)/build-build/opt $(LIBUUID_NAME) $(LIBUUID_NAME)-$(LIBUUID_VERSION) $(OUTPUT)/tmp
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+
+$(OUTPUT)/build-build/.lh_$(NASM_NAME)_copied: $(OUTPUT)/sources/.lh_$(NASM_NAME)_dled | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)
+ exec setuidgid $(NORMALUSER) s6-mkdir -p $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION) tar $(NASM_TARLETTER)xpvf $(OUTPUT)/sources/$(NASM_NAME)-$(NASM_VERSION).$(NASM_TAREXT)
+ exec setuidgid $(NORMALUSER) s6-rename $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)/$(NASM_NAME)-$(NASM_VERSION) $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)/src
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(NASM_NAME)_configured: $(OUTPUT)/build-build/.lh_$(NASM_NAME)_copied $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)/src export LDFLAGS -static ./configure --prefix=$(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION) --enable-static
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(NASM_NAME)_built: $(OUTPUT)/build-build/.lh_$(NASM_NAME)_copied $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)/src $(MAKE) LDFLAGS=-static
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(NASM_NAME)_installed: $(OUTPUT)/build-build/.lh_$(NASM_NAME)_built $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(NASM_NAME)-$(NASM_VERSION)/src $(MAKE) install
+ exec setuidgid $(NORMALUSER) makenamelink $(OUTPUT)/build-build/opt $(NASM_NAME) $(NASM_NAME)-$(NASM_VERSION) $(OUTPUT)/tmp
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+
+$(OUTPUT)/build-build/.lh_$(SYSLINUX_NAME)_copied: $(OUTPUT)/sources/.lh_$(SYSLINUX_NAME)_dled sub/syslinux/syslinux-extraflags.patch sub/syslinux/syslinux-gcc5-1.patch sub/syslinux/syslinux-gcc5-2.patch sub/syslinux/syslinux-gcc5-3.patch sub/syslinux/syslinux-inttypes.patch sub/syslinux/syslinux-oknogit.patch | $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) s6-rmrf $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)
+ exec setuidgid $(NORMALUSER) s6-mkdir -p $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION) tar $(SYSLINUX_TARLETTER)xpvf $(OUTPUT)/sources/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION).$(SYSLINUX_TAREXT)
+ exec setuidgid $(NORMALUSER) s6-rename $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION) $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-extraflags.patch patch -p1
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-gcc5-1.patch patch -p1
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-gcc5-2.patch patch -p1
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-gcc5-3.patch patch -p1
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-inttypes.patch patch -p1
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src redirfd -r 0 $(WD)/sub/syslinux/syslinux-oknogit.patch patch -p1
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(SYSLINUX_NAME)_built: $(OUTPUT)/build-build/.lh_$(SYSLINUX_NAME)_copied $(OUTPUT)/build-build/.lh_$(LIBUUID_NAME)_installed $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) cd $(OUTPUT)/build-build/opt/$(SYSLINUX_NAME)-$(SYSLINUX_VERSION)/src export INSTALLROOT $(SYSLINUX_INSTALLROOT) export EXTRA_CFLAGS $(SYSLINUX_CFLAGS) export EXTRA_LDFLAGS $(SYSLINUX_LDFLAGS) if $(MAKE) clean "" if $(MAKE) installer "" make install
+ exec setuidgid $(NORMALUSER) s6-touch $@
+
+$(OUTPUT)/build-build/.lh_$(SYSLINUX_NAME)_installed: $(OUTPUT)/build-build/.lh_$(SYSLINUX_NAME)_built $(OUTPUT)/build-build/.lh_gcc | $(OUTPUT)/tmp/.lh_prepared $(OUTPUT)/build-build/.lh_skarnet_installed
+ exec setuidgid $(NORMALUSER) makenamelink $(OUTPUT)/build-build/opt $(SYSLINUX_NAME) $(SYSLINUX_NAME)-$(SYSLINUX_VERSION) $(OUTPUT)/tmp
+ exec setuidgid $(NORMALUSER) makelinks $(OUTPUT)/build-build /bin /opt/$(SYSLINUX_NAME)/sbin
+ exec setuidgid $(NORMALUSER) s6-touch $@
diff --git a/sub/syslinux/syslinux-extraflags.patch b/sub/syslinux/syslinux-extraflags.patch
new file mode 100644
index 0000000..df64345
--- /dev/null
+++ b/sub/syslinux/syslinux-extraflags.patch
@@ -0,0 +1,39 @@
+--- src.tmp/core/Makefile
++++ src/core/Makefile
+@@ -26,7 +26,7 @@
+
+ OPTFLAGS =
+ INCLUDES = -I$(SRC)/include -I$(com32)/include -I$(com32)/include/sys -I$(com32)/lib \
+- -I$(SRC)/lwip/src/include -I$(SRC)/lwip/src/include/ipv4 -I$(SRC)/fs/pxe
++ -I$(SRC)/lwip/src/include -I$(SRC)/lwip/src/include/ipv4 -I$(SRC)/fs/pxe $(EXTRA_CFLAGS)
+
+ # This is very similar to cp437; technically it's for Norway and Denmark,
+ # but it's unlikely the characters that are different will be used in
+--- src.tmp/extlinux/Makefile
++++ src/extlinux/Makefile
+@@ -17,10 +17,10 @@
+ include $(MAKEDIR)/syslinux.mk
+
+ OPTFLAGS = -g -Os
+-INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller
++INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller $(EXTRA_CFLAGS)
+ CFLAGS = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
+ $(OPTFLAGS) $(INCLUDES)
+-LDFLAGS =
++LDFLAGS = $(EXTRA_LDFLAGS)
+
+ SRCS = main.c \
+ mountinfo.c \
+--- src.tmp/utils/Makefile
++++ src/utils/Makefile
+@@ -17,8 +17,8 @@
+ VPATH = $(SRC)
+ include $(MAKEDIR)/syslinux.mk
+
+-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC)
+-LDFLAGS = -O2
++CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) $(EXTRA_CFLAGS)
++LDFLAGS = -O2 $(EXTRA_LDFLAGS)
+
+ C_TARGETS = isohybrid gethostip memdiskfind
+ SCRIPT_TARGETS = mkdiskimage
diff --git a/sub/syslinux/syslinux-gcc5-1.patch b/sub/syslinux/syslinux-gcc5-1.patch
new file mode 100644
index 0000000..380b05a
--- /dev/null
+++ b/sub/syslinux/syslinux-gcc5-1.patch
@@ -0,0 +1,81 @@
+From e5f2b577ded109291c9632dacb6eaa621d8a59fe Mon Sep 17 00:00:00 2001
+From: Sylvain Gault <sylvain.gault@gmail.com>
+Date: Tue, 29 Sep 2015 02:38:25 +0200
+Subject: [PATCH 1/1] bios: Fix alignment change with gcc 5
+
+The section aligment specified in the ld scripts have to be greater or
+equal to those in the .o files generated by gcc.
+
+Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
+Tested-by: poma <pomidorabelisima@gmail.com>
+Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
+---
+ core/i386/syslinux.ld | 6 +++---
+ core/x86_64/syslinux.ld | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/core/i386/syslinux.ld b/core/i386/syslinux.ld
+index 7b4e012..7390451 100644
+--- a/core/i386/syslinux.ld
++++ b/core/i386/syslinux.ld
+@@ -266,7 +266,7 @@ SECTIONS
+ __text_end = .;
+ }
+
+- . = ALIGN(16);
++ . = ALIGN(32);
+
+ __rodata_vma = .;
+ __rodata_lma = __rodata_vma + __text_lma - __text_vma;
+@@ -361,7 +361,7 @@ SECTIONS
+ __dynamic_end = .;
+ }
+
+- . = ALIGN(16);
++ . = ALIGN(32);
+
+ __data_vma = .;
+ __data_lma = __data_vma + __text_lma - __text_vma;
+@@ -377,7 +377,7 @@ SECTIONS
+ __pm_code_dwords = (__pm_code_len + 3) >> 2;
+
+ . = ALIGN(128);
+-
++
+ __bss_vma = .;
+ __bss_lma = .; /* Dummy */
+ .bss (NOLOAD) : AT (__bss_lma) {
+diff --git a/core/x86_64/syslinux.ld b/core/x86_64/syslinux.ld
+index 1057112..bf815c4 100644
+--- a/core/x86_64/syslinux.ld
++++ b/core/x86_64/syslinux.ld
+@@ -266,7 +266,7 @@ SECTIONS
+ __text_end = .;
+ }
+
+- . = ALIGN(16);
++ . = ALIGN(32);
+
+ __rodata_vma = .;
+ __rodata_lma = __rodata_vma + __text_lma - __text_vma;
+@@ -361,7 +361,7 @@ SECTIONS
+ __dynamic_end = .;
+ }
+
+- . = ALIGN(16);
++ . = ALIGN(32);
+
+ __data_vma = .;
+ __data_lma = __data_vma + __text_lma - __text_vma;
+@@ -377,7 +377,7 @@ SECTIONS
+ __pm_code_dwords = (__pm_code_len + 3) >> 2;
+
+ . = ALIGN(128);
+-
++
+ __bss_vma = .;
+ __bss_lma = .; /* Dummy */
+ .bss (NOLOAD) : AT (__bss_lma) {
+--
+2.7.4.GIT
+
diff --git a/sub/syslinux/syslinux-gcc5-2.patch b/sub/syslinux/syslinux-gcc5-2.patch
new file mode 100644
index 0000000..da436f6
--- /dev/null
+++ b/sub/syslinux/syslinux-gcc5-2.patch
@@ -0,0 +1,292 @@
+From 0cc9a99e560a2f52bcf052fd85b1efae35ee812f Mon Sep 17 00:00:00 2001
+From: Sylvain Gault <sylvain.gault@gmail.com>
+Date: Tue, 29 Sep 2015 04:45:09 +0200
+Subject: [PATCH 1/1] bios: Don't try to guess the sections alignment
+
+For the compression / decompression to succeed, the sections layout must
+be the same between the virtual memory and load memory. The section
+alignment was kept in sync by introducing aligment that should be
+greater or equal to the actual section alignment.
+
+This patch compute the load memory addresses of the sections so that
+the layout is the same as the virtual memory addresses.
+
+Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
+Tested-by: poma <pomidorabelisima@gmail.com>
+Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
+---
+ core/i386/syslinux.ld | 63 ++++++++++---------------------------------------
+ core/x86_64/syslinux.ld | 63 ++++++++++---------------------------------------
+ 2 files changed, 24 insertions(+), 102 deletions(-)
+
+diff --git a/core/i386/syslinux.ld b/core/i386/syslinux.ld
+index 7390451..92b75b1 100644
+--- a/core/i386/syslinux.ld
++++ b/core/i386/syslinux.ld
+@@ -255,10 +255,9 @@ SECTIONS
+ . = 0x100000;
+
+ __pm_code_start = .;
++ __vma_to_lma = __pm_code_lma - __pm_code_start;
+
+- __text_vma = .;
+- __text_lma = __pm_code_lma;
+- .text : AT(__text_lma) {
++ .text : AT(ADDR(.text) + __vma_to_lma) {
+ FILL(0x90909090)
+ __text_start = .;
+ *(.text)
+@@ -266,106 +265,68 @@ SECTIONS
+ __text_end = .;
+ }
+
+- . = ALIGN(32);
+-
+- __rodata_vma = .;
+- __rodata_lma = __rodata_vma + __text_lma - __text_vma;
+- .rodata : AT(__rodata_lma) {
++ .rodata : AT(ADDR(.rodata) + __vma_to_lma) {
+ __rodata_start = .;
+ *(.rodata)
+ *(.rodata.*)
+ __rodata_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __ctors_vma = .;
+- __ctors_lma = __ctors_vma + __text_lma - __text_vma;
+- .ctors : AT(__ctors_lma) {
++ .ctors : AT(ADDR(.ctors) + __vma_to_lma) {
+ __ctors_start = .;
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ __ctors_end = .;
+ }
+
+- __dtors_vma = .;
+- __dtors_lma = __dtors_vma + __text_lma - __text_vma;
+- .dtors : AT(__dtors_lma) {
++ .dtors : AT(ADDR(.dtors) + __vma_to_lma) {
+ __dtors_start = .;
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ __dtors_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __dynsym_vma = .;
+- __dynsym_lma = __dynsym_vma + __text_lma - __text_vma;
+- .dynsym : AT(__dynsym_lma) {
++ .dynsym : AT(ADDR(.dynsym) + __vma_to_lma) {
+ __dynsym_start = .;
+ *(.dynsym)
+ __dynsym_end = .;
+ }
+ __dynsym_len = __dynsym_end - __dynsym_start;
+
+- . = ALIGN(4);
+-
+- __dynstr_vma = .;
+- __dynstr_lma = __dynstr_vma + __text_lma - __text_vma;
+- .dynstr : AT(__dynstr_lma) {
++ .dynstr : AT(ADDR(.dynstr) + __vma_to_lma) {
+ __dynstr_start = .;
+ *(.dynstr)
+ __dynstr_end = .;
+ }
+ __dynstr_len = __dynstr_end - __dynstr_start;
+
+- . = ALIGN(4);
+-
+- __gnu_hash_vma = .;
+- __gnu_hash_lma = __gnu_hash_vma + __text_lma - __text_vma;
+- .gnu.hash : AT(__gnu_hash_lma) {
++ .gnu.hash : AT(ADDR(.gnu.hash) + __vma_to_lma) {
+ __gnu_hash_start = .;
+ *(.gnu.hash)
+ __gnu_hash_end = .;
+ }
+
+
+- . = ALIGN(4);
+-
+- __dynlink_vma = .;
+- __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
+- .dynlink : AT(__dynlink_lma) {
++ .dynlink : AT(ADDR(.dynlink) + __vma_to_lma) {
+ __dynlink_start = .;
+ *(.dynlink)
+ __dynlink_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __got_vma = .;
+- __got_lma = __got_vma + __text_lma - __text_vma;
+- .got : AT(__got_lma) {
++ .got : AT(ADDR(.got) + __vma_to_lma) {
+ __got_start = .;
+ KEEP (*(.got.plt))
+ KEEP (*(.got))
+ __got_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __dynamic_vma = .;
+- __dynamic_lma = __dynamic_vma + __text_lma - __text_vma;
+- .dynamic : AT(__dynamic_lma) {
++ .dynamic : AT(ADDR(.dynamic) + __vma_to_lma) {
+ __dynamic_start = .;
+ *(.dynamic)
+ __dynamic_end = .;
+ }
+
+- . = ALIGN(32);
+-
+- __data_vma = .;
+- __data_lma = __data_vma + __text_lma - __text_vma;
+- .data : AT(__data_lma) {
++ .data : AT(ADDR(.data) + __vma_to_lma) {
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+diff --git a/core/x86_64/syslinux.ld b/core/x86_64/syslinux.ld
+index bf815c4..70c6e00 100644
+--- a/core/x86_64/syslinux.ld
++++ b/core/x86_64/syslinux.ld
+@@ -255,10 +255,9 @@ SECTIONS
+ . = 0x100000;
+
+ __pm_code_start = .;
++ __vma_to_lma = __pm_code_lma - __pm_code_start;
+
+- __text_vma = .;
+- __text_lma = __pm_code_lma;
+- .text : AT(__text_lma) {
++ .text : AT(ADDR(.text) + __vma_to_lma) {
+ FILL(0x90909090)
+ __text_start = .;
+ *(.text)
+@@ -266,106 +265,68 @@ SECTIONS
+ __text_end = .;
+ }
+
+- . = ALIGN(32);
+-
+- __rodata_vma = .;
+- __rodata_lma = __rodata_vma + __text_lma - __text_vma;
+- .rodata : AT(__rodata_lma) {
++ .rodata : AT(ADDR(.rodata) + __vma_to_lma) {
+ __rodata_start = .;
+ *(.rodata)
+ *(.rodata.*)
+ __rodata_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __ctors_vma = .;
+- __ctors_lma = __ctors_vma + __text_lma - __text_vma;
+- .ctors : AT(__ctors_lma) {
++ .ctors : AT(ADDR(.ctors) + __vma_to_lma) {
+ __ctors_start = .;
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ __ctors_end = .;
+ }
+
+- __dtors_vma = .;
+- __dtors_lma = __dtors_vma + __text_lma - __text_vma;
+- .dtors : AT(__dtors_lma) {
++ .dtors : AT(ADDR(.dtors) + __vma_to_lma) {
+ __dtors_start = .;
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ __dtors_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __dynsym_vma = .;
+- __dynsym_lma = __dynsym_vma + __text_lma - __text_vma;
+- .dynsym : AT(__dynsym_lma) {
++ .dynsym : AT(ADDR(.dynsym) + __vma_to_lma) {
+ __dynsym_start = .;
+ *(.dynsym)
+ __dynsym_end = .;
+ }
+ __dynsym_len = __dynsym_end - __dynsym_start;
+
+- . = ALIGN(4);
+-
+- __dynstr_vma = .;
+- __dynstr_lma = __dynstr_vma + __text_lma - __text_vma;
+- .dynstr : AT(__dynstr_lma) {
++ .dynstr : AT(ADDR(.dynstr) + __vma_to_lma) {
+ __dynstr_start = .;
+ *(.dynstr)
+ __dynstr_end = .;
+ }
+ __dynstr_len = __dynstr_end - __dynstr_start;
+
+- . = ALIGN(4);
+-
+- __gnu_hash_vma = .;
+- __gnu_hash_lma = __gnu_hash_vma + __text_lma - __text_vma;
+- .gnu.hash : AT(__gnu_hash_lma) {
++ .gnu.hash : AT(ADDR(.gnu.hash) + __vma_to_lma) {
+ __gnu_hash_start = .;
+ *(.gnu.hash)
+ __gnu_hash_end = .;
+ }
+
+
+- . = ALIGN(4);
+-
+- __dynlink_vma = .;
+- __dynlink_lma = __dynlink_vma + __text_lma - __text_vma;
+- .dynlink : AT(__dynlink_lma) {
++ .dynlink : AT(ADDR(.dynlink) + __vma_to_lma) {
+ __dynlink_start = .;
+ *(.dynlink)
+ __dynlink_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __got_vma = .;
+- __got_lma = __got_vma + __text_lma - __text_vma;
+- .got : AT(__got_lma) {
++ .got : AT(ADDR(.got) + __vma_to_lma) {
+ __got_start = .;
+ KEEP (*(.got.plt))
+ KEEP (*(.got))
+ __got_end = .;
+ }
+
+- . = ALIGN(4);
+-
+- __dynamic_vma = .;
+- __dynamic_lma = __dynamic_vma + __text_lma - __text_vma;
+- .dynamic : AT(__dynamic_lma) {
++ .dynamic : AT(ADDR(.dynamic) + __vma_to_lma) {
+ __dynamic_start = .;
+ *(.dynamic)
+ __dynamic_end = .;
+ }
+
+- . = ALIGN(32);
+-
+- __data_vma = .;
+- __data_lma = __data_vma + __text_lma - __text_vma;
+- .data : AT(__data_lma) {
++ .data : AT(ADDR(.data) + __vma_to_lma) {
+ __data_start = .;
+ *(.data)
+ *(.data.*)
+--
+2.7.4.GIT
+
diff --git a/sub/syslinux/syslinux-gcc5-3.patch b/sub/syslinux/syslinux-gcc5-3.patch
new file mode 100644
index 0000000..e4d4655
--- /dev/null
+++ b/sub/syslinux/syslinux-gcc5-3.patch
@@ -0,0 +1,35 @@
+From 8dc6d758b564a1ccc44c3ae11f265d43628219ce Mon Sep 17 00:00:00 2001
+From: Sylvain Gault <sylvain.gault@gmail.com>
+Date: Tue, 13 Oct 2015 06:18:07 +0200
+Subject: [PATCH 1/1] ldlinux: Fix return pointer to local data
+
+The command-line parsing used to return a pointer to a local array. The
+code used to work by chance, but now, gcc 5 is able to detect it and
+return a NULL pointer instead.
+
+The buffer is now marked static. This shouldn't be a problem as only one
+command line can be read at a time.
+
+Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
+Tested-by: poma <pomidorabelisima at gmail.com>
+Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
+---
+ com32/elflink/ldlinux/cli.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c
+index 6ff30c6..3119b11 100644
+--- a/com32/elflink/ldlinux/cli.c
++++ b/com32/elflink/ldlinux/cli.c
+@@ -125,7 +125,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ ,
+ int (*pDraw_Menu) (int, int, int),
+ void (*show_fkey) (int), bool *timedout)
+ {
+- char cmdline[MAX_CMDLINE_LEN] = { };
++ static char cmdline[MAX_CMDLINE_LEN] = { };
+ int key, len, prev_len, cursor;
+ int redraw = 0;
+ int x, y;
+--
+2.7.4.GIT
+
diff --git a/sub/syslinux/syslinux-inttypes.patch b/sub/syslinux/syslinux-inttypes.patch
new file mode 100644
index 0000000..79cc36c
--- /dev/null
+++ b/sub/syslinux/syslinux-inttypes.patch
@@ -0,0 +1,310 @@
+--- src.tmp/efi/wrapper.c
++++ src/efi/wrapper.c
+@@ -43,8 +43,8 @@
+ * For 64bit machines (class == ELFCLASS64), the optional
+ * header includes PE32+header fields
+ */
+-static void write_header(FILE *f, __uint32_t entry, size_t data_size,
+- __uint32_t so_memsz, __uint8_t class)
++static void write_header(FILE *f, uint32_t entry, size_t data_size,
++ uint32_t so_memsz, uint8_t class)
+ {
+ struct optional_hdr o_hdr;
+ struct optional_hdr_pe32p o_hdr_pe32p;
+@@ -53,9 +53,9 @@
+ struct extra_hdr_pe32p e_hdr_pe32p;
+ struct coff_hdr c_hdr;
+ struct header hdr;
+- __uint32_t total_sz = data_size;
+- __uint32_t hdr_sz;
+- __uint32_t reloc_start, reloc_end;
++ uint32_t total_sz = data_size;
++ uint32_t hdr_sz;
++ uint32_t reloc_start, reloc_end;
+
+ /*
+ * The header size have to be a multiple of file_align, which currently
+@@ -103,7 +103,7 @@
+ e_hdr.image_sz = hdr_sz + so_memsz;
+ e_hdr.headers_sz = hdr_sz;
+ e_hdr.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+- e_hdr.rva_and_sizes_nr = sizeof(e_hdr.data_directory) / sizeof(__uint64_t);
++ e_hdr.rva_and_sizes_nr = sizeof(e_hdr.data_directory) / sizeof(uint64_t);
+ fwrite(&e_hdr, sizeof(e_hdr), 1, f);
+ }
+ else if (class == ELFCLASS64) {
+@@ -126,7 +126,7 @@
+ e_hdr_pe32p.image_sz = hdr_sz + so_memsz;
+ e_hdr_pe32p.headers_sz = hdr_sz;
+ e_hdr_pe32p.subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+- e_hdr_pe32p.rva_and_sizes_nr = sizeof(e_hdr_pe32p.data_directory) / sizeof(__uint64_t);
++ e_hdr_pe32p.rva_and_sizes_nr = sizeof(e_hdr_pe32p.data_directory) / sizeof(uint64_t);
+ fwrite(&e_hdr_pe32p, sizeof(e_hdr_pe32p), 1, f);
+ }
+
+@@ -163,10 +163,10 @@
+ {
+ Elf32_Ehdr e32_hdr;
+ Elf64_Ehdr e64_hdr;
+- __uint32_t entry;
+- __uint8_t class;
+- __uint64_t phoff = 0;
+- __uint16_t phnum = 0, phentsize = 0;
++ uint32_t entry;
++ uint8_t class;
++ uint64_t phoff = 0;
++ uint16_t phnum = 0, phentsize = 0;
+ unsigned char *id;
+ FILE *f_in, *f_out;
+ void *buf;
+--- src.tmp/efi/wrapper.h
++++ src/efi/wrapper.h
+@@ -1,6 +1,8 @@
+ #ifndef EFI_WRAPPER_H
+ #define EFI_WRAPPER_H
+
++#include <stdint.h>
++
+ #define MSDOS_SIGNATURE 0x5a4d
+ #define PE_SIGNATURE 0x4550
+ #define PE32_FORMAT 0x10b
+@@ -27,13 +29,13 @@
+ #define OFFSETOF(t,m) ((size_t)&((t *)0)->m)
+
+ struct header {
+- __uint16_t msdos_signature;
+- __uint8_t _pad1[0x16];
+- __uint16_t relocs_ptr;
+- __uint8_t __pad2[0x3c - 0x1a];
+- __uint32_t pe_hdr;
+- __uint16_t pe_signature;
+- __uint16_t _pad2;
++ uint16_t msdos_signature;
++ uint8_t _pad1[0x16];
++ uint16_t relocs_ptr;
++ uint8_t __pad2[0x3c - 0x1a];
++ uint32_t pe_hdr;
++ uint16_t pe_signature;
++ uint16_t _pad2;
+ } __packed;
+
+ /* FIXME: when setting up coff_hdr, set up optional_hdr_sz
+@@ -43,72 +45,72 @@
+ * COFF header
+ */
+ struct coff_hdr {
+- __uint16_t arch;
+- __uint16_t nr_sections;
+- __uint32_t timedatestamp;
+- __uint32_t symtab;
+- __uint32_t nr_syms;
+- __uint16_t optional_hdr_sz;
+- __uint16_t characteristics;
++ uint16_t arch;
++ uint16_t nr_sections;
++ uint32_t timedatestamp;
++ uint32_t symtab;
++ uint32_t nr_syms;
++ uint16_t optional_hdr_sz;
++ uint16_t characteristics;
+ } __packed;
+
+ struct optional_hdr {
+- __uint16_t format;
+- __uint8_t major_linker_version;
+- __uint8_t minor_linker_version;
+- __uint32_t code_sz;
+- __uint32_t initialized_data_sz;
+- __uint32_t uninitialized_data_sz;
+- __uint32_t entry_point;
+- __uint32_t base_code;
+- __uint32_t data;
++ uint16_t format;
++ uint8_t major_linker_version;
++ uint8_t minor_linker_version;
++ uint32_t code_sz;
++ uint32_t initialized_data_sz;
++ uint32_t uninitialized_data_sz;
++ uint32_t entry_point;
++ uint32_t base_code;
++ uint32_t data;
+ } __packed;
+
+ /* For PE32+, the optional_header does NOT have
+ * data after base_code
+ */
+ struct optional_hdr_pe32p {
+- __uint16_t format;
+- __uint8_t major_linker_version;
+- __uint8_t minor_linker_version;
+- __uint32_t code_sz;
+- __uint32_t initialized_data_sz;
+- __uint32_t uninitialized_data_sz;
+- __uint32_t entry_point;
+- __uint32_t base_code;
++ uint16_t format;
++ uint8_t major_linker_version;
++ uint8_t minor_linker_version;
++ uint32_t code_sz;
++ uint32_t initialized_data_sz;
++ uint32_t uninitialized_data_sz;
++ uint32_t entry_point;
++ uint32_t base_code;
+ } __packed;
+ /*
+ * Extra header fields
+ */
+ struct extra_hdr {
+- __uint32_t image_base;
+- __uint32_t section_align;
+- __uint32_t file_align;
+- __uint16_t major_os_version;
+- __uint16_t minor_os_version;
+- __uint16_t major_image_version;
+- __uint16_t minor_image_version;
+- __uint16_t major_subsystem_version;
+- __uint16_t minor_subsystem_version;
+- __uint32_t win32_version;
+- __uint32_t image_sz;
+- __uint32_t headers_sz;
+- __uint32_t checksum;
+- __uint16_t subsystem;
+- __uint16_t dll_characteristics;
+- __uint32_t stack_reserve_sz;
+- __uint32_t stack_commit_sz;
+- __uint32_t heap_reserve_sz;
+- __uint32_t heap_commit_sz;
+- __uint32_t loader_flags;
+- __uint32_t rva_and_sizes_nr;
++ uint32_t image_base;
++ uint32_t section_align;
++ uint32_t file_align;
++ uint16_t major_os_version;
++ uint16_t minor_os_version;
++ uint16_t major_image_version;
++ uint16_t minor_image_version;
++ uint16_t major_subsystem_version;
++ uint16_t minor_subsystem_version;
++ uint32_t win32_version;
++ uint32_t image_sz;
++ uint32_t headers_sz;
++ uint32_t checksum;
++ uint16_t subsystem;
++ uint16_t dll_characteristics;
++ uint32_t stack_reserve_sz;
++ uint32_t stack_commit_sz;
++ uint32_t heap_reserve_sz;
++ uint32_t heap_commit_sz;
++ uint32_t loader_flags;
++ uint32_t rva_and_sizes_nr;
+ struct {
+- __uint64_t export_table;
+- __uint64_t import_table;
+- __uint64_t resource_table;
+- __uint64_t exception_table;
+- __uint64_t certification_table;
+- __uint64_t base_relocation_table;
++ uint64_t export_table;
++ uint64_t import_table;
++ uint64_t resource_table;
++ uint64_t exception_table;
++ uint64_t certification_table;
++ uint64_t base_relocation_table;
+ } data_directory;
+ } __packed;
+
+@@ -117,54 +119,54 @@
+ */
+
+ struct extra_hdr_pe32p {
+- __uint64_t image_base;
+- __uint32_t section_align;
+- __uint32_t file_align;
+- __uint16_t major_os_version;
+- __uint16_t minor_os_version;
+- __uint16_t major_image_version;
+- __uint16_t minor_image_version;
+- __uint16_t major_subsystem_version;
+- __uint16_t minor_subsystem_version;
+- __uint32_t win32_version;
+- __uint32_t image_sz;
+- __uint32_t headers_sz;
+- __uint32_t checksum;
+- __uint16_t subsystem;
+- __uint16_t dll_characteristics;
+- __uint64_t stack_reserve_sz;
+- __uint64_t stack_commit_sz;
+- __uint64_t heap_reserve_sz;
+- __uint64_t heap_commit_sz;
+- __uint32_t loader_flags;
+- __uint32_t rva_and_sizes_nr;
++ uint64_t image_base;
++ uint32_t section_align;
++ uint32_t file_align;
++ uint16_t major_os_version;
++ uint16_t minor_os_version;
++ uint16_t major_image_version;
++ uint16_t minor_image_version;
++ uint16_t major_subsystem_version;
++ uint16_t minor_subsystem_version;
++ uint32_t win32_version;
++ uint32_t image_sz;
++ uint32_t headers_sz;
++ uint32_t checksum;
++ uint16_t subsystem;
++ uint16_t dll_characteristics;
++ uint64_t stack_reserve_sz;
++ uint64_t stack_commit_sz;
++ uint64_t heap_reserve_sz;
++ uint64_t heap_commit_sz;
++ uint32_t loader_flags;
++ uint32_t rva_and_sizes_nr;
+ struct {
+- __uint64_t export_table;
+- __uint64_t import_table;
+- __uint64_t resource_table;
+- __uint64_t exception_table;
+- __uint64_t certification_table;
+- __uint64_t base_relocation_table;
++ uint64_t export_table;
++ uint64_t import_table;
++ uint64_t resource_table;
++ uint64_t exception_table;
++ uint64_t certification_table;
++ uint64_t base_relocation_table;
+ } data_directory;
+ } __packed;
+
+ struct section {
+- __uint8_t name[8];
+- __uint32_t virtual_sz;
+- __uint32_t virtual_address;
+- __uint32_t raw_data_sz;
+- __uint32_t raw_data;
+- __uint32_t relocs;
+- __uint32_t line_numbers;
+- __uint16_t relocs_nr;
+- __uint16_t line_numbers_nr;
+- __uint32_t characteristics;
++ uint8_t name[8];
++ uint32_t virtual_sz;
++ uint32_t virtual_address;
++ uint32_t raw_data_sz;
++ uint32_t raw_data;
++ uint32_t relocs;
++ uint32_t line_numbers;
++ uint16_t relocs_nr;
++ uint16_t line_numbers_nr;
++ uint32_t characteristics;
+ } __packed;
+
+ struct coff_reloc {
+- __uint32_t virtual_address;
+- __uint32_t symtab_index;
+- __uint16_t type;
++ uint32_t virtual_address;
++ uint32_t symtab_index;
++ uint16_t type;
+ };
+
+ #endif /* EFI_WRAPPER_H */
diff --git a/sub/syslinux/syslinux-oknogit.patch b/sub/syslinux/syslinux-oknogit.patch
new file mode 100644
index 0000000..0ace431
--- /dev/null
+++ b/sub/syslinux/syslinux-oknogit.patch
@@ -0,0 +1,22 @@
+--- src.old/efi/build-gnu-efi.sh
++++ src/efi/build-gnu-efi.sh
+@@ -29,7 +29,7 @@
+
+ (
+ cd ../..
+- git submodule update --init
++ git submodule update --init || true
+ )
+
+ mkdir -p "$objdir/gnu-efi"
+--- src.old/efi/clean-gnu-efi.sh
++++ src/efi/clean-gnu-efi.sh
+@@ -23,7 +23,7 @@
+
+ (
+ cd ../..
+- git submodule update --init
++ git submodule update --init || true
+ )
+
+ if [ -d "$objdir/gnu-efi" ];then