wok-6.x rev 19857

syslinux/iso2exe: fix recursive_partition + hybrib_mbr
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Mar 18 09:21:47 2017 +0100 (2017-03-18)
parents a1b425e953b5
children fa2037599fb8
files linld/stuff/upx.sh syslinux/receipt syslinux/stuff/extra/fs.u syslinux/stuff/extra/keytab-lilo.u syslinux/stuff/extra/lzop-1.03-gcc6.u syslinux/stuff/iso2exe/iso2exe.sh
line diff
     1.1 --- a/linld/stuff/upx.sh	Thu Mar 16 23:07:56 2017 +0100
     1.2 +++ b/linld/stuff/upx.sh	Sat Mar 18 09:21:47 2017 +0100
     1.3 @@ -1,4 +1,12 @@
     1.4  #!/bin/sh
     1.5  
     1.6 -upx -5 $1 && echo "0  3C E8 75 FB 89 F7 AD 86 E0 29 F8 AB |" | hexdump -R | \
     1.7 -dd bs=1 seek=$(($(stat -c %s $1) - 15)) of=$1 conv=notrunc 2> /dev/null
     1.8 +upx -5 $1
     1.9 +o=$(($(stat -c %s $1) - 15))
    1.10 +if dd bs=1 skik=$o if=$1 count=15 2> /dev/null | hd | \
    1.11 +   grep -iq     "2c e8 3c 01 77 f9 c1 04  08 29 34 ad e2 f1 c3"; then
    1.12 +	echo "0  3C E8 75 FB 89 F7 AD 86  E0 29 F8 AB |" | hexdump -R | \
    1.13 +	dd bs=1 seek=$o of=$1 conv=notrunc 2> /dev/null
    1.14 +else
    1.15 +	upx -d $1 > /dev/null 2>&1
    1.16 +	upx -5 --8086 $1
    1.17 +fi
     2.1 --- a/syslinux/receipt	Thu Mar 16 23:07:56 2017 +0100
     2.2 +++ b/syslinux/receipt	Sat Mar 18 09:21:47 2017 +0100
     2.3 @@ -24,7 +24,8 @@
     2.4  	patch -p 0 < $stuff/extra/loadhigh.u
     2.5  	patch -p 0 < $stuff/extra/iso9660.u
     2.6  	patch -p 0 < $stuff/extra/readconfig.u
     2.7 -	#patch -p 0 < $stuff/extra/fs.u
     2.8 +	patch -p 0 < $stuff/extra/keytab-lilo.u
     2.9 +	patch -p 0 < $stuff/extra/lzop-1.03-gcc6.u
    2.10  	cp $stuff/tools/isohybrid.sh .
    2.11  	cp $stuff/extra/md5sum.c com32/modules
    2.12  	grep -q md5sum.c32 com32/modules/Makefile ||
     3.1 --- a/syslinux/stuff/extra/fs.u	Thu Mar 16 23:07:56 2017 +0100
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,347 +0,0 @@
     3.4 ---- core/fs/fs.c
     3.5 -+++ core/fs/fs.c
     3.6 -@@ -1,10 +1,16 @@
     3.7 -+#include <sys/file.h>
     3.8 - #include <stdio.h>
     3.9 - #include <stdbool.h>
    3.10 - #include <string.h>
    3.11 -+#include <unistd.h>
    3.12 - #include <dprintf.h>
    3.13 -+#include "core.h"
    3.14 -+#include "dev.h"
    3.15 - #include "fs.h"
    3.16 - #include "cache.h"
    3.17 - 
    3.18 -+char *PATH;
    3.19 -+
    3.20 - /* The currently mounted filesystem */
    3.21 - struct fs_info *this_fs = NULL;		/* Root filesystem */
    3.22 - 
    3.23 -@@ -76,19 +82,30 @@
    3.24 - }
    3.25 - 
    3.26 - /*
    3.27 -- * Convert between a 16-bit file handle and a file structure
    3.28 -+ * Find and open the configuration file
    3.29 -  */
    3.30 --
    3.31 --void pm_load_config(com32sys_t *regs)
    3.32 -+int open_config(void)
    3.33 - {
    3.34 --    int err;
    3.35 -+    int fd, handle;
    3.36 -+    struct file_info *fp;
    3.37 - 
    3.38 --    err = this_fs->fs_ops->load_config();
    3.39 -+    fd = opendev(&__file_dev, NULL, O_RDONLY);
    3.40 -+    if (fd < 0)
    3.41 -+	return -1;
    3.42 - 
    3.43 --    if (err)
    3.44 --	printf("ERROR: No configuration file found\n");
    3.45 -+    fp = &__file_info[fd];
    3.46 - 
    3.47 --    set_flags(regs, err ? EFLAGS_ZF : 0);
    3.48 -+    handle = this_fs->fs_ops->open_config(&fp->i.fd);
    3.49 -+    if (handle < 0) {
    3.50 -+	close(fd);
    3.51 -+	errno = ENOENT;
    3.52 -+	return -1;
    3.53 -+    }
    3.54 -+
    3.55 -+    fp->i.offset = 0;
    3.56 -+    fp->i.nbytes = 0;
    3.57 -+
    3.58 -+    return fd;
    3.59 - }
    3.60 - 
    3.61 - void pm_mangle_name(com32sys_t *regs)
    3.62 -@@ -202,11 +219,10 @@
    3.63 - 
    3.64 - int searchdir(const char *name)
    3.65 - {
    3.66 --    struct inode *inode = NULL;
    3.67 --    struct inode *parent = NULL;
    3.68 -+    static char root_name[] = "/";
    3.69 -     struct file *file;
    3.70 --    char *pathbuf = NULL;
    3.71 --    char *part, *p, echar;
    3.72 -+    char *path, *inode_name, *next_inode_name;
    3.73 -+    struct inode *tmp, *inode = NULL;
    3.74 -     int symlink_count = MAX_SYMLINK_CNT;
    3.75 - 
    3.76 -     dprintf("searchdir: %s  root: %p  cwd: %p\n",
    3.77 -@@ -228,113 +244,165 @@
    3.78 - 
    3.79 -     /* else, try the generic-path-lookup method */
    3.80 - 
    3.81 --    parent = get_inode(this_fs->cwd);
    3.82 --    p = pathbuf = strdup(name);
    3.83 --    if (!pathbuf)
    3.84 --	goto err;
    3.85 -+    /* Copy the path */
    3.86 -+    path = strdup(name);
    3.87 -+    if (!path) {
    3.88 -+	dprintf("searchdir: Couldn't copy path\n");
    3.89 -+	goto err_path;
    3.90 -+    }
    3.91 - 
    3.92 --    do {
    3.93 --    got_link:
    3.94 --	if (*p == '/') {
    3.95 --	    put_inode(parent);
    3.96 --	    parent = get_inode(this_fs->root);
    3.97 -+    /* Work with the current directory, by default */
    3.98 -+    inode = get_inode(this_fs->cwd);
    3.99 -+    if (!inode) {
   3.100 -+	dprintf("searchdir: Couldn't use current directory\n");
   3.101 -+	goto err_curdir;
   3.102 -+    }
   3.103 -+
   3.104 -+    for (inode_name = path; inode_name; inode_name = next_inode_name) {
   3.105 -+	/* Root directory? */
   3.106 -+	if (inode_name[0] == '/') {
   3.107 -+	    next_inode_name = inode_name + 1;
   3.108 -+	    inode_name = root_name;
   3.109 -+	} else {
   3.110 -+	    /* Find the next inode name */
   3.111 -+	    next_inode_name = strchr(inode_name + 1, '/');
   3.112 -+	    if (next_inode_name) {
   3.113 -+		/* Terminate the current inode name and point to next */
   3.114 -+		*next_inode_name++ = '\0';
   3.115 -+	    }
   3.116 - 	}
   3.117 -+	if (next_inode_name) {
   3.118 -+	    /* Advance beyond redundant slashes */
   3.119 -+	    while (*next_inode_name == '/')
   3.120 -+		next_inode_name++;
   3.121 - 
   3.122 --	do {
   3.123 --	    inode = get_inode(parent);
   3.124 -+	    /* Check if we're at the end */
   3.125 -+	    if (*next_inode_name == '\0')
   3.126 -+		next_inode_name = NULL;
   3.127 -+	}
   3.128 -+	dprintf("searchdir: inode_name: %s\n", inode_name);
   3.129 -+	if (next_inode_name)
   3.130 -+	    dprintf("searchdir: Remaining: %s\n", next_inode_name);
   3.131 - 
   3.132 --	    while (*p == '/')
   3.133 --		p++;
   3.134 -+	/* Root directory? */
   3.135 -+	if (inode_name[0] == '/') {
   3.136 -+	    /* Release any chain that's already been established */
   3.137 -+	    put_inode(inode);
   3.138 -+	    inode = get_inode(this_fs->root);
   3.139 -+	    continue;
   3.140 -+	}
   3.141 - 
   3.142 --	    if (!*p)
   3.143 --		break;
   3.144 -+	/* Current directory? */
   3.145 -+	if (!strncmp(inode_name, ".", sizeof "."))
   3.146 -+	    continue;
   3.147 - 
   3.148 --	    part = p;
   3.149 --	    while ((echar = *p) && echar != '/')
   3.150 --		p++;
   3.151 --	    *p++ = '\0';
   3.152 -+	/* Parent directory? */
   3.153 -+	if (!strncmp(inode_name, "..", sizeof "..")) {
   3.154 -+	    /* If there is no parent, just ignore it */
   3.155 -+	    if (!inode->parent)
   3.156 -+		continue;
   3.157 - 
   3.158 --	    if (part[0] == '.' && part[1] == '.' && part[2] == '\0') {
   3.159 --		if (inode->parent) {
   3.160 --		    put_inode(parent);
   3.161 --		    parent = get_inode(inode->parent);
   3.162 --		    put_inode(inode);
   3.163 --		    inode = NULL;
   3.164 --		    if (!echar) {
   3.165 --			/* Terminal double dots */
   3.166 --			inode = parent;
   3.167 --			parent = inode->parent ?
   3.168 --			    get_inode(inode->parent) : NULL;
   3.169 --		    }
   3.170 --		}
   3.171 --	    } else if (part[0] != '.' || part[1] != '\0') {
   3.172 --		inode = this_fs->fs_ops->iget(part, parent);
   3.173 --		if (!inode)
   3.174 --		    goto err;
   3.175 --		if (inode->mode == DT_LNK) {
   3.176 --		    char *linkbuf, *q;
   3.177 --		    int name_len = echar ? strlen(p) : 0;
   3.178 --		    int total_len = inode->size + name_len + 2;
   3.179 --		    int link_len;
   3.180 -+	    /* Add a reference to the parent so we can release the child */
   3.181 -+	    tmp = get_inode(inode->parent);
   3.182 - 
   3.183 --		    if (!this_fs->fs_ops->readlink ||
   3.184 --			--symlink_count == 0       ||      /* limit check */
   3.185 --			total_len > MAX_SYMLINK_BUF)
   3.186 --			goto err;
   3.187 -+	    /* Releasing the child will drop the parent back down to 1 */
   3.188 -+	    put_inode(inode);
   3.189 - 
   3.190 --		    linkbuf = malloc(total_len);
   3.191 --		    if (!linkbuf)
   3.192 --			goto err;
   3.193 -+	    inode = tmp;
   3.194 -+	    continue;
   3.195 -+	}
   3.196 - 
   3.197 --		    link_len = this_fs->fs_ops->readlink(inode, linkbuf);
   3.198 --		    if (link_len <= 0) {
   3.199 --			free(linkbuf);
   3.200 --			goto err;
   3.201 --		    }
   3.202 -+	/* Anything else */
   3.203 -+	tmp = inode;
   3.204 -+	inode = this_fs->fs_ops->iget(inode_name, inode);
   3.205 -+	if (!inode) {
   3.206 -+	    /* Failure.  Release the chain */
   3.207 -+	    put_inode(tmp);
   3.208 -+	    break;
   3.209 -+	}
   3.210 - 
   3.211 --		    q = linkbuf + link_len;
   3.212 -+	/* Sanity-check */
   3.213 -+	if (inode->parent && inode->parent != tmp) {
   3.214 -+	    dprintf("searchdir: iget returned a different parent\n");
   3.215 -+	    put_inode(inode);
   3.216 -+	    inode = NULL;
   3.217 -+	    put_inode(tmp);
   3.218 -+	    break;
   3.219 -+	}
   3.220 -+	inode->parent = tmp;
   3.221 -+	inode->name = strdup(inode_name);
   3.222 -+	dprintf("searchdir: path component: %s\n", inode->name);
   3.223 - 
   3.224 --		    if (echar) {
   3.225 --			if (link_len > 0 && q[-1] != '/')
   3.226 --			    *q++ = '/';
   3.227 -+	/* Symlink handling */
   3.228 -+	if (inode->mode == DT_LNK) {
   3.229 -+	    char *new_path;
   3.230 -+	    int new_len, copied;
   3.231 - 
   3.232 --			memcpy(q, p, name_len+1);
   3.233 --		    } else {
   3.234 --			*q = '\0';
   3.235 --		    }
   3.236 -+	    /* target path + NUL */
   3.237 -+	    new_len = inode->size + 1;
   3.238 - 
   3.239 --		    free(pathbuf);
   3.240 --		    p = pathbuf = linkbuf;
   3.241 --		    put_inode(inode);
   3.242 --		    inode = NULL;
   3.243 --		    goto got_link;
   3.244 --		}
   3.245 -+	    if (next_inode_name) {
   3.246 -+		/* target path + slash + remaining + NUL */
   3.247 -+		new_len += strlen(next_inode_name) + 1;
   3.248 -+	    }
   3.249 - 
   3.250 --		inode->name = strdup(part);
   3.251 --		dprintf("path component: %s\n", inode->name);
   3.252 -+	    if (!this_fs->fs_ops->readlink ||
   3.253 -+		/* limit checks */
   3.254 -+		--symlink_count == 0 ||
   3.255 -+		new_len > MAX_SYMLINK_BUF)
   3.256 -+		goto err_new_len;
   3.257 - 
   3.258 --		inode->parent = parent;
   3.259 --		parent = NULL;
   3.260 -+	    new_path = malloc(new_len);
   3.261 -+	    if (!new_path)
   3.262 -+		goto err_new_path;
   3.263 - 
   3.264 --		if (!echar)
   3.265 --		    break;
   3.266 -+	    copied = this_fs->fs_ops->readlink(inode, new_path);
   3.267 -+	    if (copied <= 0)
   3.268 -+		goto err_copied;
   3.269 -+	    new_path[copied] = '\0';
   3.270 -+	    dprintf("searchdir: Symlink: %s\n", new_path);
   3.271 - 
   3.272 --		if (inode->mode != DT_DIR)
   3.273 --		    goto err;
   3.274 --
   3.275 --		parent = inode;
   3.276 --		inode = NULL;
   3.277 -+	    if (next_inode_name) {
   3.278 -+		new_path[copied] = '/';
   3.279 -+		strcpy(new_path + copied + 1, next_inode_name);
   3.280 -+		dprintf("searchdir: New path: %s\n", new_path);
   3.281 - 	    }
   3.282 --	} while (echar);
   3.283 --    } while (0);
   3.284 - 
   3.285 --    free(pathbuf);
   3.286 --    pathbuf = NULL;
   3.287 --    put_inode(parent);
   3.288 --    parent = NULL;
   3.289 -+	    free(path);
   3.290 -+	    path = next_inode_name = new_path;
   3.291 - 
   3.292 --    if (!inode)
   3.293 -+            /* Add a reference to the parent so we can release the child */
   3.294 -+            tmp = get_inode(inode->parent);
   3.295 -+
   3.296 -+            /* Releasing the child will drop the parent back down to 1 */
   3.297 -+            put_inode(inode);
   3.298 -+
   3.299 -+            inode = tmp;
   3.300 -+	    continue;
   3.301 -+err_copied:
   3.302 -+	    free(new_path);
   3.303 -+err_new_path:
   3.304 -+err_new_len:
   3.305 -+	    put_inode(inode);
   3.306 -+	    inode = NULL;
   3.307 -+	    break;
   3.308 -+	}
   3.309 -+
   3.310 -+	/* If there's more to process, this should be a directory */
   3.311 -+	if (next_inode_name && inode->mode != DT_DIR) {
   3.312 -+	    dprintf("searchdir: Expected a directory\n");
   3.313 -+	    put_inode(inode);
   3.314 -+	    inode = NULL;
   3.315 -+	    break;
   3.316 -+	}
   3.317 -+    }
   3.318 -+err_curdir:
   3.319 -+    free(path);
   3.320 -+err_path:
   3.321 -+    if (!inode) {
   3.322 -+	dprintf("searchdir: Not found\n");
   3.323 - 	goto err;
   3.324 -+    }
   3.325 - 
   3.326 -     file->inode  = inode;
   3.327 -     file->offset = 0;
   3.328 -@@ -342,10 +410,6 @@
   3.329 -     return file_to_handle(file);
   3.330 - 
   3.331 - err:
   3.332 --    put_inode(inode);
   3.333 --    put_inode(parent);
   3.334 --    if (pathbuf)
   3.335 --	free(pathbuf);
   3.336 -     _close_file(file);
   3.337 - err_no_close:
   3.338 -     return -1;
   3.339 -@@ -483,6 +547,11 @@
   3.340 - 	fs.root = fs.fs_ops->iget_root(&fs);
   3.341 - 	fs.cwd = get_inode(fs.root);
   3.342 - 	dprintf("init: root inode %p, cwd inode %p\n", fs.root, fs.cwd);
   3.343 -+    }
   3.344 -+
   3.345 -+    if (fs.fs_ops->chdir_start) {
   3.346 -+	    if (fs.fs_ops->chdir_start() < 0)
   3.347 -+		    printf("Failed to chdir to start directory\n");
   3.348 -     }
   3.349 - 
   3.350 -     SectorShift = fs.sector_shift;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/syslinux/stuff/extra/keytab-lilo.u	Sat Mar 18 09:21:47 2017 +0100
     4.3 @@ -0,0 +1,15 @@
     4.4 +kbd 2.0.3 support
     4.5 +--- utils/keytab-lilo
     4.6 ++++ utils/keytab-lilo
     4.7 +@@ -48,9 +48,9 @@
     4.8 +     $empty = 1;
     4.9 +     while (<FILE>) {
    4.10 + 	chop;
    4.11 +-	if (/^(static\s+)?u_short\s+(\S+)_map\[\S*\]\s+=\s+{\s*$/) {
    4.12 ++	if (/^(static\s+)?(u_|unsigned )short\s+(\S+)_map\[\S*\]\s+=\s+{\s*$/) {
    4.13 + 	    die "active at beginning of map" if defined $current;
    4.14 +-	    $current = $pfx.":".$2;
    4.15 ++	    $current = $pfx.":".$3;
    4.16 + 	    next;
    4.17 + 	}
    4.18 + 	undef $current if /^};\s*$/;
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/syslinux/stuff/extra/lzop-1.03-gcc6.u	Sat Mar 18 09:21:47 2017 +0100
     5.3 @@ -0,0 +1,37 @@
     5.4 +gcc-6 has additional errors e.g.
     5.5 +
     5.6 +./test.c:1:12: error: variably modified '__acc_cta' at file scope
     5.7 + extern int __acc_cta[1-2*!((1l << (8*8 -1)) < 0)];
     5.8 +            ^~~~~~~~~
     5.9 +
    5.10 +This is rightly pointed out since that index is undefined
    5.11 +
    5.12 +Signed-off-by: Khem Raj <raj.khem@gmail.com>
    5.13 +Upstream-Status: Pending
    5.14 +
    5.15 +--- lzo/src/miniacc.h	2016-02-10 16:09:23.247315866 +0100
    5.16 ++++ lzo/src/miniacc.h	2016-02-10 16:12:14.973297054 +0100
    5.17 +@@ -4469,12 +4469,12 @@
    5.18 + #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150)
    5.19 + #elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
    5.20 + #else
    5.21 +-    ACCCHK_ASSERT((1   << (8*SIZEOF_INT-1)) < 0)
    5.22 ++    ACCCHK_ASSERT((int)(1u   << (8*SIZEOF_INT-1)) < 0)
    5.23 + #endif
    5.24 +     ACCCHK_ASSERT((1u  << (8*SIZEOF_INT-1)) > 0)
    5.25 + #if 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
    5.26 + #else
    5.27 +-    ACCCHK_ASSERT((1l  << (8*SIZEOF_LONG-1)) < 0)
    5.28 ++    ACCCHK_ASSERT((long)(1ul  << (8*SIZEOF_LONG-1)) < 0)
    5.29 + #endif
    5.30 +     ACCCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0)
    5.31 + #if defined(acc_int16e_t)
    5.32 +@@ -4646,7 +4646,7 @@
    5.33 + #elif 1 && (ACC_CC_LCC || ACC_CC_LCCWIN32) && !defined(ACCCHK_CFG_PEDANTIC)
    5.34 + #elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
    5.35 + #elif !defined(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
    5.36 +-    ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
    5.37 ++    ACCCHK_ASSERT( (int)((unsigned int)((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
    5.38 + #endif
    5.39 + #if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0530) && (__BORLANDC__ < 0x0560))
    5.40 + #  pragma option pop
     6.1 --- a/syslinux/stuff/iso2exe/iso2exe.sh	Thu Mar 16 23:07:56 2017 +0100
     6.2 +++ b/syslinux/stuff/iso2exe/iso2exe.sh	Sat Mar 18 09:21:47 2017 +0100
     6.3 @@ -116,7 +116,7 @@
     6.4  		ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc
     6.5  	fi
     6.6  	rm -f /tmp/exe$$ /tmp/coff$$
     6.7 -	if [ -z "$RECURSIVE_PARTITION" ]; then
     6.8 +	if [ -z "$RECURSIVE_PARTITION" -a $(get 470 $1 4) -eq 0 ]; then
     6.9  		store 464 $((1+$i/512)) $1 8
    6.10  		store 470 $(($i/512)) $1 8
    6.11  		store 474 $(($(get 474 $1 4) - $i/512)) $1 32
    6.12 @@ -262,6 +262,15 @@
    6.13  		ddq bs=1 conv=notrunc if="$1" of="$1" skip=$((0x1BE)) seek=0 count=3
    6.14  		ddq bs=1 skip=$((0x1BE)) count=66 if="$2" | \
    6.15  			ddq bs=1 seek=$((0x1BE)) count=66 of="$1" conv=notrunc
    6.16 +		if [ -n "$RECURSIVE_PARTITION" ]; then
    6.17 +			for i in 0 1 2 3 ; do
    6.18 +				n=$(get $((0x1C6+16*i)) $1 4)
    6.19 +				[ $n -eq 0 -o $n -gt 64 ] && continue
    6.20 +				store $((0x1C0+16*i)) 1 $1 8
    6.21 +				store $((0x1C6+16*i)) 0 $1 32
    6.22 +				store $((0x1CA+16*i)) $(($(get $((0x1CA+16*i)) $1 4)+$n)) $1 32
    6.23 +			done
    6.24 +		fi
    6.25  	fi
    6.26  }
    6.27