feat: add syslinux and util-linux
This commit is contained in:
parent
73fd88ccc0
commit
03eba21374
6 changed files with 284 additions and 0 deletions
40
packages/syslinux/Containerfile
Normal file
40
packages/syslinux/Containerfile
Normal file
|
@ -0,0 +1,40 @@
|
|||
FROM scratch as base
|
||||
ENV VERSION=6.04-pre1
|
||||
ENV SRC_HASH=3f6d50a57f3ed47d8234fd0ab4492634eb7c9aaf7dd902f33d3ac33564fd631d
|
||||
ENV SRC_FILE=syslinux-${VERSION}.tar.xz
|
||||
ENV SRC_SITE=https://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/${SRC_FILE}
|
||||
|
||||
FROM base as fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE}
|
||||
|
||||
FROM fetch as build
|
||||
COPY --from=stagex/busybox . /
|
||||
COPY --from=stagex/gcc . /
|
||||
COPY --from=stagex/binutils . /
|
||||
COPY --from=stagex/make . /
|
||||
COPY --from=stagex/perl . /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/util-linux . /
|
||||
COPY --from=stagex/linux-headers . /
|
||||
RUN tar -xf ${SRC_FILE}
|
||||
WORKDIR syslinux-${VERSION}
|
||||
COPY *.patch .
|
||||
RUN --network=none <<-EOF
|
||||
patch -p1 < fix-sysmacros.patch
|
||||
patch -p1 < prevent-pow-optimization.patch
|
||||
patch -p1 < gcc-10.patch
|
||||
make efi64 installer
|
||||
EOF
|
||||
|
||||
FROM build as install
|
||||
RUN make -j1 INSTALLROOT="/rootfs" MANDIR=/usr/share/man bios efi64 install
|
||||
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
|
||||
FROM base as test
|
||||
COPY --from=install /rootfs /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/busybox . /
|
||||
RUN syslinux --version
|
||||
|
||||
FROM scratch as package
|
||||
COPY --from=install /rootfs /
|
12
packages/syslinux/fix-sysmacros.patch
Normal file
12
packages/syslinux/fix-sysmacros.patch
Normal file
|
@ -0,0 +1,12 @@
|
|||
diff --git a/extlinux/main.c b/extlinux/main.c
|
||||
index a7ebd49..69bb164 100644
|
||||
--- a/extlinux/main.c
|
||||
+++ b/extlinux/main.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/vfs.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
|
||||
#include "linuxioctl.h"
|
||||
|
109
packages/syslinux/gcc-10.patch
Normal file
109
packages/syslinux/gcc-10.patch
Normal file
|
@ -0,0 +1,109 @@
|
|||
From 951928f2cad5682c2844e6bd0f7201236c5d9b66 Mon Sep 17 00:00:00 2001
|
||||
From: Merlin Mathesius <mmathesi@redhat.com>
|
||||
Date: Wed, 13 May 2020 08:02:27 -0500
|
||||
Subject: [PATCH] Workaround multiple definition of symbol errors
|
||||
|
||||
---
|
||||
com32/cmenu/Makefile | 2 +-
|
||||
com32/elflink/ldlinux/Makefile | 2 +-
|
||||
com32/gpllib/Makefile | 2 +-
|
||||
com32/hdt/Makefile | 2 +-
|
||||
core/Makefile | 2 +-
|
||||
dos/Makefile | 2 +-
|
||||
efi/Makefile | 2 +-
|
||||
7 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
|
||||
index b81b68ed..2ae989c4 100644
|
||||
--- a/com32/cmenu/Makefile
|
||||
+++ b/com32/cmenu/Makefile
|
||||
@@ -49,7 +49,7 @@ makeoutputdirs:
|
||||
@mkdir -p $(OBJ)/libmenu
|
||||
|
||||
libmenu/libmenu.elf: $(LIBMENU)
|
||||
- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) \
|
||||
+ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) \
|
||||
-o $@ $^
|
||||
|
||||
tidy dist:
|
||||
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
|
||||
index 87c0d362..2be2a01a 100644
|
||||
--- a/com32/elflink/ldlinux/Makefile
|
||||
+++ b/com32/elflink/ldlinux/Makefile
|
||||
@@ -33,7 +33,7 @@ endif
|
||||
all: $(BTARGET) ldlinux_lnx.a
|
||||
|
||||
ldlinux.elf : $(OBJS)
|
||||
- $(LD) $(LDFLAGS) -soname $(SONAME) -o $@ $^ $(LIBS)
|
||||
+ $(LD) $(LDFLAGS) -z muldefs -soname $(SONAME) -o $@ $^ $(LIBS)
|
||||
|
||||
LNXCFLAGS += -D__export='__attribute__((visibility("default")))'
|
||||
LNXLIBOBJS = get_key.lo
|
||||
diff --git a/com32/gpllib/Makefile b/com32/gpllib/Makefile
|
||||
index 1fec9145..2d764d0b 100644
|
||||
--- a/com32/gpllib/Makefile
|
||||
+++ b/com32/gpllib/Makefile
|
||||
@@ -24,7 +24,7 @@ makeoutputdirs:
|
||||
$(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b))
|
||||
|
||||
libgpl.elf : $(LIBOBJS)
|
||||
- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
|
||||
+ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
|
||||
|
||||
tidy dist clean:
|
||||
find . \( -name \*.o -o -name .\*.d -o -name \*.tmp \) -print0 | \
|
||||
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
|
||||
index 61736d05..1d947857 100644
|
||||
--- a/com32/hdt/Makefile
|
||||
+++ b/com32/hdt/Makefile
|
||||
@@ -52,7 +52,7 @@ QEMU ?= qemu-kvm
|
||||
all: $(MODULES) $(TESTFILES)
|
||||
|
||||
hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
|
||||
- $(LD) $(LDFLAGS) -o $@ $^
|
||||
+ $(LD) $(LDFLAGS) -z muldefs -o $@ $^
|
||||
|
||||
memtest:
|
||||
-[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
|
||||
diff --git a/core/Makefile b/core/Makefile
|
||||
index 46cb037c..f0cfcbe9 100644
|
||||
--- a/core/Makefile
|
||||
+++ b/core/Makefile
|
||||
@@ -156,7 +156,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld
|
||||
NASM_ELF = elf
|
||||
|
||||
%.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS)
|
||||
- $(LD) $(LDFLAGS) -pie -Bsymbolic \
|
||||
+ $(LD) $(LDFLAGS) -z muldefs -pie -Bsymbolic \
|
||||
-T $(LDSCRIPT) \
|
||||
--unresolved-symbols=report-all \
|
||||
-E --hash-style=gnu -M -o $@ $< \
|
||||
diff --git a/dos/Makefile b/dos/Makefile
|
||||
index 4c930d19..5d1c72ca 100644
|
||||
--- a/dos/Makefile
|
||||
+++ b/dos/Makefile
|
||||
@@ -19,7 +19,7 @@ include $(MAKEDIR)/embedded.mk
|
||||
CFLAGS += -D__MSDOS__ -mregparm=3 -DREGPARM=3
|
||||
# CFLAGS += -DDEBUG
|
||||
|
||||
-LDFLAGS = -T $(SRC)/dosexe.ld
|
||||
+LDFLAGS = -T $(SRC)/dosexe.ld -z muldefs
|
||||
OPTFLAGS = -g
|
||||
INCLUDES = -include code16.h -nostdinc -iwithprefix include \
|
||||
-I$(SRC) -I$(SRC)/.. -I$(SRC)/../libfat \
|
||||
diff --git a/efi/Makefile b/efi/Makefile
|
||||
index bbf23f24..3dd922d5 100644
|
||||
--- a/efi/Makefile
|
||||
+++ b/efi/Makefile
|
||||
@@ -69,7 +69,7 @@ $(OBJS): | $(OBJ)/$(ARCH)
|
||||
BTARGET = syslinux.efi
|
||||
|
||||
syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
|
||||
- $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
|
||||
+ $(LD) $(LDFLAGS) -z muldefs --strip-debug -o $@ $^ -lgnuefi -lefi
|
||||
|
||||
# We need to rename the .hash section because the EFI firmware
|
||||
# linker really doesn't like it.
|
||||
--
|
||||
2.25.1
|
||||
|
36
packages/syslinux/prevent-pow-optimization.patch
Normal file
36
packages/syslinux/prevent-pow-optimization.patch
Normal file
|
@ -0,0 +1,36 @@
|
|||
From: Lukas Schwaighofer <lukas@schwaighofer.name>
|
||||
Date: Tue, 26 Feb 2019 23:13:58 +0100
|
||||
Subject: Prevent optimizing the pow() function
|
||||
|
||||
With the current GCC 8.2.0 from Debian, a section of code calling pow() in
|
||||
zzjson_parse.c is turned into a sequence calling exp(). Since no exp()
|
||||
implementation is available in syslinux those optimizations need to be
|
||||
disabled.
|
||||
---
|
||||
com32/gpllib/zzjson/zzjson_parse.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/com32/gpllib/zzjson/zzjson_parse.c b/com32/gpllib/zzjson/zzjson_parse.c
|
||||
index ecb6f61..e66a9d8 100644
|
||||
--- a/com32/gpllib/zzjson/zzjson_parse.c
|
||||
+++ b/com32/gpllib/zzjson/zzjson_parse.c
|
||||
@@ -138,6 +138,10 @@ static ZZJSON *parse_string2(ZZJSON_CONFIG *config) {
|
||||
return zzjson;
|
||||
}
|
||||
|
||||
+static double __attribute__((optimize("O0"))) pow_noopt(double x, double y) {
|
||||
+ return pow(x, y);
|
||||
+}
|
||||
+
|
||||
static ZZJSON *parse_number(ZZJSON_CONFIG *config) {
|
||||
ZZJSON *zzjson;
|
||||
unsigned long long ival = 0, expo = 0;
|
||||
@@ -213,7 +217,7 @@ skipexpo:
|
||||
if (dbl) {
|
||||
dval = sign * (long long) ival;
|
||||
dval += sign * frac;
|
||||
- dval *= pow(10.0, (double) signexpo * expo);
|
||||
+ dval *= pow_noopt(10.0, (double) signexpo * expo);
|
||||
}
|
||||
|
||||
zzjson = config->calloc(1, sizeof(ZZJSON));
|
53
packages/util-linux/Containerfile
Normal file
53
packages/util-linux/Containerfile
Normal file
|
@ -0,0 +1,53 @@
|
|||
FROM scratch as base
|
||||
ENV VERSION=2.39.3
|
||||
ENV SRC_HASH=d3315ff701890f4fa1dd38ea387767fcb9e1aaeb763eb904677c03d2a7a5bdc1
|
||||
ENV SRC_FILE=util-linux-${VERSION}.tar.gz
|
||||
ENV SRC_SITE=https://codeload.github.com/util-linux/util-linux/legacy.tar.gz/v${VERSION}
|
||||
|
||||
FROM base as fetch
|
||||
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE}
|
||||
|
||||
FROM fetch as build
|
||||
COPY --from=stagex/busybox . /
|
||||
COPY --from=stagex/musl . /
|
||||
COPY --from=stagex/gcc . /
|
||||
COPY --from=stagex/binutils . /
|
||||
COPY --from=stagex/perl . /
|
||||
COPY --from=stagex/pkgconf . /
|
||||
COPY --from=stagex/autoconf . /
|
||||
COPY --from=stagex/automake . /
|
||||
COPY --from=stagex/gettext . /
|
||||
COPY --from=stagex/bison . /
|
||||
COPY --from=stagex/libtool . /
|
||||
COPY --from=stagex/linux-headers . /
|
||||
COPY --from=stagex/m4 . /
|
||||
COPY --from=stagex/make . /
|
||||
RUN mkdir util-linux
|
||||
RUN tar -xvf $SRC_FILE --strip-components=1 -C util-linux
|
||||
WORKDIR util-linux
|
||||
RUN --network=none <<-EOF
|
||||
set -eux
|
||||
./autogen.sh
|
||||
./configure \
|
||||
--build=x86_64-unknown-linux-musl \
|
||||
--host=x86_64-unknown-linux-musl \
|
||||
--prefix=/usr \
|
||||
--disable-nls \
|
||||
--with-vendordir=/usr/lib \
|
||||
--enable-fs-paths-extra=/usr/sbin \
|
||||
--disable-silent-rules \
|
||||
--disable-gtk-doc \
|
||||
--enable-newgrp
|
||||
make
|
||||
EOF
|
||||
|
||||
FROM build as install
|
||||
RUN <<-EOF
|
||||
printf "root:x:0:root\ntty:x:5:" >> /etc/group
|
||||
printf "root:x:0:0:root:/root:/bin/sh" >> /etc/passwd
|
||||
make DESTDIR=/rootfs install
|
||||
EOF
|
||||
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
||||
|
||||
FROM scratch as package
|
||||
COPY --from=install /rootfs /
|
|
@ -882,6 +882,20 @@ out/sxctl/index.json: \
|
|||
out/go/index.json
|
||||
$(call build,sxctl)
|
||||
|
||||
.PHONY: syslinux
|
||||
syslinux: out/syslinux/index.json
|
||||
out/syslinux/index.json: \
|
||||
packages/syslinux/Containerfile \
|
||||
out/binutils/index.json \
|
||||
out/busybox/index.json \
|
||||
out/gcc/index.json \
|
||||
out/linux-headers/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json \
|
||||
out/perl/index.json \
|
||||
out/util-linux/index.json
|
||||
$(call build,syslinux)
|
||||
|
||||
.PHONY: tar
|
||||
tar: out/tar/index.json
|
||||
out/tar/index.json: \
|
||||
|
@ -923,6 +937,26 @@ out/tofu/index.json: \
|
|||
out/go/index.json
|
||||
$(call build,tofu)
|
||||
|
||||
.PHONY: util-linux
|
||||
util-linux: out/util-linux/index.json
|
||||
out/util-linux/index.json: \
|
||||
packages/util-linux/Containerfile \
|
||||
out/autoconf/index.json \
|
||||
out/automake/index.json \
|
||||
out/binutils/index.json \
|
||||
out/bison/index.json \
|
||||
out/busybox/index.json \
|
||||
out/gcc/index.json \
|
||||
out/gettext/index.json \
|
||||
out/libtool/index.json \
|
||||
out/linux-headers/index.json \
|
||||
out/m4/index.json \
|
||||
out/make/index.json \
|
||||
out/musl/index.json \
|
||||
out/perl/index.json \
|
||||
out/pkgconf/index.json
|
||||
$(call build,util-linux)
|
||||
|
||||
.PHONY: xorriso
|
||||
xorriso: out/xorriso/index.json
|
||||
out/xorriso/index.json: \
|
||||
|
|
Loading…
Reference in a new issue