# HG changeset patch # User Pascal Bellard # Date 1489825307 -3600 # Node ID d070ffff2c8159892bf2ec77c9cf41efa4c5b8c4 # Parent a1b425e953b55b19d0b0dc9a1236a5893878665a syslinux/iso2exe: fix recursive_partition + hybrib_mbr diff -r a1b425e953b5 -r d070ffff2c81 linld/stuff/upx.sh --- a/linld/stuff/upx.sh Thu Mar 16 23:07:56 2017 +0100 +++ b/linld/stuff/upx.sh Sat Mar 18 09:21:47 2017 +0100 @@ -1,4 +1,12 @@ #!/bin/sh -upx -5 $1 && echo "0 3C E8 75 FB 89 F7 AD 86 E0 29 F8 AB |" | hexdump -R | \ -dd bs=1 seek=$(($(stat -c %s $1) - 15)) of=$1 conv=notrunc 2> /dev/null +upx -5 $1 +o=$(($(stat -c %s $1) - 15)) +if dd bs=1 skik=$o if=$1 count=15 2> /dev/null | hd | \ + grep -iq "2c e8 3c 01 77 f9 c1 04 08 29 34 ad e2 f1 c3"; then + echo "0 3C E8 75 FB 89 F7 AD 86 E0 29 F8 AB |" | hexdump -R | \ + dd bs=1 seek=$o of=$1 conv=notrunc 2> /dev/null +else + upx -d $1 > /dev/null 2>&1 + upx -5 --8086 $1 +fi diff -r a1b425e953b5 -r d070ffff2c81 syslinux/receipt --- a/syslinux/receipt Thu Mar 16 23:07:56 2017 +0100 +++ b/syslinux/receipt Sat Mar 18 09:21:47 2017 +0100 @@ -24,7 +24,8 @@ patch -p 0 < $stuff/extra/loadhigh.u patch -p 0 < $stuff/extra/iso9660.u patch -p 0 < $stuff/extra/readconfig.u - #patch -p 0 < $stuff/extra/fs.u + patch -p 0 < $stuff/extra/keytab-lilo.u + patch -p 0 < $stuff/extra/lzop-1.03-gcc6.u cp $stuff/tools/isohybrid.sh . cp $stuff/extra/md5sum.c com32/modules grep -q md5sum.c32 com32/modules/Makefile || diff -r a1b425e953b5 -r d070ffff2c81 syslinux/stuff/extra/fs.u --- a/syslinux/stuff/extra/fs.u Thu Mar 16 23:07:56 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +0,0 @@ ---- core/fs/fs.c -+++ core/fs/fs.c -@@ -1,10 +1,16 @@ -+#include - #include - #include - #include -+#include - #include -+#include "core.h" -+#include "dev.h" - #include "fs.h" - #include "cache.h" - -+char *PATH; -+ - /* The currently mounted filesystem */ - struct fs_info *this_fs = NULL; /* Root filesystem */ - -@@ -76,19 +82,30 @@ - } - - /* -- * Convert between a 16-bit file handle and a file structure -+ * Find and open the configuration file - */ -- --void pm_load_config(com32sys_t *regs) -+int open_config(void) - { -- int err; -+ int fd, handle; -+ struct file_info *fp; - -- err = this_fs->fs_ops->load_config(); -+ fd = opendev(&__file_dev, NULL, O_RDONLY); -+ if (fd < 0) -+ return -1; - -- if (err) -- printf("ERROR: No configuration file found\n"); -+ fp = &__file_info[fd]; - -- set_flags(regs, err ? EFLAGS_ZF : 0); -+ handle = this_fs->fs_ops->open_config(&fp->i.fd); -+ if (handle < 0) { -+ close(fd); -+ errno = ENOENT; -+ return -1; -+ } -+ -+ fp->i.offset = 0; -+ fp->i.nbytes = 0; -+ -+ return fd; - } - - void pm_mangle_name(com32sys_t *regs) -@@ -202,11 +219,10 @@ - - int searchdir(const char *name) - { -- struct inode *inode = NULL; -- struct inode *parent = NULL; -+ static char root_name[] = "/"; - struct file *file; -- char *pathbuf = NULL; -- char *part, *p, echar; -+ char *path, *inode_name, *next_inode_name; -+ struct inode *tmp, *inode = NULL; - int symlink_count = MAX_SYMLINK_CNT; - - dprintf("searchdir: %s root: %p cwd: %p\n", -@@ -228,113 +244,165 @@ - - /* else, try the generic-path-lookup method */ - -- parent = get_inode(this_fs->cwd); -- p = pathbuf = strdup(name); -- if (!pathbuf) -- goto err; -+ /* Copy the path */ -+ path = strdup(name); -+ if (!path) { -+ dprintf("searchdir: Couldn't copy path\n"); -+ goto err_path; -+ } - -- do { -- got_link: -- if (*p == '/') { -- put_inode(parent); -- parent = get_inode(this_fs->root); -+ /* Work with the current directory, by default */ -+ inode = get_inode(this_fs->cwd); -+ if (!inode) { -+ dprintf("searchdir: Couldn't use current directory\n"); -+ goto err_curdir; -+ } -+ -+ for (inode_name = path; inode_name; inode_name = next_inode_name) { -+ /* Root directory? */ -+ if (inode_name[0] == '/') { -+ next_inode_name = inode_name + 1; -+ inode_name = root_name; -+ } else { -+ /* Find the next inode name */ -+ next_inode_name = strchr(inode_name + 1, '/'); -+ if (next_inode_name) { -+ /* Terminate the current inode name and point to next */ -+ *next_inode_name++ = '\0'; -+ } - } -+ if (next_inode_name) { -+ /* Advance beyond redundant slashes */ -+ while (*next_inode_name == '/') -+ next_inode_name++; - -- do { -- inode = get_inode(parent); -+ /* Check if we're at the end */ -+ if (*next_inode_name == '\0') -+ next_inode_name = NULL; -+ } -+ dprintf("searchdir: inode_name: %s\n", inode_name); -+ if (next_inode_name) -+ dprintf("searchdir: Remaining: %s\n", next_inode_name); - -- while (*p == '/') -- p++; -+ /* Root directory? */ -+ if (inode_name[0] == '/') { -+ /* Release any chain that's already been established */ -+ put_inode(inode); -+ inode = get_inode(this_fs->root); -+ continue; -+ } - -- if (!*p) -- break; -+ /* Current directory? */ -+ if (!strncmp(inode_name, ".", sizeof ".")) -+ continue; - -- part = p; -- while ((echar = *p) && echar != '/') -- p++; -- *p++ = '\0'; -+ /* Parent directory? */ -+ if (!strncmp(inode_name, "..", sizeof "..")) { -+ /* If there is no parent, just ignore it */ -+ if (!inode->parent) -+ continue; - -- if (part[0] == '.' && part[1] == '.' && part[2] == '\0') { -- if (inode->parent) { -- put_inode(parent); -- parent = get_inode(inode->parent); -- put_inode(inode); -- inode = NULL; -- if (!echar) { -- /* Terminal double dots */ -- inode = parent; -- parent = inode->parent ? -- get_inode(inode->parent) : NULL; -- } -- } -- } else if (part[0] != '.' || part[1] != '\0') { -- inode = this_fs->fs_ops->iget(part, parent); -- if (!inode) -- goto err; -- if (inode->mode == DT_LNK) { -- char *linkbuf, *q; -- int name_len = echar ? strlen(p) : 0; -- int total_len = inode->size + name_len + 2; -- int link_len; -+ /* Add a reference to the parent so we can release the child */ -+ tmp = get_inode(inode->parent); - -- if (!this_fs->fs_ops->readlink || -- --symlink_count == 0 || /* limit check */ -- total_len > MAX_SYMLINK_BUF) -- goto err; -+ /* Releasing the child will drop the parent back down to 1 */ -+ put_inode(inode); - -- linkbuf = malloc(total_len); -- if (!linkbuf) -- goto err; -+ inode = tmp; -+ continue; -+ } - -- link_len = this_fs->fs_ops->readlink(inode, linkbuf); -- if (link_len <= 0) { -- free(linkbuf); -- goto err; -- } -+ /* Anything else */ -+ tmp = inode; -+ inode = this_fs->fs_ops->iget(inode_name, inode); -+ if (!inode) { -+ /* Failure. Release the chain */ -+ put_inode(tmp); -+ break; -+ } - -- q = linkbuf + link_len; -+ /* Sanity-check */ -+ if (inode->parent && inode->parent != tmp) { -+ dprintf("searchdir: iget returned a different parent\n"); -+ put_inode(inode); -+ inode = NULL; -+ put_inode(tmp); -+ break; -+ } -+ inode->parent = tmp; -+ inode->name = strdup(inode_name); -+ dprintf("searchdir: path component: %s\n", inode->name); - -- if (echar) { -- if (link_len > 0 && q[-1] != '/') -- *q++ = '/'; -+ /* Symlink handling */ -+ if (inode->mode == DT_LNK) { -+ char *new_path; -+ int new_len, copied; - -- memcpy(q, p, name_len+1); -- } else { -- *q = '\0'; -- } -+ /* target path + NUL */ -+ new_len = inode->size + 1; - -- free(pathbuf); -- p = pathbuf = linkbuf; -- put_inode(inode); -- inode = NULL; -- goto got_link; -- } -+ if (next_inode_name) { -+ /* target path + slash + remaining + NUL */ -+ new_len += strlen(next_inode_name) + 1; -+ } - -- inode->name = strdup(part); -- dprintf("path component: %s\n", inode->name); -+ if (!this_fs->fs_ops->readlink || -+ /* limit checks */ -+ --symlink_count == 0 || -+ new_len > MAX_SYMLINK_BUF) -+ goto err_new_len; - -- inode->parent = parent; -- parent = NULL; -+ new_path = malloc(new_len); -+ if (!new_path) -+ goto err_new_path; - -- if (!echar) -- break; -+ copied = this_fs->fs_ops->readlink(inode, new_path); -+ if (copied <= 0) -+ goto err_copied; -+ new_path[copied] = '\0'; -+ dprintf("searchdir: Symlink: %s\n", new_path); - -- if (inode->mode != DT_DIR) -- goto err; -- -- parent = inode; -- inode = NULL; -+ if (next_inode_name) { -+ new_path[copied] = '/'; -+ strcpy(new_path + copied + 1, next_inode_name); -+ dprintf("searchdir: New path: %s\n", new_path); - } -- } while (echar); -- } while (0); - -- free(pathbuf); -- pathbuf = NULL; -- put_inode(parent); -- parent = NULL; -+ free(path); -+ path = next_inode_name = new_path; - -- if (!inode) -+ /* Add a reference to the parent so we can release the child */ -+ tmp = get_inode(inode->parent); -+ -+ /* Releasing the child will drop the parent back down to 1 */ -+ put_inode(inode); -+ -+ inode = tmp; -+ continue; -+err_copied: -+ free(new_path); -+err_new_path: -+err_new_len: -+ put_inode(inode); -+ inode = NULL; -+ break; -+ } -+ -+ /* If there's more to process, this should be a directory */ -+ if (next_inode_name && inode->mode != DT_DIR) { -+ dprintf("searchdir: Expected a directory\n"); -+ put_inode(inode); -+ inode = NULL; -+ break; -+ } -+ } -+err_curdir: -+ free(path); -+err_path: -+ if (!inode) { -+ dprintf("searchdir: Not found\n"); - goto err; -+ } - - file->inode = inode; - file->offset = 0; -@@ -342,10 +410,6 @@ - return file_to_handle(file); - - err: -- put_inode(inode); -- put_inode(parent); -- if (pathbuf) -- free(pathbuf); - _close_file(file); - err_no_close: - return -1; -@@ -483,6 +547,11 @@ - fs.root = fs.fs_ops->iget_root(&fs); - fs.cwd = get_inode(fs.root); - dprintf("init: root inode %p, cwd inode %p\n", fs.root, fs.cwd); -+ } -+ -+ if (fs.fs_ops->chdir_start) { -+ if (fs.fs_ops->chdir_start() < 0) -+ printf("Failed to chdir to start directory\n"); - } - - SectorShift = fs.sector_shift; diff -r a1b425e953b5 -r d070ffff2c81 syslinux/stuff/extra/keytab-lilo.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syslinux/stuff/extra/keytab-lilo.u Sat Mar 18 09:21:47 2017 +0100 @@ -0,0 +1,15 @@ +kbd 2.0.3 support +--- utils/keytab-lilo ++++ utils/keytab-lilo +@@ -48,9 +48,9 @@ + $empty = 1; + while () { + chop; +- if (/^(static\s+)?u_short\s+(\S+)_map\[\S*\]\s+=\s+{\s*$/) { ++ if (/^(static\s+)?(u_|unsigned )short\s+(\S+)_map\[\S*\]\s+=\s+{\s*$/) { + die "active at beginning of map" if defined $current; +- $current = $pfx.":".$2; ++ $current = $pfx.":".$3; + next; + } + undef $current if /^};\s*$/; diff -r a1b425e953b5 -r d070ffff2c81 syslinux/stuff/extra/lzop-1.03-gcc6.u --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/syslinux/stuff/extra/lzop-1.03-gcc6.u Sat Mar 18 09:21:47 2017 +0100 @@ -0,0 +1,37 @@ +gcc-6 has additional errors e.g. + +./test.c:1:12: error: variably modified '__acc_cta' at file scope + extern int __acc_cta[1-2*!((1l << (8*8 -1)) < 0)]; + ^~~~~~~~~ + +This is rightly pointed out since that index is undefined + +Signed-off-by: Khem Raj +Upstream-Status: Pending + +--- lzo/src/miniacc.h 2016-02-10 16:09:23.247315866 +0100 ++++ lzo/src/miniacc.h 2016-02-10 16:12:14.973297054 +0100 +@@ -4469,12 +4469,12 @@ + #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150) + #elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC) + #else +- ACCCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0) ++ ACCCHK_ASSERT((int)(1u << (8*SIZEOF_INT-1)) < 0) + #endif + ACCCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0) + #if 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC) + #else +- ACCCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0) ++ ACCCHK_ASSERT((long)(1ul << (8*SIZEOF_LONG-1)) < 0) + #endif + ACCCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0) + #if defined(acc_int16e_t) +@@ -4646,7 +4646,7 @@ + #elif 1 && (ACC_CC_LCC || ACC_CC_LCCWIN32) && !defined(ACCCHK_CFG_PEDANTIC) + #elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC) + #elif !defined(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1) +- ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0) ++ ACCCHK_ASSERT( (int)((unsigned int)((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0) + #endif + #if (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0530) && (__BORLANDC__ < 0x0560)) + # pragma option pop diff -r a1b425e953b5 -r d070ffff2c81 syslinux/stuff/iso2exe/iso2exe.sh --- a/syslinux/stuff/iso2exe/iso2exe.sh Thu Mar 16 23:07:56 2017 +0100 +++ b/syslinux/stuff/iso2exe/iso2exe.sh Sat Mar 18 09:21:47 2017 +0100 @@ -116,7 +116,7 @@ ddq if=/tmp/exe$$ bs=1 count=3 skip=$((0x7C00)) of=$1 seek=$i conv=notrunc fi rm -f /tmp/exe$$ /tmp/coff$$ - if [ -z "$RECURSIVE_PARTITION" ]; then + if [ -z "$RECURSIVE_PARTITION" -a $(get 470 $1 4) -eq 0 ]; then store 464 $((1+$i/512)) $1 8 store 470 $(($i/512)) $1 8 store 474 $(($(get 474 $1 4) - $i/512)) $1 32 @@ -262,6 +262,15 @@ ddq bs=1 conv=notrunc if="$1" of="$1" skip=$((0x1BE)) seek=0 count=3 ddq bs=1 skip=$((0x1BE)) count=66 if="$2" | \ ddq bs=1 seek=$((0x1BE)) count=66 of="$1" conv=notrunc + if [ -n "$RECURSIVE_PARTITION" ]; then + for i in 0 1 2 3 ; do + n=$(get $((0x1C6+16*i)) $1 4) + [ $n -eq 0 -o $n -gt 64 ] && continue + store $((0x1C0+16*i)) 1 $1 8 + store $((0x1C6+16*i)) 0 $1 32 + store $((0x1CA+16*i)) $(($(get $((0x1CA+16*i)) $1 4)+$n)) $1 32 + done + fi fi }