-
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Containerfile.image.l4t36
80 lines (65 loc) · 2.5 KB
/
Containerfile.image.l4t36
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
FROM ubuntu:jammy
LABEL org.opencontainers.image.authors="Badr @pythops"
# Define the BSP version
ARG BSP=https://developer.nvidia.com/downloads/embedded/l4t/r36_release_v4.0/release/Jetson_Linux_R36.4.0_aarch64.tbz2
ARG L4T_PACKAGES
# Install different dependencies
RUN apt update && \
apt install -y \
wget \
patch \
bzip2 \
qemu-user-static \
sudo \
libxml2-utils \
python3 \
gdisk \
kpartx \
cpio \
binutils \
ssh \
python-is-python3 \
dosfstools \
python3-yaml \
build-essential \
lz4 \
cpio \
xmlstarlet
# Extract the BSP
RUN mkdir /build && \
wget -qO- $BSP | tar -jxpf - -C /build
# Copy the ubuntu rootfs
COPY rootfs/ /build/Linux_for_Tegra/rootfs/
# Sudo permissions
RUN chmod 4755 /build/Linux_for_Tegra/rootfs/usr/bin/sudo
# Different patches
COPY patches /patches
RUN patch /build/Linux_for_Tegra/nv_tegra/nv-apply-debs.sh < /patches/nv-apply-debs.diff && \
patch /build/Linux_for_Tegra/tools/jetson-disk-image-creator.sh < /patches/jetson-disk-image-creator.diff && \
patch /build/Linux_for_Tegra/tools/jetson-disk-image-creator.sh < /patches/agx-orin.diff
# Remove GUI packages
RUN rm -rf /build/Linux_for_Tegra/nv_tegra/l4t_deb_packages/nvidia-l4t-nvpmodel-gui-tools*.deb && \
rm -rf /build/Linux_for_Tegra/nv_tegra/l4t_deb_packages/nvidia-l4t-jetsonpower-gui-tools*.deb && \
rm -rf /build/Linux_for_Tegra/tools/python-jetson-gpio_*_arm64.deb
# Install nvidia packages in the new rootfs
WORKDIR /build/Linux_for_Tegra/
RUN ./apply_binaries.sh
# Fix permissions
RUN chroot /build/Linux_for_Tegra/rootfs/ /bin/bash -c "chown -R jetson:jetson /home/jetson && chmod 1777 /tmp"
# L4T packages
RUN mount -t proc proc rootfs/proc/ && \
mount -t sysfs sys rootfs/sys && \
mount -o bind /dev rootfs/dev && \
chroot rootfs /bin/bash -c "echo 'nameserver 8.8.8.8' > /etc/resolv.conf && apt update; apt install -y cuda-toolkit $L4T_PACKAGES"
# Edit initrd
WORKDIR /tmp/pythops
RUN gzip -d -c /build/Linux_for_Tegra/bootloader/l4t_initrd.img > initrd
WORKDIR /tmp/pythops/lab
RUN cpio -iv < ../initrd && \
echo "nameserver 127.0.0.53" > etc/resolv.conf && \
find . | cpio --create --format="newc" > ../new_initrd
WORKDIR /tmp/pythops
RUN gzip new_initrd && mv new_initrd.gz /build/Linux_for_Tegra/bootloader/l4t_initrd.img
# Copy the script to create the image
COPY scripts/create-jetson-image.sh /usr/local/bin/
WORKDIR /build/Linux_for_Tegra/tools