Skip to content

Commit

Permalink
Ubuntu 24.04 (#262)
Browse files Browse the repository at this point in the history
* Ubuntu 24.04 (#188)

* separate out qtwayland5 compilation

* ubuntu 22.04

* temp build system image

* remove bionic deps

* temp packages update

* update armhf packages

* back to libstdc++6

* replaced remove dqt5-default meta package with actual depss

* fix for build libqmi crashing with /usr/bin/env: 'python': No such file or directory

* mapbox-gl-native gcc11 fix

* openpilot_dependencies.sh change

* ubuntu-base 24.04 daily current

* apt install meson because PEP 668

* temp g++-11 for mapbox-gl-native

* bump capnproto to 1.0.2

* temp build only agnos-compiler-mapbox-gl-native

* Fixes for compiling mapbox-gl-native

* Fixes for compiling ffmpeg

* Build main system image again

* pyopencl from git since no 2023.1.5 release since inducer/pyopencl#705

* Try to fix checkinstall - no success

* apt capnproto & ffmpeg since can't figure out issue with checkinstall

* Commented removed services disable

* Ubuntu 24.04 currently has arm-none-eabi/12.2.1 but just use wildcard to go to first folder

* pyclean is missing ?!

* ubuntu-latest in tests workflow

* Updated README

* Reverted internal/package_ota.py changes

* rebuilt kernel

* poetry.lock update

* Simplified build_system pipeline

* headers for capnproto

* Fix typo

* Fix for checkinstall

* Reverted apt capnproto & ffmpeg

* Some cleaning in Dockerfile

* 24.04 libwayland-client

* libffi6:armhf deb file

* Updated qtwayland

* Revert "libffi6:armhf deb file"

This reverts commit bb9cb5d.

* libffi.so.6.0.4

* qt5-qmake qtbase5-dev qtbase5-dev-tools already in qt5-default

* Removed qtwayland old files

* checkinstall temp fix

* QStandardPaths: wrong permissions on runtime directory /var/tmp/weston, 0770 instead of 0700

* temp permissions fix makes loading build spinner show

* temp build optimization

* 24.04 new libs

* build kernel don't use tools on aarch64/arm64

* updated boot image and ko files

* cleaning

* switch to release 24.04

* wip - downgrade qt and libwayland

* polkitd-pkla package to support polkit *.pkla

* fixed issue with old qt needing libssl 1.1.1f

* remove /.dockerenv file

* more cleaning

---------

Co-authored-by: Justin Newberry <justin@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Ubuntu 24.04 branch fixes (#235)

* bump version

* /lib64 is now UsrMerged

* latest pip poetry; poetry.lock update

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* revert README

* [upload]

* disable failing nvmf-autoconnect.service

* disable failing networking.service

* [upload]

* no replacement for ondemand.service

* snapd.service is in snapd package we don't install

* nfs is using rpc-pipefs-generator now, when used

* checkinstall is still not fixed so remove TODO

* updated comment about usr merged lib64

* added checkinstall bug link

* removed not used libffi.so.6 and libwayland-client.so.0

* cleaned compile-qtwayland5.sh and removed 5.15 patch

* removed unused qt-comma 5.15 deb

* cleaned up custom debs for qt and libwayland and added a README

* fixed typo [upload]

* change version

* build-libwayland-deb.sh

* build-qt-deb.sh

* cleaned README

* [upload]

* fix libdl.so qtwayland build [upload]

* rebuild debs

* update libdl path [upload]

* added missing systemd-resolved

* ping capability

* disable some systemd services

* etc/resolv.conf link should not be needed

* Revert "etc/resolv.conf link should not be needed"

This reverts commit b627615.

* Revert "ping capability"

This reverts commit 812ca35.

* set ping capability outside of container

* disable systemd services: console-setup and sfsconfig

Co-authored-by: Robin Reckmann <robin.reckmann@gmail.com>

* disabled more systemd services

* bump version [upload]

* update version

---------

Co-authored-by: Justin Newberry <justin@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Robin Reckmann <robin.reckmann@gmail.com>
  • Loading branch information
4 people committed Aug 13, 2024
1 parent cd181f2 commit 4a924da
Show file tree
Hide file tree
Showing 28 changed files with 366 additions and 81 deletions.
30 changes: 16 additions & 14 deletions Dockerfile.agnos
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ###### Base ###### #
# ################## #
FROM scratch AS agnos-base
ADD ubuntu-base-20.04.1-base-arm64.tar.gz /
ADD ubuntu-base-24.04-base-arm64.tar.gz /

# Build folder
RUN mkdir -p /tmp/agnos
Expand All @@ -19,16 +19,25 @@ RUN echo "resolvconf resolvconf/linkify-resolvconf boolean false" | debconf-set-
COPY ./userspace/base_setup.sh /tmp/agnos
RUN /tmp/agnos/base_setup.sh

# Install openpilot dependencies
COPY ./userspace/openpilot_dependencies.sh /tmp/agnos/
RUN /tmp/agnos/openpilot_dependencies.sh

# Install old Qt 5.12.8, libwayland 1.9.0-1 and deps
COPY ./userspace/qtwayland/*.deb /tmp/agnos/
RUN apt-get -o Dpkg::Options::="--force-overwrite" install -yq \
/tmp/agnos/qt-5.12.8.deb \
/tmp/agnos/libwayland-1.9.0-1.deb \
/tmp/agnos/libicu66_66.1-2ubuntu2.1_arm64.deb \
/tmp/agnos/libssl1.1_1.1.1f-1ubuntu2.22_arm64.deb \
/tmp/agnos/libffi6_3.2.1-8_arm64.deb

# ################## #
# #### Compiler #### #
# ################## #
FROM agnos-base AS agnos-compiler

RUN apt-fast update && apt-fast install --no-install-recommends -yq checkinstall
# Install openpilot dependencies, probably needed for build,
# but we don't want these in the base image
COPY ./userspace/openpilot_dependencies.sh /tmp/agnos/
RUN /tmp/agnos/openpilot_dependencies.sh

# Individual compiling images
FROM agnos-compiler AS agnos-compiler-capnp
Expand All @@ -41,7 +50,7 @@ RUN /tmp/agnos/compile-ffmpeg.sh

FROM agnos-compiler AS agnos-compiler-qtwayland5
COPY ./userspace/compile-qtwayland5.sh /tmp/agnos/
COPY ./userspace/qtwayland/patch /tmp/agnos/
COPY ./userspace/qtwayland/patch* /tmp/agnos/
RUN /tmp/agnos/compile-qtwayland5.sh

# ################### #
Expand All @@ -64,9 +73,6 @@ RUN /tmp/agnos/compile-modemmanager.sh
COPY --from=agnos-compiler-capnp /tmp/capnproto.deb /tmp/capnproto.deb
RUN cd /tmp && apt-get -o Dpkg::Options::="--force-overwrite" install -yq ./capnproto.deb

# Install openpilot dependencies
COPY ./userspace/openpilot_dependencies.sh /tmp/agnos/
RUN /tmp/agnos/openpilot_dependencies.sh
COPY ./userspace/openpilot_python_dependencies.sh /tmp/agnos/
RUN /tmp/agnos/openpilot_python_dependencies.sh

Expand Down Expand Up @@ -98,10 +104,6 @@ RUN export PATH="/usr/local/pyenv/bin:/usr/local/pyenv/shims:$PATH" && \
COPY ./userspace/install_extras.sh /tmp/agnos/
RUN /tmp/agnos/install_extras.sh

# 16.04 libwayland-client + libffi6
COPY ./userspace/qtwayland/libffi.so.6 /lib/aarch64-linux-gnu/
COPY ./userspace/qtwayland/libwayland-client.so.0 /lib/aarch64-linux-gnu/libwayland-client.so.0

COPY --from=agnos-compiler-qtwayland5 /tmp/qtwayland5.deb /tmp/qtwayland5.deb
RUN cd /tmp && apt-get -o Dpkg::Options::="--force-overwrite" install -yq --allow-downgrades ./qtwayland5.deb

Expand Down Expand Up @@ -185,7 +187,7 @@ RUN sed -i 's/hosts: files dns myhostname/hosts: files myhostn

# TODO: move this to base_setup.sh or build gcc from source
# Remove unused architectures from arm-none-eabi
RUN cd /usr/lib/gcc/arm-none-eabi/9.2.1 && \
RUN cd /usr/lib/gcc/arm-none-eabi/* && \
rm -rf arm/ && \
rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp

Expand Down
1 change: 1 addition & 0 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN apt-get update && \
openssl \
ccache \
android-sdk-libsparse-utils \
libcap2-bin \
&& rm -rf /var/lib/apt/lists/*

RUN if [ ${UID:-0} -ne 0 ] && [ ${GID:-0} -ne 0 ]; then \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.1
11
11 changes: 9 additions & 2 deletions build_system.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash
set -e

UBUNTU_BASE_URL="http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release"
UBUNTU_FILE="ubuntu-base-20.04.1-base-arm64.tar.gz"
UBUNTU_BASE_URL="http://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release"
UBUNTU_FILE="ubuntu-base-24.04-base-arm64.tar.gz"

# Make sure we're in the correct spot
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
Expand Down Expand Up @@ -99,6 +99,10 @@ echo "Extracting docker image"
docker container export -o $BUILD_DIR/filesystem.tar $CONTAINER_ID
exec_as_root tar -xf $BUILD_DIR/filesystem.tar -C $ROOTFS_DIR > /dev/null

# Avoid detecting as container
echo "Removing .dockerenv file"
exec_as_root rm -f $ROOTFS_DIR/.dockerenv

echo "Setting network stuff"
set_network_stuff() {
cd $ROOTFS_DIR
Expand All @@ -111,6 +115,9 @@ set_network_stuff() {
# Fix resolv config
bash -c "ln -sf /run/systemd/resolve/stub-resolv.conf etc/resolv.conf"

# Set capability for ping
bash -c "setcap cap_net_raw+ep bin/ping"

# Write build info
DATETIME=$(date '+%Y-%m-%dT%H:%M:%S')
bash -c "printf \"$GIT_HASH\n$DATETIME\" > BUILD"
Expand Down
23 changes: 8 additions & 15 deletions userspace/base_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ apt-fast install --no-install-recommends -yq \
ssh \
sshfs \
sudo \
systemd-resolved \
traceroute \
tk-dev \
ubuntu-minimal \
Expand All @@ -115,9 +116,6 @@ echo "makestep 0.1 3" >> /etc/chrony/chrony.conf
mkdir /data && chown $USERNAME:$USERNAME /data
mkdir /persist && chown $USERNAME:$USERNAME /persist

# Disable automatic ondemand switching from ubuntu
systemctl disable ondemand

# Disable pstore service that moves files out of /sys/fs/pstore
systemctl disable systemd-pstore.service

Expand All @@ -131,7 +129,7 @@ ln -sf /bin/bash /bin/sh
apt-fast update -yq
apt-fast install --no-install-recommends -yq \
libacl1:armhf \
libasan5-armhf-cross \
libasan6-armhf-cross \
libatomic1-armhf-cross \
libattr1:armhf \
libaudit1:armhf \
Expand All @@ -145,13 +143,12 @@ apt-fast install --no-install-recommends -yq \
libdrm2:armhf \
libevdev2:armhf \
libexpat1:armhf \
libffi7:armhf \
libffi8:armhf \
libfontconfig1:armhf \
libfreetype6:armhf \
libgbm1:armhf \
libgcc-9-dev-armhf-cross \
libgcc1:armhf \
libglib2.0-0:armhf \
libgcc-11-dev-armhf-cross \
libglib2.0-0t64:armhf \
libgomp1-armhf-cross \
libgudev-1.0-0:armhf \
libinput-bin:armhf \
Expand All @@ -163,23 +160,20 @@ apt-fast install --no-install-recommends -yq \
libjpeg8:armhf \
libjpeg8-dev:armhf \
libkmod2:armhf \
libmtdev1:armhf \
libmtdev1t64:armhf \
libpam0g:armhf \
libpam0g-dev:armhf \
libpcre3:armhf \
libpixman-1-0:armhf \
libpng16-16:armhf \
libpng16-16t64:armhf \
libselinux1:armhf \
libstdc++6:armhf \
libstdc++6-armhf-cross \
libubsan1-armhf-cross \
libudev-dev:armhf \
libudev1:armhf \
libuuid1:armhf \
libwacom2:armhf \
libwayland-client0:armhf \
libwayland-cursor0:armhf \
libwayland-server0:armhf \
libwacom9:armhf \
libx11-6:armhf \
libxau6:armhf \
libxcb-render0:armhf \
Expand All @@ -197,7 +191,6 @@ apt-fast install --no-install-recommends -yq \
libgles1 \
libgles2 \
libgles-dev \
libwayland-dev \
openssh-server \
dnsmasq-base \
isc-dhcp-client \
Expand Down
4 changes: 3 additions & 1 deletion userspace/compile-capnp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ CXXFLAGS="-fPIC -O2" ./configure

make -j$(nproc)

checkinstall -yD --install=no --pkgname=capnproto
# remove "--fstrans=no" when checkinstall is fixed (still not fixed in 24.04)
# https://bugs.launchpad.net/ubuntu/+source/checkinstall/+bug/78455
checkinstall -yD --install=no --fstrans=no --pkgname=capnproto
mv capnproto*.deb /tmp/capnproto.deb
11 changes: 9 additions & 2 deletions userspace/compile-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ wget https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2
tar xvf ffmpeg-4.2.2.tar.bz2
cd ffmpeg-4.2.2

./configure --enable-shared --disable-static
# avoid makeinfo: error parsing ./doc/t2h.pm: Undefined subroutine &Texinfo::Config::set_from_init_file called at ./doc/t2h.pm line 24.
# with --disable-htmlpages
# --disable-doc works too, disables building documentation completely
# https://gist.github.com/omegdadi/6904512c0a948225c81114b1c5acb875
# https://github.com/7Ji/archrepo/issues/10
./configure --enable-shared --disable-static --disable-htmlpages
make -j$(nproc)

checkinstall -yD --install=no --pkgname=ffmpeg
# remove "--fstrans=no" when checkinstall is fixed (still not fixed in 24.04)
# # https://bugs.launchpad.net/ubuntu/+source/checkinstall/+bug/78455
checkinstall -yD --install=no --fstrans=no --pkgname=ffmpeg
mv ffmpeg*.deb /tmp/ffmpeg.deb
7 changes: 3 additions & 4 deletions userspace/compile-modemmanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ apt-fast update
apt-fast install -y --no-install-recommends automake autoconf build-essential cmake

# TODO: clean up these build time dependencies
apt-fast install -y --no-install-recommends python3 python3-pip python3-setuptools python3-wheel ninja-build
pip3 install --user meson
apt-fast install -y --no-install-recommends python3 python3-pip python3-setuptools python3-wheel ninja-build meson
export PATH=$PATH:/root/.local/bin

# build mobile-broadband-provider-info
Expand All @@ -25,7 +24,7 @@ make install

# build libqmi
cd /tmp
apt-fast install -y --no-install-recommends libgudev-1.0-dev gobject-introspection libgirepository1.0-dev help2man bash-completion
apt-fast install -y --no-install-recommends libgudev-1.0-dev gobject-introspection libgirepository1.0-dev help2man bash-completion python-is-python3

git clone -b $LIBQMI_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
cd libqmi
Expand All @@ -35,7 +34,7 @@ ninja -C build install

# build ModemManager
cd /tmp
apt install -y --no-install-recommends gettext libpolkit-gobject-1-dev libdbus-1-dev libsystemd-dev
apt install -y --no-install-recommends gettext libpolkit-gobject-1-dev libdbus-1-dev libsystemd-dev polkitd-pkla

git clone -b $MM_VERSION --depth 1 https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git

Expand Down
15 changes: 11 additions & 4 deletions userspace/compile-qtwayland5.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
#!/bin/bash -e

# Patched qtwayland that outputs a fixed screen size
# Clone qtwayland submodule, checkout 5.12.9 (5.12.8 leaks timers, see https://bugreports.qt.io/browse/QTBUG-82914), apply patch, qmake, make
# Clone qtwayland submodule, checkout, apply patch, qmake, make
VERSION=5.12.9

cd /tmp
git clone --branch v5.12.9 https://github.com/qt/qtwayland.git
git clone --branch v${VERSION} --depth 1 https://github.com/qt/qtwayland.git
cd qtwayland

git apply /tmp/agnos/patch
git apply /tmp/agnos/patch-qtwayland-v5.12

# qtwayland is incorrectly built against libdl.so instead of libdl.so.2
# https://stackoverflow.com/a/75855054/639708
ln -s libdl.so.2 /usr/lib/aarch64-linux-gnu/libdl.so

mkdir /tmp/build && cd /tmp/build
qmake /tmp/qtwayland

export MAKEFLAGS="-j$(nproc)"
make

checkinstall -yD --install=no --pkgversion="5.12.8" --pkgname=qtwayland5 --pkgarch=arm64 --replaces=qtwayland5,libqt5waylandclient5,libqt5waylandcompositor5
# remove "--fstrans=no" when checkinstall is fixed (still not fixed in 24.04)
# # https://bugs.launchpad.net/ubuntu/+source/checkinstall/+bug/78455
checkinstall -yD --install=no --fstrans=no --pkgversion="${VERSION}" --pkgname=qtwayland5 --pkgarch=arm64 --replaces=qtwayland5,libqt5waylandclient5,libqt5waylandcompositor5
mv qtwayland5*.deb /tmp/qtwayland5.deb
3 changes: 0 additions & 3 deletions userspace/debs/qt.deb

This file was deleted.

3 changes: 2 additions & 1 deletion userspace/files/weston-ready.service
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ ExecStart=/bin/bash -c "while [ ! -e \"$XDG_RUNTIME_DIR/wayland-0\" ]; do sleep
ExecStart=/bin/sleep 0.5

ExecStart=/bin/echo "fixing permissions"
ExecStart=/bin/bash -c "chmod -R 770 $XDG_RUNTIME_DIR"
ExecStart=/bin/bash -c "chown -R comma: $XDG_RUNTIME_DIR"
ExecStart=/bin/bash -c "chmod -R 700 $XDG_RUNTIME_DIR"

# these are set by udev rules, but udev is slow
ExecStart=/bin/bash -c "chgrp gpu /dev/ion /dev/kgsl-3d0"
Expand Down
1 change: 1 addition & 0 deletions userspace/files/weston.service
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TTYVTDisallocate=yes

ExecStartPre=/bin/bash -c "mkdir -p $XDG_RUNTIME_DIR"
ExecStartPre=/bin/bash -c "chown -R comma: $XDG_RUNTIME_DIR"
ExecStartPre=/bin/bash -c "chmod -R 700 $XDG_RUNTIME_DIR"

ExecStartPre=/bin/bash -c "mkdir -p /data/misc/display || true"
ExecStartPre=/bin/bash -c "echo 0 > /data/misc/display/sdm_dbg_cfg.txt || true"
Expand Down
7 changes: 7 additions & 0 deletions userspace/hardware_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

# Install driver deb files (we're fine with overwriting stuff too)
cd /tmp/agnos/debs

# Setting up usr merged lib64 since it's not done by default (in 24.04-base)
# https://wiki.debian.org/UsrMerge
# https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/
sudo mkdir /usr/lib64
sudo ln -s usr/lib64 /lib64

apt-get -o Dpkg::Options::="--force-overwrite" install -yq \
./agnos-base.deb \
./agnos-display_0.0.1.deb \
Expand Down
15 changes: 1 addition & 14 deletions userspace/openpilot_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ apt-fast install --no-install-recommends -yq \
libffi-dev \
libfreetype6-dev \
libglfw3-dev \
libglib2.0-0 \
libglib2.0-0t64 \
libi2c-dev \
libjpeg-dev \
liblzma-dev \
Expand Down Expand Up @@ -61,17 +61,4 @@ apt-fast install --no-install-recommends -yq \
vnstat \
wget \
zlib1g-dev \
libqt5opengl5-dev \
libqt5sql5-sqlite \
libqt5svg5-dev \
libqt5multimedia5-plugins \
qml-module-qtquick2 \
qt5-default \
qtbase5-private-dev \
qtdeclarative5-dev \
qtdeclarative5-private-dev \
qtlocation5-dev \
qtmultimedia5-dev \
qtpositioning5-dev \
qtwayland5 \
zstd
2 changes: 0 additions & 2 deletions userspace/qtwayland/.gitattributes

This file was deleted.

Loading

0 comments on commit 4a924da

Please sign in to comment.