Permalink
Browse files

tools/*: sync with Entware-ng

  • Loading branch information...
The-BB committed Oct 11, 2017
1 parent a4bdfa5 commit ac2d1f40c0385719e91a05cdee325fac002ae8a0
Showing with 833 additions and 601 deletions.
  1. +3 −3 tools/automake/Makefile
  2. +4 −4 tools/automake/patches/000-relocatable.patch
  3. +25 −0 tools/bison/patches/001-fix-macos-vasnprintf.patch
  4. +25 −0 tools/coreutils/patches/001-fix-macos-vasnprintf.patch
  5. +2 −2 tools/e2fsprogs/Makefile
  6. +2 −2 tools/expat/Makefile
  7. +1 −2 tools/firmware-utils/Makefile
  8. +19 −1 tools/firmware-utils/src/addpattern.c
  9. +2 −3 tools/firmware-utils/src/dgn3500sum.c
  10. +26 −4 tools/firmware-utils/src/hcsmakeimage.c
  11. +0 −1 tools/firmware-utils/src/imagetag.c
  12. +23 −1 tools/firmware-utils/src/jcgimage.c
  13. +18 −4 tools/firmware-utils/src/mkchkimg.c
  14. +0 −1 tools/firmware-utils/src/mkrtn56uimg.c
  15. +0 −352 tools/firmware-utils/src/mktplinkfw-kernel.c
  16. +53 −58 tools/firmware-utils/src/mktplinkfw.c
  17. +101 −55 tools/firmware-utils/src/mktplinkfw2.c
  18. +0 −1 tools/firmware-utils/src/spw303v.c
  19. +305 −6 tools/firmware-utils/src/tplink-safeloader.c
  20. +0 −1 tools/firmware-utils/src/xorimage.c
  21. +0 −1 tools/firmware-utils/src/zyxbcm.c
  22. +2 −1 tools/flex/Makefile
  23. +2 −2 tools/flex/patches/100-disable-tests-docs.patch
  24. +0 −72 tools/include/getline.h
  25. +25 −0 tools/m4/patches/001-fix-macos-vasnprintf.patch
  26. +67 −0 tools/mkimage/patches/110-fix_musl_build.patch
  27. +62 −0 tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
  28. +25 −0 tools/patch/patches/001-fix-macos-vasnprintf.patch
  29. +2 −2 tools/pkg-config/Makefile
  30. +0 −18 tools/pkg-config/patches/001-glib-gdate-suppress-string-format-literal-warning.patch
  31. +4 −4 tools/sparse/Makefile
  32. +25 −0 tools/tar/patches/001-fix-macos-vasnprintf.patch
  33. +10 −0 tools/tar/patches/110-symlink-force-permissions.patch
View
@@ -7,11 +7,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=automake
PKG_VERSION:=1.15
PKG_VERSION:=1.15.1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@GNU/automake
PKG_HASH:=9908c75aabd49d13661d6dcb1bc382252d22cc77bf733a2d55e87f2aa2db8636
PKG_HASH:=af6ba39142220687c500f79b4aa2f181d9b24e4f8d8ec497cea4ba26c64bedaf
include $(INCLUDE_DIR)/host-build.mk
@@ -24,7 +24,7 @@ HOST_CONFIGURE_VARS += \
am_cv_prog_PERL_ithreads=no
define Host/Configure
(cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR="" ./bootstrap.sh)
(cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR="" ./bootstrap)
$(call Host/Configure/Default)
endef
@@ -24,7 +24,7 @@
+
# aclocal - create aclocal.m4 by scanning configure.ac
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Copyright (C) 1996-2017 Free Software Foundation, Inc.
@@ -27,7 +29,7 @@ eval 'case $# in 0) exec @PERL@ -S "$0";
BEGIN
@@ -59,7 +59,7 @@
+$^W = 1;
+
# automake - create Makefile.in from Makefile.am
# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
@@ -31,7 +33,7 @@ use strict;
@@ -79,7 +79,7 @@
+$^W = 1;
+
# Copyright (C) 2012-2014 Free Software Foundation, Inc.
# Copyright (C) 2012-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
--- a/t/wrap/automake.in
@@ -91,6 +91,6 @@
+$^W = 1;
+
# Copyright (C) 2012-2014 Free Software Foundation, Inc.
# Copyright (C) 2012-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -0,0 +1,25 @@
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -4858,7 +4858,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if ! (((__GLIBC__ > 2 \
+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \
+ && !defined __UCLIBC__) \
+ || (defined __APPLE__ && defined __MACH__) \
+ || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
@@ -4872,6 +4876,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
in format strings in writable memory may crash the program
(if compiled with _FORTIFY_SOURCE=2), so we should avoid it
in this situation. */
+ /* macOS 10.13 High Sierra behaves like glibc with
+ _FORTIFY_SOURCE=2, and older macOS releases
+ presumably do not need %n. */
/* On native Windows systems (such as mingw), we can avoid using
%n because:
- Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
@@ -0,0 +1,25 @@
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -4858,7 +4858,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
#endif
*fbp = dp->conversion;
#if USE_SNPRINTF
-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
+# if ! (((__GLIBC__ > 2 \
+ || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \
+ && !defined __UCLIBC__) \
+ || (defined __APPLE__ && defined __MACH__) \
+ || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
fbp[1] = '%';
fbp[2] = 'n';
fbp[3] = '\0';
@@ -4872,6 +4876,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
in format strings in writable memory may crash the program
(if compiled with _FORTIFY_SOURCE=2), so we should avoid it
in this situation. */
+ /* macOS 10.13 High Sierra behaves like glibc with
+ _FORTIFY_SOURCE=2, and older macOS releases
+ presumably do not need %n. */
/* On native Windows systems (such as mingw), we can avoid using
%n because:
- Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
View
@@ -8,8 +8,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=e2fsprogs
PKG_VERSION:=1.43.4
PKG_HASH:=54b3f21123a531a6a536b9cdcc21344b0122a72790dbe4dacc98e64db25e4a24
PKG_VERSION:=1.43.5
PKG_HASH:=261f3d9ade383fbf032a19140c9c25e998cc0f71a1ae686614fb3ae0eb955a17
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
View
@@ -8,10 +8,10 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=expat
PKG_VERSION:=2.2.0
PKG_VERSION:=2.2.3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_HASH:=d9e50ff2d19b3538bd2127902a89987474e1a4db8e43a66a4d1a712ab9a504ff
PKG_HASH:=b31890fb02f85c002a67491923f89bda5028a880fd6c374f707193ad81aace5f
PKG_SOURCE_URL:=@SF/expat
HOST_BUILD_PARALLEL:=1
@@ -41,7 +41,6 @@ define Host/Compile
$(call cc,mkplanexfw sha1)
$(call cc,mktplinkfw md5, -Wall)
$(call cc,mktplinkfw2 md5)
$(call cc,mktplinkfw-kernel)
$(call cc,tplink-safeloader md5, -Wall)
$(call cc,pc1crypt)
$(call cc,osbridge-crc)
@@ -73,7 +72,7 @@ define Host/Compile
$(call cc,mkdcs932, -Wall)
$(call cc,mkheader_gemtek,-lz)
$(call cc,mkrtn56uimg, -lz)
$(call cc,dgn3500sum)
$(call cc,dgn3500sum, -Wall)
$(call cc,edimax_fw_header, -Wall)
$(call cc,mkmerakifw sha1, -Wall)
$(call cc,mkmerakifw-old, -Wall)
@@ -58,6 +58,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
@@ -141,6 +142,20 @@ void usage(void)
exit(EXIT_FAILURE);
}
static time_t source_date_epoch = -1;
static void set_source_date_epoch() {
char *env = getenv("SOURCE_DATE_EPOCH");
char *endptr = env;
errno = 0;
if (env && *env) {
source_date_epoch = strtoull(env, &endptr, 10);
if (errno || (endptr && *endptr != '\0')) {
fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
exit(1);
}
}
}
struct board_info *find_board(char *id)
{
struct board_info *board;
@@ -273,7 +288,10 @@ int main(int argc, char **argv)
usage();
}
if (time(&t) == (time_t)(-1)) {
set_source_date_epoch();
if (source_date_epoch != -1) {
t = source_date_epoch;
} else if ((time(&t) == (time_t)(-1))) {
fprintf(stderr, "time call failed\n");
return EXIT_FAILURE;
}
@@ -103,7 +103,7 @@ int main(int argc, char** argv)
unsigned long start, i;
char *endptr, *buffer, *p;
int count; // size of file in bytes
unsigned short sum, sum1;
unsigned short sum = 0, sum1 = 0;
char sumbuf[9];
if(argc < 3) {
@@ -117,7 +117,7 @@ int main(int argc, char** argv)
printf("ERROR: File not writeable!\n");
return 1;
}
if(argc = 4)
if(argc == 4)
{
printf("%s: PID type: %s\n", argv[0], argv[3]);
if(strcmp(argv[3], "DE")==0)
@@ -147,7 +147,6 @@ int main(int argc, char** argv)
start = strtol(argv[2], &endptr, 16);
p = buffer+start;
sum1 = 0;
for(i = 0; i < count - start; i++)
{
sum1 += p[i];
@@ -5,7 +5,8 @@
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include <sys/time.h>
#include <errno.h>
#include <time.h>
#include <sys/stat.h>
#include <libgen.h>
#include "bcmalgo.h"
@@ -42,6 +43,19 @@ static void print_help ( const char* ename )
printf ( "\n" );
}
static time_t source_date_epoch = -1;
static void set_source_date_epoch() {
char *env = getenv("SOURCE_DATE_EPOCH");
char *endptr = env;
errno = 0;
if (env && *env) {
source_date_epoch = strtoull(env, &endptr, 10);
if (errno || (endptr && *endptr != '\0')) {
fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
exit(1);
}
}
}
int main ( int argc, char** argv )
{
@@ -149,11 +163,19 @@ int main ( int argc, char** argv )
{
fname = filename;
}
struct timeval tm;
gettimeofday ( &tm,NULL );
time_t t = -1;
set_source_date_epoch();
if (source_date_epoch != -1) {
t = source_date_epoch;
} else if ((time(&t) == (time_t)(-1))) {
fprintf(stderr, "time call failed\n");
return EXIT_FAILURE;
}
struct stat buf;
stat ( input,&buf );
ldr_header_t* head = construct_header ( magicnum, (uint16_t) majrev, (uint16_t) minrev, ( uint32_t ) tm.tv_sec, ( uint32_t ) buf.st_size, ldaddress, fname, get_file_crc ( input ) );
ldr_header_t* head = construct_header ( magicnum, (uint16_t) majrev, (uint16_t) minrev, ( uint32_t ) t, ( uint32_t ) buf.st_size, ldaddress, fname, get_file_crc ( input ) );
free(dupe);
//uint32_t magic, uint16_t rev_maj,uint16_t rev_min, uint32_t build_date, uint32_t filelen, uint32_t ldaddress, const char* filename, uint32_t crc
//FILE* fd = fopen ("/tftpboot/haxorware11rev32.bin","r");
@@ -11,7 +11,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <netinet/in.h>
@@ -158,6 +158,20 @@ opensize(char *name, size_t *size)
return fd;
}
static time_t source_date_epoch = -1;
static void set_source_date_epoch() {
char *env = getenv("SOURCE_DATE_EPOCH");
char *endptr = env;
errno = 0;
if (env && *env) {
source_date_epoch = strtoull(env, &endptr, 10);
if (errno || (endptr && *endptr != '\0')) {
fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
exit(1);
}
}
}
/*
* Write the JCG header
*/
@@ -167,6 +181,13 @@ mkjcgheader(struct jcg_header *h, size_t psize, char *version)
uLong crc;
uint16_t major = 0, minor = 0;
void *payload = (void *)h + sizeof(*h);
time_t t;
if (source_date_epoch != -1) {
t = source_date_epoch;
} else if ((time(&t) == (time_t)(-1))) {
err(1, "time call failed");
}
if (version != NULL) {
if (sscanf(version, "%hu.%hu", &major, &minor) != 2) {
@@ -177,7 +198,7 @@ mkjcgheader(struct jcg_header *h, size_t psize, char *version)
memset(h, 0, sizeof(*h));
h->jh_magic = htonl(JH_MAGIC);
h->jh_type = htonl(1);
h->jh_time = htonl(time(NULL));
h->jh_time = htonl(t);
h->jh_major = htons(major);
h->jh_minor = htons(minor);
@@ -303,6 +324,7 @@ main(int argc, char **argv)
/* Make sure the headers have the right size */
assert(sizeof(struct jcg_header) == 512);
assert(sizeof(struct uimage_header) == 64);
set_source_date_epoch();
while ((c = getopt(argc, argv, "o:k:f:u:v:h")) != -1) {
switch (c) {
@@ -31,6 +31,20 @@
#define MAX_BOARD_ID_LEN (64)
/*
* Note on the reserved field of the chk_header:
* OFW naming scheme is typically: DEVICENAME-VA.B.C.D_E.F.G.chk, with A-G
* between 0 and 255. For instance: EX3700_EX3800-V1.0.0.58_1.0.38.chk
* The reserved field works like this:
* reserved[0]: region code. 1 for WW (WorldWide) and 2 for NA (North America)
* reserved[1]: A
* reserved[2]: B
* reserved[3]: C
* reserved[4]: D
* reserved[5]: E
* reserved[6]: F
* reserved[7]: G
*/
struct chk_header {
uint32_t magic;
uint32_t header_len;
@@ -248,10 +262,10 @@ main (int argc, char * argv[])
hdr->reserved[1] = 1; /* Major */
hdr->reserved[2] = 1; /* Minor */
hdr->reserved[3] = 99; /* Build */
hdr->reserved[4] = 0; /* Unknown t1 ? was 1 */
hdr->reserved[5] = 0; /* Unknonw t2 ? was 0 */
hdr->reserved[6] = 0; /* Unknonw t3 ? was 1 */
hdr->reserved[7] = 0; /* Unused ? */
hdr->reserved[4] = 0;
hdr->reserved[5] = 0;
hdr->reserved[6] = 0;
hdr->reserved[7] = 0;
message (" Board Id: %s", board_id);
message (" Region: %s", region == 1 ? "World Wide (WW)"
: (region == 2 ? "North America (NA)" : "Unknown"));
@@ -17,7 +17,6 @@
#include <netinet/in.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <zlib.h>
Oops, something went wrong.

0 comments on commit ac2d1f4

Please sign in to comment.