forked from greigdp/rk-rootfs-build
-
Notifications
You must be signed in to change notification settings - Fork 26
/
mk-rootfs-stretch-arm64.sh
executable file
·152 lines (121 loc) · 4.81 KB
/
mk-rootfs-stretch-arm64.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
#!/bin/bash -e
# Directory contains the target rootfs
TARGET_ROOTFS_DIR="binary"
if [ ! $ARCH ]; then
ARCH='arm64'
fi
if [ ! $VERSION ]; then
VERSION="debug"
fi
if [ ! -e linaro-stretch-alip-*.tar.gz ]; then
echo "\033[36m Run mk-base-debian.sh first \033[0m"
fi
finish() {
sudo umount $TARGET_ROOTFS_DIR/dev
exit -1
}
trap finish ERR
echo -e "\033[36m Extract image \033[0m"
sudo tar -xpf linaro-stretch-alip-*.tar.gz
echo -e "\033[36m Copy overlay to rootfs \033[0m"
sudo mkdir -p $TARGET_ROOTFS_DIR/packages
sudo cp -rf packages/$ARCH/* $TARGET_ROOTFS_DIR/packages
# some configs
sudo cp -rf overlay/* $TARGET_ROOTFS_DIR/
if [ "$ARCH" == "arm64" ]; then
sudo cp overlay-firmware/usr/bin/brcm_patchram_plus1_64 $TARGET_ROOTFS_DIR/usr/bin/brcm_patchram_plus1
sudo cp overlay-firmware/usr/bin/rk_wifi_init_64 $TARGET_ROOTFS_DIR/usr/bin/rk_wifi_init
fi
# bt,wifi,audio firmware
sudo mkdir -p $TARGET_ROOTFS_DIR/system/lib/modules/
sudo find ../kernel/drivers/net/wireless/rockchip_wlan/* -name "*.ko" | \
xargs -n1 -i sudo cp {} $TARGET_ROOTFS_DIR/system/lib/modules/
sudo cp -rf overlay-firmware/* $TARGET_ROOTFS_DIR/
if [ "$VERSION" == "debug" ] || [ "$VERSION" == "jenkins" ]; then
# adb, video, camera test file
sudo cp -rf overlay-debug/* $TARGET_ROOTFS_DIR/
fi
# adb
if [ "$ARCH" == "arm64" ]; then
sudo cp -rf overlay-debug/usr/local/share/adb/adbd-64 $TARGET_ROOTFS_DIR/usr/local/bin/adbd
fi
# glmark2
if [ "$ARCH" == "arm64" ]; then
sudo rm -rf $TARGET_ROOTFS_DIR/usr/local/share/glmark2
sudo mkdir -p $TARGET_ROOTFS_DIR/usr/local/share/glmark2
sudo cp -rf overlay-debug/usr/local/share/glmark2/aarch64/share/* $TARGET_ROOTFS_DIR/usr/local/share/glmark2
sudo cp overlay-debug/usr/local/share/glmark2/aarch64/bin/glmark2-es2 $TARGET_ROOTFS_DIR/usr/local/bin/glmark2-es2
fi
if [ "$VERSION" == "jenkins" ]; then
# network
sudo cp -b /etc/resolv.conf $TARGET_ROOTFS_DIR/etc/resolv.conf
fi
echo -e "\033[36m Change root.....................\033[0m"
sudo cp /usr/bin/qemu-aarch64-static $TARGET_ROOTFS_DIR/usr/bin/
sudo mount -o bind /dev $TARGET_ROOTFS_DIR/dev
cat <<EOF | sudo chroot $TARGET_ROOTFS_DIR
chmod o+x /usr/lib/dbus-1.0/dbus-daemon-launch-helper
apt-get update
apt-get install -y lxpolkit
apt-get install -y blueman:arm64
echo exit 101 > /usr/sbin/policy-rc.d
chmod +x /usr/sbin/policy-rc.d
apt-get install -y blueman:arm64
rm -f /usr/sbin/policy-rc.d
#---------------power management --------------
apt-get install -y pm-utils triggerhappy
cp /etc/Powermanager/triggerhappy.service /lib/systemd/system/triggerhappy.service
#---------------conflict workaround --------------
apt-get remove -y xserver-xorg-input-evdev
apt-get install -y libxfont1 libinput-bin libinput10 libwacom-common libwacom2 libunwind8 xserver-xorg-input-libinput
#---------------Xserver--------------
echo -e "\033[36m Setup Xserver.................... \033[0m"
dpkg -i /packages/xserver/*
apt-get install -f -y
#---------------Video--------------
echo -e "\033[36m Setup Video.................... \033[0m"
apt-get install -y gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-alsa \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad alsa-utils
dpkg -i /packages/video/mpp/*.deb
dpkg -i /packages/video/gstreamer/*.deb
apt-get install -f -y
#------------------libdrm------------
#dpkg -i /packages/libdrm/*.deb
#apt-get install -f -y
#---------------Qt-Video--------------
dpkg -l | grep lxde
if [ "$?" -eq 0 ]; then
# if target is base, we won't install qt
apt-get install -y libqt5opengl5 libqt5qml5 libqt5quick5 libqt5widgets5 libqt5gui5 libqt5core5a qml-module-qtquick2 \
libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediaquick-p5
dpkg -i /packages/video/qt/*
apt-get install -f -y
else
echo "won't install qt"
fi
#---------------Others--------------
#---------Camera---------
dpkg -i /packages/others/camera/*
#---------FFmpeg---------
#-----TODO: it will cause crash with online video on chromium---------
apt-get install -y libsdl2-2.0-0:arm64 libcdio-paranoia1:arm64 libjs-bootstrap:arm64 libjs-jquery:arm64
dpkg -i /packages/others/ffmpeg/*
#---------MPV---------
dpkg -i /packages/others/mpv/*
apt-get install -f -y
#---------------Debug--------------
if [ "$VERSION" == "debug" ] || [ "$VERSION" == "jenkins" ] ; then
apt-get install -y sshfs openssh-server bash-completion
fi
#---------------Custom Script--------------
systemctl enable rockchip.service
systemctl mask systemd-networkd-wait-online.service
systemctl mask NetworkManager-wait-online.service
rm /lib/systemd/system/[email protected]
#---------------get accelerated back for chromium v61--------------
ln -s /usr/lib/aarch64-linux-gnu/libGLESv2.so /usr/lib/chromium/libGLESv2.so
ln -s /usr/lib/aarch64-linux-gnu/libEGL.so /usr/lib/chromium/libEGL.so
#---------------Clean--------------
rm -rf /var/lib/apt/lists/*
EOF
sudo umount $TARGET_ROOTFS_DIR/dev