Hi, As I have not seen any confirmation yet on the list, I just wanted to let you know that sdi.c32 works fine here, at least as fine as my initial syslinux-2.11 asm patch. I only use XPe SDI images with the following structure (of course PART blob size can vary): Type Offset Size Base Address Attr ---- ------------------- ------------------- ------------------- ---------- BOOT 0x00000000.00001000 0x00000000.00005EC2 0x00000000.00000000 0x00000000 PART 0x00000000.00007000 0x00000000.170A6000 0x00000000.00000007 0x00000000 LOAD 0x00000000.170AD000 0x00000000.00034400 0x00000000.00000000 0x00000000 To make things more fun, I booted with gpxelinux.0 and loaded the SDI image by HTTP without any problem, amazing work there ! I would just suggest to use zloadfile to support gzipped SDI images, as images with uncompressed NTFS or free space can have an interesting compression ratio (I personally blank free space by copying the PART blob with ntfsclone). Associated with gpxelinux/HTTP, this would make pxelinux a very fast SDI loader. A last, if you want, you can use my patch doc as a basis to initiate an sdi.c32 documentation (this would almost just require to update the pxelinux.cfg/default configuration part and warning/error messages): http://remile.free.fr/syslinux/sdi.txt I will update it soon to point to mainline syslinux with SDI support. Kind regards, R?mi Lefevre
Hi, Peter and Remi, thank you a lot! We still have a little political issue, about checking the header checksum: http://skolk.livejournal.com/886.html http://syslinux.zytor.com/archives/2008-April/009878.html Because it covers only first 512 bytes, and there are no other checksums, it's not usable for error detection. But the checksum can be used in addition to $SDI magic to verify format. The political question is do we need to check it. Best regards, Sergii Kolisnyk
And my formatting tab settings were not the same as com32 code, so sorry for the flood... SDIheader variable names and checksum algo are from http://skolk.livejournal.com/ diff -urN com32/modules/sdi.c.ini com32/modules/sdi.c --- com32/modules/sdi.c.ini 2008-09-03 15:32:27.000000000 +0200 +++ com32/modules/sdi.c 2008-09-03 17:26:00.000000000 +0200 @@ -39,12 +39,25 @@ # define dprintf(f, ...) ((void)0) #endif +typedef uint8_t guid_t[16]; + struct SDIHeader { uint32_t Signature; char Version[4]; uint64_t SDIReserved; uint64_t BootCodeOffset; uint64_t BootCodeSize; + uint64_t VendorID; + uint64_t DeviceID; + guid_t DeviceModel; + uint64_t DeviceRole; + uint64_t Reserved1; + guid_t RuntimeGUID; + uint64_t RuntimeOEMrev; + uint64_t Reserved2; + uint64_t PageAlignment; /* BLOB alignment value in pages */ + uint64_t Reserved3[48]; + uint64_t Checksum; }; #define SDI_LOAD_ADDR (16 << 20) /* 16 MB */ @@ -139,6 +152,21 @@ return -1; } +/* + * Check that the sum of all bytes from first 512 bytes (SDI header) + * is 0 modulo 256. + */ +int has_valid_header(unsigned char *header) +{ + unsigned char checksum; + unsigned int i; + + checksum = 0; + for (i = 0; i < sizeof(struct SDIHeader); i++) + checksum += header[i]; + return (!checksum); +} + int main(int argc, char *argv[]) { void *data; @@ -160,6 +188,11 @@ } fputs("ok\n", stdout); + if (!has_valid_header(data)) { + error("SDI header is corrupted\n"); + return 1; + } + boot_sdi(data, data_len); error("Invalid SDI file or insufficient memory\n"); return 1;