forked from rock64-linux/rk-rootfs-build
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mk-rootfs.sh
executable file
·112 lines (89 loc) · 3.82 KB
/
mk-rootfs.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
#!/bin/bash -e
# Directory contains the target rootfs
TARGET_ROOTFS_DIR="binary"
if [ ! $ARCH ]; then
ARCH='armhf'
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/
# bt,wifi,audio firmware
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
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-arm-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
#---------------conflict workaround --------------
apt-get remove -y xserver-xorg-video-fbdev xserver-xorg xserver-xorg-video-ati \
xserver-xorg-video-amdgpu xserver-xorg-video-nouveau xserver-xorg-video-radeon \
xserver-xorg-video-vesa libdrm-amdgpu1 libdrm-radeon1 libxfont2
apt-get install -y libxfont1 libinput-bin libinput10 libwacom-common libwacom2 libunwind8
dpkg -i /packages/workaround/*
rm /lib/systemd/system/wpa_supplicant@.service
#---------------Xserver--------------
echo -e "\033[36m Setup Xserver.................... \033[0m"
[ -e /packages/xserver/xserver-common_*_all.deb ] && dpkg -i /packages/xserver/xserver-common_*_all.deb
[ -e /packages/xserver/xserver-xorg-core_*_$ARCH.deb ] && dpkg -i /packages/xserver/xserver-xorg-core_*_$ARCH.deb
apt-get install -f -y
#---------------libdrm--------------
echo -e "\033[36m Setup libdrm.................... \033[0m"
dpkg -i /packages/libdrm/*
apt-get install -f -y
#---------------Video--------------
echo -e "\033[36m Setup vaapi.................... \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
# [ -e /packages/video/gstreamer1.0-vaapi_*.deb ] && dpkg -i /packages/video/gstreamer1.0-vaapi_*.deb
# [ -e /packages/video/libva-rockchip*.deb ] && dpkg -i /packages/video/libva-rockchip*.deb
[ -e /packages/video/mpp/librockchip-mpp1_*_armhf.deb ] && dpkg -i /packages/video/mpp/librockchip-mpp1_*_armhf.deb
[ -e /packages/video/mpp/librockchip-mpp-dev_*_armhf.deb ] && dpkg -i /packages/video/mpp/librockchip-mpp-dev_*_armhf.deb
[ -e /packages/video/mpp/librockchip-vpu0_*_armhf.deb ] && dpkg -i /packages/video/mpp/librockchip-vpu0_*_armhf.deb
[ -e /packages/video/gstreamer1.0-rockchip*.deb ] && dpkg -i /packages/video/gstreamer1.0-rockchip*.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
dpkg -i /packages/video/qt/*
apt-get install -f -y
else
echo 1
fi
#---------------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
#---------------Clean--------------
rm -rf /var/lib/apt/lists/*
EOF
sudo umount $TARGET_ROOTFS_DIR/dev