Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions pkgs/by-name/du/dumpifs/package.nix
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 ];
tomodachi94 marked this conversation as resolved.
Show resolved Hide resolved
mainProgram = "dumpifs";
};
})
100 changes: 100 additions & 0 deletions pkgs/by-name/du/dumpifs/package.patch
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");

Loading