Fix a bug in the printing of the "image too big" message, and make it

stop printing when building standalone images.
This commit is contained in:
garbled 2006-04-13 18:57:24 +00:00
parent e26a0c7cb1
commit 3869624bdd
1 changed files with 7 additions and 6 deletions

View File

@ -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);