forked from rizalmart/puppy-linux-kernel-maker
-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (151 loc) · 6.5 KB
/
linux-kernel-aufs.yml
File metadata and controls
186 lines (151 loc) · 6.5 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Puppy Linux Kernel Build + AUFS
on:
# schedule:
# - cron: '0 2 */20 * *' # daily at 02:00 UTC
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: debian:sid
env:
BASE_VERSION: "6.18"
CUSTOM_VERSION: "opkm"
AUFS_REPO: "https://github.com/sfjro/aufs-standalone.git"
AUFS_BRANCH: "aufs6.18" # Replace with desired AUFS branch
AUFS_PATCH_FILES: "aufs6-kbuild.patch aufs6-base.patch aufs6-mmap.patch aufs6-standalone.patch"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install build dependencies
run: |
apt-get update
apt-get install -y \
build-essential bc bison flex libssl-dev libelf-dev dwarves pahole \
squashfs-tools wget xz-utils ca-certificates gcc g++ binutils \
llvm clang kmod python3 curl git jq patch rsync
- name: Detect latest kernel patch
id: detect_kernel
run: |
set -euo pipefail
echo "Checking kernel.org releases for base ${BASE_VERSION}..."
releases_json="$(curl -sS https://www.kernel.org/releases.json)"
LATEST=$(printf '%s\n' "$releases_json" \
| jq -r --arg base "${BASE_VERSION}." '.releases[]
| select(.version | startswith($base))
| .version' \
| sort -V \
| tail -n 1)
if [ -z "$LATEST" ]; then
echo "No patch found. Using base ${BASE_VERSION}"
echo "KERNEL_VERSION=$BASE_VERSION" >> $GITHUB_ENV
else
echo "Detected latest kernel patch: $LATEST"
echo "KERNEL_VERSION=$LATEST" >> $GITHUB_ENV
fi
- name: Download Linux kernel
run: |
wget https://cdn.kernel.org/pub/linux/kernel/v${BASE_VERSION%%.*}.x/linux-$KERNEL_VERSION.tar.xz
tar -xf linux-$KERNEL_VERSION.tar.xz
mv linux-$KERNEL_VERSION linux
- name: Clone AUFS repository
run: git clone --depth=1 --branch $AUFS_BRANCH $AUFS_REPO aufs
- name: Apply AUFS patches
run: |
set -e
cd linux
PATCH_DIR="../aufs"
cp -rf $PATCH_DIR/fs ./
cp -rf $PATCH_DIR/Documentation ./
cp -f $PATCH_DIR/include/uapi/linux/aufs_type.h include/linux/
cp -rf $PATCH_DIR/include ./
for patch in $AUFS_PATCH_FILES ; do
if [ -f "$PATCH_DIR/$patch" ]; then
echo "Applying patch $PATCH_DIR/$patch..."
patch -p1 < "$PATCH_DIR/$patch" || echo "Patch $patch failed, skipping"
fi
done
- name: Set custom version string
working-directory: linux
run: echo "${CUSTOM_VERSION}" > .config.localversion
- name: Export KMOD_VERSION
run: echo "KMOD_VERSION=$KERNEL_VERSION-$(cat linux/.config.localversion)" >> $GITHUB_ENV
- name: Copy provided .config
run: |
sed -i -e "s#^EXTRAVERSION\ =.*#EXTRAVERSION=-$CUSTOM_VERSION#" linux/Makefile
cp .config-aufs linux/.config
- name: Auto-update config
working-directory: linux
run: |
make olddefconfig
cp -f .config kernel-${KMOD_VERSION}-aufs.config
- name: Upload kernel config
uses: actions/upload-artifact@v4
with:
name: kernel-${{ env.KMOD_VERSION }}-aufs-config
path: |
linux/kernel-${{ env.KMOD_VERSION }}-aufs.config
- name: Build kernel image
working-directory: linux
run: make -j"$(nproc)" bzImage
- name: Build modules
working-directory: linux
run: make modules -j"$(nproc)"
- name: Install modules into staging
working-directory: linux
run: |
mkdir -p ../staging
make modules_install INSTALL_MOD_PATH=../staging
- name: Strip unneeded symbols
run: find staging/lib/modules -type f -name '*.ko' -exec strip --strip-unneeded {} \;
- name: Install kernel headers
working-directory: linux
run: |
mkdir -p ../kernel-headers
make headers_install INSTALL_HDR_PATH=../kernel-headers
- name: Prepare SquashFS root
run: |
mkdir -p squashfs-root/lib/modules
mkdir -p squashfs-root-usrmerge/usr/lib/modules
cp -arf staging/lib/modules/* squashfs-root/lib/modules/
cp -arf staging/lib/modules/* squashfs-root-usrmerge/usr/lib/modules/
for mdir in squashfs-root/lib/modules squashfs-root-usrmerge/usr/lib/modules
do
find ./$mdir -maxdepth 2 -type l -name "build" -exec rm -f {} \;
done
mkdir -p kernel-headers-squashfs/usr/include
cp -a kernel-headers/include/* kernel-headers-squashfs/usr/include/
cp linux/arch/x86/boot/bzImage ./vmlinuz
cp -f linux/.config kernel-${KMOD_VERSION}.config
- name: Create Kernel Modules SquashFS
run: |
mksquashfs squashfs-root huge-kernel-${KMOD_VERSION}-aufs.sfs \
-comp xz -Xdict-size 100% -b 1M -noappend -Xbcj x86
mksquashfs squashfs-root-usrmerge huge-kernel-${KMOD_VERSION}-aufs-usrmerge.sfs \
-comp xz -Xdict-size 100% -b 1M -noappend -Xbcj x86
- name: Create Kernel Headers SquashFS
run: |
mksquashfs kernel-headers-squashfs \
kernel-headers-${KMOD_VERSION}-aufs.sfs \
-comp xz -Xdict-size 100% -b 1M -noappend -Xbcj x86
- name: Package kernel + squashfs
run: |
tar -cJf huge-kernel-${KMOD_VERSION}-aufs.tar.xz \
vmlinuz huge-kernel-${KMOD_VERSION}-aufs.sfs
tar -cJf huge-kernel-${KMOD_VERSION}-aufs-usrmerge.tar.xz \
vmlinuz huge-kernel-${KMOD_VERSION}-aufs-usrmerge.sfs
- name: Upload kernel package (traditional)
uses: actions/upload-artifact@v4
with:
name: huge-kernel-${{ env.KMOD_VERSION }}-aufs
path: huge-kernel-${{ env.KMOD_VERSION }}-aufs.tar.xz
- name: Upload kernel package (usrmerge)
uses: actions/upload-artifact@v4
with:
name: huge-kernel-${{ env.KMOD_VERSION }}-aufs-usrmerge
path: huge-kernel-${{ env.KMOD_VERSION }}-aufs-usrmerge.tar.xz
- name: Upload kernel headers
uses: actions/upload-artifact@v4
with:
name: kernel-headers-${{ env.KMOD_VERSION }}-aufs
path: kernel-headers-${{ env.KMOD_VERSION }}-aufs.sfs