More mtdow fixes
This commit is contained in:
parent
d87d01a24b
commit
8509b6a83f
1 changed files with 16 additions and 5 deletions
|
@ -63,7 +63,7 @@ CFEWriter.blocks = {
|
||||||
image = {
|
image = {
|
||||||
magic = {"4844", "5735"},
|
magic = {"4844", "5735"},
|
||||||
device = "linux",
|
device = "linux",
|
||||||
write = WRITE_COMBINED
|
write = WRITE_IMAGE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,11 +181,22 @@ function Writer._write_emulated(self, devicename, imagestream, appendfile)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Writer._write_memory(self, devicename, imagestream)
|
function Writer._write_memory(self, devicename, imagestream)
|
||||||
local devicestream = ltn12.sink.file(io.open(devicename, "w"))
|
local imageproc = posix.fork()
|
||||||
local stat, err = ltn12.pump.all(imagestream, devicestream)
|
assert(imageproc ~= -1, ERROR_RESOURCE)
|
||||||
if stat then
|
if imageproc == 0 then
|
||||||
return os.execute("sync")
|
fs.unlink(self.IMAGEFIFO)
|
||||||
|
assert(posix.mkfifo(self.IMAGEFIFO), ERROR_RESOURCE)
|
||||||
|
local imagefifo = io.open(self.IMAGEFIFO, "w")
|
||||||
|
assert(imagefifo, ERROR_RESOURCE)
|
||||||
|
ltn12.pump.all(imagestream, ltn12.sink.file(imagefifo))
|
||||||
|
os.exit(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return os.execute(
|
||||||
|
"%s write '%s' '%s'" % {
|
||||||
|
self.MTD, self.IMAGEFIFO, devicename
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Writer._write_combined(self, devicename, imagestream, appendfile)
|
function Writer._write_combined(self, devicename, imagestream, appendfile)
|
||||||
|
|
Loading…
Reference in a new issue