From 346d2278e23f1b9f02903506753263ad7226de58 Mon Sep 17 00:00:00 2001 From: Adam Goldman Date: Sun, 5 Mar 2017 17:24:22 -0500 Subject: [PATCH 01/20] pxe: Fix recognition of keeppxe option The preprocessor directive IS_PXELINUX is no longer valid. Submitted-by: Adam Goldman Move "keeppxe" processing from com32/elflink/ldlinux/kernel.c:new_linux_kernel() to com32/lib/syslinux/load_linux.c:bios_boot_linux() using strstr() (not find_argument in original patch). Should also be processed by firmware->boot_linux() if not yet done. Signed-off-by: Gene Cumm --- com32/elflink/ldlinux/kernel.c | 8 -------- com32/lib/syslinux/load_linux.c | 12 +++++++++++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/com32/elflink/ldlinux/kernel.c b/com32/elflink/ldlinux/kernel.c index f3ba37fa..942f97cc 100644 --- a/com32/elflink/ldlinux/kernel.c +++ b/com32/elflink/ldlinux/kernel.c @@ -48,14 +48,6 @@ int new_linux_kernel(char *okernel, char *ocmdline) sprintf(cmdline, "BOOT_IMAGE=%s %s", kernel_name, args); - /* "keeppxe" handling */ -#if IS_PXELINUX - extern char KeepPXE; - - if (strstr(cmdline, "keeppxe")) - KeepPXE |= 1; -#endif - if (strstr(cmdline, "quiet")) opt_quiet = true; diff --git a/com32/lib/syslinux/load_linux.c b/com32/lib/syslinux/load_linux.c index 26c39c1a..0edb7712 100644 --- a/com32/lib/syslinux/load_linux.c +++ b/com32/lib/syslinux/load_linux.c @@ -48,6 +48,7 @@ #include #include #include +#include #define BOOT_MAGIC 0xAA55 #define LINUX_MAGIC ('H' + ('d' << 8) + ('r' << 16) + ('S' << 24)) @@ -166,6 +167,7 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size, struct syslinux_memmap *amap = NULL; uint32_t memlimit = 0; uint16_t video_mode = 0; + uint16_t bootflags = 0; const char *arg; cmdline_size = strlen(cmdline) + 1; @@ -200,6 +202,14 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size, } } + if (syslinux_filesystem() == SYSLINUX_FS_PXELINUX && + strstr(cmdline, "keeppxe")) { + extern __weak char KeepPXE; + + KeepPXE |= 1; /* for pxelinux_scan_memory */ + bootflags = 3; /* for unload_pxe */ + } + /* Copy the header into private storage */ /* Use whdr to modify the actual kernel header */ memcpy(&hdr, kernel_buf, sizeof hdr); @@ -495,7 +505,7 @@ int bios_boot_linux(void *kernel_buf, size_t kernel_size, dprintf("*** vga=current, not calling syslinux_force_text_mode()...\n"); } - syslinux_shuffle_boot_rm(fraglist, mmap, 0, ®s); + syslinux_shuffle_boot_rm(fraglist, mmap, bootflags, ®s); dprintf("shuffle_boot_rm failed\n"); bail: From 48e94f4fa7b3c32cbd43b6e57c64bc933f76d059 Mon Sep 17 00:00:00 2001 From: Martin Str|mberg Date: Sat, 25 Mar 2017 08:15:04 -0400 Subject: [PATCH 02/20] mbr/isohdpfx.S: correct pointer for heads/sectors sectors is pushed first then heads but pointers were in reverse order. Signed-off-by: Gene Cumm --- mbr/isohdpfx.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S index 17e1efe1..a693ccb1 100644 --- a/mbr/isohdpfx.S +++ b/mbr/isohdpfx.S @@ -48,8 +48,8 @@ isolinux_start_hybrid = 0x7c00+64+4 stack = 0x7c00 partoffset = (stack-8) driveno = (stack-14) -heads = (stack-16) -sectors = (stack-18) +sectors = (stack-16) +heads = (stack-18) ebios_flag = (stack-20) secpercyl = (stack-24) From 2b351509e19072dc74b084c6cda38431b3028fb5 Mon Sep 17 00:00:00 2001 From: Martin Str|mberg Date: Tue, 28 Mar 2017 10:37:04 -0400 Subject: [PATCH 03/20] Revert "mbr/isohdpfx.S: correct pointer for heads/sectors" This reverts commit 48e94f4fa7b3c32cbd43b6e57c64bc933f76d059. Signed-off-by: Gene Cumm --- mbr/isohdpfx.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S index a693ccb1..17e1efe1 100644 --- a/mbr/isohdpfx.S +++ b/mbr/isohdpfx.S @@ -48,8 +48,8 @@ isolinux_start_hybrid = 0x7c00+64+4 stack = 0x7c00 partoffset = (stack-8) driveno = (stack-14) -sectors = (stack-16) -heads = (stack-18) +heads = (stack-16) +sectors = (stack-18) ebios_flag = (stack-20) secpercyl = (stack-24) From 32c09027423f61c305e2423e52f5f69ecad8e2c0 Mon Sep 17 00:00:00 2001 From: Martin Str|mberg Date: Sun, 26 Mar 2017 07:32:11 -0400 Subject: [PATCH 04/20] mbr/isohdpfx.S: correct stack for heads/sectors; revert Heads and sectors were pushed in reverse order per isolinux.asm bb519a95 reversed the order of heads/sectors on the stack Signed-off-by: Gene Cumm --- mbr/isohdpfx.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S index 17e1efe1..f9e96919 100644 --- a/mbr/isohdpfx.S +++ b/mbr/isohdpfx.S @@ -175,12 +175,12 @@ next: /* Get (C)HS geometry */ movb $0x08, %ah int $0x13 - andw $0x3f, %cx /* Sector count */ popw %bx /* EBIOS flag */ - pushw %cx /* -16: Save sectors on the stack */ movzbw %dh, %ax /* dh = max head */ incw %ax /* From 0-based max to count */ - pushw %ax /* -18: Save heads on the stack */ + pushw %ax /* -16: Save heads on the stack */ + andw $0x3f, %cx /* Sector count */ + pushw %cx /* -18: Save sectors on the stack */ mulw %cx /* Heads*sectors -> sectors per cylinder */ pushw %bx /* -20: EBIOS flag */ From 8739e2ff9ba3f92652c8df846924fd00e1ce2753 Mon Sep 17 00:00:00 2001 From: Martin Str|mberg Date: Sun, 26 Mar 2017 07:54:29 -0400 Subject: [PATCH 05/20] mbr/isohdpfx.S: Clear CX on INT 13h AH 41h failure If anything goes wrong, clear CX in case it contains garbage. Signed-off-by: Gene Cumm --- mbr/isohdpfx.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S index f9e96919..4b107e4b 100644 --- a/mbr/isohdpfx.S +++ b/mbr/isohdpfx.S @@ -167,8 +167,10 @@ next: read_sector_cbios: movb $0x42, %ah ; jmp read_common */ movl $0xeb42b4+((read_common-read_sector_cbios-4) << 24), \ (read_sector_cbios) - jmp 1f + jmp 2f 1: + xor %cx, %cx /* Clear EBIOS flag. */ +2: popw %dx pushw %cx /* EBIOS flag */ From 80b0ef5ffd6998818b3785c3c15bf2ae73687e09 Mon Sep 17 00:00:00 2001 From: Colin Finck Date: Thu, 19 Jan 2017 00:41:39 +0100 Subject: [PATCH 06/20] isohybrid: Open ISO file in binary mode Open ISO file in binary mode to ensure that line endings stay untouched. Signed-off-by: Gene Cumm --- utils/isohybrid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/isohybrid.c b/utils/isohybrid.c index 1a203213..a9e38d4d 100644 --- a/utils/isohybrid.c +++ b/utils/isohybrid.c @@ -967,7 +967,7 @@ main(int argc, char *argv[]) srand(time(NULL) << (getppid() << getpid())); - if (!(fp = fopen(argv[0], "r+"))) + if (!(fp = fopen(argv[0], "rb+"))) err(1, "could not open file `%s'", argv[0]); if (fseeko(fp, (off_t) (16 << 11), SEEK_SET)) From 8a0d48421413f20dc400c58c7e4e7b9ec8d9bc78 Mon Sep 17 00:00:00 2001 From: Julien Viard de Galbert Date: Wed, 31 May 2017 06:07:49 -0400 Subject: [PATCH 07/20] efi/udp: core_udp_connect: use SubnetMask not StationAddress for netmask Signed-off-by: Julien Viard de Galbert Signed-off-by: Gene Cumm --- efi/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efi/udp.c b/efi/udp.c index 1088f470..b0f13ad4 100644 --- a/efi/udp.c +++ b/efi/udp.c @@ -163,7 +163,7 @@ void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip, } else { udata.UseDefaultAddress = FALSE; memcpy(&udata.StationAddress, &IPInfo.myip, sizeof(IPInfo.myip)); - memcpy(&udata.StationAddress, &IPInfo.netmask, sizeof(IPInfo.netmask)); + memcpy(&udata.SubnetMask, &IPInfo.netmask, sizeof(IPInfo.netmask)); } memcpy(&udata.RemoteAddress, &ip, sizeof(ip)); udata.RemotePort = port; From 828a75d005daf87707e883f04909282efb3e764a Mon Sep 17 00:00:00 2001 From: Julien Viard de Galbert Date: Wed, 31 May 2017 06:50:53 -0400 Subject: [PATCH 08/20] efi/udp: Add retry disabling UseDefaultAddress Add retry disabling UseDefaultAddress in core_udp_connect() and core_udp_sendto() Signed-off-by: Julien Viard de Galbert Signed-off-by: Gene Cumm --- efi/udp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/efi/udp.c b/efi/udp.c index b0f13ad4..1b787e5b 100644 --- a/efi/udp.c +++ b/efi/udp.c @@ -158,6 +158,7 @@ void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip, /* Re-use the existing local port number */ udata.StationPort = socket->net.efi.localport; +retry: if (efi_net_def_addr) { udata.UseDefaultAddress = TRUE; } else { @@ -170,6 +171,11 @@ void core_udp_connect(struct pxe_pvt_inode *socket, uint32_t ip, udata.TimeToLive = 64; status = core_udp_configure(udp, &udata, L"core_udp_connect"); + if (efi_net_def_addr && (status == EFI_NO_MAPPING)) { + efi_net_def_addr = 0; + Print(L"disable UseDefaultAddress\n"); + goto retry; + } if (status != EFI_SUCCESS) { Print(L"Failed to configure UDP: %d\n", status); return; @@ -392,6 +398,7 @@ void core_udp_sendto(struct pxe_pvt_inode *socket, const void *data, /* Re-use the existing local port number */ udata.StationPort = socket->net.efi.localport; +retry: if (efi_net_def_addr) { udata.UseDefaultAddress = TRUE; } else { @@ -404,6 +411,11 @@ void core_udp_sendto(struct pxe_pvt_inode *socket, const void *data, udata.TimeToLive = 64; status = core_udp_configure(udp, &udata, L"core_udp_sendto"); + if (efi_net_def_addr && (status == EFI_NO_MAPPING)) { + efi_net_def_addr = 0; + Print(L"disable UseDefaultAddress\n"); + goto retry; + } if (status != EFI_SUCCESS) goto bail; From c100204000cdc565e5edaec1b8a6239143173fbd Mon Sep 17 00:00:00 2001 From: Julien Viard de Galbert Date: Wed, 31 May 2017 17:39:45 -0400 Subject: [PATCH 09/20] efi/udp: Removing the udp_reader efi_binding Signed-off-by: Julien Viard de Galbert --- efi/udp.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/efi/udp.c b/efi/udp.c index 1b787e5b..288010cf 100644 --- a/efi/udp.c +++ b/efi/udp.c @@ -10,14 +10,6 @@ extern EFI_GUID Udp4ServiceBindingProtocol, Udp4Protocol; -/* - * This UDP binding is configured to operate in promiscuous mode. It is - * only used for reading packets. It has no associated state unlike - * socket->net.efi.binding, which has a remote IP address and port - * number. - */ -static struct efi_binding *udp_reader; - static int volatile efi_udp_has_recv = 0; int volatile efi_net_def_addr = 1; @@ -76,17 +68,11 @@ int core_udp_open(struct pxe_pvt_inode *socket) EFI_STATUS status; EFI_UDP4 *udp; - (void)socket; - - udp_reader = efi_create_binding(&Udp4ServiceBindingProtocol, &Udp4Protocol); - if (!udp_reader) - return -1; - b = efi_create_binding(&Udp4ServiceBindingProtocol, &Udp4Protocol); if (!b) goto bail; - udp = (EFI_UDP4 *)udp_reader->this; + udp = (EFI_UDP4 *)b->this; memset(&udata, 0, sizeof(udata)); @@ -114,9 +100,6 @@ int core_udp_open(struct pxe_pvt_inode *socket) if (b) efi_destroy_binding(b, &Udp4ServiceBindingProtocol); - efi_destroy_binding(udp_reader, &Udp4ServiceBindingProtocol); - udp_reader = NULL; - return -1; } @@ -127,9 +110,6 @@ int core_udp_open(struct pxe_pvt_inode *socket) */ void core_udp_close(struct pxe_pvt_inode *socket) { - efi_destroy_binding(udp_reader, &Udp4ServiceBindingProtocol); - udp_reader = NULL; - if (!socket->net.efi.binding) return; @@ -239,7 +219,7 @@ int core_udp_recv(struct pxe_pvt_inode *socket, void *buf, uint16_t *buf_len, (void)socket; - b = udp_reader; + b = socket->net.efi.binding; udp = (EFI_UDP4 *)b->this; memset(&token, 0, sizeof(token)); From af7e95c32cea40c1e443ae301e64b27f068b4915 Mon Sep 17 00:00:00 2001 From: Paulo Alcantara Date: Wed, 11 Oct 2017 07:00:31 -0400 Subject: [PATCH 10/20] ext4: Fix 64bit feature As per ext4 specification: > In ext2, ext3, and ext4 (when the 64bit feature is not enabled), the > block group descriptor was only 32 bytes long and therefore ends at > bg_checksum. On an ext4 filesystem with the 64bit feature enabled, the > block group descriptor expands to at least the 64 bytes described below; > the size is stored in the superblock. Since block group descriptor has been expanded to 64 bytes long (when 64 bit feature is enabled), we cannot index ext2_group_desc and return it *directly* -- as we did it in ext2_get_group_desc -- it's still 32 bytes long. Instead, use s_desc_size field from superblock to correctly index and return block group descriptors. Cc: H. Peter Anvin Cc: Gene Cumm Signed-off-by: Paulo Alcantara --- core/fs/ext2/ext2.c | 23 ++++++++++++++--------- core/fs/ext2/ext2_fs.h | 1 + 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/fs/ext2/ext2.c b/core/fs/ext2/ext2.c index 76bd1d5a..4bc0a535 100644 --- a/core/fs/ext2/ext2.c +++ b/core/fs/ext2/ext2.c @@ -25,22 +25,17 @@ static enum dirent_type ext2_cvt_type(unsigned int d_file_type) return inode_type[d_file_type]; } -/* - * get the group's descriptor of group_num - */ -static const struct ext2_group_desc * -ext2_get_group_desc(struct fs_info *fs, uint32_t group_num) +static const void *__ext2_get_group_desc(struct fs_info *fs, uint32_t group_num) { struct ext2_sb_info *sbi = EXT2_SB(fs); uint32_t desc_block, desc_index; - const struct ext2_group_desc *desc_data_block; + uint8_t *p; if (group_num >= sbi->s_groups_count) { printf ("ext2_get_group_desc" "block_group >= groups_count - " "block_group = %d, groups_count = %d", group_num, sbi->s_groups_count); - return NULL; } @@ -49,8 +44,17 @@ ext2_get_group_desc(struct fs_info *fs, uint32_t group_num) desc_block += sbi->s_first_data_block + 1; - desc_data_block = get_cache(fs->fs_dev, desc_block); - return &desc_data_block[desc_index]; + p = get_cache(fs->fs_dev, desc_block); + return p + sbi->s_desc_size * desc_index; +} + +/* + * get the group's descriptor of group_num + */ +static inline const struct ext2_group_desc * +ext2_get_group_desc(struct fs_info *fs, uint32_t group_num) +{ + return __ext2_get_group_desc(fs, group_num); } /* @@ -306,6 +310,7 @@ static int ext2_fs_init(struct fs_info *fs) if (sb.s_desc_size < sizeof(struct ext2_group_desc)) sb.s_desc_size = sizeof(struct ext2_group_desc); sbi->s_desc_per_block = BLOCK_SIZE(fs) / sb.s_desc_size; + sbi->s_desc_size = sb.s_desc_size; sbi->s_groups_count = (sb.s_blocks_count - sb.s_first_data_block + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); diff --git a/core/fs/ext2/ext2_fs.h b/core/fs/ext2/ext2_fs.h index 803a9954..d8d07ebd 100644 --- a/core/fs/ext2/ext2_fs.h +++ b/core/fs/ext2/ext2_fs.h @@ -278,6 +278,7 @@ struct ext2_sb_info { uint32_t s_first_data_block; /* First Data Block */ int s_inode_size; uint8_t s_uuid[16]; /* 128-bit uuid for volume */ + int s_desc_size; /* size of group descriptor */ }; static inline struct ext2_sb_info *EXT2_SB(struct fs_info *fs) From ce3d03a0556b11f43b30966cbf51213cb5564897 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 Nov 2017 11:26:02 -0400 Subject: [PATCH 11/20] man: Updating list of supported filesystems in extlinux Debian (Closes: #692844); also update contact info. Author: Daniel Baumann Signed-off-by: Gene Cumm --- man/extlinux.1 | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/man/extlinux.1 b/man/extlinux.1 index 5daa4e52..14e6be12 100644 --- a/man/extlinux.1 +++ b/man/extlinux.1 @@ -1,17 +1,17 @@ -.TH extlinux "1" "18 December 2007" "SYSLINUX for ext2/ext3 filesystem" +.TH extlinux "1" "18 December 2007" "SYSLINUX for ext/btrfs/xfs filesystems" .SH NAME -extlinux \- install the \s-1SYSLINUX\s+1 bootloader on a ext2/ext3 filesystem +extlinux \- install the \s-1SYSLINUX\s+1 bootloader on an ext2/ext3/ext4/btrfs/xfs filesystem .SH SYNOPSIS .B extlinux [\fIoptions\fP] \fIdirectory\fP .SH DESCRIPTION -\fBEXTLINUX\fP is a new syslinux derivative, which boots from a Linux ext2/ext3 +\fBEXTLINUX\fP is a new syslinux derivative, which boots from a Linux ext2/ext3/ext4/btrfs or xfs filesystem. It works the same way as \fBSYSLINUX\fP, with a few slight modifications. It is intended to simplify first-time installation of Linux, and for creation of rescue and other special-purpose boot disks. .PP The installer is designed to be run on a mounted directory. For example, if you have an -ext2 or ext3 usb key mounted on /mnt, you can run the following command: +ext2, ext3, ext4, or btrfs usb key mounted on /mnt, you can run the following command: .IP .B extlinux --install /mnt .SH OPTIONS @@ -56,6 +56,9 @@ The extlinux configuration file needs to be named syslinux.cfg or extlinux.conf and needs to be stored in the extlinux installation directory. For more information about the contents of extlinux.conf, see syslinux(1) manpage, section files. +.SH LIMITATIONS +Booting from XFS only works when an MBR partition table is used (not on GPT +partition tables). .SH BUGS I would appreciate hearing of any problems you have with \s-1SYSLINUX\s+1. I would also like to hear from you if you have successfully used \s-1SYSLINUX\s+1, @@ -66,8 +69,14 @@ about your system and your BIOS; the vast majority of all problems reported turn out to be BIOS or hardware bugs, and I need as much information as possible in order to diagnose the problems. .PP -There is a mailing list for discussion among \s-1SYSLINUX\s+1 users and for -announcements of new and test versions. To join, send a message to -majordomo@linux.kernel.org with the line: +There is a +.MT syslinux@\:zytor.com +mailing list +.ME +for discussion among \s-1SYSLINUX\s+1 users and for announcements of new and +test versions. You can +.UR http://\:www.zytor.com/\:mailman/\:listinfo/\:syslinux +subscribe to this mailing list +.UE . .SH SEE ALSO .BR syslinux (1) From f1e7b73dd8c1d657fd68640c6a2cf430872e703e Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sat, 4 Nov 2017 11:32:32 -0400 Subject: [PATCH 12/20] make: Sort object files for reproducible linking order Author: Reiner Herrmann Change be645d7a was not extended to the efi/Makefile previously; this patch addresses this. Signed-off-by: Gene Cumm --- efi/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/efi/Makefile b/efi/Makefile index d3788d90..869edfef 100644 --- a/efi/Makefile +++ b/efi/Makefile @@ -17,15 +17,15 @@ include $(MAKEDIR)/efi.mk # Upstream gnu-efi has old-style function definitions. CFLAGS += -Wno-strict-prototypes -CORE_CSRC := $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c) +CORE_CSRC := $(sort $(wildcard $(core)/*.c $(core)/*/*.c $(core)/*/*/*.c)) CORE_COBJ := $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o,$(CORE_CSRC))) # We don't want to include any of the networking stack or the thread # code since it will be implemented completely differently for EFI. -FILTERED_OBJS:= $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o, \ +FILTERED_OBJS:= $(sort $(subst $(core),$(OBJ)/../core,$(patsubst %.c,%.o, \ $(wildcard $(core)/legacynet/*.c) \ $(wildcard $(core)/fs/pxe/*.c) \ - $(wildcard $(core)/thread/*.c))) + $(wildcard $(core)/thread/*.c)))) # Don't include unit tests FILTERED_OBJS += $(subst $(core),$(OBJ)/../core, \ @@ -44,7 +44,7 @@ CORE_OBJS += $(addprefix $(OBJ)/../core/, \ LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \ $(LIBEFI) -CSRC = $(wildcard $(SRC)/*.c) +CSRC = $(sort $(wildcard $(SRC)/*.c)) OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC)))) OBJS += $(objdir)/core/codepage.o $(ARCH)/linux.o From 523250bbd841597bfd60009771f9afa09a324dc7 Mon Sep 17 00:00:00 2001 From: Lukas Schwaighofer Date: Sat, 4 Nov 2017 11:36:41 -0400 Subject: [PATCH 13/20] libinstaller: Use SOURCE_DATE_EPOCH for synthesized modification time stamps Patches bin2c.pl to use the value of SOURCE_DATE_EPOCH instead of real modification time stamp (only if SOURCE_DATE_EPOCH is set). Author: Lukas Schwaighofer Signed-off-by: Gene Cumm --- libinstaller/bin2c.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libinstaller/bin2c.pl b/libinstaller/bin2c.pl index 07c11ddb..c79a506f 100755 --- a/libinstaller/bin2c.pl +++ b/libinstaller/bin2c.pl @@ -71,8 +71,11 @@ 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]; +if (defined $ENV{'SOURCE_DATE_EPOCH'}) { + printf "\nconst int %s_mtime = %s;\n", $table_name, $ENV{'SOURCE_DATE_EPOCH'}; +} else { + @st = stat STDIN; + printf "\nconst int %s_mtime = %d;\n", $table_name, $st[9]; +} exit 0; From 1efb5bfe949b41d16054ae856914388f1afa23d1 Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Sat, 4 Nov 2017 11:46:46 -0400 Subject: [PATCH 14/20] utils: use Digest::SHA for sha1pass Debian (Closes: #625812) Author: Salvatore Bonaccorso Logic can be added if we need to check between these. Signed-off-by: Gene Cumm --- utils/sha1pass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/sha1pass b/utils/sha1pass index 3be2dbc1..34cc99c0 100755 --- a/utils/sha1pass +++ b/utils/sha1pass @@ -1,7 +1,7 @@ #!/usr/bin/perl use bytes; -use Digest::SHA1; +use Digest::SHA; use MIME::Base64; sub random_bytes($) { @@ -29,6 +29,6 @@ sub random_bytes($) { unless (defined($salt)) { $salt = MIME::Base64::encode(random_bytes(6), ''); } -$pass = Digest::SHA1::sha1_base64($salt, $pass); +$pass = Digest::SHA::sha1_base64($salt, $pass); print '$4$', $salt, '$', $pass, "\$\n"; From c05fde2f0f71e480fe3e5941150d9a354acabc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Allard?= Date: Wed, 5 Apr 2017 14:18:09 +0200 Subject: [PATCH 15/20] memdisk: Force ld output format to 32-bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On toolchains where the default output is x86_64, we need to be consistent with the other .o files Signed-off-by: Benoît Allard --- memdisk/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memdisk/Makefile b/memdisk/Makefile index 42e56e00..ccd5738b 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -78,7 +78,7 @@ memdisk16.o: memdisk16.asm $(NASM) -f bin $(NASMOPT) $(NFLAGS) $(NINCLUDE) -o $@ -l $*.lst $< memdisk_%.o: memdisk_%.bin - $(LD) -r -b binary -o $@ $< + $(LD) --oformat elf32-i386 -r -b binary -o $@ $< memdisk16.elf: $(OBJS16) $(LD) -Ttext 0 -o $@ $^ From e28fa26e30ce42690f39cad55093ab91d6491275 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Thu, 23 Nov 2017 08:57:23 -0500 Subject: [PATCH 16/20] Use CC for CC_FOR_BUILD when unspecified. (GC): Let's put the pre-requisite first rather than making a FTBFS commit Signed-off-by: Gene Cumm --- efi/Makefile | 2 ++ utils/Makefile | 2 ++ 2 files changed, 4 insertions(+) diff --git a/efi/Makefile b/efi/Makefile index 869edfef..c57e13f7 100644 --- a/efi/Makefile +++ b/efi/Makefile @@ -14,6 +14,8 @@ VPATH = $(SRC) include $(MAKEDIR)/lib.mk include $(MAKEDIR)/efi.mk +CC_FOR_BUILD ?= $(CC) + # Upstream gnu-efi has old-style function definitions. CFLAGS += -Wno-strict-prototypes diff --git a/utils/Makefile b/utils/Makefile index dfe62590..330e2026 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -17,6 +17,8 @@ VPATH = $(SRC) include $(MAKEDIR)/syslinux.mk +CC_FOR_BUILD ?= $(CC) + CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) LDFLAGS = -O2 From 6cdeb9ceb8b5fd929a534535d33f61791e8cec60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Allard?= Date: Thu, 23 Nov 2017 09:02:21 -0500 Subject: [PATCH 17/20] utils: Use the host toolchain to build. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The utilities are meant to run on the host machine, hence must be built using the host toolchain. Signed-off-by: Benoît Allard (GC): Minor merge conflict Signed-off-by: Gene Cumm --- utils/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/Makefile b/utils/Makefile index 330e2026..b1031249 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -19,8 +19,8 @@ include $(MAKEDIR)/syslinux.mk CC_FOR_BUILD ?= $(CC) -CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) -LDFLAGS = -O2 +CFLAGS = $(CFLAGS_FOR_BUILD) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) +LDFLAGS = $(LDFLAGS_FOR_BUILD) -O2 C_TARGETS = isohybrid gethostip memdiskfind SCRIPT_TARGETS = mkdiskimage @@ -37,7 +37,7 @@ ISOHDPFX = $(addprefix $(OBJ)/,../mbr/isohdpfx.bin ../mbr/isohdpfx_f.bin \ all: $(TARGETS) %.o: %.c - $(CC) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $< + $(CC_FOR_BUILD) $(UMAKEDEPS) $(CFLAGS) -c -o $@ $< mkdiskimage: mkdiskimage.in ../mbr/mbr.bin bin2hex.pl $(PERL) $(SRC)/bin2hex.pl < $(OBJ)/../mbr/mbr.bin | cat $(SRC)/mkdiskimage.in - > $@ @@ -53,13 +53,13 @@ isohdpfx.c: $(ISOHDPFX) isohdpfxarray.pl $(PERL) $(SRC)/isohdpfxarray.pl $(ISOHDPFX) > $@ isohybrid: isohybrid.o isohdpfx.o - $(CC) $(LDFLAGS) -o $@ $^ -luuid + $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^ -luuid gethostip: gethostip.o - $(CC) $(LDFLAGS) -o $@ $^ + $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^ memdiskfind: memdiskfind.o - $(CC) $(LDFLAGS) -o $@ $^ + $(CC_FOR_BUILD) $(LDFLAGS) -o $@ $^ tidy dist: rm -f *.o .*.d isohdpfx.c From 2ea44cbedb297bd6b409d5c1e0402d5f89592be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Allard?= Date: Mon, 12 Jun 2017 14:59:16 +0200 Subject: [PATCH 18/20] efi/wrapper: build it with the host toolchain. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wrapper program is executed on the build machine, so it should be built with CC_FOR_BUILD. Signed-off-by: Benoît Allard --- efi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efi/Makefile b/efi/Makefile index c57e13f7..f4501e7f 100644 --- a/efi/Makefile +++ b/efi/Makefile @@ -80,7 +80,7 @@ syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS) # cp $^ $@ wrapper: wrapper.c - $(CC) $^ -o $@ + $(CC_FOR_BUILD) $^ -o $@ # # Build the wrapper app and wrap our .so to produce a .efi From ac39cffd82d9f3ea4f243657c63db071ba8ef7b0 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Thu, 25 Oct 2018 06:13:04 -0400 Subject: [PATCH 19/20] ISOLINUX: Fix checksum calculation in lzo/prepcore.c The prescription for Boot Info Table says that checksumming begins at byte 64 of isolinux.bin. When prepcore writes isolinux.bin it begins copying bytes from the input file at the offset given by variable "start". But it begins checksumming at offset 64 of the input file. The problem exists since introduction of prepcore by release 4.00. ISO 9660 programs usually fix it when they write the Boot Info Table. Signed-off-by: Thomas Schmitt --- lzo/prepcore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lzo/prepcore.c b/lzo/prepcore.c index 9147b2e4..b5ebe88b 100644 --- a/lzo/prepcore.c +++ b/lzo/prepcore.c @@ -331,7 +331,7 @@ int main(int argc, char *argv[]) unsigned int ptr; outfile_len = ((offset - start + out_len + 2047) & ~2047) - (offset - start); - for (ptr = 64; ptr < offset; ptr += 4) + for (ptr = start + 64; ptr < offset; ptr += 4) csum += get_32((uint32_t *) (infile + ptr)); for (ptr = 0; ptr < outfile_len; ptr += 4) csum += get_32((uint32_t *) (out + ptr)); From 5e426532210bb830d2d7426eb8d8c154d9dfcba6 Mon Sep 17 00:00:00 2001 From: Lukas Schwaighofer Date: Thu, 25 Oct 2018 06:38:12 -0400 Subject: [PATCH 20/20] core/Makefile: sort to be reproducible Signed-off-by: Lukas Schwaighofer --- core/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/Makefile b/core/Makefile index 46cb037c..50ff35af 100644 --- a/core/Makefile +++ b/core/Makefile @@ -41,9 +41,9 @@ BTARGET = kwdhash.gen \ # All primary source files for the main syslinux files NASMSRC := $(sort $(wildcard $(SRC)/*.asm)) NASMHDR := $(sort $(wildcard $(SRC)/*.inc)) -CSRC := $(shell find $(SRC) -name '*.c' -print) -SSRC := $(shell find $(SRC) -name '*.S' -print) -CHDR := $(shell find $(SRC) -name '*.h' -print) +CSRC := $(sort $(shell find $(SRC) -name '*.c' -print)) +SSRC := $(sort $(shell find $(SRC) -name '*.S' -print)) +CHDR := $(sort $(shell find $(SRC) -name '*.h' -print)) OTHERSRC := keywords ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC) @@ -56,13 +56,13 @@ CORE_PXE_CSRC = \ $(addprefix $(SRC)/fs/pxe/, dhcp_option.c pxe.c tftp.c urlparse.c bios.c) LPXELINUX_CSRC = $(CORE_PXE_CSRC) \ - $(shell find $(SRC)/lwip -name '*.c' -print) \ + $(sort $(shell find $(SRC)/lwip -name '*.c' -print)) \ $(addprefix $(SRC)/fs/pxe/, \ core.c dnsresolv.c ftp.c ftp_readdir.c gpxeurl.c http.c \ http_readdir.c idle.c isr.c tcp.c) PXELINUX_CSRC = $(CORE_PXE_CSRC) \ - $(shell find $(SRC)/legacynet -name '*.c' -print) + $(sort $(shell find $(SRC)/legacynet -name '*.c' -print)) LPXELINUX_OBJS = $(subst $(SRC)/,,$(LPXELINUX_CSRC:%.c=%.o)) PXELINUX_OBJS = $(subst $(SRC)/,,$(PXELINUX_CSRC:%.c=%.o))