-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile.kernel-builder
More file actions
77 lines (63 loc) · 2.64 KB
/
Dockerfile.kernel-builder
File metadata and controls
77 lines (63 loc) · 2.64 KB
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
# Dockerfile for building ClockworkPi uConsole kernel
# This creates a reproducible build environment for kernel compilation
FROM ubuntu:24.04
# Avoid interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Install kernel build dependencies
RUN echo "Updated APT sources:"
# Add arm64 architecture for cross-compilation
##APPEND APT SOURCES FOR AMD64 AFTER 'Signed-By: .*'##
RUN sed -i '/^Signed-By:/a Architectures: amd64 \n' /etc/apt/sources.list.d/ubuntu.sources
# Replace 'Types: deb' by 'Types:deb deb-src' to add source repositories
RUN sed -i 's/Types: deb/Types: deb deb-src/g' /etc/apt/sources.list.d/ubuntu.sources
RUN cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu-src.sources
RUN cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/cross.sources
# Append 'Architectures: arm64' to the new cross sources list
RUN cat /etc/apt/sources.list.d/ubuntu.sources
#REPLACE URIS FOR ARM64##
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://ports.ubuntu.com/ubuntu-ports/|g' /etc/apt/sources.list.d/cross.sources
RUN sed -i 's|http://security.ubuntu.com/ubuntu/|http://ports.ubuntu.com/ubuntu-ports/|g' /etc/apt/sources.list.d/cross.sources
RUN sed -i 's/amd64/arm64/g' /etc/apt/sources.list.d/cross.sources
RUN cat /etc/apt/sources.list.d/cross.sources
RUN dpkg --add-architecture arm64
#Ensure the Docker image has necessary packages installed
RUN apt update
RUN apt search linux-image-unsigned
RUN apt upgrade -y
# Install kernel build dependencies on docker container for architecture arm64
RUN apt-get install -y \
build-essential \
bc \
bison \
flex \
libssl-dev:amd64 libssl-dev:arm64 \
libncurses-dev:amd64 libncurses-dev:arm64 \
libelf-dev:amd64 libelf-dev:arm64 \
kmod \
cpio \
rsync \
git \
fakeroot \
dpkg-dev \
debhelper \
kernel-wedge \
crossbuild-essential-arm64 \
crossbuild-essential-amd64 \
bzip2 \
zlib1g-dev:amd64 zlib1g-dev:arm64 \
libssl3t64:amd64 libssl3t64:arm64 \
perl \
libc6:amd64 libc6:arm64 \
libzstd1:amd64 libzstd1:arm64 \
gcc-14 \
g++-14 \
gcc-14-aarch64-linux-gnu \
g++-14-aarch64-linux-gnu
# Install kernel build dependencies on docker container for architecture arm64
RUN apt build-dep -y linux linux-image-unsigned-6.8.0-31-generic linux-image-unsigned-6.8.0-31-lowlatency
# Create a non-root user for building (optional, can build as root)
# RUN useradd -m -u 1000 -s /bin/bash builder
# Set working directory
WORKDIR /build
# Default command shows usage
CMD ["echo", "Usage: docker run -v /path/to/output:/output kernel-builder /build/build_kernel_in_container.sh"]