wok-current rev 20062
Up zstd (1.3.1), syslinux/c32box fix loadcustominitrd()
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Sep 22 15:56:58 2017 +0200 (2017-09-22) |
parents | 6a8b83dd1456 |
children | d3852d2a7903 |
files | syslinux/stuff/extra/md5sum.c zstd/receipt |
line diff
1.1 --- a/syslinux/stuff/extra/md5sum.c Sun Sep 17 11:42:45 2017 +0200 1.2 +++ b/syslinux/stuff/extra/md5sum.c Fri Sep 22 15:56:58 2017 +0200 1.3 @@ -248,6 +248,10 @@ 1.4 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 1.5 */ 1.6 1.7 +#ifdef EXTRA 1.8 +#define WITH_UNROCKRIDGE 1.9 +#endif 1.10 +#ifdef WITH_UNROCKRIDGE 1.11 static char *unrockridge(const char *name) 1.12 { 1.13 static char buffer[256]; 1.14 @@ -270,6 +274,7 @@ 1.15 buffer[i] = 0; 1.16 return buffer; 1.17 } 1.18 +#endif 1.19 1.20 static uint8_t *hash_file(const char *filename) 1.21 { 1.22 @@ -278,9 +283,12 @@ 1.23 static uint8_t hash_value[16*2+1]; 1.24 1.25 src_fd = open(filename, O_RDONLY); 1.26 +#ifdef WITH_UNROCKRIDGE 1.27 if (src_fd < 0) { 1.28 src_fd = open(unrockridge(filename), O_RDONLY); 1.29 } 1.30 +#endif 1.31 + 1.32 if (src_fd < 0) { 1.33 return NULL; 1.34 } 1.35 @@ -301,6 +309,7 @@ 1.36 return hash_value; 1.37 } 1.38 1.39 +#ifdef EXTRA 1.40 static int main_say(int argc, char **argv) 1.41 { 1.42 int i; 1.43 @@ -310,6 +319,7 @@ 1.44 sleep(5); 1.45 return 0; 1.46 } 1.47 +#endif 1.48 1.49 static int main_md5sum(int argc, char **argv) 1.50 { 1.51 @@ -323,8 +333,10 @@ 1.52 FILE *fp; 1.53 char eol, *line, buffer[4096]; 1.54 fp = fopen(*argv,"r"); 1.55 +#ifdef WITH_UNROCKRIDGE 1.56 if (fp == NULL) 1.57 fp = fopen(unrockridge(*argv),"r"); 1.58 +#endif 1.59 1.60 while ((line = fgets(buffer,sizeof(buffer),fp)) != NULL) { 1.61 uint8_t *hash_value; 1.62 @@ -732,14 +744,13 @@ 1.63 static int got_config; 1.64 static char *custom_cmdline = ""; 1.65 static int custom_initrdlen; 1.66 -static char *custom_initrdbase; 1.67 +static int custom_initrdbase; 1.68 static char *custom_buffer; 1.69 static struct disk_info diskinfo; 1.70 1.71 static int has_custom_config(void) 1.72 { 1.73 const union syslinux_derivative_info *sdi; 1.74 - int retry=0; 1.75 1.76 if (got_config) 1.77 goto done; 1.78 @@ -748,27 +759,24 @@ 1.79 goto fail; 1.80 disk_get_params(sdi->iso.drive_number, &diskinfo); 1.81 custom_buffer = disk_read_sectors(&diskinfo, 32768 / diskinfo.bps, 1); 1.82 - got_config = (*(unsigned long *) (custom_buffer + 80) * 2048) / diskinfo.bps; 1.83 - do { 1.84 - free(custom_buffer); 1.85 - custom_buffer = disk_read_sectors(&diskinfo, got_config, 1); 1.86 - if (!memcmp(custom_buffer,"#!boot ",7)) { 1.87 - char *p = custom_buffer+7+32+1; 1.88 + got_config = (16 + *(unsigned long *) (custom_buffer + 80)) 1.89 + * 2048 / diskinfo.bps; 1.90 + free(custom_buffer); 1.91 + custom_buffer = disk_read_sectors(&diskinfo, got_config, 1); 1.92 + if (!memcmp(custom_buffer,"#!boot ",7)) { 1.93 + char *p = custom_buffer+7+32+1; 1.94 1.95 - if (!memcmp(p,"append=",7)) { 1.96 - custom_cmdline = p + 7; 1.97 - p = strchr(p,'\n'); 1.98 - *p++ = 0; 1.99 - } 1.100 - if (!memcmp(p,"initrd:",7)) { 1.101 - custom_initrdlen = strtoul(p + 7, &custom_initrdbase, 10); 1.102 - custom_initrdbase++; 1.103 - } 1.104 - return 1; 1.105 - } 1.106 - got_config += 16UL; 1.107 - retry = 1 - retry; 1.108 - } while (retry); 1.109 + if (!memcmp(p,"append=",7)) { 1.110 + custom_cmdline = p + 7; 1.111 + p = strchr(p,'\n'); 1.112 + *p++ = 0; 1.113 + } 1.114 + if (!memcmp(p,"initrd:",7)) { 1.115 + custom_initrdlen = strtoul(p + 7, &custom_initrdbase, 10); 1.116 + custom_initrdbase += (got_config << 11) + 1 - (int) custom_buffer; 1.117 + } 1.118 + return 1; 1.119 + } 1.120 fail: 1.121 got_config = -1; 1.122 done: 1.123 @@ -780,22 +788,17 @@ 1.124 int n, len; 1.125 char *p; 1.126 1.127 - p = *data = malloc(custom_initrdlen); 1.128 + p = *data = malloc(len = custom_initrdlen); 1.129 if (!p) return 0; 1.130 - len = custom_initrdlen; 1.131 - while (1) { 1.132 - n = 2048 + custom_buffer - custom_initrdbase; 1.133 + for (len = custom_initrdlen; len != 0; len -= n, p += n) { 1.134 + free(custom_buffer); 1.135 + custom_buffer = disk_read_sectors(&diskinfo, custom_initrdbase >> 11, 1.136 + 2048 / diskinfo.bps); 1.137 + n = 2048 - (custom_initrdbase & 2047); 1.138 if (n > len) 1.139 n = len; 1.140 - memcpy(p, custom_initrdbase, n); 1.141 - p += n; 1.142 - len -= n; 1.143 - if (len == 0) 1.144 - break; 1.145 - free(custom_buffer); 1.146 - got_config += 2048 / diskinfo.bps; 1.147 - custom_initrdbase = custom_buffer = 1.148 - disk_read_sectors(&diskinfo, got_config, 2048 / diskinfo.bps); 1.149 + memcpy(p, custom_buffer + (custom_initrdbase & 2047), n); 1.150 + custom_initrdbase += n; 1.151 } 1.152 return 1; 1.153 } 1.154 @@ -849,10 +852,7 @@ 1.155 return cmdline; 1.156 } 1.157 1.158 -static bool __constfunc cpu_has_cpuid(void) 1.159 -{ 1.160 - return cpu_has_eflag(X86_EFLAGS_ID); 1.161 -} 1.162 +#define cpu_has_cpuid() cpu_has_eflag(X86_EFLAGS_ID) 1.163 1.164 static bool __constfunc cpu_has_level(uint32_t level) 1.165 { 1.166 @@ -896,8 +896,10 @@ 1.167 if (cpu_has_feature(feature)) { 1.168 strcat(newfilename, ext); 1.169 fd = open(new, O_RDONLY); 1.170 +#ifdef WITH_UNROCKRIDGE 1.171 if (fd < 0) 1.172 fd = open(new = unrockridge(new), O_RDONLY); 1.173 +#endif 1.174 if (fd >= 0) { 1.175 found = new; 1.176 close(fd); 1.177 @@ -1114,6 +1116,7 @@ 1.178 return 1; 1.179 } 1.180 1.181 +#ifdef EXTRA 1.182 static int main_setarg(int argc, char *argv[]) 1.183 { 1.184 if (argc < 3) { 1.185 @@ -1191,6 +1194,7 @@ 1.186 sleep(5); 1.187 return 0; 1.188 } 1.189 +#endif 1.190 1.191 int main(int argc, char *argv[]) 1.192 { 1.193 @@ -1199,16 +1203,18 @@ 1.194 char *name; 1.195 int (*main)(int argc, char *argv[]); 1.196 } bin[] = { 1.197 +#ifdef EXTRA 1.198 { "say", main_say }, 1.199 - { "md5sum", main_md5sum }, 1.200 - { "ifmem", main_ifmem }, 1.201 - { "reboot", main_reboot }, 1.202 - { "poweroff", main_poweroff }, 1.203 - { "kbdmap", main_kbdmap }, 1.204 - { "linux", main_linux }, 1.205 { "setarg", main_setarg }, 1.206 { "ifarg", main_ifarg }, 1.207 - { "listarg", main_listarg } 1.208 + { "listarg", main_listarg }, 1.209 +#endif 1.210 + { "kbdmap", main_kbdmap }, 1.211 + { "ifmem", main_ifmem }, 1.212 + { "linux", main_linux }, 1.213 + { "md5sum", main_md5sum }, 1.214 + { "reboot", main_reboot }, 1.215 + { "poweroff", main_poweroff } 1.216 }; 1.217 1.218 openconsole(&dev_null_r, &dev_stdcon_w);
2.1 --- a/zstd/receipt Sun Sep 17 11:42:45 2017 +0200 2.2 +++ b/zstd/receipt Fri Sep 22 15:56:58 2017 +0200 2.3 @@ -1,11 +1,11 @@ 2.4 # SliTaz package receipt. 2.5 2.6 PACKAGE="zstd" 2.7 -VERSION="1.3.0" 2.8 +VERSION="1.3.1" 2.9 CATEGORY="base-system" 2.10 SHORT_DESC="Zstandard - Fast and efficient compression algorithm." 2.11 MAINTAINER="pascal.bellard@slitaz.org" 2.12 -LICENSE="BSD" 2.13 +LICENSE="BSD GPL2" 2.14 TARBALL="$PACKAGE-$VERSION.tar.gz" 2.15 WEB_SITE="https://github.com/Cyan4973/zstd" 2.16 WGET_URL="$WEB_SITE/archive/v$VERSION.tar.gz"