-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (57 loc) · 2.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SHELL:=/bin/bash
OSS=$(realpath ../buildroot-arm/)
FMK_DIR=$(OSS)/fmk
HOST_BUILDROOT_DIR=$(OSS)/buildroot-2013.05/output/host/usr/bin
REVENG_DIR=$(OSS)/reveng-1.1.2
TARGETGCC=$(HOST_BUILDROOT_DIR)/mipsel-buildroot-linux-uclibc-gcc
all: .check-prereqs IPCUpdateC_V.1.7.19.modded.bin
.check-prereqs:
dpkg -l python-magic > /dev/null
touch $@
include tenvisd/make.inc
V1.7_V.1.7.19.zip:
wget http://apps.tenvis.com/Download/JPT3815W/2013/V1.7_V.1.7.19.zip
IPCUpdateC_V.1.7.19.bin: V1.7_V.1.7.19.zip
unzip V1.7_V.1.7.19.zip
tmp/IPCUpdateC_V.1.7.19.uImage.bin: IPCUpdateC_V.1.7.19.bin
echo oss $(OSS)
echo binwalk $(BINWALK)
mkdir -p tmp
dd if=$^ bs=8 skip=1 [email protected]
dd if=$^ bs=8 skip=1 [email protected]
dd [email protected] count=1 of=$@ bs=\
$$(binwalk $^ | awk '/uImage header/ { sub(/.*image size: /, ""); print $$1 }')
tmp/IPCUpdateC_V.1.7.19.kernelromfs.bin: tmp/IPCUpdateC_V.1.7.19.uImage.bin
dd if=$^ bs=64 skip=1 of=$@
fmk: tmp/IPCUpdateC_V.1.7.19.kernelromfs.bin
$(FMK_DIR)/extract-firmware.sh $^
define LOGIN_SKIP_AUTH
EOF
EOF
endef
export LOGIN_SKIP_AUTH
.check-patched: | fmk
rm fmk/rootfs/bin/login
echo '#!/bin/sh' > fmk/rootfs/bin/login
echo 'exec /bin/busybox ash' >> fmk/rootfs/bin/login
chmod 755 fmk/rootfs/bin/login
echo '#!/bin/sh' > fmk/rootfs/bin/cat
echo "exec /bin/busybox sed -e''" >> fmk/rootfs/bin/cat
chmod 755 fmk/rootfs/bin/cat
(cd fmk/rootfs ; patch -p1 ) < tenvis_turn_on_telnetd.patch
rm fmk/rootfs/etc_ro/web/IPCPlayerPlug.exe
touch $@
IPCUpdateC_V.1.7.19.modded.bin: tenvisd/tenvisd_mipsel | .check-patched
cp tenvisd/tenvisd_mipsel fmk/rootfs/usr/bin/
$(FMK_DIR)/build-firmware.sh fmk # creates fmk/new-firmware.bin
$(HOST_BUILDROOT_DIR)/mkimage -A mips -O linux -T kernel -C lzma -a 0x80000000 -e 0x8026a000 -n "Linux Kernel Image" -d fmk/new-firmware.bin tmp/[email protected]
printf "IPCM\3\0\0\0" | dd bs=8 of=tmp/[email protected]
cat tmp/[email protected] >> tmp/[email protected]
$(REVENG_DIR)/reveng -c -m KERMIT -f tmp/[email protected] -S | python -c "import sys, struct; xin=sys.stdin.read().split(); sys.stdout.write(struct.pack('BB', *[int(x, base=16) for x in xin]))" > tmp/[email protected]
[ "$$(ls -l tmp/[email protected] | awk '{ printf $$5 }')" = "2" ]
cat tmp/[email protected] tmp/[email protected] > $@
clean:
-rm -rf fmk
-rm -rf tmp
-rm .check-*
-rm IPCUpdateC_V.1.7.19.modded.bin