-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dumpifs: init at 0-unstable-2020-05-07
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
clang, | ||
fetchFromGitHub, | ||
lib, | ||
lzo, | ||
lz4, | ||
stdenv, | ||
ucl, | ||
unstableGitUpdater, | ||
zlib, | ||
}: | ||
|
||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "dumpifs"; | ||
version = "0-unstable-2020-05-07"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "askac"; | ||
repo = "dumpifs"; | ||
rev = "b7bac90e8312eca2796f2003a52791899eb8dcd9"; | ||
hash = "sha256-vFiMKcPfowLQQZXlXbq5ZR1X6zr7u3iQwz3o4A6aQMY="; | ||
}; | ||
|
||
nativeBuildInputs = [ clang ]; | ||
|
||
buildInputs = [ | ||
lzo | ||
lz4 | ||
ucl | ||
zlib | ||
]; | ||
|
||
postUnpack = '' | ||
rm source/{dumpifs,exMifsLzo,uuu,zzz} | ||
''; | ||
|
||
patches = [ ./package.patch ]; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
install -Dm755 dumpifs exMifsLz4 exMifsLzo fixdecifs fixencifs uuu zzz -t $out/bin | ||
runHook postInstall | ||
''; | ||
|
||
passthru.updateScript = unstableGitUpdater { }; | ||
|
||
meta = { | ||
description = "Tool for those who are interested in hacking MIB2 firmware"; | ||
homepage = "https://github.com/askac/dumpifs"; | ||
platforms = lib.platforms.unix; | ||
maintainers = with lib.maintainers; [ KSJ2000 ]; | ||
mainProgram = "dumpifs"; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
diff --git a/exMifsLzo.c b/exMifsLzo.c | ||
index 3173db5..a077bbf 100644 | ||
--- a/exMifsLzo.c | ||
+++ b/exMifsLzo.c | ||
@@ -73,8 +73,8 @@ int main(int argc, char **argv) | ||
printf("Block count=%d Total Size=%d + 2048=%d (%x)\n", v2, v7, v7+2048, v7+2048); | ||
v7=0;maxBlkSize=0; | ||
if(lzo_init() != LZO_E_OK) { | ||
- error(1, "decompression init failure"); | ||
- return 0; | ||
+ fprintf(stderr, "decompression init failure"); | ||
+ exit(1); | ||
} | ||
|
||
for(readBlk=blockInfo;readBlk!=currBlockInfo;readBlk++) | ||
diff --git a/fixdecifs.c b/fixdecifs.c | ||
index 1404732..ebb44a3 100644 | ||
--- a/fixdecifs.c | ||
+++ b/fixdecifs.c | ||
@@ -7,6 +7,7 @@ | ||
|
||
#include "sys/image.h" | ||
#include "sys/startup.h" | ||
+#include <string.h> | ||
|
||
#define ENDIAN_RET32(x) ((((x) >> 24) & 0xff) | \ | ||
(((x) >> 8) & 0xff00) | \ | ||
diff --git a/fixencifs.c b/fixencifs.c | ||
index d52f0fa..d5f69c2 100644 | ||
--- a/fixencifs.c | ||
+++ b/fixencifs.c | ||
@@ -3,6 +3,7 @@ | ||
#include <stdarg.h> | ||
#include "sys/image.h" | ||
#include "sys/startup.h" | ||
+#include <string.h> | ||
|
||
#define ENDIAN_RET32(x) ((((x) >> 24) & 0xff) | \ | ||
(((x) >> 8) & 0xff00) | \ | ||
diff --git a/uuu.c b/uuu.c | ||
index 7f8c712..f245a9b 100644 | ||
--- a/uuu.c | ||
+++ b/uuu.c | ||
@@ -1,12 +1,12 @@ | ||
#include <stdio.h> | ||
#include <ucl/ucl.h> | ||
- | ||
#ifndef QNX | ||
-#include <error.h> | ||
#else | ||
#define error(p,q,r) printf(r) | ||
#endif | ||
|
||
+#include <stdlib.h> | ||
+ | ||
int main(int ac, char**av) | ||
{ | ||
FILE *fpr, *fpw; | ||
@@ -38,8 +38,8 @@ int main(int ac, char**av) | ||
printf("buf[0-4] = %02X %02X %02X %02X, Package %d bytes \n", buf[0], buf[1], buf[2], buf[3], len); | ||
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); | ||
if(status != 0) { | ||
- error(1, 0, "compression failure.\n"); | ||
- break; | ||
+ fprintf(stderr, "compression failure.\n"); | ||
+ exit(1); | ||
} | ||
packSize[0] = (out_len >> 8) & 0xff; | ||
packSize[1] = out_len & 0xff; | ||
diff --git a/zzz.c b/zzz.c | ||
index 0870840..d2d86e5 100644 | ||
--- a/zzz.c | ||
+++ b/zzz.c | ||
@@ -1,12 +1,13 @@ | ||
#include <stdio.h> | ||
#ifndef QNX | ||
#include <lzo/lzo1x.h> | ||
-#include <error.h> | ||
#else | ||
#include <lzo1x.h> | ||
#define error(p,q,r) printf(r) | ||
#endif | ||
|
||
+#include <stdlib.h> | ||
+ | ||
int main(int ac, char**av) | ||
{ | ||
FILE *fpr, *fpw; | ||
@@ -40,8 +41,8 @@ retry: | ||
//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); | ||
status = lzo1x_999_compress(buf, len, out_buf, &out_len, work); | ||
if(status != 0) { | ||
- error(1, 0, "compression failure.\n"); | ||
- break; | ||
+ fprintf(stderr, "compression failure.\n"); | ||
+ exit(1); | ||
} | ||
if(out_len > 0xffff) { | ||
printf("!!!! Packed size too big! Need retry!\n"); | ||
|