Skip to content

Commit 9d57291

Browse files
Revert "Remove Qt + weston (#502)"
This reverts commit 3762ea1.
1 parent 3762ea1 commit 9d57291

31 files changed

+649
-5
lines changed

Dockerfile.agnos

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ COPY ./userspace/compile-lpac.sh /tmp/agnos/
5151
RUN --mount=type=cache,target=/root/.ccache,id=lpac,sharing=shared \
5252
/tmp/agnos/compile-lpac.sh
5353

54+
# qtwayland5
55+
FROM agnos-compiler AS agnos-compiler-qtwayland5
56+
COPY ./userspace/qtwayland/*.deb /tmp/agnos/
57+
COPY ./userspace/compile-qtwayland5.sh /tmp/agnos/
58+
COPY ./userspace/qtwayland/patch* /tmp/agnos/
59+
RUN --mount=type=cache,target=/root/.ccache,id=qtwayland5,sharing=shared \
60+
/tmp/agnos/compile-qtwayland5.sh
61+
5462
# ################## #
5563
# ###### Base ###### #
5664
# ################## #
@@ -79,6 +87,15 @@ RUN /tmp/agnos/openpilot_dependencies.sh
7987
COPY ./userspace/openpilot_python_dependencies.sh /tmp/agnos/
8088
RUN /tmp/agnos/openpilot_python_dependencies.sh
8189

90+
# Install old Qt 5.12.8, libwayland 1.9.0-1 and deps
91+
COPY ./userspace/qtwayland/*.deb /tmp/agnos/
92+
RUN apt-get -o Dpkg::Options::="--force-overwrite" install -yq \
93+
/tmp/agnos/qt-5.12.8.deb \
94+
/tmp/agnos/libwayland-1.9.0-1.deb \
95+
/tmp/agnos/libicu66_66.1-2ubuntu2.1_arm64.deb \
96+
/tmp/agnos/libssl1.1_1.1.1f-1ubuntu2.22_arm64.deb \
97+
/tmp/agnos/libffi6_3.2.1-8_arm64.deb
98+
8299
# ################### #
83100
# ###### AGNOS ###### #
84101
# ################### #
@@ -136,6 +153,12 @@ RUN source $XDG_DATA_HOME/venv/bin/activate && \
136153
COPY ./userspace/install_extras.sh /tmp/agnos/
137154
RUN /tmp/agnos/install_extras.sh
138155

156+
COPY --from=agnos-compiler-qtwayland5 /tmp/qtwayland5.deb /tmp/qtwayland5.deb
157+
RUN cd /tmp && apt-get -o Dpkg::Options::="--force-overwrite" install -yq --allow-downgrades ./qtwayland5.deb
158+
159+
# Patched libeglSubDriverWayland with fixed nullptr deref in CommitBuffer
160+
COPY ./userspace/files/libeglSubDriverWayland.so.patched /lib/aarch64-linux-gnu/libeglSubDriverWayland.so
161+
139162
COPY ./userspace/home/ /home/$USERNAME/
140163
COPY ./userspace/home/.config/ /root/.config
141164
RUN chown -R $USERNAME: /home/$USERNAME/.config
@@ -171,6 +194,10 @@ COPY ./userspace/libs32/* /usr/lib/arm-linux-gnueabihf/
171194
#COPY ./userspace/files/linux-headers-4.9.103+_4.9.103+-1_arm64.deb /tmp/
172195
#RUN dpkg -i /tmp/linux-headers-4.9.103+_4.9.103+-1_arm64.deb
173196

197+
# Weston with hacked touch rotate and color correction
198+
COPY ./userspace/files/weston /usr/bin/weston
199+
COPY ./userspace/files/gl-renderer.so /usr/lib/arm-linux-gnueabihf/weston
200+
174201
# Setup systemd services
175202
COPY ./userspace/services.sh /tmp/agnos
176203
RUN /tmp/agnos/services.sh
@@ -199,6 +226,9 @@ COPY ./userspace/files/avahi-override.conf /etc/systemd/system/avahi-daemon.serv
199226
# Prevent polkitd memory leak from getting out of hand by restarting it every ~day
200227
COPY ./userspace/files/polkit-override.conf /etc/systemd/system/polkit.service.d/override.conf
201228

229+
# Remove qt network bearer plugins
230+
RUN rm -rf /usr/lib/aarch64-linux-gnu/qt5/plugins/bearer
231+
202232
# Add iptable rules to block incoming traffic on wwan0
203233
COPY ./userspace/etc/iptables/rules.v4 /etc/iptables/rules.v4
204234

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ Some concrete things on the roadmap:
8787
- [ ] mainline Linux kernel https://github.com/commaai/openpilot/issues/32386
8888
- [ ] fully open source
8989
- [ ] anything from `firmware/`: XBL, ABL, etc.
90-
- [x] <s>Weston https://github.com/commaai/agnos-builder/issues/16</s> deleted!
90+
- [ ] Weston https://github.com/commaai/agnos-builder/issues/16

userspace/.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
usr/comma/wlan.ko filter=lfs diff=lfs merge=lfs -text
22
usr/comma/wifi filter=lfs diff=lfs merge=lfs -text
3+
files/weston filter=lfs diff=lfs merge=lfs -text
4+
files/libeglSubDriverWayland.so.patched filter=lfs diff=lfs merge=lfs -text
35
usr/comma/reset filter=lfs diff=lfs merge=lfs -text
46
usr/comma/setup filter=lfs diff=lfs merge=lfs -text
57
usr/comma/installer filter=lfs diff=lfs merge=lfs -text

userspace/compile-qtwayland5.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash -e
2+
3+
VERSION=5.12.9
4+
5+
# Install build requirements
6+
dpkg --add-architecture armhf
7+
8+
apt-get update && apt-get install -yq --no-install-recommends \
9+
libc6:armhf \
10+
libdbus-1-3 \
11+
libegl-dev \
12+
libexpat1:armhf \
13+
libfontconfig-dev \
14+
libfreetype6 \
15+
libgles-dev \
16+
libglib2.0-dev \
17+
libharfbuzz-dev \
18+
libpcre2-dev \
19+
libwayland-dev \
20+
libxcomposite-dev \
21+
libxkbcommon-dev \
22+
zlib1g-dev
23+
24+
apt-get -o Dpkg::Options::="--force-overwrite" install -yq \
25+
/tmp/agnos/qt-5.12.8.deb \
26+
/tmp/agnos/libwayland-1.9.0-1.deb \
27+
/tmp/agnos/libicu66_66.1-2ubuntu2.1_arm64.deb \
28+
/tmp/agnos/libssl1.1_1.1.1f-1ubuntu2.22_arm64.deb \
29+
/tmp/agnos/libffi6_3.2.1-8_arm64.deb
30+
31+
# Patched qtwayland that outputs a fixed screen size
32+
# Clone qtwayland submodule, checkout, apply patch, qmake, make
33+
cd /tmp
34+
git clone --branch v${VERSION} --depth 1 https://github.com/qt/qtwayland.git
35+
cd qtwayland
36+
37+
git apply /tmp/agnos/patch-qtwayland-v5.12
38+
39+
# qtwayland is incorrectly built against libdl.so instead of libdl.so.2
40+
# https://stackoverflow.com/a/75855054/639708
41+
ln -s libdl.so.2 /usr/lib/aarch64-linux-gnu/libdl.so
42+
43+
qmake
44+
export MAKEFLAGS="-j$(nproc)"
45+
make
46+
47+
OUTPUT_DIR=/tmp/qtwayland5
48+
mkdir $OUTPUT_DIR
49+
make install INSTALL_ROOT=$OUTPUT_DIR
50+
51+
mkdir $OUTPUT_DIR/DEBIAN
52+
cat << EOF > $OUTPUT_DIR/DEBIAN/control
53+
Package: qtwayland5
54+
Version: ${VERSION}-1
55+
Architecture: all
56+
Maintainer: Andrei Radulescu <andi.radulescu@gmail.com>
57+
Replaces: qtwayland5, libqt5waylandclient5, libqt5waylandcompositor5
58+
Installed-Size: `du -s $OUTPUT_DIR | awk '{print $1}'`
59+
Homepage: https://comma.ai
60+
Description: Patched qtwayland that outputs a fixed screen size
61+
EOF
62+
63+
dpkg-deb --root-owner-group --build $OUTPUT_DIR /tmp/qtwayland5.deb

userspace/files/agnos-tests.service

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Unit]
2-
#After=
2+
#After=weston-ready.service
33

44
[Service]
55
#Type=simple
@@ -10,6 +10,7 @@ Restart=no
1010
# exit if connected to 5V
1111
ExecStartPre=/bin/bash -c "if [ $(cat /sys/class/hwmon/hwmon1/in1_input) -le 6500 ]; then echo 'Exiting, connected to 5V'; exit 1; fi"
1212

13+
#ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_weston.py"
1314
ExecStart=/bin/bash -c "source /etc/profile && /usr/comma/tests/test_sounds.py"
1415

1516
[Install]

userspace/files/gl-renderer.so

182 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:34b01105549bba97710ded5916a24a318d4b7dbe91fe4e617ca320a7d98f6a39
3+
size 197632

userspace/files/profile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ if [ -d /etc/profile.d ]; then
2626
unset i
2727
fi
2828

29-
export XDG_RUNTIME_DIR="/var/tmp/xdg"
29+
# display setup
30+
export XDG_RUNTIME_DIR="/var/tmp/weston"
31+
export QT_QPA_PLATFORM="wayland-egl"
3032

3133
# python setup
3234
export PYTHONPATH="/data/pythonpath"

userspace/files/weston

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7e38b2701eaa61471dfb2418b606846c0512afd90f67bfc0d65dcf5178fb51b8
3+
size 782832
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[Unit]
2+
PartOf=weston.service
3+
4+
[Service]
5+
Type=oneshot
6+
RemainAfterExit=yes
7+
Restart=no
8+
Environment="XDG_RUNTIME_DIR=/var/tmp/weston"
9+
10+
ExecStart=/bin/echo "waiting for wayland socket"
11+
ExecStart=/bin/bash -c "while [ ! -e \"$XDG_RUNTIME_DIR/wayland-0\" ]; do sleep 0.1; done"
12+
13+
# still starting after socket comes up
14+
ExecStart=/bin/sleep 0.5
15+
16+
ExecStart=/bin/echo "fixing permissions"
17+
ExecStart=/bin/bash -c "chown -R comma: $XDG_RUNTIME_DIR"
18+
ExecStart=/bin/bash -c "chmod -R 700 $XDG_RUNTIME_DIR"
19+
20+
# these are set by udev rules, but udev is slow
21+
ExecStart=/bin/bash -c "chgrp gpu /dev/ion /dev/kgsl-3d0"
22+
ExecStart=/bin/bash -c "chmod 660 /dev/ion /dev/kgsl-3d0"
23+
24+
ExecStart=/bin/echo "turning on display"
25+
ExecStart=/bin/bash -c "echo 500 > /sys/class/backlight/panel0-backlight/brightness"
26+
27+
[Install]
28+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)