forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
debd71e
commit ea09f16
Showing
3 changed files
with
117 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/usr/bin/env bash | ||
set -eux | ||
|
||
apt-get update | ||
apt-get install -y debootstrap tar zstd | ||
|
||
mkdir /tmp/chroot | ||
|
||
debootstrap --variant=minbase noble /tmp/chroot http://archive.ubuntu.com/ubuntu | ||
|
||
mkdir -p /tmp/chroot/tmp/tools | ||
cp tools/install_ubuntu_dependencies.sh /tmp/chroot/tmp/tools | ||
cp tools/install_python_dependencies.sh /tmp/chroot/tmp/tools | ||
cp pyproject.toml uv.lock /tmp/chroot/tmp | ||
|
||
cat <<EOF > /tmp/chroot/etc/apt/sources.list | ||
deb http://archive.ubuntu.com/ubuntu noble main | ||
deb http://archive.ubuntu.com/ubuntu noble universe | ||
deb http://archive.ubuntu.com/ubuntu noble multiverse | ||
deb http://archive.ubuntu.com/ubuntu noble restricted | ||
EOF | ||
|
||
cat <<EOF > /tmp/chroot/tmp/install-deps.sh | ||
set -eux | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
sudo \ | ||
tzdata \ | ||
locales \ | ||
ssh \ | ||
pulseaudio \ | ||
xvfb \ | ||
x11-xserver-utils \ | ||
gnome-screenshot \ | ||
apt-utils \ | ||
alien \ | ||
unzip \ | ||
tar \ | ||
curl \ | ||
xz-utils \ | ||
dbus \ | ||
gcc-arm-none-eabi \ | ||
tmux \ | ||
vim \ | ||
libx11-6 \ | ||
wget | ||
mkdir -p /tmp/opencl-driver-intel | ||
cd /tmp/opencl-driver-intel | ||
wget https://github.com/intel/llvm/releases/download/2024-WW14/oclcpuexp-2024.17.3.0.09_rel.tar.gz | ||
wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.12.0/oneapi-tbb-2021.12.0-lin.tgz | ||
mkdir -p /opt/intel/oclcpuexp_2024.17.3.0.09_rel | ||
cd /opt/intel/oclcpuexp_2024.17.3.0.09_rel | ||
tar -zxvf /tmp/opencl-driver-intel/oclcpuexp-2024.17.3.0.09_rel.tar.gz | ||
mkdir -p /etc/OpenCL/vendors | ||
echo /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64/libintelocl.so > /etc/OpenCL/vendors/intel_expcpu.icd | ||
cd /opt/intel | ||
tar -zxvf /tmp/opencl-driver-intel/oneapi-tbb-2021.12.0-lin.tgz | ||
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbb.so /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 | ||
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbbmalloc.so /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 | ||
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbb.so.12 /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 | ||
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbbmalloc.so.2 /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 | ||
mkdir -p /etc/ld.so.conf.d | ||
echo /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 > /etc/ld.so.conf.d/libintelopenclexp.conf | ||
ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf | ||
cd / | ||
rm -rf /tmp/opencl-driver-intel | ||
echo "NVIDIA_VISIBLE_DEVICES=all" >> /etc/environment | ||
echo "NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute" >> /etc/environment | ||
echo "QTWEBENGINE_DISABLE_SANDBOX=1" >> /etc/environment | ||
USER=batman | ||
USER_UID=1001 | ||
useradd -m -s /bin/bash -u \$USER_UID \$USER | ||
usermod -aG sudo $USER | ||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
chown \$USER /tmp/{pyproject.toml,uv.lock,tools/install_python_dependencies.sh} | ||
dbus-uuidgen > /etc/machine-id | ||
# Remove arm architecture toolchains that we don't want. | ||
cd /usr/lib/gcc/arm-none-eabi/* | ||
rm -rf arm/ thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp | ||
# Remove all the tmp files. | ||
rm -rf /tmp/* /tmp/.* | ||
# Clean up the apt cache, there are lots of archives. | ||
apt clean | ||
EOF | ||
|
||
cp /etc/resolv.conf /tmp/chroot/resolv.conf | ||
mount --bind /proc /tmp/chroot/proc | ||
mount --bind /sys /tmp/chroot/sys | ||
mount --bind /dev /tmp/chroot/dev | ||
chmod +x /tmp/chroot/tmp/install-deps.sh | ||
chroot /tmp/chroot bash /tmp/install-deps.sh | ||
umount /tmp/chroot/proc | ||
umount /tmp/chroot/sys | ||
umount /tmp/chroot/dev | ||
|
||
tar -C /tmp/chroot -cp - | zstd -9 > /tmp/chroot.tar.zstd | ||
du -h /tmp/chroot.tar.zstd |