diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2012-06-23 17:01:48 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2012-06-23 17:01:48 +0200 |
commit | 2110196958579fd26112ed358106edb2ef952b19 (patch) | |
tree | a60e1c0a48ebd3821702b57945680beb245fa968 /src/fiasco.c | |
parent | 9195f3c7dadd3dd630884d7532cf977c2506ba98 (diff) | |
download | 0xFFFF-2110196958579fd26112ed358106edb2ef952b19.tar.bz2 |
Fiasco image: Allow to specify device string without hw revision (then image is valid for all hw revisions). Generating images should be complete!
Diffstat (limited to 'src/fiasco.c')
-rw-r--r-- | src/fiasco.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/fiasco.c b/src/fiasco.c index 31b59df..c767407 100644 --- a/src/fiasco.c +++ b/src/fiasco.c @@ -459,22 +459,24 @@ int fiasco_add(int fd, const char *name, const char *file, const char *layout, c write(fd, device, len); for (i=0; i<16-len; ++i) write(fd, "\x00", 1); - ptr = hwrevs; - oldptr = hwrevs; - while ((ptr = strchr(ptr, ','))) { - len = ptr-oldptr; + if (hwrevs) { + ptr = hwrevs; + oldptr = hwrevs; + while ((ptr = strchr(ptr, ','))) { + len = ptr-oldptr; + if (len > 8) len = 8; + write(fd, oldptr, len); + for (i=0; i<8-len; ++i) + write(fd, "\x00", 1); + ++ptr; + oldptr = ptr; + } + len = strlen(oldptr); if (len > 8) len = 8; write(fd, oldptr, len); for (i=0; i<8-len; ++i) write(fd, "\x00", 1); - ++ptr; - oldptr = ptr; } - len = strlen(oldptr); - if (len > 8) len = 8; - write(fd, oldptr, len); - for (i=0; i<8-len; ++i) - write(fd, "\x00", 1); } /* append layout subsection */ @@ -554,7 +556,7 @@ int fiasco_pack(int optind, char *argv[]) if (strncmp(arg, "version:", strlen("version:"))==0) continue; -// format: [[[[dev:hw:]ver:]type:]file[%layout] +// format: [[[[dev:[hw:]]ver:]type:]file[%layout] ptr = strdup(arg); layout = strchr(ptr, '%'); if (layout) { @@ -576,10 +578,9 @@ int fiasco_pack(int optind, char *argv[]) if (version) { *(version++) = 0; hwrevs = strchr(ptr, ':'); - if (hwrevs) { + if (hwrevs) *(hwrevs++) = 0; - device = ptr; - } + device = ptr; } else { version = ptr; } |