From 3869624bddfaf7aa3affadbd84049a9c6057f912 Mon Sep 17 00:00:00 2001 From: garbled Date: Thu, 13 Apr 2006 18:57:24 +0000 Subject: [PATCH] Fix a bug in the printing of the "image too big" message, and make it stop printing when building standalone images. --- sys/arch/prep/stand/mkbootimage/mkbootimage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/arch/prep/stand/mkbootimage/mkbootimage.c b/sys/arch/prep/stand/mkbootimage/mkbootimage.c index 0f08a60cf925..a31cc6c67b40 100644 --- a/sys/arch/prep/stand/mkbootimage/mkbootimage.c +++ b/sys/arch/prep/stand/mkbootimage/mkbootimage.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkbootimage.c,v 1.14 2006/03/25 06:29:42 garbled Exp $ */ +/* $NetBSD: mkbootimage.c,v 1.15 2006/04/13 18:57:24 garbled Exp $ */ /*- * Copyright (C) 2006 Tim Rightnour @@ -247,6 +247,7 @@ main(int argc, char **argv) int elf_fd, prep_fd, kern_fd, elf_img_len = 0; off_t lenpos, kstart, kend; unsigned long length; + long flength; gzFile gzf; struct stat kern_stat; char *kernel = NULL, *boot = NULL, *rawdev = NULL; @@ -373,15 +374,15 @@ main(int argc, char **argv) lseek(prep_fd, sizeof(mbr) + 4, SEEK_SET); write(prep_fd, &length, sizeof(length)); - length = 0x400 + elf_img_len + 8 + kgzlen; + flength = 0x400 + elf_img_len + 8 + kgzlen; if (lfloppyflag) - length -= (5760 * 512); + flength -= (5760 * 512); else - length -= (2880 * 512); - if (length > 0) + flength -= (2880 * 512); + if (flength > 0 && !saloneflag) fprintf(stderr, "%s: Image %s is %d bytes larger than single" " floppy. Can only be used for netboot.\n", getprogname(), - argv[0], length); + argv[0], flength); free(kern_img); close(kern_fd);