The image file size must include the size of the area before the FS.
This commit is contained in:
parent
2f72cb043d
commit
8b13d2ea93
|
@ -44,7 +44,7 @@ public class CoffeeImageFile implements CoffeeImage {
|
||||||
imageFile = new RandomAccessFile(filename, "rw");
|
imageFile = new RandomAccessFile(filename, "rw");
|
||||||
if (imageFile.length() == 0) {
|
if (imageFile.length() == 0) {
|
||||||
// Allocate a full file system image.
|
// Allocate a full file system image.
|
||||||
imageFile.setLength(conf.fsSize);
|
imageFile.setLength(conf.startOffset + conf.fsSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ public class CoffeeImageFile implements CoffeeImage {
|
||||||
imageFile.read(bytes, 0, size);
|
imageFile.read(bytes, 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] bytes, int size, int offset) throws IOException {
|
public void write(byte[] bytes, int size, int offset) throws IOException {
|
||||||
imageFile.seek(conf.startOffset + offset);
|
imageFile.seek(conf.startOffset + offset);
|
||||||
imageFile.write(bytes, 0, size);
|
imageFile.write(bytes, 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void erase(int size, int offset) throws IOException {
|
public void erase(int size, int offset) throws IOException {
|
||||||
byte[] bytes = new byte[256];
|
byte[] bytes = new byte[256];
|
||||||
int chunkSize;
|
int chunkSize;
|
||||||
|
|
Loading…
Reference in a new issue