Sync from SUSE:SLFO:Main syslinux revision e783fb092298de1c0a4d005229872b58

This commit is contained in:
Adrian Schröter 2024-05-04 00:58:59 +02:00
commit 6e13d42b75
33 changed files with 3681 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

25
README.gfxboot Normal file
View File

@ -0,0 +1,25 @@
gfxboot is now loaded via a COM32 module. If you used a line like
gfxboot bootlogo
before in isolinux.cfg or syslinux.cfg, change this to
ui gfxboot bootlogo
and add /usr/share/syslinux/gfxboot.c32 to your boot directory (the one
where the config file is).
You can also use
ui gfxboot bootlogo message
and remove the
display message
line. The 'message' file will be shown when you leave the gfxboot module (or
it couldn't be started).
This also means that gfxboot now works with other syslinux variants like
pxelinux or extlinux.

12
baselibs.conf Normal file
View File

@ -0,0 +1,12 @@
arch x86_64 targets aarch64:64bit ppc64le:64bit s390x:64bit
targetname <name>-x86_64
arch x86_64 package syslinux
conflicts "syslinux"
+.*
-/usr/bin/syslinux
-/usr/bin/extlinux
-/usr/bin/gethostip
-/usr/bin/isohybrid
-/usr/bin/memdiskfind

69
isolinux-config Normal file
View File

@ -0,0 +1,69 @@
#! /usr/bin/perl
#
# Patch new base dir into isolinux.
#
# Makes some assumptions about memory layout in isolinux.
#
use Getopt::Long;
sub help;
$opt_base = undef;
$opt_help = undef;
GetOptions(
'help' => \$opt_help,
'base=s' => \$opt_base,
);
$file = shift;
help if $file eq '' || $opt_help;
open F, $file or die "$file: $!\n";
sysread F, $file_buf, -s($file);
close F;
if((length $file_buf > (8 << 10)) && ($file_buf =~ m#(/boot(/[\x20-\xff]*)\x00*)\x00isolinux.cfg\x00#s)) {
$format = 1;
}
elsif((length $file_buf > (8 << 10)) && ($file_buf =~ m#(/boot(/[\x20-\xff]*)\x00*)\x00/boot/syslinux\x00#s)) {
$format = 2;
}
die "$file: is not isolinux\n" unless $format;
$start = length $`;
$base_buf = $1;
$old_base = $2;
if(defined $opt_base) {
($base = $opt_base) =~ s#^/*##;
$base = "/boot/$base";
die "$opt_base: file name too long\n" if length($base) > length($base_buf);
$base_buf = $base . "\x00" x (length($base_buf) - length($base));
substr($file_buf, $start, length($base_buf)) = $base_buf;
open F, ">$file" or die "$file: $!\n";
syswrite F, $file_buf;
close F;
($old_base = $base) =~ s#^/boot##;
}
print "base=$old_base\n";
sub help
{
die
"usage: isolinux-config [options] isolinux_binary\n" .
"Configure isolinux.\n" .
"Options:\n" .
" --base dir\tset isolinux base directory to dir\n" .
" --help\tthis message\n";
}

View File

@ -0,0 +1,13 @@
diff --git a/mbr/Makefile b/mbr/Makefile
index be2bded7..59e06915 100644
--- a/mbr/Makefile
+++ b/mbr/Makefile
@@ -36,7 +36,7 @@
$(LD) $(LDFLAGS) -T mbr.ld -e _start -o $@ $<
%.bin: %.elf checksize.pl
- $(OBJCOPY) -O binary $< $@
+ $(OBJCOPY) -O binary --remove-section .note.gnu.property $< $@
$(PERL) checksize.pl $@
$(CHMOD) -x $@

11
syslinux-4.04-align.diff Normal file
View File

@ -0,0 +1,11 @@
--- core/syslinux.ld
+++ core/syslinux.ld
@@ -263,7 +263,7 @@
__text_end = .;
}
- . = ALIGN(16);
+ . = ALIGN(32);
__rodata_vma = .;
__rodata_lma = __rodata_vma + __text_lma - __text_vma;

View File

@ -0,0 +1,36 @@
commit 0a0e0e41cad93cd16c323cf16f40264a21eedd6c
Author: H. Peter Anvin <hpa@zytor.com>
Date: Thu Jul 19 07:29:55 2012 -0700
Correct initialization of the cache doubly-linked list
The initialization of the cache doubly-linked list had
head->next->prev instead of head->prev->next; this entry is supposed
to initialize the ->next entry of the last entry in the list (which
points back to the head node.)
For clarity, consistently use "head" to refer to the head node; the
mixing of "head" and "dev->cache_head" needlessly obfuscated the code.
The wild pointer reference caused crashes on some systems.
Reported-by: Jan Safrata <jsafrata@centrum.cz>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/core/fs/cache.c b/core/fs/cache.c
index 0d7891b..3b21fc2 100644
--- a/core/fs/cache.c
+++ b/core/fs/cache.c
@@ -37,10 +37,10 @@ void cache_init(struct device *dev, int block_size_shift)
dev->cache_head = head = (struct cache *)
(data + (dev->cache_entries << block_size_shift));
- cache = dev->cache_head + 1; /* First cache descriptor */
+ cache = head + 1; /* First cache descriptor */
head->prev = &cache[dev->cache_entries-1];
- head->next->prev = dev->cache_head;
+ head->prev->next = head;
head->block = -1;
head->data = NULL;

45
syslinux-4.04-cwd.diff Normal file
View File

@ -0,0 +1,45 @@
diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index 9a39e79..35d180a 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -102,6 +102,8 @@ typedef struct __attribute__ ((packed)) {
// 0: GFX_CB_MENU_INIT accepts 32 bit addresses
// 1: knows about xmem_start, xmem_end
uint16_t reserved_1; // 62:
+ uint32_t gfxboot_cwd; // 64: if set, points to current gfxboot working directory relative
+ // to syslinux working directory
} gfx_config_t;
@@ -181,6 +183,7 @@ int main(int argc, char **argv)
{
int menu_index;
const union syslinux_derivative_info *sdi;
+ char working_dir[256];
openconsole(&dev_stdcon_r, &dev_stdcon_w);
@@ -224,6 +227,10 @@ int main(int argc, char **argv)
return 0;
}
+ if(getcwd(working_dir, sizeof working_dir)) {
+ gfx_config.gfxboot_cwd = (uint32_t) working_dir;
+ }
+
if(gfx_init(argv[1])) {
printf("Error setting up gfxboot\n");
if(argc > 2) show_message(argv[2]);
@@ -806,6 +813,12 @@ void boot(int index)
int i, label_len;
unsigned ipapp;
const struct syslinux_ipappend_strings *ipappend;
+ char *gfxboot_cwd = (char *) gfx_config.gfxboot_cwd;
+
+ if(gfxboot_cwd) {
+ chdir(gfxboot_cwd);
+ gfx_config.gfxboot_cwd = 0;
+ }
for(menu_ptr = menu; menu_ptr; menu_ptr = menu_ptr->next, index--) {
if(!index) break;

88
syslinux-4.04-gcc10.diff Normal file
View File

@ -0,0 +1,88 @@
--- com32/MCONFIG 2011-04-18 23:24:17.000000000 +0200
+++ com32/MCONFIG 2020-03-18 17:05:57.507347671 +0100
@@ -18,6 +18,7 @@
include $(topdir)/MCONFIG
GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-fcommon,)
GCCOPT += $(call gcc_ok,-m32,)
GCCOPT += $(call gcc_ok,-fno-stack-protector,)
GCCOPT += $(call gcc_ok,-fwrapv,)
--- com32/lib/MCONFIG 2011-04-18 23:24:17.000000000 +0200
+++ com32/lib/MCONFIG 2020-03-18 17:07:39.960337684 +0100
@@ -3,6 +3,7 @@
include $(topdir)/MCONFIG
GCCOPT := $(call gcc_ok,-std=gnu99,)
+GCCOPT += $(call gcc_ok,-fcommon,)
GCCOPT += $(call gcc_ok,-m32,)
GCCOPT += $(call gcc_ok,-fno-stack-protector,)
GCCOPT += $(call gcc_ok,-fwrapv,)
--- dos/errno.h 2011-04-18 23:24:17.000000000 +0200
+++ dos/errno.h 2020-03-18 17:12:17.359044057 +0100
@@ -36,7 +36,7 @@
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE 34 /* Math result not representable */
-int errno;
+int errno __attribute__ ((common));
void perror(const char *);
#endif /* ERRNO_H */
--- gpxe/src/core/exec.c 2011-04-18 23:24:17.000000000 +0200
+++ gpxe/src/core/exec.c 2020-03-18 16:56:52.257888015 +0100
@@ -38,8 +38,8 @@
*/
/* Avoid dragging in getopt.o unless a command really uses it */
-int optind;
-int nextchar;
+extern int optind;
+extern int nextchar;
/**
* Execute command
--- gpxe/src/include/compiler.h 2011-04-18 23:24:17.000000000 +0200
+++ gpxe/src/include/compiler.h 2020-03-18 16:48:56.193236495 +0100
@@ -64,7 +64,7 @@
.comm _sym, 0
#else /* ASSEMBLY */
#define PROVIDE_SYMBOL( _sym ) \
- char _sym[0]
+ char _sym[0] __attribute__ ((common))
#endif /* ASSEMBLY */
/** Require a symbol within this object file
--- dos/string.h 2020-03-18 17:25:50.019155261 +0100
+++ dos/string.h 2020-03-19 15:10:36.310787373 +0100
@@ -5,12 +5,13 @@
#ifndef _STRING_H
#define _STRING_H
+#include <stdlib.h>
+
/* Standard routines */
#define memcpy(a,b,c) __builtin_memcpy(a,b,c)
#define memmove(a,b,c) __builtin_memmove(a,b,c)
#define memset(a,b,c) __builtin_memset(a,b,c)
#define strcpy(a,b) __builtin_strcpy(a,b)
-#define strlen(a) __builtin_strlen(a)
/* This only returns true or false */
static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
@@ -21,6 +22,15 @@
return rv;
}
+static inline size_t strlen(const char *s)
+{
+ size_t len = 0;
+
+ while(*s++) len++;
+
+ return len;
+}
+
extern char *strchr(const char *s, int c);
#endif /* _STRING_H */

27
syslinux-4.04-gcc47.diff Normal file
View File

@ -0,0 +1,27 @@
--- com32/lib/sys/entry.S
+++ com32/lib/sys/entry.S
@@ -92,8 +92,8 @@
pushl %eax # Save argc
/* Look for library initialization functions */
- leal __ctors_start@GOTOFF(%ebx),%esi
- leal __ctors_end@GOTOFF(%ebx),%edi
+ leal __init_array_start@GOTOFF(%ebx),%esi
+ leal __init_array_end@GOTOFF(%ebx),%edi
6:
cmpl %edi,%esi
jae 7f
--- com32/lib/sys/exit.S
+++ com32/lib/sys/exit.S
@@ -17,9 +17,9 @@
#endif
/* Run any destructors */
- movl $__dtors_start, %esi
+ movl $__fini_array_start, %esi
2:
- cmpl $__dtors_end, %esi
+ cmpl $__fini_array_end, %esi
jae 1f
call *(%esi)
addl $4,%esi

View File

@ -0,0 +1,38 @@
From 73cd9bf26066cad0d4a483e31e1d89802a7ca1f9 Mon Sep 17 00:00:00 2001
From: Gene Cumm <gene.cumm@gmail.com>
Date: Wed, 11 May 2011 16:03:30 +0000
Subject: extlinux/main.c: Fix geometry handling
1) ioctl HDIO_GETGEO expects a pointer to a struct hd_geometry
2) struct stat's st_dev is the parent file used; st_rdev is what we want
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
---
(limited to 'extlinux/main.c')
diff --git a/extlinux/main.c b/extlinux/main.c
index e5212a9..6aa6202 100755
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -112,7 +112,7 @@ static int sysfs_get_offset(int devfd, unsigned long *start)
if ((size_t)snprintf(sysfs_name, sizeof sysfs_name,
"/sys/dev/block/%u:%u/start",
- major(st.st_dev), minor(st.st_dev))
+ major(st.st_rdev), minor(st.st_rdev))
>= sizeof sysfs_name)
return -1;
@@ -153,7 +153,7 @@ int get_geometry(int devfd, uint64_t totalbytes, struct hd_geometry *geo)
memset(geo, 0, sizeof *geo);
- if (!ioctl(devfd, HDIO_GETGEO, &geo)) {
+ if (!ioctl(devfd, HDIO_GETGEO, geo)) {
goto ok;
} else if (!ioctl(devfd, FDGETPRM, &fd_str)) {
geo->heads = fd_str.head;
--
cgit v0.9.2

View File

@ -0,0 +1,38 @@
diff --git a/core/fs/iso9660/iso9660.c b/core/fs/iso9660/iso9660.c
index 3cd3ac4..9bbc299 100644
--- a/core/fs/iso9660/iso9660.c
+++ b/core/fs/iso9660/iso9660.c
@@ -228,14 +228,25 @@ static int iso_readdir(struct file *file, struct dirent *dirent)
/* Load the config file, return 1 if failed, or 0 */
static int iso_load_config(void)
{
- static const char *search_directories[] = {
- "/boot/isolinux",
- "/isolinux",
- "/boot/syslinux",
- "/syslinux",
- "/",
- NULL
- };
+ /*
+ * Put search_directories[] to different section so it
+ * won't be compressed (and we can patch it later).
+ */
+ __asm__(
+ ".section .data16\n"
+ ".s1: .ascii \"/boot\"\n"
+ ".s2: .string \"/isolinux\"\n"
+ ".fill 64, 1, 0\n"
+ ".s3: .ascii \"/boot\"\n"
+ ".s4: .string \"/syslinux\"\n"
+ ".s5: .string \"/\"\n"
+ ".align 4\n"
+ "search_directories:\n"
+ ".long .s1, .s2, .s3, .s4, .s5, 0\n"
+ ".text\n"
+ );
+ extern const char *search_directories[];
+
static const char *filenames[] = {
"isolinux.cfg",
"syslinux.cfg",

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index 7638bc0..09f4520 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -1028,7 +1028,9 @@ main(int argc, char *argv[])
errx(1, "%s: invalid efi catalogue", argv[0]);
}
} else {
- errx(1, "%s: unable to find efi image", argv[0]);
+ fprintf(stderr, "%s: warning: unable to find efi image\n", argv[0]);
+ mode &= ~EFI;
+ part_efi = 0;
}
}

View File

@ -0,0 +1,27 @@
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
index 09f4520..954b5ed 100644
--- a/utils/isohybrid.c
+++ b/utils/isohybrid.c
@@ -653,12 +653,10 @@ initialise_mbr(uint8_t *mbr)
continue;
}
- if (i == 1)
- mbr[0] = 0x80;
-
if (i == part_data)
{
chs = ofs2chs(offset);
+ mbr[0] = 0x80;
mbr[1] = chs >> 8;
mbr[2] = chs >> 16;
mbr[3] = chs >> 24;
@@ -945,7 +943,7 @@ main(int argc, char *argv[])
}
if (!(mode & (MODE_MBR | MODE_GPT))) {
- mode |= (mode & EFI) ? MODE_GPT : MODE_MBR;
+ mode |= MODE_MBR;
}
if ((mode & EFI) && !offset) type = 0;

View File

@ -0,0 +1,11 @@
--- libinstaller/linuxioctl.h
+++ libinstaller/linuxioctl.h
@@ -19,7 +19,7 @@
#undef SECTOR_SIZE /* Defined in msdos_fs.h for no good reason */
#undef SECTOR_BITS
-#include <linux/ext2_fs.h> /* EXT2_IOC_* */
+#include <ext2fs/ext2_fs.h> /* EXT2_IOC_* */
#ifndef FAT_IOCTL_GET_ATTRIBUTES
# define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)

View File

@ -0,0 +1,20 @@
diff --git a/core/localboot.inc b/core/localboot.inc
index 1fe3102..30f34fc 100644
--- a/core/localboot.inc
+++ b/core/localboot.inc
@@ -33,6 +33,15 @@ local_boot:
cmp ax,-1
je .int18
+ cmp ax,-2
+ jne .load
+
+ mov al,[DriveNumber]
+ cmp al,80h
+ mov al,80h
+ jnz .load
+ inc ax
+.load:
; Load boot sector from the specified BIOS device and jump to it.
mov dl,al
xor dh,dh

11
syslinux-4.04-lzo.diff Normal file
View File

@ -0,0 +1,11 @@
--- lzo/Makefile
+++ lzo/Makefile
@@ -19,6 +19,8 @@
LIB = lzo.a
BINS = prepcore
+OPTFLAGS += -fno-strict-aliasing
+
all : $(BINS)
$(LIB) : $(LIBOBJS)

View File

@ -0,0 +1,39 @@
diff --git a/com32/mboot/mboot.c b/com32/mboot/mboot.c
index 35450e0..a124a21 100644
--- a/com32/mboot/mboot.c
+++ b/com32/mboot/mboot.c
@@ -97,9 +97,14 @@ static int get_modules(char **argv, struct module_data **mdp)
int arglen;
const char module_separator[] = "---";
+ char *bootif = 0;
for (argp = argv; *argp; argp++) {
if (!strcmp(*argp, module_separator))
module_count++;
+ /* BOOTIF= gets only appended for last group by syslinux, but it may be needed also
+ for other modules. So let's copy it. Esp. needed for XEN booting, Dom0 kernel needs it */
+ if (!strncmp(*argp, "BOOTIF=", 7))
+ bootif = *argp;
}
*mdp = mp = malloc(module_count * sizeof(struct module_data));
@@ -133,11 +138,19 @@ static int get_modules(char **argv, struct module_data **mdp)
mp->cmdline = strdup("");
} else {
char *p;
+ if (bootif) {
+ arglen += strlen(bootif) + 1;
+ }
+
mp->cmdline = p = malloc(arglen);
for (; *argp && strcmp(*argp, module_separator); argp++) {
p = stpcpy(p, *argp);
*p++ = ' ';
}
+ if (bootif) {
+ p = stpcpy(p, bootif);
+ *p++ = ' ';
+ }
*--p = '\0';
}
mp++;

View File

@ -0,0 +1,16 @@
--- a/utils/md5pass
+++ b/utils/md5pass
@@ -1,7 +1,6 @@
#!/usr/bin/perl
use bytes;
-use Crypt::PasswdMD5;
use MIME::Base64;
sub random_bytes($) {
@@ -31,4 +30,4 @@ unless (defined($salt)) {
$salt =~ tr/\+/./; # . not +
}
-print unix_md5_crypt($pass, $salt), "\n";
+print crypt($pass, "\$1\$$salt\$"), "\n";

View File

@ -0,0 +1,28 @@
Index: lzo/src/miniacc.h
===================================================================
--- lzo/src/miniacc.h.orig 2016-02-11 14:37:17.029802775 +0100
+++ lzo/src/miniacc.h 2016-02-11 14:38:38.086742103 +0100
@@ -4412,12 +4412,12 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mod
#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150)
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
#else
- ACCCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0)
+ ACCCHK_ASSERT((int)(1u << (8*SIZEOF_INT-1)) < 0)
#endif
ACCCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0)
#if 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
#else
- ACCCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0)
+ ACCCHK_ASSERT((long)(1ul << (8*SIZEOF_LONG-1)) < 0)
#endif
ACCCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0)
#if defined(acc_int16e_t)
@@ -4646,7 +4646,7 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mod
#elif 1 && (ACC_CC_LCC || ACC_CC_LCCWIN32) && !defined(ACCCHK_CFG_PEDANTIC)
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
#elif !defined(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
- ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
+ ACCCHK_ASSERT( (int)((unsigned int)((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
#endif
#if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0530) && (__BORLANDC__ < 0x0560))
# pragma option pop

97
syslinux-4.04-mtime.diff Normal file
View File

@ -0,0 +1,97 @@
diff --git a/core/Makefile b/core/Makefile
index 33ad7e9..49ba474 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -63,7 +63,7 @@ PREPCORE = ../lzo/prepcore
# official release. Otherwise, substitute a hex string that is pretty much
# guaranteed to be unique to be unique from build to build.
ifndef HEXDATE
-HEXDATE := $(shell $(PERL) ../now.pl $(SRCS))
+HEXDATE := $(shell $(PERL) ../now.pl $(ALLSRC))
endif
ifndef DATE
DATE := $(shell sh ../gen-id.sh $(VERSION) $(HEXDATE))
diff --git a/libinstaller/bin2c.pl b/libinstaller/bin2c.pl
index 07c11dd..2864488 100755
--- a/libinstaller/bin2c.pl
+++ b/libinstaller/bin2c.pl
@@ -71,8 +71,4 @@ if ($align != 0) {
printf "\n};\n\nconst unsigned int %s_len = %u;\n", $table_name, $total_len;
-@st = stat STDIN;
-
-printf "\nconst int %s_mtime = %d;\n", $table_name, $st[9];
-
exit 0;
diff --git a/libinstaller/syslinux.h b/libinstaller/syslinux.h
index 710d30e..963cafe 100644
--- a/libinstaller/syslinux.h
+++ b/libinstaller/syslinux.h
@@ -20,11 +20,9 @@
/* The standard boot sector and ldlinux image */
extern unsigned char syslinux_bootsect[];
extern const unsigned int syslinux_bootsect_len;
-extern const int syslinux_bootsect_mtime;
extern unsigned char syslinux_ldlinux[];
extern const unsigned int syslinux_ldlinux_len;
-extern const int syslinux_ldlinux_mtime;
#define boot_sector syslinux_bootsect
#define boot_sector_len syslinux_bootsect_len
@@ -33,7 +31,6 @@ extern const int syslinux_ldlinux_mtime;
extern unsigned char syslinux_mbr[];
extern const unsigned int syslinux_mbr_len;
-extern const int syslinux_mbr_mtime;
/* Sector size assumptions... */
#define SECTOR_SHIFT 9
diff --git a/now.pl b/now.pl
old mode 100644
new mode 100755
index a3b5a79..60c4fe0
--- a/now.pl
+++ b/now.pl
@@ -1,21 +1,22 @@
-#!/usr/bin/perl
-#
-# Print the time (possibly the mtime of a file) as a hexadecimal integer
-# If more than one file, print the mtime of the *newest* file.
-#
-
-undef $now;
-
-foreach $file ( @ARGV ) {
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,
- $ctime,$blksize,$blocks) = stat($file);
- if ( !defined($now) || $now < $mtime ) {
- $now = $mtime;
- }
-}
+#! /usr/bin/perl
+
+# Use checksum over all sources and source file names to create some unique id.
+
+use Digest::SHA;
+
+use strict;
-if ( !defined($now) ) {
- $now = time;
+my $digest = Digest::SHA->new(256);
+
+# print STDERR "now.pl: ", join(" ", @ARGV) , "\n";
+
+for (sort @ARGV) {
+ $digest->add($_);
+ $digest->addfile($_);
}
-printf "0x%08x\n", $now;
+my $val = substr($digest->hexdigest, 0, 8);
+
+# printf STDERR "now.pl: = 0x$val\n";
+
+print "0x$val\n";

View File

@ -0,0 +1,21 @@
diff --git a/com32/gfxboot/gfxboot.c b/com32/gfxboot/gfxboot.c
index 3749920..9a39e79 100644
--- a/com32/gfxboot/gfxboot.c
+++ b/com32/gfxboot/gfxboot.c
@@ -922,11 +922,15 @@ void boot_entry(menu_t *menu_ptr, char *arg)
*skip_nonspaces(s) = 0;
initrd_arg = s;
}
+ else if(initrd_arg) {
+ free(s0);
+ initrd_arg = s0 = strdup(initrd_arg);
+ }
if(initrd_arg) {
initrd = initramfs_init();
- while((t = strsep(&s, ","))) {
+ while((t = strsep(&initrd_arg, ","))) {
initrd_buf = load_one(t, &initrd_size);
if(!initrd_buf) {

View File

@ -0,0 +1,11 @@
--- utils/Makefile
+++ utils/Makefile
@@ -18,7 +18,7 @@
include $(topdir)/MCONFIG
CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
-LDFLAGS = -O2 -s
+LDFLAGS = -O2 -g
TARGETS = mkdiskimage isohybrid gethostip memdiskfind
TARGETS += isohybrid.pl # about to be obsoleted

68
syslinux-4.04-pie.diff Normal file
View File

@ -0,0 +1,68 @@
Index: syslinux-4.04/utils/Makefile
===================================================================
--- syslinux-4.04.orig/utils/Makefile
+++ syslinux-4.04/utils/Makefile
@@ -17,8 +17,8 @@
topdir = ..
include $(topdir)/MCONFIG
-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64
-LDFLAGS = -O2 -g
+CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -fPIC $(OPTFLAGS)
+LDFLAGS += -O2 -g -pie
TARGETS = mkdiskimage isohybrid gethostip memdiskfind
TARGETS += isohybrid.pl # about to be obsoleted
Index: syslinux-4.04/extlinux/Makefile
===================================================================
--- syslinux-4.04.orig/extlinux/Makefile
+++ syslinux-4.04/extlinux/Makefile
@@ -20,8 +20,8 @@ include $(topdir)/MCONFIG
OPTFLAGS = -g -Os
INCLUDES = -I. -I.. -I../libinstaller
CFLAGS = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \
- $(OPTFLAGS) $(INCLUDES)
-LDFLAGS = # -s
+ -fPIC $(OPTFLAGS) $(INCLUDES)
+LDFLAGS += -pie # -s
SRCS = main.c \
../libinstaller/syslxmod.c \
Index: syslinux-4.04/mtools/Makefile
===================================================================
--- syslinux-4.04.orig/mtools/Makefile
+++ syslinux-4.04/mtools/Makefile
@@ -3,8 +3,8 @@ include $(topdir)/MCONFIG
OPTFLAGS = -g -Os
INCLUDES = -I. -I.. -I../libfat -I../libinstaller
-CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
-LDFLAGS = -s
+CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 -fPIC $(OPTFLAGS) $(INCLUDES)
+LDFLAGS += -s -pie
SRCS = syslinux.c \
../libinstaller/fat.c \
Index: syslinux-4.04/core/Makefile
===================================================================
--- syslinux-4.04.orig/core/Makefile
+++ syslinux-4.04/core/Makefile
@@ -138,3 +138,4 @@ spotless: clean
# Include dependencies file
-include .*.d */.*.d */*/.*.d
+
Index: syslinux-4.04/linux/Makefile
===================================================================
--- syslinux-4.04.orig/linux/Makefile
+++ syslinux-4.04/linux/Makefile
@@ -20,7 +20,8 @@ include $(topdir)/MCONFIG
OPTFLAGS = -g -O0 -Dalloca=malloc
INCLUDES = -I. -I.. -I../libinstaller
CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES)
-LDFLAGS =
+CFLAGS += -fPIC
+LDFLAGS = -pie
SRCS = syslinux.c \
../libinstaller/syslxopt.c \

148
syslinux-4.04-python3.diff Normal file
View File

@ -0,0 +1,148 @@
--- com32/cmenu/Makefile
+++ com32/cmenu/Makefile
@@ -37,7 +37,7 @@
.PRECIOUS: %.c
%.c: %.menu adv_menu.tpl
- python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
+ python3 menugen.py --input=$< --output=$@ --template=adv_menu.tpl
all: menus
--- com32/cmenu/menugen.py
+++ com32/cmenu/menugen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys, re, getopt
@@ -100,27 +100,27 @@
if not self.entry["info"]:
self.entry["info"] = self.entry["data"]
if not self.menus:
- print "Error before line %d" % self.lineno
- print "REASON: menu must be declared before a menu item is declared"
+ print("Error before line %d" % self.lineno)
+ print("REASON: menu must be declared before a menu item is declared")
sys.exit(1)
self.menus[-1][1].append(self.entry)
self.init_entry()
def set_item(self,name,value):
- if not self.entry.has_key(name):
+ if not name in self.entry:
msg = ["Unknown attribute %s in line %d" % (name,self.lineno)]
msg.append("REASON: Attribute must be one of %s" % self.vattrs)
return "\n".join(msg)
- if name=="type" and not self.types.has_key(value):
+ if name=="type" and not value in self.types:
msg = [ "Unrecognized type %s in line %d" % (value,self.lineno)]
msg.append("REASON: Valid types are %s" % self.vtypes)
return "\n".join(msg)
if name=="shortcut":
- if (value <> "-1") and not re.match("^[A-Za-z0-9]$",value):
+ if (value != "-1") and not re.match("^[A-Za-z0-9]$",value):
msg = [ "Invalid shortcut char '%s' in line %d" % (value,self.lineno) ]
msg.append("REASON: Valid values are [A-Za-z0-9]")
return "\n".join(msg)
- elif value <> "-1": value = "'%s'" % value
+ elif value != "-1": value = "'%s'" % value
elif name in ["state","helpid","ipappend"]:
try:
value = int(value)
@@ -131,14 +131,14 @@
return ""
def set_menu(self,name,value):
- if not self.menu.has_key(name):
+ if not name in self.menu:
return "Error: Unknown keyword %s" % name
self.menu[name] = value
self.menu["_updated"] = 1
return ""
def set_system(self,name,value):
- if not self.system.has_key(name):
+ if not name in self.system:
return "Error: Unknown keyword %s" % name
if name == "skipcondn":
try: # is skipcondn a number?
@@ -169,7 +169,7 @@
if not err: return
# all errors so return item's error message
- print err
+ print(err)
sys.exit(1)
def print_entry(self,entry,fd):
@@ -211,9 +211,9 @@
missing = None
for x in self.reqd_templates:
- if not self.templates.has_key(x): missing = x
+ if not x in self.templates: missing = x
if missing:
- print "Template %s required but not defined in %s" % (missing,self.code_template_filename)
+ print("Template %s required but not defined in %s" % (missing,self.code_template_filename))
if filename == "-":
fd = sys.stdout
@@ -227,8 +227,8 @@
fd.write(self.templates["footer"])
fd.close()
if not self.foundmain:
- print "main menu not found"
- print self.menus
+ print("main menu not found")
+ print(self.menus)
sys.exit(1)
def input(self,filename):
@@ -259,26 +259,26 @@
# add property of current entry
pos = line.find("=") # find the first = in string
if pos < 0:
- print "Syntax error in line %d" % self.lineno
- print "REASON: non-section lines must be of the form ATTRIBUTE=VALUE"
+ print("Syntax error in line %d" % self.lineno)
+ print("REASON: non-section lines must be of the form ATTRIBUTE=VALUE")
sys.exit(1)
attr = line[:pos].strip().lower()
value = line[pos+1:].strip()
self.set(attr,value)
except:
- print "Error while parsing line %d: %s" % (self.lineno,line)
+ print("Error while parsing line %d: %s" % (self.lineno,line))
raise
fd.close()
self.add_item()
def usage():
- print sys.argv[0]," [options]"
- print "--input=<file> is the name of the .menu file declaring the menu structure"
- print "--output=<file> is the name of generated C source"
- print "--template=<file> is the name of template to be used"
- print
- print "input and output default to - (stdin and stdout respectively)"
- print "template defaults to adv_menu.tpl"
+ print(sys.argv[0]," [options]")
+ print("--input=<file> is the name of the .menu file declaring the menu structure")
+ print("--output=<file> is the name of generated C source")
+ print("--template=<file> is the name of template to be used")
+ print()
+ print("input and output default to - (stdin and stdout respectively)")
+ print("template defaults to adv_menu.tpl")
sys.exit(1)
def main():
@@ -287,7 +287,7 @@
ofile = "-"
opts,args = getopt.getopt(sys.argv[1:], "hi:o:t:",["input=","output=","template=","help"])
if args:
- print "Unknown options %s" % args
+ print("Unknown options %s" % args)
usage()
for o,a in opts:
if o in ["-i","--input"]:

View File

@ -0,0 +1,59 @@
https://github.com/distropatches/syslinux/tree/isohybrid
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date: Wed Feb 3 09:30:53 2021 +0100
isohybrid: Use SOURCE_DATE_EPOCH for deterministic results
without this patch, iso output contained 4 random bytes
at offset 440 for MBR ID
See https://reproducible-builds.org/ for why this matters.
isohybrid: Keep entropy for srand
without this patch, the seed would often be 0 or 0x70000000
The <<2 is added so that pid and ppid do not cancel out each other.
Index: syslinux-4.04/utils/isohybrid.pl
===================================================================
--- syslinux-4.04.orig/utils/isohybrid.pl
+++ syslinux-4.04/utils/isohybrid.pl
@@ -199,7 +199,7 @@ if (defined($opt{'id'})) {
seek(FILE, 440, SEEK_SET) or die "$0: $file: $!\n";
read(FILE, $id, 4);
if ($id eq "\x00\x00\x00\x00") {
- $id = pack("V", get_random());
+ $id = pack("V", $ENV{SOURCE_DATE_EPOCH} || get_random());
}
}
Index: syslinux-4.04/utils/isohybrid.c
===================================================================
--- syslinux-4.04.orig/utils/isohybrid.c
+++ syslinux-4.04/utils/isohybrid.c
@@ -927,6 +927,8 @@ main(int argc, char *argv[])
uint8_t *buf = NULL, *bufz = NULL;
int cylsize = 0, frac = 0;
unsigned padding = 0;
+ int randseed;
+ char *source_date_epoch;
size_t orig_gpt_size, free_space, gpt_size;
struct iso_primary_descriptor descriptor;
struct stat isostat;
@@ -956,7 +958,11 @@ main(int argc, char *argv[])
if(entry != part_efi && entry != part_mac) part_data = entry;
}
- srand(time(NULL) << (getppid() << getpid()));
+
+ if((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
+ (randseed = strtol(source_date_epoch, NULL, 10)) <= 0)
+ randseed = time(NULL) ^ (getppid()<<2) ^ getpid();
+ srand(randseed);
if (!(fp = fopen(argv[0], "r+"))) // #####
err(1, "could not open file `%s'", argv[0]);

View File

@ -0,0 +1,224 @@
commit be645d7a9848847388a662f6c0f7571d52ed7a05
Author: Philippe Coval <philippe.coval@open.eurogiciel.org>
Date: Wed Dec 17 16:46:29 2014 -0500
build: sort sources to build in a more deterministic way
It has been observed that binaries contents
are depending on the order of linked objects.
This order is caused by GNU make's wildcard function
and the position of sources on filesystem.
This change tries to prevent this kind of randomness.
Also consider building using -j1 flag
to make it even more reproductible.
Change-Id: Ie8eee7f336e6f1fa2863c4150d967afd15519f1d
Bug: http://bugzilla.syslinux.org/show_bug.cgi?id=57#related
Signed-off-by: Philippe Coval <philippe.coval at open.eurogiciel.org>
Index: syslinux-4.04/com32/cmenu/Makefile
===================================================================
--- syslinux-4.04.orig/com32/cmenu/Makefile
+++ syslinux-4.04/com32/cmenu/Makefile
@@ -28,7 +28,7 @@ CFLAGS += -I./libmenu
LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
-CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
+CMENUS = $(sort $(patsubst %.c,%.c32,$(wildcard *.c)))
IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
MENUS = $(CMENUS) $(IMENUS)
@@ -56,7 +56,7 @@ clean: tidy menuclean libclean
rm -f *.lss *.c32 *.com
menuclean:
- rm -f $(patsubst %.menu,%.c,$(wildcard *.menu))
+ rm -f $(patsubst %.menu,%.c,$(sort $(wildcard *.menu)))
spotless: clean libclean menuclean
rm -f *~ \#*
Index: syslinux-4.04/com32/rosh/Makefile
===================================================================
--- syslinux-4.04.orig/com32/rosh/Makefile
+++ syslinux-4.04/com32/rosh/Makefile
@@ -24,7 +24,7 @@ include MCONFIG
# official release. Otherwise, substitute a hex string that is pretty much
# guaranteed to be unique to be unique from build to build.
ifndef HEXDATE
-HEXDATE := $(shell $(PERL) $(topdir)/now.pl $(SRCS) $(wildcard *.h))
+HEXDATE := $(shell $(PERL) $(topdir)/now.pl $(SRCS) $(sort $(wildcard *.h)))
endif
ifndef DATE
DATE := $(shell sh $(topdir)/gen-id.sh $(VERSION) $(HEXDATE))
Index: syslinux-4.04/core/Makefile
===================================================================
--- syslinux-4.04.orig/core/Makefile
+++ syslinux-4.04/core/Makefile
@@ -37,10 +37,10 @@ BTARGET = kwdhash.gen \
isolinux.bin isolinux-debug.bin pxelinux.0
# All primary source files for the main syslinux files
-NASMSRC := $(wildcard *.asm)
-NASMHDR := $(wildcard *.inc)
-CSRC := $(wildcard *.c */*.c */*/*.c)
-SSRC := $(wildcard *.S */*.S */*/*.S)
+NASMSRC := $(sort $(wildcard *.asm))
+NASMHDR := $(sort $(wildcard *.inc))
+CSRC := $(sort $(wildcard *.c */*.c */*/*.c))
+SSRC := $(sort $(wildcard *.S */*.S */*/*.S))
CHDR := $(wildcard *.h)
OTHERSRC := keywords
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
Index: syslinux-4.04/gpxe/src/Makefile.housekeeping
===================================================================
--- syslinux-4.04.orig/gpxe/src/Makefile.housekeeping
+++ syslinux-4.04/gpxe/src/Makefile.housekeeping
@@ -246,9 +246,9 @@ endif
#
# BIN has the form bin[-[arch-]platform]
-ARCHS := $(patsubst arch/%,%,$(wildcard arch/*))
+ARCHS := $(patsubst arch/%,%,$(sort $(wildcard arch/*)))
PLATFORMS := $(patsubst config/defaults/%.h,%,\
- $(wildcard config/defaults/*.h))
+ $(sort $(wildcard config/defaults/*.h)))
archs :
@$(ECHO) $(ARCHS)
@@ -307,8 +307,8 @@ srcdirs :
# SRCS lists all .c or .S files found in any SRCDIR
#
-SRCS += $(wildcard $(patsubst %,%/*.c,$(SRCDIRS)))
-SRCS += $(wildcard $(patsubst %,%/*.S,$(SRCDIRS)))
+SRCS += $(sort $(wildcard $(patsubst %,%/*.c,$(SRCDIRS))))
+SRCS += $(sort $(wildcard $(patsubst %,%/*.S,$(SRCDIRS))))
srcs :
@$(ECHO) $(SRCS)
@@ -677,7 +677,7 @@ endef
$(BIN)/%.objs : $(BIN)/%.tmp
$(Q)$(ECHO) $(call objs_list,$<)
$(BIN)/%.sizes : $(BIN)/%.tmp
- $(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(wildcard $(BIN)/$(subst _,?,$(OBJ)).o)) | \
+ $(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(sort $(wildcard $(BIN)/$(subst _,?,$(OBJ)).o))) | \
sort -g
# Get dependency list for the specified target
@@ -807,7 +807,7 @@ $(BIN)/%.o : payload/%.img
$(Q)$(LD) -b binary -r -o $@ $< --undefined obj_payload \
--defsym obj_$*=0
-BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(wildcard payload/*.img))
+BOBJS += $(patsubst payload/%.img,$(BIN)/%.o,$(sort $(wildcard payload/*.img)))
# The "allXXXs" targets for each suffix
#
Index: syslinux-4.04/lzo/Makefile
===================================================================
--- syslinux-4.04.orig/lzo/Makefile
+++ syslinux-4.04/lzo/Makefile
@@ -15,7 +15,7 @@ include $(topdir)/MCONFIG.build
INCLUDES += -I./include
-LIBOBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
+LIBOBJS = $(sort $(patsubst %.c,%.o,$(wildcard src/*.c)))
LIB = lzo.a
BINS = prepcore
Index: syslinux-4.04/mtools/Makefile
===================================================================
--- syslinux-4.04.orig/mtools/Makefile
+++ syslinux-4.04/mtools/Makefile
@@ -13,7 +13,7 @@ SRCS = syslinux.c \
../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
OBJS = $(patsubst %.c,%.o,$(notdir $(SRCS)))
.SUFFIXES: .c .o .i .s .S
Index: syslinux-4.04/com32/gpllib/Makefile
===================================================================
--- syslinux-4.04.orig/com32/gpllib/Makefile
+++ syslinux-4.04/com32/gpllib/Makefile
@@ -9,7 +9,7 @@ include ../lib/MCONFIG
REQFLAGS += -I../gplinclude
GPLDIRS := . disk dmi vpd acpi
-LIBOBJS := $(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+LIBOBJS := $(sort $(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c))))
BINDIR = /usr/bin
LIBDIR = /usr/lib
Index: syslinux-4.04/com32/hdt/Makefile
===================================================================
--- syslinux-4.04.orig/com32/hdt/Makefile
+++ syslinux-4.04/com32/hdt/Makefile
@@ -25,7 +25,7 @@ CFLAGS += -I$(com32)/cmenu/libmenu
MODULES = hdt.c32
TESTFILES =
-OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
+OBJS = $(sort $(patsubst %.c,%.o,$(wildcard *.c)))
VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h)
CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h)
VERSION_C32 = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g')
Index: syslinux-4.04/com32/sysdump/Makefile
===================================================================
--- syslinux-4.04.orig/com32/sysdump/Makefile
+++ syslinux-4.04/com32/sysdump/Makefile
@@ -25,7 +25,7 @@ LNXLIBS = ../libutil/libutil_lnx.a
MODULES = sysdump.c32
TESTFILES =
-SRCS = $(wildcard *.c)
+SRCS = $(sort $(wildcard *.c))
OBJS = $(patsubst %.c,%.o,$(SRCS))
# The DATE is set on the make command line when building binaries for
Index: syslinux-4.04/memdisk/Makefile
===================================================================
--- syslinux-4.04.orig/memdisk/Makefile
+++ syslinux-4.04/memdisk/Makefile
@@ -23,7 +23,7 @@ NASMOPT = -O9999
NFLAGS = -dDATE='"$(DATE)"'
NINCLUDE =
-SRCS = $(wildcard *.asm *.c *.h)
+SRCS = $(sort $(wildcard *.asm *.c *.h))
# The DATE is set on the make command line when building binaries for
# official release. Otherwise, substitute a hex string that is pretty much
Index: syslinux-4.04/win32/Makefile
===================================================================
--- syslinux-4.04.orig/win32/Makefile
+++ syslinux-4.04/win32/Makefile
@@ -57,7 +57,7 @@ LIBSRC = ../libinstaller/fat.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
LIBOBJS = $(patsubst %.c,%.obj,$(notdir $(LIBSRC)))
LIB = syslinux.lib
Index: syslinux-4.04/win64/Makefile
===================================================================
--- syslinux-4.04.orig/win64/Makefile
+++ syslinux-4.04/win64/Makefile
@@ -47,7 +47,7 @@ LIBSRC = ../libinstaller/fat.c \
../libinstaller/bootsect_bin.c \
../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
- $(wildcard ../libfat/*.c)
+ $(sort $(wildcard ../libfat/*.c))
LIBOBJS = $(patsubst %.c,%.obj,$(notdir $(LIBSRC)))
LIB = syslinux.lib

View File

@ -0,0 +1,61 @@
diff --git a/core/ui.inc b/core/ui.inc
index 0a4bb56..97945c9 100644
--- a/core/ui.inc
+++ b/core/ui.inc
@@ -529,30 +529,36 @@ kernel_corrupt: mov si,err_notkernel
; which can be adjusted by the caller based on the corresponding
; master variables; on return they're updated.
;
-; This cheats. If we say "no timeout" we actually get a timeout of
-; 7.5 years.
-;
getchar_timeout:
call vgashowcursor
call reset_idle
.loop:
- push word [__jiffies]
+ push dword [__jiffies]
call pollchar
jnz .got_char
call do_idle
- pop ax
- cmp ax,[__jiffies] ; Has the timer advanced?
+ pop eax
+ sub eax,[__jiffies] ; Has the timer advanced?
je .loop
- dec dword [ThisKbdTo]
- jz .timeout
- dec dword [ThisTotalTo]
- jnz .loop
+ ; more than one tick may have passed, keep the diff in eax
+ neg eax
+
+ cmp dword [ThisKbdTo],0
+ jz .chk_total
+ sub [ThisKbdTo],eax
+ jbe .timeout
+
+.chk_total:
+ cmp dword [ThisTotalTo],0
+ jz .loop
+ sub [ThisTotalTo],eax
+ ja .loop
.timeout:
; Timeout!!!!
- pop cx ; Discard return address
+ pop ecx ; Discard return address
call vgahidecursor
mov si,Ontimeout ; Copy ontimeout command
mov di,command_line
@@ -561,7 +567,7 @@ getchar_timeout:
jmp command_done
.got_char:
- pop cx ; Discard
+ pop ecx ; Discard
call getchar
call vgahidecursor
ret

BIN
syslinux-4.04.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

1127
syslinux.changes Normal file

File diff suppressed because it is too large Load Diff

135
syslinux.spec Normal file
View File

@ -0,0 +1,135 @@
#
# spec file for package syslinux
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: syslinux
ExclusiveArch: %ix86 x86_64
BuildRequires: libext2fs-devel
BuildRequires: libpng-devel
BuildRequires: libuuid-devel
BuildRequires: nasm
BuildRequires: netpbm
BuildRequires: python3
BuildRequires: xz
# lots of assembler here that would need to be changed :(
#!BuildIgnore: gcc-PIE
URL: http://www.syslinux.org/wiki/index.php/The_Syslinux_Project
Suggests: mtools
Summary: Boot Loader for Linux
License: GPL-2.0-or-later
Group: System/Boot
Version: 4.04
Release: 0
Source: https://www.kernel.org/pub/linux/utils/boot/syslinux/%{name}-%{version}.tar.bz2
Source1: isolinux-config
Source2: README.gfxboot
Source3: baselibs.conf
Patch0: %{name}-%{version}-iso9660.diff
Patch1: %{name}-%{version}-cwd.diff
Patch2: %{name}-%{version}-noinitrd.diff
Patch3: %{name}-%{version}-mboot_bootif.diff
Patch5: %{name}-%{version}-md5pass.diff
Patch6: %{name}-%{version}-libext2fs.diff
Patch7: %{name}-%{version}-gcc47.diff
Patch8: %{name}-%{version}-isohybrid_efi.diff
Patch9: %{name}-%{version}-isohybrid_efi_optional.diff
Patch10: %{name}-%{version}-isohybrid_mbr.diff
Patch11: %{name}-%{version}-localboot.diff
Patch12: %{name}-%{version}-geometry.diff
Patch13: %{name}-%{version}-nostrip.diff
Patch14: %{name}-%{version}-timeout.diff
Patch15: %{name}-%{version}-cache_fix.diff
Patch16: %{name}-%{version}-mtime.diff
Patch17: %{name}-%{version}-miniacc.diff
Patch18: %{name}-%{version}-align.diff
# PATCH-FIX-UPSTREAM -- make package build reproducible
Patch19: syslinux-4.04-reproducible.patch
Patch20: %{name}-%{version}-python3.diff
Patch21: sysmacros.patch
Patch22: remove-note-gnu-section.patch
Patch23: %{name}-%{version}-lzo.diff
Patch24: %{name}-%{version}-gcc10.diff
Patch25: syslinux-4.04-reproducible-isohybrid.patch
Patch26: %{name}-%{version}-pie.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
SYSLINUX is a boot loader for the Linux operating system which operates
off an MS-DOS or Windows FAT file system. It is intended to simplify
first-time installation of Linux and for creation of rescue and other
special purpose boot disks.
Authors:
--------
H. Peter Anvin <hpa@zytor.com>
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p0
%patch7 -p0
%patch8 -p0
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p0
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17
%patch18
%patch19 -p1
%patch20 -p0
%patch21 -p1
%patch22 -p1
%patch23 -p0
%patch24 -p0
%patch25 -p1
%patch26 -p1
%build
cp %{SOURCE2} .
make spotless
make
%install
make install-all \
INSTALLROOT=%{buildroot} BINDIR=%{_bindir} SBINDIR=%{_bindir} \
LIBDIR=%{_datadir} INCDIR=%{_includedir} MANDIR=%{_mandir}
install -m 755 mtools/syslinux $RPM_BUILD_ROOT/%{_bindir}/syslinux-mtools
install -m 755 linux/syslinux $RPM_BUILD_ROOT/%{_bindir}/syslinux
install -m 755 %{SOURCE1} $RPM_BUILD_ROOT/%{_bindir}
rm -rf $RPM_BUILD_ROOT/%{_datadir}/syslinux/com32
rm -rf $RPM_BUILD_ROOT/boot
rm -rf $RPM_BUILD_ROOT/tftpboot
%files
%defattr(-,root,root)
%doc doc/*.txt
%doc README* NEWS
%doc %{_mandir}/man1/*
%{_bindir}/*
%{_datadir}/syslinux
%changelog

33
sysmacros.patch Normal file
View File

@ -0,0 +1,33 @@
From 1a74985b2a404639b08882c57f3147229605dfd5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 19 Apr 2016 06:50:31 -0400
Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev
These functions are defined in sys/sysmacros.h, so add the include to
main.c. This is already handled correctly in mountinfo.c. Otherwise
we get build failures like:
main.o: In function 'find_device_sysfs':
extlinux/main.c:1131: undefined reference to 'minor'
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
---
extlinux/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/extlinux/main.c b/extlinux/main.c
index a7ebd49a94..ebff7eae0e 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -38,6 +38,7 @@
#include <sysexits.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/vfs.h>
--
2.19.0