From patchwork Tue Jun 14 15:32:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilles Chanteperdrix X-Patchwork-Id: 635395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rTYYv4kpRz9t0v for ; Wed, 15 Jun 2016 01:32:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 33ABB31DDA; Tue, 14 Jun 2016 15:32:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hT-5+FVYYa3I; Tue, 14 Jun 2016 15:32:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 695D931E27; Tue, 14 Jun 2016 15:32:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id B6F7E1CE64E for ; Tue, 14 Jun 2016 15:32:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B2857891BC for ; Tue, 14 Jun 2016 15:32:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Improper folded header field made up entirely of whitespace (char 20 hex): X-Spam_report: ...that system for details.\n \n Content previ[...] Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wx+-I8Ctuib6 for ; Tue, 14 Jun 2016 15:32:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-51317.xenomai.org (sd-51317.xenomai.org [62.210.215.82]) by hemlock.osuosl.org (Postfix) with ESMTPS id D599187DFE for ; Tue, 14 Jun 2016 15:32:35 +0000 (UTC) Received: from for13-1-78-194-115-96.fbxo.proxad.net ([78.194.115.96] helo=prometheus.click-hack.org) by sd-51317.xenomai.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1bCqKF-0001Hl-KC; Tue, 14 Jun 2016 17:32:24 +0200 From: Gilles Chanteperdrix To: buildroot@buildroot.org Date: Tue, 14 Jun 2016 17:32:17 +0200 Message-Id: <1465918337-30732-3-git-send-email-gilles.chanteperdrix@xenomai.org> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1465918337-30732-1-git-send-email-gilles.chanteperdrix@xenomai.org> References: <20160614152928.GH3060@hermes.click-hack.org> <1465918337-30732-1-git-send-email-gilles.chanteperdrix@xenomai.org> X-Spam_score: -1.0 X-Spam_score_int: -9 X-Spam_bar: - X-Spam_report: Spam detection software, running on the system "sd-51317.xenomai.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Build with the target toolchain so that the binaries are identical with different host toolchains. Sort files lists in order to get deterministic link order. Build with HEXDATE set to the source date epoch. [...] Content analysis details: (-1.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Cc: Gilles Chanteperdrix Subject: [Buildroot] [PATCH 12/12] reproducible/syslinux: make syslinux build reproducible X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Build with the target toolchain so that the binaries are identical with different host toolchains. Sort files lists in order to get deterministic link order. Build with HEXDATE set to the source date epoch. Signed-off-by: Gilles Chanteperdrix --- boot/syslinux/0001-fixed-build-order.patch | 42 ++++++++++++++++++++++++++ boot/syslinux/syslinux.mk | 47 +++++++++++++++++++++++++----- fs/iso9660/iso9660.mk | 4 +-- 3 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 boot/syslinux/0001-fixed-build-order.patch diff --git a/boot/syslinux/0001-fixed-build-order.patch b/boot/syslinux/0001-fixed-build-order.patch new file mode 100644 index 0000000..3697b74 --- /dev/null +++ b/boot/syslinux/0001-fixed-build-order.patch @@ -0,0 +1,42 @@ +Sort source file names in order for the link order not to depend on the order in +which find return file names. + +Signed-off-by: Gilles Chanteperdrix +-- +--- syslinux-6.03/core/Makefile~ 2014-10-06 18:27:44.000000000 +0200 ++++ syslinux-6.03/core/Makefile 2016-03-24 14:36:38.207391899 +0100 +@@ -41,9 +41,9 @@ + # All primary source files for the main syslinux files + NASMSRC := $(wildcard $(SRC)/*.asm) + NASMHDR := $(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 := $(shell find $(SRC) -name '*.c' -print | sort) ++SSRC := $(shell find $(SRC) -name '*.S' -print | sort) ++CHDR := $(shell find $(SRC) -name '*.h' -print | sort) + OTHERSRC := keywords + ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC) + +@@ -56,18 +56,18 @@ + $(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) \ ++ $(shell find $(SRC)/lwip -name '*.c' -print | sort) \ + $(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) ++ $(shell find $(SRC)/legacynet -name '*.c' -print | sort) + + LPXELINUX_OBJS = $(subst $(SRC)/,,$(LPXELINUX_CSRC:%.c=%.o)) + PXELINUX_OBJS = $(subst $(SRC)/,,$(PXELINUX_CSRC:%.c=%.o)) + +-UNITTEST_CSRC = $(shell find $(SRC) -path '*/tests/*.c' -print) ++UNITTEST_CSRC = $(shell find $(SRC) -path '*/tests/*.c' -print | sort) + UNITTEST_OBJS = $(subst $(SRC)/,,$(UNITTEST_CSRC:%.c=%.o)) + + # Don't include console and network stack specific objects or unit tests diff --git a/boot/syslinux/syslinux.mk b/boot/syslinux/syslinux.mk index 82890c5..cdd5b3c 100644 --- a/boot/syslinux/syslinux.mk +++ b/boot/syslinux/syslinux.mk @@ -13,7 +13,7 @@ SYSLINUX_LICENSE_FILES = COPYING SYSLINUX_INSTALL_IMAGES = YES -SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx +SYSLINUX_DEPENDENCIES = host-nasm host-util-linux host-upx host-perl host-python host-xz ifeq ($(BR2_TARGET_SYSLINUX_LEGACY_BIOS),y) SYSLINUX_TARGET += bios @@ -47,12 +47,35 @@ define SYSLINUX_CLEANUP endef SYSLINUX_POST_PATCH_HOOKS += SYSLINUX_CLEANUP +ifeq ($(BR2_REPRODUCIBLE),y) +define SYSLINUX_REPRODUCIBLE + HEXDATE="`printf "0x%x" $(SOURCE_DATE_EPOCH)`" +endef +endif + +define SYSLINUX_MAKE + $(TARGET_MAKE_ENV) $(MAKE1) \ + $(SYSLINUX_REPRODUCIBLE) \ + NASM=$(HOST_DIR)/usr/bin/nasm \ + PERL=$(HOST_DIR)/usr/bin/perl \ + PYTHON=$(HOST_DIR)/usr/bin/python \ + UPX=$(HOST_DIR)/usr/bin/upx \ + CC="$(TARGET_CC)" \ + LD="$(TARGET_LD) -m elf_i386" \ + OBJDUMP="$(TARGET_OBJDUMP)" \ + OBJCOPY="$(TARGET_OBJCOPY)" \ + STRIP="$(TARGET_STRIP)" \ + AR="$(TARGET_AR)" \ + NM="$(TARGET_NM)" \ + RANLIB="$(TARGET_RANLIB)" \ + XZ=$(HOST_DIR)/usr/bin/xz $(SYSLINUX_EFI_ARGS) +endef + # syslinux build system has no convenient way to pass CFLAGS, # and the internal zlib should take precedence so -I shouldn't # be used. define SYSLINUX_BUILD_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) -C $(@D) $(SYSLINUX_TARGET) + $(SYSLINUX_MAKE) -C $(@D) $(SYSLINUX_TARGET) endef # While the actual bootloader is compiled for the target, several @@ -61,8 +84,7 @@ endef # Repeat CC and AR, since syslinux really wants to check them at # install time define SYSLINUX_INSTALL_TARGET_CMDS - $(TARGET_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ - AR="$(HOSTAR)" $(SYSLINUX_EFI_ARGS) INSTALLROOT=$(HOST_DIR) \ + $(SYSLINUX_MAKE) INSTALLROOT=$(@D)/inst \ -C $(@D) $(SYSLINUX_TARGET) install endef @@ -80,10 +102,21 @@ define SYSLINUX_INSTALL_IMAGES_CMDS for i in $(SYSLINUX_IMAGES-y); do \ $(INSTALL) -D -m 0755 $(@D)/$$i $(BINARIES_DIR)/syslinux/$${i##*/}; \ done - for i in $(SYSLINUX_C32); do \ - $(INSTALL) -D -m 0755 $(HOST_DIR)/usr/share/syslinux/$${i} \ + for i in $(SYSLINUX_C32) ldlinux.c32; do \ + $(INSTALL) -D -m 0755 $(@D)/inst/usr/share/syslinux/$${i} \ $(BINARIES_DIR)/syslinux/$${i}; \ done endef +define HOST_SYSLINUX_BUILD_CMDS + $(HOST_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ +- AR="$(HOSTAR)" -C $(@D) bios +endef + +define HOST_SYSLINUX_INSTALL_CMDS + $(HOST_MAKE_ENV) $(MAKE1) CC="$(HOSTCC) -idirafter $(HOST_DIR)/usr/include $(HOST_LDFLAGS)" \ +- AR="$(HOSTAR)" -C $(@D) INSTALLROOT=$(HOST_DIR) bios install +endef + $(eval $(generic-package)) +$(eval $(host-generic-package)) diff --git a/fs/iso9660/iso9660.mk b/fs/iso9660/iso9660.mk index f97a9d7..db22ca4 100644 --- a/fs/iso9660/iso9660.mk +++ b/fs/iso9660/iso9660.mk @@ -70,8 +70,6 @@ ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin define ROOTFS_ISO9660_INSTALL_BOOTLOADER $(INSTALL) -D -m 0644 $(BINARIES_DIR)/syslinux/* \ $(ROOTFS_ISO9660_TARGET_DIR)/isolinux/ - $(INSTALL) -D -m 0644 $(HOST_DIR)/usr/share/syslinux/ldlinux.c32 \ - $(ROOTFS_ISO9660_TARGET_DIR)/isolinux/ldlinux.c32 endef endif @@ -166,6 +164,8 @@ define ROOTFS_ISO9660_CMD endef ifeq ($(BR2_TARGET_ROOTFS_ISO9660_HYBRID),y) +ROOTFS_ISO9660_DEPENDENCIES += host-syslinux + define ROOTFS_ISO9660_GEN_HYBRID $(ROOTFS_ISO9660_ISOHYBRID) -t 0x96 $@ endef