Fiasco image: Allow to specify device string without hw revision (then image is valid for all hw revisions). Generating images should be complete!

This commit is contained in:
Pali Rohár committed 2012-06-23 17:01:48 +02:00
1 parent 9195f3c7da
commit 2110196958
2 files changed
+20 -19

No files matched your search

+16 -15
View File
@@ -459,22 +459,24 @@ int fiasco_add(int fd, const char *name, const char *file, const char *layout, c
write(fd, device, len); write(fd, device, len);
for (i=0; i<16-len; ++i) for (i=0; i<16-len; ++i)
write(fd, "\x00", 1); write(fd, "\x00", 1);
ptr = hwrevs; if (hwrevs) {
oldptr = hwrevs; ptr = hwrevs;
while ((ptr = strchr(ptr, ','))) { oldptr = hwrevs;
len = ptr-oldptr; 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; if (len > 8) len = 8;
write(fd, oldptr, len); write(fd, oldptr, len);
for (i=0; i<8-len; ++i) for (i=0; i<8-len; ++i)
write(fd, "\x00", 1); 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 */ /* append layout subsection */
@@ -554,7 +556,7 @@ int fiasco_pack(int optind, char *argv[])
if (strncmp(arg, "version:", strlen("version:"))==0) if (strncmp(arg, "version:", strlen("version:"))==0)
continue; continue;
// format: [[[[dev:hw:]ver:]type:]file[%layout] // format: [[[[dev:[hw:]]ver:]type:]file[%layout]
ptr = strdup(arg); ptr = strdup(arg);
layout = strchr(ptr, '%'); layout = strchr(ptr, '%');
if (layout) { if (layout) {
@@ -576,10 +578,9 @@ int fiasco_pack(int optind, char *argv[])
if (version) { if (version) {
*(version++) = 0; *(version++) = 0;
hwrevs = strchr(ptr, ':'); hwrevs = strchr(ptr, ':');
if (hwrevs) { if (hwrevs)
*(hwrevs++) = 0; *(hwrevs++) = 0;
device = ptr; device = ptr;
}
} else { } else {
version = ptr; version = ptr;
} }
+4 -4
View File
@@ -112,9 +112,9 @@ void show_usage()
printf ("Image specification:\n" printf ("Image specification:\n"
" -p [arg] specify normal image\n" " -p [arg] specify normal image\n"
" arg is [[[dev:hw:]ver:]type:]file[%%layout]\n" " arg is [[[dev:[hw:]]ver:]type:]file[%%layout]\n"
" hw is device HW revision\n" " hw is device HW revision\n"
" dev is device string\n" " dev is device name string\n"
" ver is image version string\n" " ver is image version string\n"
" type is image type\n" " type is image type\n"
" file is image file name\n" " file is image file name\n"
@@ -169,9 +169,9 @@ void show_usage()
" -i show device information (let standby mode)\n" " -i show device information (let standby mode)\n"
" -l list supported usb device ids\n" " -l list supported usb device ids\n"
" -p format piece-of-firmware\n" " -p format piece-of-firmware\n"
" piece format: [[[[dev:hw:]ver:]type:]file[%%layout]\n" " piece format: [[[[dev:[hw:]]ver:]type:]file[%%layout]\n"
" hw is device HW revision\n" " hw is device HW revision\n"
" dev is device string\n" " dev is device name string\n"
" ver is image version string\n" " ver is image version string\n"
" type is image type\n" " type is image type\n"
" file is image file name\n" " file is image file name\n"