wok-6.x rev 18897
syslinux/isohybrid.exe add -r support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Feb 14 22:06:06 2016 +0100 (2016-02-14) |
parents | d8f609680ee4 |
children | edf927a09cd3 |
files | fusecloop/description.txt syslinux/stuff/iso2exe/iso2exe.c syslinux/stuff/iso2exe/iso2exe.sh |
line diff
1.1 --- a/fusecloop/description.txt Sat Feb 13 16:01:41 2016 -0500 1.2 +++ b/fusecloop/description.txt Sun Feb 14 22:06:06 2016 +0100 1.3 @@ -8,6 +8,8 @@ 1.4 1.5 2- Add new V3 format to build huge cloop images. 1.6 * The index is compressed and uses 32 bits lengths instead of 64 bits offsets. 1.7 + * The length msb is set to mark a duplicate bleck and the remining bits give 1.8 + the block number. 1.9 * The index is moved to the file end. The cloop creation tool holds the index 1.10 in memory instead of the datas. This reduces memory needs by 5000. 1.11 $ genisoimage -R myDVD/ | create_compressed_fs 131072 > myDVD.cloop
2.1 --- a/syslinux/stuff/iso2exe/iso2exe.c Sat Feb 13 16:01:41 2016 -0500 2.2 +++ b/syslinux/stuff/iso2exe/iso2exe.c Sun Feb 14 22:06:06 2016 +0100 2.3 @@ -33,6 +33,7 @@ 2.4 static char tazlitoinfo[0x8000U - BOOTISOSZ]; 2.5 #define buffer tazlitoinfo 2.6 #define BUFFERSZ 2048 2.7 +#define BYTE(n) * (unsigned char *) (n) 2.8 #define WORD(n) * (unsigned short *) (n) 2.9 #define LONG(n) * (unsigned long *) (n) 2.10 2.11 @@ -493,22 +494,144 @@ 2.12 return SUCCESSMSG; 2.13 } 2.14 2.15 +static unsigned short files[] = { // to move to iso2exe.sh .... 2.16 + WIN32_EXE, /* 0 */ 2.17 + SYSLINUX_MBR, /* 1 */ 2.18 + FLAVOR_INFO, /* 2 */ 2.19 + FLOPPY_BOOT, /* 3 */ 2.20 + TAZBOOT_COM, /* 4 */ 2.21 + ROOTFS_GZ, /* 5 */ 2.22 + DOSSTUB, /* 6 */ 2.23 + BOOT_MD5, /* 7 */ 2.24 + FS_ISO, /* 8 */ 2.25 + CUSTOM_MAGIC, /* 9 */ 2.26 + CUSTOM_APPEND, /* 10 */ 2.27 + CUSTOM_INITRD /* 11 */ 2.28 +}; 2.29 + 2.30 +static long file_offset, file_size; 2.31 +static void fileofs(int number) 2.32 +{ 2.33 + unsigned long i, c, stub; 2.34 + char *s; 2.35 + 2.36 + c = getcustomsector(); 2.37 + readsector(0); 2.38 + i = 1024; 2.39 + if (WORD(buffer+1024) != 35615) i = 512 * (1 + BYTE(buffer+417)); 2.40 + stub = WORD(buffer+20) - 0xC0; 2.41 + file_size = file_offset = 0; 2.42 + switch (files[number]) { 2.43 + case WIN32_EXE: /* win32.exe */ 2.44 + if (i != 1024) file_size = i - 512; break; 2.45 + case SYSLINUX_MBR: /* syslinux.mbr */ 2.46 + if (i != 1024) file_offset = i - 512; 2.47 + file_size = 512; break; 2.48 + case FLAVOR_INFO: /* flavor.info */ 2.49 + file_offset = i; file_size = 0; break; 2.50 + case FLOPPY_BOOT: /* floppy.boot */ 2.51 + file_size = BYTE(buffer+26)*512; 2.52 + file_offset = WORD(buffer+64) - 0xC0 - file_size; break; 2.53 + case TAZBOOT_COM: /* tazboot.com */ 2.54 + file_offset = WORD(buffer+64) - 0xC0; 2.55 + file_size = stub - WORD(buffer+24) - file_offset; break; 2.56 + case ROOTFS_GZ: /* rootfs.gz */ 2.57 + file_size = WORD(buffer+24); 2.58 + file_offset = stub - file_size; break; 2.59 + case DOSSTUB: /* dosstub */ 2.60 + file_offset = stub; 2.61 + file_size = 0x8000U - file_offset; break; 2.62 + case BOOT_MD5: /* boot.md5 */ 2.63 + file_offset = 0x7FF0U; file_size = 16; break; 2.64 + case FS_ISO: /* fs.iso */ 2.65 + file_offset = 0x8000U; file_size = 2048*c - file_offset; break; 2.66 + case CUSTOM_MAGIC: /* custom.magic */ 2.67 + readsector(c); 2.68 + if (!strncmp(buffer, "#!boot", 6)) { 2.69 + file_size = 39; file_offset = 2048*c; 2.70 + }; break; 2.71 + case CUSTOM_APPEND: /* custom.append */ 2.72 + readsector(c); 2.73 + file_offset = 2048*c + 47; s = strstr(buffer, "append="); 2.74 + if (s) file_size = strchr(s,'\n') - s - 7; 2.75 + break; 2.76 + case CUSTOM_INITRD: /* custom.initrd */ 2.77 + readsector(c); 2.78 + s = strstr(buffer,"initrd:"); 2.79 + if (!s) break; 2.80 + file_size = atoi(s + 7); 2.81 + s = strchr(s,'\n') + 1; 2.82 + file_offset = 2048*c + (s - buffer); 2.83 + } 2.84 +} 2.85 + 2.86 +static void list(void) 2.87 +{ 2.88 + int num, heap = 0; 2.89 + 2.90 + for (num = 0; num < sizeof(files)/sizeof(files[0]); num++) { 2.91 + fileofs(num); 2.92 + if (file_size <= 0 || file_offset > 0x3FFFFFFFUL) continue; 2.93 + readsector(file_offset / 2048); 2.94 + if (WORD(buffer + file_offset % 2048) == 0) continue; 2.95 + if (file_offset > heap && (file_offset - heap) > 16) 2.96 + printf("%d free bytes in %04X..%04X\n", 2.97 + file_offset - heap, heap, file_offset); 2.98 + if (file_offset >= heap) heap = file_offset + file_size; 2.99 + printf("%s at %04X (%d bytes).\n", bootiso + files[num], 2.100 + file_offset, file_size); 2.101 + } 2.102 + file_offset=lseek(fd, 0UL, SEEK_END); 2.103 + if (file_offset > heap) 2.104 + printf("%d free bytes in %04X..%04X\n", 2.105 + file_offset - heap, heap, file_offset); 2.106 +} 2.107 + 2.108 +static void extract(char *name) 2.109 +{ 2.110 + int num; 2.111 + 2.112 + for (num = sizeof(files)/sizeof(files[0]) - 1; 2.113 + strcmp(name,bootiso + files[num]); num--) if (num <= 0) return; 2.114 + fileofs(num); 2.115 + if (file_size == 0) return; 2.116 + lseek(fd, file_offset, SEEK_SET); 2.117 + num = open(name, O_WRONLY|O_BINARY|O_CREAT, 0x644); 2.118 + while (file_size > 0) { 2.119 + int n = read(fd, buffer, BUFFERSZ); 2.120 + if (n <= 0) break; 2.121 + if (n > file_size) n = file_size; 2.122 + write(num,buffer,n); 2.123 + file_size -= n; 2.124 + } 2.125 + close(num); 2.126 +} 2.127 + 2.128 int main(int argc, char *argv[]) 2.129 { 2.130 int i; 2.131 char *s; 2.132 2.133 - while (argc > 2) { 2.134 + for (i = 0; argc > 2;) { 2.135 s = argv[1]; 2.136 if (*s != '-') break; 2.137 while (*s == '-') s++; 2.138 switch (*s | 0x20) { 2.139 case 'a' : append=argv[2]; break; 2.140 case 'i' : initrd=argv[2]; break; 2.141 + case 'r' : case 'l' : 2.142 + i++; argv++; argc--; continue; 2.143 } 2.144 argv += 2; 2.145 argc -= 2; 2.146 } 2.147 + if (i != 0) { 2.148 + fd = open(argv[i],O_RDONLY|O_BINARY); 2.149 + if (fd == -1) puts(bootiso + OPENERR); 2.150 + else if (argc <= 2) list(); 2.151 + else for (i = 2; i < argc; i++) extract(argv[i]); 2.152 + return 0; 2.153 + } 2.154 for (i = 2; i < argc; i++) { 2.155 char *s = argv[i]; 2.156 while ((unsigned)(*s - '-') <= ('/' - '-')) s++;
3.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh Sat Feb 13 16:01:41 2016 -0500 3.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Sun Feb 14 22:06:06 2016 +0100 3.3 @@ -315,7 +315,7 @@ 3.4 fi 3.5 done <<EOT 3.6 READSECTORERR Read sector failure. 3.7 -USAGE Usage: isohybrid.exe [--append cmdline] [--initrd file] file.iso [--forced|--undo|--quick] 3.8 +USAGE Usage: isohybrid.exe [--list|--read] [--append cmdline] [--initrd file] file.iso [--forced|--undo|--quick|filename...] 3.9 OPENERR Can't open r/w the iso file. 3.10 ELTORITOERR No EL TORITO SPECIFICATION signature. 3.11 CATALOGERR Invalid boot catalog. 3.12 @@ -326,6 +326,18 @@ 3.13 UNINSTALLMSG Uninstall done. 3.14 OPENINITRDERR Can't open the initrd file. 3.15 ALREADYEXEERR Already an EXE file. 3.16 +WIN32_EXE win32.exe 3.17 +SYSLINUX_MBR syslinux.mbr 3.18 +FLAVOR_INFO flavor.info 3.19 +FLOPPY_BOOT floppy.boot 3.20 +TAZBOOT_COM tazboot.com 3.21 +ROOTFS_GZ rootfs.gz 3.22 +DOSSTUB dosstub 3.23 +BOOT_MD5 boot.md5 3.24 +FS_ISO fs.iso 3.25 +CUSTOM_MAGIC custom.magic 3.26 +CUSTOM_APPEND custom.append 3.27 +CUSTOM_INITRD custom.initrd 3.28 EOT 3.29 done 3.30 rm -rf $DATA