forked from codedwrench/ps4-linux
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
97 lines (72 loc) · 4.13 KB
/
Dockerfile
File metadata and controls
97 lines (72 loc) · 4.13 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# State an OS to use with from
# https://hub.docker.com/search?categories=Operating+systems
#FROM ubuntu:22.04 AS build-env ## Ubuntu 22.04's Clang (v14) is too old for Kernel 6.15
FROM ubuntu:24.04 AS build-env
# Inherit everything from this first build stage onto this second stage:
# We can have all the commands in one single stage/directive, but this is cleaner and useful
FROM build-env AS deb-src
#You can use both "EOF" and EOF in this first heredoc declaration
RUN cat <<"EOF" > /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
# deb http://archive.canonical.com/ubuntu/ jammy partner
# deb-src http://archive.canonical.com/ubuntu/ jammy partner
EOF
# List copied from
# https://gist.github.com/hakerdefo/9c99e140f543b5089e32176fe8721f5f
FROM deb-src AS install-deps
ARG DEBIAN_FRONTEND=noninteractive
# Used only at build time
ENV TZ=Etc/UTC
# Used both at build and runtime
# Need non interactive builds and installs and TZ set for package "tzdata"
RUN <<"EOF"
#DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get update did not work.
apt-get update
apt-get install build-essential clang clang-14 lld lld-14 llvm llvm-14 wget git -y
#clang-17 lld-17 llvm-17
# I think llvm meta package is not needed for Kernel build. Nevermind it is.
# Me: Are you 100% sure llvm-ar is in clang package? AI: I am 100% sure
# Results:
#Me: Deathbed. AI: Oh yes. That *is* a poisonous mushroom. Would you like to know more about this poisonous mushroom?
#Maybe: Add two separate Dockerfiles for gcc build and LLVM build
#Download the right Dockerfile from the GH Actions file
# On second thought, maybe don't. It seems downloading and installing Clang adds only a few seconds of
# overhead, and having two different Dockerfiles would invalidate the Docker cache, slowing down builds
# and taking up GH cache space.
apt-get build-dep linux -y
EOF
FROM install-deps AS install-deps2
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install gcc-11 libgcc-11-dev libssl-dev -y
#openssl2.1-dev doesn't exist
#OpenSSL 2.1 needed for Linux kernel version 5.15.
#Without gcc-11 (or older), you will probably get compilation errors
FROM install-deps2 AS install-extra-firmware
RUN <<"EOF"
mkdir -p /lib/firmware/mrvl
cd /lib/firmware/mrvl
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mrvl/sd8897_uapsta.bin
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mrvl/pcie8897_uapsta.bin
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mrvl/sd8797_uapsta.bin
mkdir -p /lib/firmware/mediatek
cd /lib/firmware/mediatek
wget -nc https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/mediatek/mt7668pr2h.bin
#### Extra firmware that are / might be needed for kernel compilation.
EOF
# Wget code snippet from https://github.com/TigerClips1
# Clone the Linux kernel source . . . This fails to cache as expected.
# A slight change of git clone invalidates the whole kernel source
# directory cache. So used custom caching mecahnism in github.yaml
FROM install-extra-firmware AS prepare-kernel-source
RUN mkdir -p /container/workspace/kernel-source-container
WORKDIR /container/workspace/kernel-source-container
# This step is no longer necessary as we are going to compile outside of the docker image build. (Outside of Dockerfile).
###FROM prepare-kernel-source AS compile-kernel
# Dockerfile adapted from
#https://moebuta.org/posts/using-github-actions-to-build-linux-kernels/