-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
109 lines (82 loc) · 3.27 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
uname_p := $(shell uname -p)
KVERSION = $(shell uname -r)
KERNELSRC = /KL/ZODIAC-IMX6-HDCAPM-TOOLCHAIN/linux-4.13
BUILDARCH = ARCH=arm CROSS_COMPILE=arm-v7a-linux-gnueabihf-
COLOR_ON = \033[33;01m
COLOR_OFF= \033[0m
EXTRA_CPPFLAGS = ""
DEVICE=/dev/video2
mst3367-objs := mst3367-drv.o
obj-m += mst3367.o
hdcapm-objs := hdcapm-core.o hdcapm-buffer.o hdcapm-i2c.o hdcapm-compressor.o hdcapm-video.o kl-histogram.o
obj-m += hdcapm.o
default: intel
all: intel arm
# Intel for the current system (either x86 or x64)
intel:
@echo "$(COLOR_ON)Building Intel $(uname_p)$(COLOR_OFF)"
make -C /lib/modules/$(KVERSION)/build M=$(PWD) KCPPFLAGS=$(EXTRA_CPPFLAGS) modules
mkdir -p build-$(uname_p)
cp hdcapm.ko build-$(uname_p)
cp mst3367.ko build-$(uname_p)
arm:
@echo "$(COLOR_ON)Building ARM$(COLOR_OFF)"
make $(BUILDARCH) -C $(KERNELSRC) M=$(PWD) KCPPFLAGS=$(EXTRA_CPPFLAGS) modules
mkdir -p build-$(@)
cp hdcapm.ko build-$(@)
cp mst3367.ko build-$(@)
clean:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
rm -rf ./build-*
load: intel
sudo dmesg -c >/dev/null
sudo cp v4l-hdcapm-vidfw-01.fw /lib/firmware
sudo cp v4l-hdcapm-audfw-01.fw /lib/firmware
sudo modprobe cx23885
sudo modprobe saa7164
sudo modprobe v4l2-dv-timings
sudo /sbin/insmod ./build-$(uname_p)/mst3367.ko debug=1
sudo /sbin/insmod ./build-$(uname_p)/hdcapm.ko debug=1 i2c_scan=0
unload:
sudo /sbin/rmmod hdcapm
sudo /sbin/rmmod mst3367
test:
dd if=$(DEVICE) of=raw.ts bs=65535
mntcopy:
mount /KL/mnt
cp build-arm/* /KL/mnt
umount /KL/mnt
sshcopy:
ssh [email protected] "cat >/mnt/mst3367.ko" < build-arm/mst3367.ko
ssh [email protected] "cat >/mnt/hdcapm.ko" < build-arm/hdcapm.ko
#ssh [email protected] "cat >/lib/firmware/v4l-hdcapm-vidfw-01.fw" < v4l-hdcapm-vidfw-01.fw
#ssh [email protected] "cat >/lib/firmware/v4l-hdcapm-audfw-01.fw" < v4l-hdcapm-audfw-01.fw
scaler:
# CBR, GOP len 1, 3Mb, scaler output is 640x360
v4l2-ctl -d $(DEVICE) --set-ctrl=video_bitrate=6000000
v4l2-ctl -d $(DEVICE) --set-ctrl=video_peak_bitrate=6000000
v4l2-ctl -d $(DEVICE) --set-ctrl=video_gop_size=1
v4l2-ctl -d $(DEVICE) --set-ctrl=video_bitrate_mode=1
v4l2-ctl -d /dev/video2 --set-fmt-video=width=640,height=360
iso13818_util -i $(DEVICE) -o udp://192.168.0.66:5005 -s
stream:
# Main 4.1
# v4l2-ctl -d $(DEVICE) --set-ctrl=h264_profile=2
# v4l2-ctl -d $(DEVICE) --set-ctrl=h264_level=12
# High 5.1
# v4l2-ctl -d $(DEVICE) --set-ctrl=h264_profile=4
# v4l2-ctl -d $(DEVICE) --set-ctrl=h264_level=15
v4l2-ctl -d $(DEVICE) --set-ctrl=video_bitrate=10000000
v4l2-ctl -d $(DEVICE) --set-ctrl=video_peak_bitrate=10000000
v4l2-ctl -d $(DEVICE) --set-ctrl=video_gop_size=1
# VBR
# v4l2-ctl -d $(DEVICE) --set-ctrl=video_bitrate_mode=0
# CBR
# v4l2-ctl -d $(DEVICE) --set-ctrl=video_bitrate_mode=1
iso13818_util -i $(DEVICE) -o udp://192.168.0.66:5005 -s
gstreamer:
#gst-launch-1.0 v4l2src device=$(DEVICE) io-mode=1 ! video/mpegts,systemstream=true ! queue ! udpsink host=192.168.0.66 port=5005
#gst-launch-1.0 v4l2src device=$(DEVICE) io-mode=1 ! video/mpegts,systemstream=true ! queue ! udpsink host=192.168.0.66 port=5005 buffer-size=1316
gst-launch-1.0 v4l2src device=$(DEVICE) io-mode=1 ! video/mpegts,systemstream=true ! queue ! filesink location=test.ts
snapshot:
tar zcf ../hdcapm-dev-$(shell date +%Y%m%d-%H%M%S).tgz .