fixed patch script

Signed-off-by: Mahmoud Bazzal <mahmood1994ha@gmail.com>
diff --git a/RTFParallella/patch_init.sh b/RTFParallella/patch_init.sh
index 1d2113e..b3acef0 100644
--- a/RTFParallella/patch_init.sh
+++ b/RTFParallella/patch_init.sh
@@ -11,40 +11,45 @@
 #   Contributors:
 #        Dortmund University of Applied Sciences and Arts - initial API and implementation
 #*******************************************************************************
-echo "Parallella Deployment Script version 1.0"
+echo "RTFP patching Script version 1.0"
 echo "welcome to the world of tomorrow"
 
-#Board connection parameters
-HOST_NAME=172.22.167.10
-HOST_USER=parallella
-PORT=22
-HOST_OFFLOAD_PATH="~/boardExec"
-
-#SSH key file
-KEY=~/.ssh/id_rsa
-#path and file name inputs
-DEPOLYMENT_BINARY=${1?Error: no host binary given}
-
-#proper ssh, use this to open an ssh connection to parallella for execution
-#sudo ssh parallella@idial.institute -p 32767 -i ~/.ssh/key
-
-#clear hostOfflad path before copying new files
-#ssh $HOST_NAME -p$PORT -l$HOST_USER -i$KEY "cd $HOST_OFFLOAD_PATH "
-
-#transfer host and device binaries to parallella board
-echo "---------------------------------------"
-echo "copying binaries to remote board..."
-scp -4 -C -P $PORT -i $KEY $DEPOLYMENT_BINARY $HOST_USER@$HOST_NAME:$HOST_OFFLOAD_PATH
-if [[ $? != 0 ]]; then
-  echo "Transfer failed!"
-  exit 1
-else
-  echo "Transfer complete."
-fi
-echo "---------------------------------------"
-echo "Running program $HOST_BINARY"
-echo "***************************************"
-#run the binaries remotely on parallella
-#ssh $HOST_NAME -p$PORT -l$HOST_USER -i$KEY "EPIPHANY_HOME=/opt/adapteva/esdk && . $EPIPHANY_HOME/setup.sh && cd $HOST_OFFLOAD_PATH && ./$DEPOLYMENT_BINARY"
+#Path to the cloned RTFP repo
+#RTFP_REPO_PATH="~/boardExec"
+KERNEL_FOLDER="RTFP_RTOS_KERNEL_PATCHED"
+echo "*****************************************************"
+echo "cloning dependencies..."
+#clone FreeRTOS kernel from svn
+echo "cloning FreeRTOS kernel"
+svn checkout svn://svn.code.sf.net/p/freertos/code/trunk@2712 $KERNEL_FOLDER > /dev/null
+#Clone original port repo
+echo "cloning contribute Epiphany port"
+mkdir Epiphay_port
+cd Epiphay_port
+git clone https://github.com/mahmood1994ha/FreeRTOS.git
+cd FreeRTOS
+#create patch file of original port commit
+git format-patch -1 78e8efaf3ca9aa56c389e00411f2c3bcb0222b64
+PORT_PATCH_FILE="0001-runs-on-the-epiphany-processor-core-as-present-on-th.patch"
+#apply the patch to kernel
+echo "exit FreeRTOS"
+cd ..
+echo "exit Epiphay_port"
+cd ..
+echo "enter KERNEL_FOLDER"
+cd $KERNEL_FOLDER
+echo "enter patch dir"
+cd FreeRTOS
+echo "*****************************************************"
+echo "patching port"
+patch -p2 < ../../Epiphay_port/FreeRTOS/0001-runs-on-the-epiphany-processor-core-as-present-on-th.patch 
+#patch Epiphany port with RTFP fix
+cd ../../
+patch $KERNEL_FOLDER/FreeRTOS/Source/portable/GCC/Epiphany/port.c < port_patch.patch 
+patch $KERNEL_FOLDER/FreeRTOS/Source/portable/GCC/Epiphany/portasm.s < portasm.patch
+echo "port patched with RTFP fix"
+echo "*****************************************************"
+echo "cleaning kernel and port"
+pwd
 echo "***************************************"
 echo "done"
\ No newline at end of file