Allow to create a floppy image without kernel (load kernel from SCSI disk)

This commit is contained in:
Laurent Vivier 2004-12-03 00:26:28 +00:00
parent 33a8a20132
commit 385015a670

View File

@ -50,10 +50,14 @@ static int second_tune(int fd, char* second_level, char *kernel_image, unsigned
return 7; return 7;
} }
write_long(&header.kernel_image_offset, if (kernel_image != NULL)
FIRST_LEVEL_SIZE + get_size(second_level)); {
write_long(&header.kernel_image_size, write_long(&header.kernel_image_offset,
get_size(kernel_image)); FIRST_LEVEL_SIZE + get_size(second_level));
write_long(&header.kernel_image_size,
get_size(kernel_image));
}
write_long(&header.kernel_size, buffer_size); write_long(&header.kernel_size, buffer_size);
if (ramdisk == NULL) if (ramdisk == NULL)
@ -235,10 +239,13 @@ static int aggregate(int fd, char* first_level, char* second_level, char* kernel
return 6; return 6;
total += ret; total += ret;
ret = copy_file(fd, kernel_image); if (kernel_image != NULL)
if (ret < 0) {
return 6; ret = copy_file(fd, kernel_image);
total += ret; if (ret < 0)
return 6;
total += ret;
}
if (ramdisk != NULL) if (ramdisk != NULL)
{ {
@ -294,9 +301,7 @@ int create_image(char* first_level, char* second_level, char* kernel_image,
if (kernel_image == NULL) if (kernel_image == NULL)
{ {
fprintf(stderr, "kernel image file not defined\n"); fprintf(stderr, "WARNING: kernel image file not defined\n");
close(fd);
return 5;
} }
ret = aggregate(fd, first_level, second_level, kernel_image, ramdisk); ret = aggregate(fd, first_level, second_level, kernel_image, ramdisk);
@ -348,7 +353,7 @@ int main(int argc, char** argv)
ASSERT_BB( ASSERT_BB(
{fprintf(stderr,"Internal Error: Bad boot block size\n"); exit(1);}); {fprintf(stderr,"Internal Error: Bad boot block size\n"); exit(1);});
if ((argc != 12) && (argc != 10)) if ((argc != 12) && (argc != 10) && (argc != 8) )
{ {
usage(argc, argv); usage(argc, argv);
return 1; return 1;