Repository navigation
69 lines (69 loc) · 2.69 KB
/
Copy pathkernel.yml
File metadata and controls
69 lines (69 loc) · 2.69 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
name: Compile Linux Kernel
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y llvm lld clang clang-tools libelf-dev
- name: Compile Busybox
run: |
BUSYBOX_VERSION=1.36.1
docker run --rm -v $PWD/busybox:/busybox-${BUSYBOX_VERSION} archlinux env BUSYBOX_VERSION=${BUSYBOX_VERSION} sh -c "
pacman-key --init
pacman -Syu --noconfirm base-devel musl kernel-headers-musl
curl https://busybox.net/downloads/busybox-${BUSYBOX_VERSION}.tar.bz2 | tar -jx
cd busybox-${BUSYBOX_VERSION}
make defconfig -j$(nproc)
LDFLAGS="--static" KCONFIG_NOTIMESTAMP=1 make CC=musl-gcc -j$(nproc)
"
- name: Generate initramfs
run: |
mkdir rootfs
pushd rootfs
mkdir -p bin dev/{pts,shm} proc sys tmp
cp ../busybox/busybox bin
for i in $(./bin/busybox --list);do
ln -sf busybox bin/$i
done
cat > init << EOF
#!/bin/sh
mount -t devtmpfs dev /dev
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t tmpfs tmpfs /tmp
mount -t devpts devpts /dev/pts
mount -t tmpfs tmpfs /dev/shm
setsid cttyhack /bin/sh
EOF
chmod +x init
find . -print0 | cpio -o --format=newc -0 -R 0:0 > ../rootfs.cpio
popd
- name: Compile Kernel
run: |
KERNEL_VERSION=6.6.69
curl https://cdn.kernel.org/pub/linux/kernel/v${KERNEL_VERSION%%.*}.x/linux-${KERNEL_VERSION}.tar.xz | tar -Jx
pushd linux-${KERNEL_VERSION}
make LLVM=1 defconfig
sed -i 's|.*CONFIG_INITRAMFS_SOURCE="".*|CONFIG_INITRAMFS_SOURCE="rootfs.cpio"|' .config
sed -i "s|.*\\(CONFIG_KERNEL_.*\\)=y|\\#\\ \\1 is not set|" .config
sed -i "s|.*# CONFIG_KERNEL_XZ is not set.*|CONFIG_KERNEL_XZ=y|" .config
sed -i "s|^CONFIG_DEBUG_KERNEL.*|# CONFIG_DEBUG_KERNEL is not set|" .config
sed -i "s|.*CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y.*|# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set|" .config
sed -i "s|.*# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set.*|CONFIG_CC_OPTIMIZE_FOR_SIZE=y|" .config
sed -i "s|.*CONFIG_AUDIT=y.*|# CONFIG_AUDIT is not set|" .config
sed -i "s|.*CONFIG_FTRACE=y.*|# CONFIG_FTRACE is not set|" .config
sed -i "s|.*CONFIG_FB_VESA.*|CONFIG_FB_VESA=y|" .config
cp ../rootfs.cpio .
make LLVM=1 -j$(nproc)
cp arch/x86/boot/bzImage ../vmlinuz
popd
- run: du -k vmlinuz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vmlinuz
path: vmlinuz