-
Notifications
You must be signed in to change notification settings - Fork 8
/
set-hdmi-res.sh
executable file
·115 lines (100 loc) · 2.27 KB
/
set-hdmi-res.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
#!/bin/bash
function pt_error()
{
echo -e "\033[1;31mERROR: $*\033[0m"
}
function pt_warn()
{
echo -e "\033[1;31mWARN: $*\033[0m"
}
function pt_info()
{
echo -e "\033[1;32mINFO: $*\033[0m"
}
function pt_ok()
{
echo -e "\033[1;33mOK: $*\033[0m"
}
function do_720p()
{
if [ ! -d "/media/ubuntu/${BOOT_DEVICE}boot/a64" ]
then
pt_error "Directory missing!"
exit
fi
cd /media/ubuntu/${BOOT_DEVICE}boot/a64
if [ ! -f "m64.dtb_720p" ]
then
pt_error "There is no 720p file mode for your board!"
exit
fi
if [ ! -f "m64.dtb" ]
then
pt_error "There is no n64.dtb on your board!"
exit
fi
sudo rm -f m64.dtb
sudo ln -s m64.dtb_720p m64.dtb
sync
whiptail --msgbox "HDMI resolution is set up to boot with 720p mode." 20 40 2
pt_info "Please, reboot"
}
function do_1080p()
{
if [ ! -d "/media/ubuntu/${BOOT_DEVICE}boot/a64" ]
then
pt_error "Directory missing!"
exit
fi
cd /media/ubuntu/${BOOT_DEVICE}boot/a64
if [ ! -f "m64.dtb_1080p" ]
then
pt_error "There is no 1080p file mode for your board!"
exit
fi
if [ ! -f "m64.dtb" ]
then
pt_error "There is no n64.dtb on your board!"
exit
fi
sudo rm -f m64.dtb
sudo ln -s m64.dtb_1080p m64.dtb
sync
whiptail --msgbox "HDMI resolution is set up to boot with 1080p mode." 20 40 2
pt_info "Please, reboot"
}
if [ $UID -ne 0 ]
then
pt_error "Please run as root."
exit
fi
set -e
BOOT_DEVICE="emmc"
boot_dev=$(whiptail --menu "Chose Boot device to change HDMI resolution (eMMC or SD CARD)" 20 60 10 \
"SDCARD" "Changes will be visible when booting from SD card" \
"EMMC" "Changes will be visible when booting from eMMC card" \
3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
case "$boot_dev" in
SDCARD*) BOOT_DEVICE="" ;;
EMMC*) BOOT_DEVICE="emmc" ;;
*)
whiptail --msgbox "Please, choose one of the option" 20 50 2
return 1
;;
esac
fi
hdmi_res=$(whiptail --menu "Chose HDMI Resolution for the next boot" 20 50 10 \
"720p" "HD Resolution ( 1280 x 720 )" \
"1080p" "Full HD Resolution ( 1920 x 1080 )" \
3>&1 1>&2 2>&3)
if [ $? -eq 0 ]; then
case "$hdmi_res" in
720p*) do_720p ;;
1080p*) do_1080p ;;
*)
whiptail --msgbox "Please, choose one of the option" 20 50 2
return 1
;;
esac
fi