Module Name: src
Committed By: christos
Date: Thu Feb 8 18:10:34 UTC 2024
Modified Files:
src/sys/arch/hp300/stand: Makefile.buildboot
src/sys/arch/hp300/stand/mkboot: mkboot.c
Log Message:
PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/hp300/stand/Makefile.buildboot
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hp300/stand/mkboot/mkboot.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/hp300/stand/Makefile.buildboot
diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.37 src/sys/arch/hp300/stand/Makefile.buildboot:1.38
--- src/sys/arch/hp300/stand/Makefile.buildboot:1.37 Fri Jul 9 13:44:28 2021
+++ src/sys/arch/hp300/stand/Makefile.buildboot Thu Feb 8 13:10:34 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.buildboot,v 1.37 2021/07/09 17:44:28 tsutsui Exp $
+# $NetBSD: Makefile.buildboot,v 1.38 2024/02/08 18:10:34 christos Exp $
# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
RELOC= FFF00000
@@ -29,9 +29,13 @@ LIBC=
LIBCRTBEGIN=
LIBCRTEND=
+.if ${MKREPRO_TIMESTAMP:Uno} != "no"
+HP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}"
+.endif
+
${PROG}: ${PROGAOUT}
${OBJCOPY} --output-target=binary ${PROGAOUT} ${PROGAOUT}.bin
- ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${PROGAOUT}.bin ${PROG}
+ ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGAOUT}.bin ${PROG}
rm -f ${PROGAOUT}.bin
.include "${S}/conf/newvers_stand.mk"
Index: src/sys/arch/hp300/stand/mkboot/mkboot.c
diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.12
--- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11 Sat Oct 11 01:33:25 2014
+++ src/sys/arch/hp300/stand/mkboot/mkboot.c Thu Feb 8 13:10:34 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $ */
+/* $NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT(
#ifdef notdef
static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90";
#endif
-__RCSID("$NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $");
+__RCSID("$NetBSD: mkboot.c,v 1.12 2024/02/08 18:10:34 christos Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -60,6 +60,7 @@ __RCSID("$NetBSD: mkboot.c,v 1.11 2014/1
#include <time.h>
#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -78,11 +79,11 @@ __RCSID("$NetBSD: mkboot.c,v 1.11 2014/1
#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE)
#define lifstob(s) ((s) * SECTSIZE)
-int lpflag;
-int loadpoint;
+int loadpoint = -1;
struct load ld;
struct lifvol lifv;
struct lifdir lifd[LIF_NUMDIR];
+time_t repro_epoch = 0;
int main(int, char **);
void bcddate(char *, char *);
@@ -110,24 +111,25 @@ int
main(int argc, char **argv)
{
char *n1, *n2, *n3;
- int n, to;
+ int n, to, ch;
int count;
- --argc;
- ++argv;
- if (argc == 0)
- usage();
- if (!strcmp(argv[0], "-l")) {
- argv++;
- argc--;
- if (argc == 0)
+
+ while ((ch = getopt(argc, argv, "l:t:")) != -1)
+ switch (ch) {
+ case 'l':
+ loadpoint = strtol(optarg, NULL, 0);
+ break;
+ case 't':
+ repro_epoch = (time_t)atoll(optarg);
+ break;
+ default:
usage();
- sscanf(argv[0], "0x%x", &loadpoint);
- lpflag++;
- argv++;
- argc--;
- }
- if (!lpflag || argc == 0)
+ }
+
+ argc -= optind;
+ argv += optind;
+ if (loadpoint == -1 || argc == 0)
usage();
n1 = argv[0];
argv++;
@@ -147,11 +149,8 @@ main(int argc, char **argv)
} else
n2 = n3 = NULL;
- to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644);
- if (to < 0) {
- perror("open");
- exit(1);
- }
+ if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1)
+ err(1, "Can't open `%s'", argv[0]);
/* clear possibly unused directory entries */
strncpy(lifd[1].dir_name, " ", 10);
lifd[1].dir_type = htobe16(-1);
@@ -250,8 +249,7 @@ void
usage(void)
{
- fprintf(stderr,
- "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n");
+ fprintf(stderr, "Usage: %s -l <loadpoint [-t <timestamp>] prog1 [ prog2 ] outfile\n", getprogname());
exit(1);
}