From 45247d6d8cd20486dd8f4123f0fed726d5b053bd Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Thu, 23 Jul 2020 18:07:50 +0300 Subject: [PATCH] Add RCM payload support for Raspberry Pi See #57 --- BUILD.md | 7 ++++ JNI sources/linux/Makefile_raspberry | 31 ++++++++++++++++++ README.md | 10 +++++- pom.xml | 2 +- src/main/java/nsusbloader/NSLMain.java | 2 +- .../nsusbloader/Utilities/JNIRcmLoader.java | 3 ++ .../resources/native/linux/arm/smashlib.so | Bin 0 -> 7656 bytes 7 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 JNI sources/linux/Makefile_raspberry create mode 100755 src/main/resources/native/linux/arm/smashlib.so diff --git a/BUILD.md b/BUILD.md index 18f6371..d3d26a1 100644 --- a/BUILD.md +++ b/BUILD.md @@ -29,6 +29,13 @@ $ javac -h . RcmSmash.java $ cd 'NS-USBloader/JNI sources/linux' $ make install clean ``` +**Build for Raspberry Pi (Raspberry Pi host):** +``` + $ cd 'NS-USBloader/JNI sources/linux' + $ mv Makefile_rapsberry Makefile + $ make install clean +``` + **Build for Windows (on x86_64 host):** [ This part should be updated ] diff --git a/JNI sources/linux/Makefile_raspberry b/JNI sources/linux/Makefile_raspberry new file mode 100644 index 0000000..f89ee4b --- /dev/null +++ b/JNI sources/linux/Makefile_raspberry @@ -0,0 +1,31 @@ +# Compiler +CC=arm-linux-gnueabihf-gcc +# Flags +CFLAGS=-O2 +MKDIR_P = mkdir -p +APP_NAME = smashlib.so + +ifeq ($(JAVA_HOME),) + JAVA_LIB_PATH := "/usr/lib/jvm/default-java/include" + JAVA_LIB_PATH_LINUX := "/usr/lib/jvm/default-java/include/linux" +else + JAVA_LIB_PATH = ${JAVA_HOME}/include + JAVA_LIB_PATH_LINUX = ${JAVA_HOME}/include/linux +endif + +all: arm + +arm: + test $(JAVA_LIB_PATH) + $(MKDIR_P) ./arm + $(CC) -c -fPIC -I$(JAVA_LIB_PATH) -I"$(JAVA_LIB_PATH_LINUX)" smashlib.c -o smashlib_arm.o + $(CC) ${CFLAGS} -shared -fPIC -o ./arm/${APP_NAME} smashlib_arm.o -lc + +clean: + rm -rf smashlib_arm.o ./arm + +install: arm + install ./arm/${APP_NAME} ../../src/main/resources/native/linux/arm/ + +uninstall: + rm ../../src/main/resources/native/linux/arm/${APP_NAME} \ No newline at end of file diff --git a/README.md b/README.md index e0f62b0..2cabead 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ NS-USBloader is: * A PC-side installer for **[Adubbz/TinFoil (v0.2.1)](https://github.com/Adubbz/Tinfoil/)**, **[Huntereb/Awoo-Installer](https://github.com/Huntereb/Awoo-Installer)** (USB and Network supported) and **[XorTroll/GoldLeaf](https://github.com/XorTroll/Goldleaf)** (USB) NSP installer. Replacement for default **usb_install_pc.py**, **remote_install_pc.py**, **GoldTree**/**Quark**. -* This application also could be used as RCM payload on Windows, MacOS and Linux (supported arch: x86, x86_64). +* This application also could be used as RCM payload on Windows, MacOS and Linux (supported arch: x86, x86_64 and Raspberry Pi). * And of course it's a tool for split files! * And also for merging split-files into one :) @@ -90,6 +90,14 @@ root # udevadm control --reload-rules && udevadm trigger Please note: you may have to change 'plugdev' group from example above to the different one. It's depends on you linux distro. +##### Raspberry Pi + +1. Install JDK: `sudo apt install default-jdk` + +2. For UI install JavaFX: + +3. See steps 3 and 4 from 'Linux' section to update 'udev'. + ##### macOS Double-click on downloaded .jar file. Follow instructions. Or see 'Linux' section. diff --git a/pom.xml b/pom.xml index f7a8f1c..48cdd9f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ NS-USBloader ns-usbloader - 4.0-SNAPSHOT + 4.1-SNAPSHOT https://github.com/developersu/ns-usbloader/ diff --git a/src/main/java/nsusbloader/NSLMain.java b/src/main/java/nsusbloader/NSLMain.java index cd24e2c..f18f653 100644 --- a/src/main/java/nsusbloader/NSLMain.java +++ b/src/main/java/nsusbloader/NSLMain.java @@ -32,7 +32,7 @@ import java.util.ResourceBundle; public class NSLMain extends Application { - public static final String appVersion = "v4.0"; + public static final String appVersion = "v4.1"; public static boolean isCli; @Override diff --git a/src/main/java/nsusbloader/Utilities/JNIRcmLoader.java b/src/main/java/nsusbloader/Utilities/JNIRcmLoader.java index 8a3a31b..d8229ff 100644 --- a/src/main/java/nsusbloader/Utilities/JNIRcmLoader.java +++ b/src/main/java/nsusbloader/Utilities/JNIRcmLoader.java @@ -43,6 +43,9 @@ public class JNIRcmLoader { case "amd64": osArch = "amd64"; break; + case "arm": + osArch = "arm"; + break; default: return false; } diff --git a/src/main/resources/native/linux/arm/smashlib.so b/src/main/resources/native/linux/arm/smashlib.so new file mode 100755 index 0000000000000000000000000000000000000000..1fa45512cbee99c74790b178ecd206934e197f48 GIT binary patch literal 7656 zcmeHMYitzP6+W|Tu(6$F0Vf!++7UG=QS9BNA=E|rv9>XfuqFgdo2aP6cz29f-G{p~ zCeVjM)2Kpfk;y|!R2AVgX{A3<+Amvd z;EQA;SO)s67CXlDrLtH+-l%B;%pxqb@E=-J5cZguR1n5T&$G6 zF?YP^Dc!X-PVSKFOccs)vG7GtrmN#}uY1sS%Ko%JUaYuq=k=OPyUUCr^CQh)!3 zjgFVDLg6ObwMGZd=WPY_JrQNhQ62!j6#;z@DdI9iiXh%hityY^uF{OYb;v^)cyev@QWJ znfe0>X|%2cpBSv~v#mz!9pLSu`u=pRAwwq{Et#2Gx6IBT!`PCZolB%U8m*s#O?tR~ z#ddjPpS`T{`clj-F;h#(>c(-{#}c#iNJ#?soDY$GV?KT-^=5_M64}+4s4q@10G3Zx#6g?Rf^0exlI+-~AYaeDfHY$ZlC=$1~~#&pEFJ#TfJ4pSE*5>WQN-Ts*o2-+csQ2Jw|RZAtsy zz9Yxa#pR~GEtw8{JTmwowVdj22x6@han^=4cP2U-JY)KibKj`9oH}tH&&V9#Eqt$} z^4`JJ__UwG%RjX?eOEsG!2mbl#tz)rfg3w;V+U^Rz=zm@b;x^9FH-kE=G;hYg?Bon zwQ?FcFt5eTw^xJ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