mirror of
https://xff.cz/git/pinephone-keyboard/
synced 2024-11-09 14:05:43 +01:00
Dump option ROM when reading flash over USB
This commit is contained in:
parent
0e4f426dfb
commit
fa19294d05
1 changed files with 3 additions and 2 deletions
|
@ -693,15 +693,16 @@ int main(int ac, char* av[])
|
||||||
|
|
||||||
for (int i = optind; i < ac; i++) {
|
for (int i = optind; i < ac; i++) {
|
||||||
if (!strcmp(av[i], "read")) {
|
if (!strcmp(av[i], "read")) {
|
||||||
uint8_t rom[0x8000];
|
uint8_t rom[0x8100];
|
||||||
memset(rom, 0xff, sizeof rom);
|
memset(rom, 0xff, sizeof rom);
|
||||||
|
|
||||||
printf("Reading code ROM\n");
|
printf("Reading code ROM\n");
|
||||||
cmd_read_rom(rom, 0, 0x8000);
|
cmd_read_rom(rom, 0, 0x8000);
|
||||||
|
cmd_read_option(rom + 0x8000);
|
||||||
|
|
||||||
int fd = open(rom_out, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
int fd = open(rom_out, O_WRONLY | O_CREAT | O_TRUNC, 0666);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
ssize_t wr = write(fd, rom, 0x8000);
|
ssize_t wr = write(fd, rom, 0x8100);
|
||||||
syscall_error(wr < 0, "write failed");
|
syscall_error(wr < 0, "write failed");
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue