summaryrefslogtreecommitdiffstats
path: root/Scripts/mount_ubifs_nac.sh
diff options
context:
space:
mode:
authorLudwig <vasseur.ludwig@gmail.com>2020-10-02 14:52:40 +0200
committerLudwig <ludwig@v>2020-10-02 14:55:38 +0200
commit18f35ab726ec8c8d7659f6faa89803d93083dd73 (patch)
tree4d4afb4aa8750dc5a420cadce4290f1078982d2f /Scripts/mount_ubifs_nac.sh
downloadpsa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar.gz
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar.bz2
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar.lz
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar.xz
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.tar.zst
psa-nac-firmware-reverse-engineering-18f35ab726ec8c8d7659f6faa89803d93083dd73.zip
Diffstat (limited to 'Scripts/mount_ubifs_nac.sh')
-rw-r--r--Scripts/mount_ubifs_nac.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/Scripts/mount_ubifs_nac.sh b/Scripts/mount_ubifs_nac.sh
new file mode 100644
index 0000000..9d0ea35
--- /dev/null
+++ b/Scripts/mount_ubifs_nac.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+UBIFS_IMAGE=$1
+
+mkdir -p /mnt/ubifs
+if grep -qs '/dev/ubi' /proc/mounts; then
+ umount /mnt/ubifs
+ ubidetach -p /dev/mtd0
+ rmmod nandsim
+fi
+
+modprobe ubi
+modprobe nandsim first_id_byte=0xec second_id_byte=0xd5 third_id_byte=0x51 fourth_id_byte=0xa6
+flash_erase /dev/mtd0 0 0
+ubiformat /dev/mtd0 -s 4096 -O 4096
+ubiattach -m 0 -d 0 -O 4096
+ubimkvol /dev/ubi0 -N NAC_UBIFS -s 1024MiB
+ubiupdatevol /dev/ubi0_0 $UBIFS_IMAGE
+mount /dev/ubi0_0 /mnt/ubifs
+
+echo "${UBIFS_IMAGE} mounted on /mnt/ubifs" \ No newline at end of file