mirror of
https://github.com/vivier/EMILE.git
synced 2025-01-18 06:31:23 +00:00
allow to read driver if block is given using 'blocksize' bytes unit instead of 512 bytes unit; extract only bootsize bytes from the driver partition
This commit is contained in:
parent
151189f71f
commit
656abb6c79
@ -111,8 +111,19 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
part = emile_map_seek_driver_partition(map,
|
||||
block * block_size / 512 );
|
||||
if (part == partition)
|
||||
{
|
||||
emile_map_read(map, part);
|
||||
if (emile_is_apple_driver(map))
|
||||
break;
|
||||
}
|
||||
part = emile_map_seek_driver_partition(map, block);
|
||||
if (part == partition)
|
||||
{
|
||||
emile_map_read(map, part);
|
||||
if (emile_is_apple_driver(map))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (part != partition)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@ -157,10 +168,10 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = read(fd, code, partition_size * 512);
|
||||
ret = read(fd, code, bootsize);
|
||||
close(fd);
|
||||
|
||||
if (ret != partition_size * 512)
|
||||
if (ret != bootsize)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot read driver (read())\n");
|
||||
free(code);
|
||||
@ -183,11 +194,11 @@ static int get_driver(emile_map_t *map, int partition, char* appledriver)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = write(fd, code, partition_size * 512);
|
||||
ret = write(fd, code, bootsize);
|
||||
close(fd);
|
||||
free(code);
|
||||
|
||||
if (ret != partition_size * 512)
|
||||
if (ret != bootsize)
|
||||
{
|
||||
fprintf(stderr, "ERROR: cannot save driver to %s\n",
|
||||
appledriver);
|
||||
|
Loading…
x
Reference in New Issue
Block a user