dumpifs: init at 0-unstable-2020-05-07 (#348768)

authored by Arne Keller and committed by GitHub b737b28e b9893cde

+156
+56
pkgs/by-name/du/dumpifs/package.nix
··· 1 + { 2 + clang, 3 + fetchFromGitHub, 4 + lib, 5 + lzo, 6 + lz4, 7 + stdenv, 8 + ucl, 9 + unstableGitUpdater, 10 + zlib, 11 + }: 12 + 13 + stdenv.mkDerivation (finalAttrs: { 14 + pname = "dumpifs"; 15 + version = "0-unstable-2020-05-07"; 16 + 17 + src = fetchFromGitHub { 18 + owner = "askac"; 19 + repo = "dumpifs"; 20 + rev = "b7bac90e8312eca2796f2003a52791899eb8dcd9"; 21 + hash = "sha256-vFiMKcPfowLQQZXlXbq5ZR1X6zr7u3iQwz3o4A6aQMY="; 22 + }; 23 + 24 + nativeBuildInputs = [ clang ]; 25 + 26 + buildInputs = [ 27 + lzo 28 + lz4 29 + ucl 30 + zlib 31 + ]; 32 + 33 + postUnpack = '' 34 + rm source/{dumpifs,exMifsLzo,uuu,zzz} 35 + ''; 36 + 37 + patches = [ ./package.patch ]; 38 + 39 + installPhase = '' 40 + runHook preInstall 41 + 42 + install -Dm755 dumpifs exMifsLz4 exMifsLzo fixdecifs fixencifs uuu zzz -t $out/bin 43 + 44 + runHook postInstall 45 + ''; 46 + 47 + passthru.updateScript = unstableGitUpdater { }; 48 + 49 + meta = { 50 + description = "Tool for those who are interested in hacking MIB2 firmware"; 51 + homepage = "https://github.com/askac/dumpifs"; 52 + platforms = lib.platforms.unix; 53 + maintainers = with lib.maintainers; [ KSJ2000 ]; 54 + mainProgram = "dumpifs"; 55 + }; 56 + })
+100
pkgs/by-name/du/dumpifs/package.patch
··· 1 + diff --git a/exMifsLzo.c b/exMifsLzo.c 2 + index 3173db5..a077bbf 100644 3 + --- a/exMifsLzo.c 4 + +++ b/exMifsLzo.c 5 + @@ -73,8 +73,8 @@ int main(int argc, char **argv) 6 + printf("Block count=%d Total Size=%d + 2048=%d (%x)\n", v2, v7, v7+2048, v7+2048); 7 + v7=0;maxBlkSize=0; 8 + if(lzo_init() != LZO_E_OK) { 9 + - error(1, "decompression init failure"); 10 + - return 0; 11 + + fprintf(stderr, "decompression init failure"); 12 + + exit(1); 13 + } 14 + 15 + for(readBlk=blockInfo;readBlk!=currBlockInfo;readBlk++) 16 + diff --git a/fixdecifs.c b/fixdecifs.c 17 + index 1404732..ebb44a3 100644 18 + --- a/fixdecifs.c 19 + +++ b/fixdecifs.c 20 + @@ -7,6 +7,7 @@ 21 + 22 + #include "sys/image.h" 23 + #include "sys/startup.h" 24 + +#include <string.h> 25 + 26 + #define ENDIAN_RET32(x) ((((x) >> 24) & 0xff) | \ 27 + (((x) >> 8) & 0xff00) | \ 28 + diff --git a/fixencifs.c b/fixencifs.c 29 + index d52f0fa..d5f69c2 100644 30 + --- a/fixencifs.c 31 + +++ b/fixencifs.c 32 + @@ -3,6 +3,7 @@ 33 + #include <stdarg.h> 34 + #include "sys/image.h" 35 + #include "sys/startup.h" 36 + +#include <string.h> 37 + 38 + #define ENDIAN_RET32(x) ((((x) >> 24) & 0xff) | \ 39 + (((x) >> 8) & 0xff00) | \ 40 + diff --git a/uuu.c b/uuu.c 41 + index 7f8c712..f245a9b 100644 42 + --- a/uuu.c 43 + +++ b/uuu.c 44 + @@ -1,12 +1,12 @@ 45 + #include <stdio.h> 46 + #include <ucl/ucl.h> 47 + - 48 + #ifndef QNX 49 + -#include <error.h> 50 + #else 51 + #define error(p,q,r) printf(r) 52 + #endif 53 + 54 + +#include <stdlib.h> 55 + + 56 + int main(int ac, char**av) 57 + { 58 + FILE *fpr, *fpw; 59 + @@ -38,8 +38,8 @@ int main(int ac, char**av) 60 + printf("buf[0-4] = %02X %02X %02X %02X, Package %d bytes \n", buf[0], buf[1], buf[2], buf[3], len); 61 + status = ucl_nrv2b_99_compress(buf, len, out_buf, &out_len, NULL, 9, NULL, NULL);//= ucl_nrv2b_decompress_8(buf, len, out_buf, &out_len, NULL); 62 + if(status != 0) { 63 + - error(1, 0, "compression failure.\n"); 64 + - break; 65 + + fprintf(stderr, "compression failure.\n"); 66 + + exit(1); 67 + } 68 + packSize[0] = (out_len >> 8) & 0xff; 69 + packSize[1] = out_len & 0xff; 70 + diff --git a/zzz.c b/zzz.c 71 + index 0870840..d2d86e5 100644 72 + --- a/zzz.c 73 + +++ b/zzz.c 74 + @@ -1,12 +1,13 @@ 75 + #include <stdio.h> 76 + #ifndef QNX 77 + #include <lzo/lzo1x.h> 78 + -#include <error.h> 79 + #else 80 + #include <lzo1x.h> 81 + #define error(p,q,r) printf(r) 82 + #endif 83 + 84 + +#include <stdlib.h> 85 + + 86 + int main(int ac, char**av) 87 + { 88 + FILE *fpr, *fpw; 89 + @@ -40,8 +41,8 @@ retry: 90 + //status = ucl_nrv2b_99_compress(buf, len, out_buf, &out_len, NULL, 9, NULL, NULL);//= ucl_nrv2b_decompress_8(buf, len, out_buf, &out_len, NULL); 91 + status = lzo1x_999_compress(buf, len, out_buf, &out_len, work); 92 + if(status != 0) { 93 + - error(1, 0, "compression failure.\n"); 94 + - break; 95 + + fprintf(stderr, "compression failure.\n"); 96 + + exit(1); 97 + } 98 + if(out_len > 0xffff) { 99 + printf("!!!! Packed size too big! Need retry!\n"); 100 +