diff options
| author | Michael Forney <mforney@mforney.org> | 2017-03-02 19:19:53 -0800 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2017-03-02 19:21:41 -0800 |
| commit | 05a28a284a7a8fac805b47ad787df84a612b9e6c (patch) | |
| tree | 31e8c4ff158b4f7b2d50555960cb598f3fcad4fb /pkg | |
| parent | 3270dbaa984ffad41caa210c59f90611e5d38cc6 (diff) | |
Add syslinux 6.03
For now just use the pre-compiled binaries, but build our own static
extlinux.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/gen.rc | 1 | ||||
| -rw-r--r-- | pkg/syslinux/.gitignore | 3 | ||||
| -rw-r--r-- | pkg/syslinux/bin2c.c | 64 | ||||
| -rw-r--r-- | pkg/syslinux/gen.rc | 45 | ||||
| -rw-r--r-- | pkg/syslinux/rev | 1 | ||||
| -rw-r--r-- | pkg/syslinux/sha256 | 1 | ||||
| -rw-r--r-- | pkg/syslinux/url | 1 | ||||
| -rw-r--r-- | pkg/syslinux/uuid/uuid.h | 1 | ||||
| -rw-r--r-- | pkg/syslinux/version.awk | 15 |
9 files changed, 132 insertions, 0 deletions
@@ -70,6 +70,7 @@ subgen sshfs subgen st subgen strace subgen swc +subgen syslinux subgen terminus-font subgen the_silver_searcher subgen transmission diff --git a/pkg/syslinux/.gitignore b/pkg/syslinux/.gitignore new file mode 100644 index 00000000..3df33818 --- /dev/null +++ b/pkg/syslinux/.gitignore @@ -0,0 +1,3 @@ +/src +/syslinux-6.03.tar.xz +/tools.ninja diff --git a/pkg/syslinux/bin2c.c b/pkg/syslinux/bin2c.c new file mode 100644 index 00000000..7dd6f1ec --- /dev/null +++ b/pkg/syslinux/bin2c.c @@ -0,0 +1,64 @@ +#include <err.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <unistd.h> +#include <stdlib.h> + +void +usage(void) +{ + errx(2, "usage: bin2c tablename [align]"); +} + +int +main(int argc, char *argv[]) +{ + int fd; + char buf[4096], *s, *table_name; + ssize_t n; + size_t total = 0, pad, align = 0; + struct stat st; + + switch (argc) { + case 3: + align = strtoul(argv[2], &s, 10); + if (*s) + usage(); + case 2: + table_name = argv[1]; + break; + default: + usage(); + } + + if (fstat(0, &st) < 0) + err(1, "fstat 0"); + + printf("unsigned char %s[] = {", table_name); + + for (;;) { + n = read(0, buf, sizeof(buf)); + if (n < 0) + err(1, "read"); + if (n == 0) + break; + for (s = buf; s < buf + n; ++s) { + if (total++ % 8 == 0) + printf("\n\t"); + printf("0x%02hhx,", *s); + } + } + if (align) { + for (pad = (total + (align - 1)) / align * align - total; pad; --pad) { + if (total++ % 8 == 0) + printf("\n\t"); + printf("0x00,"); + } + } + + printf("\n};\n\nconst unsigned int %s_len = %zu;\n", table_name, total); + printf("\nconst int %s_mtime = %d;\n", table_name, st.st_mtime); + + return 0; +} diff --git a/pkg/syslinux/gen.rc b/pkg/syslinux/gen.rc new file mode 100644 index 00000000..becad305 --- /dev/null +++ b/pkg/syslinux/gen.rc @@ -0,0 +1,45 @@ +cflags\ + -I '$dir' \ + -I '$outdir' \ + -I '$srcdir'/libinstaller\ + -I '$srcdir'/com32/include/libinstaller +# NOTE: we should only have to include $srcdir/libinstaller, but BSD pax/tar +# transforms symlink targets as well as filenames, trashing the +# libinstaller/advconst.h symlink. + +build '$outdir'/version.h awk '$srcdir'/version '|' '$dir'/version.awk ; with\ + expr '-f $dir/version.awk -v fmt=''#define %s %s''' + +{ + toolchain host + set srcdir '$dir' + exe bin2c bin2c.c +} >tools.ninja ; subninja tools.ninja + +rule bin2c '$outdir/bin2c $args <$in >$out.tmp && mv $out.tmp $out' +fn bin2c { + bin=$1 + name=$2 + shift + build '$outdir'/$name.c bin2c '$srcdir'/$bin '|' '$outdir'/bin2c + with args $"* +} + +bin2c bios/core/ldlinux.bss syslinux_bootsect +bin2c bios/core/ldlinux.sys syslinux_ldlinux 512 +bin2c bios/com32/elflink/ldlinux/ldlinux.c32 syslinux_ldlinuxc32 + +exe bin/extlinux -d '$outdir'/version.h\ + extlinux/^(main.c mountinfo.c)\ + libinstaller/^(\ + syslxmod.c\ + syslxopt.c\ + syslxcom.c\ + setadv.c\ + advio.c\ + )\ + '$outdir'/syslinux_^(bootsect ldlinux ldlinuxc32)^.c + +file lib/syslinux/bios/mbr.bin '$srcdir'/bios/mbr/mbr.bin 644 + +fetch curl diff --git a/pkg/syslinux/rev b/pkg/syslinux/rev new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/pkg/syslinux/rev @@ -0,0 +1 @@ +1 diff --git a/pkg/syslinux/sha256 b/pkg/syslinux/sha256 new file mode 100644 index 00000000..56d3c185 --- /dev/null +++ b/pkg/syslinux/sha256 @@ -0,0 +1 @@ +26d3986d2bea109d5dc0e4f8c4822a459276cf021125e8c9f23c3cca5d8c850e syslinux-6.03.tar.xz diff --git a/pkg/syslinux/url b/pkg/syslinux/url new file mode 100644 index 00000000..d45d7971 --- /dev/null +++ b/pkg/syslinux/url @@ -0,0 +1 @@ +url = "https://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz" diff --git a/pkg/syslinux/uuid/uuid.h b/pkg/syslinux/uuid/uuid.h new file mode 100644 index 00000000..ee9c753a --- /dev/null +++ b/pkg/syslinux/uuid/uuid.h @@ -0,0 +1 @@ +typedef unsigned char uuid_t[16]; diff --git a/pkg/syslinux/version.awk b/pkg/syslinux/version.awk new file mode 100644 index 00000000..007470aa --- /dev/null +++ b/pkg/syslinux/version.awk @@ -0,0 +1,15 @@ +function def(var, val) { + printf fmt "\n", var, val +} + +{ + def("VERSION", $1) + def("VERSION_STR", "\"" $1 "\"") + + i = index($1, ".") + def("VERSION_MAJOR", int(substr($1, 1, i - 1))) + def("VERSION_MINOR", int(substr($1, i + 1))) + + def("YEAR", $2) + def("YEAR_STR", "\"" $2 "\"") +} |
