-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathc2_init.sh
executable file
·155 lines (146 loc) · 2.72 KB
/
c2_init.sh
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/sh
for x in $(cat /proc/cmdline); do
case ${x} in
m_bpp=*) export bpp=${x#*=} ;;
hdmimode=*) export mode=${x#*=} ;;
modeline=*) export modeline=${x#*=} ;;
esac
done
HPD_STATE=/sys/class/amhdmitx/amhdmitx0/hpd_state
DISP_CAP=/sys/class/amhdmitx/amhdmitx0/disp_cap
DISP_MODE=/sys/class/display/mode
# if setenv nographics "1" in boot.ini then this needs to fail
if [ ! -f $DISP_MODE ]; then
exit 0
fi
echo $mode > $DISP_MODE
common_display_setup() {
M="0 0 $(($X - 1)) $(($Y - 1))"
Y_VIRT=$(($Y * 2))
fbset -fb /dev/fb0 -g $X $Y $X $Y_VIRT $bpp
echo $mode > /sys/class/display/mode
echo 0 > /sys/class/graphics/fb0/free_scale
echo 1 > /sys/class/graphics/fb0/freescale_mode
echo $M > /sys/class/graphics/fb0/free_scale_axis
echo $M > /sys/class/graphics/fb0/window_axis
echo 0 > /sys/class/graphics/fb1/free_scale
echo 1 > /sys/class/graphics/fb1/freescale_mode
}
case $mode in
custombuilt*)
export X=`echo $modeline | cut -f1 -d","`
export Y=`echo $modeline | cut -f2 -d","`
;;
480x320*)
export X=480
export Y=320
;;
480x800*)
export X=480
export Y=800
;;
480i*|480p*)
export X=720
export Y=480
;;
576*)
export X=720
export Y=576
;;
720p*)
export X=1280
export Y=720
;;
1080*)
export X=1920
export Y=1080
;;
2160p*)
export X=3840
export Y=2160
;;
smpte24hz*)
export X=3840
export Y=2160
;;
640x480p60hz*)
export X=640
export Y=480
;;
800x480p60hz*)
export X=800
export Y=480
;;
800x600p60hz*)
export X=800
export Y=600
;;
1024x600p60hz*)
export X=1024
export Y=600
;;
1024x768p60hz*)
export X=1024
export Y=768
;;
1280x800p60hz*)
export X=1280
export Y=800
;;
1280x1024p60hz*)
export X=1280
export Y=1024
;;
1360x768p60hz*)
export X=1360
export Y=768
;;
1440x900p60hz*)
export X=1440
export Y=900
;;
1600x900p60hz*)
export X=1600
export Y=900
;;
1680x1050p60hz*)
export X=1680
export Y=1050
;;
1600x1200p60hz*)
export X=1600
export Y=1200
;;
1920x1200p60hz*)
export X=1920
export Y=1200
;;
2560x1080p60hz*)
export X=2560
export Y=1080
;;
2560x1440p60hz*)
export X=2560
export Y=1440
;;
2560x1600p60hz*)
export X=2560
export Y=1600
;;
3440x1440p60hz*)
export X=3440
export Y=1440
;;
esac
common_display_setup
# Console unblack
case $mode in
*cvbs*|480i*|576i*|1080i*)
echo 0 > /sys/class/graphics/fb0/blank
echo 1 > /sys/class/graphics/fb1/blank
;;
*)
echo 0 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb1/blank
;;
esac