Skip to content

Remove conditional checks for libelf-dev installation and kernel conf… #145

Remove conditional checks for libelf-dev installation and kernel conf…

Remove conditional checks for libelf-dev installation and kernel conf… #145

Workflow file for this run

name: Makefile CI
env:
VERSION: linux-6.16.2
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cache the kernel
id: cache-kernel
uses: actions/cache@v4
with:
path: ${{ env.VERSION }}
key: ${{ env.VERSION }}
# https://kernel.org
- name: Download
if: steps.cache-kernel.outputs.cache-hit != 'true'
run: wget https://cdn.kernel.org/pub/linux/kernel/v6.x/${{ env.VERSION }}.tar.xz
# https://docs.kernel.org/admin-guide/README.html#installing-the-kernel-source
- name: Install the kernel source
if: steps.cache-kernel.outputs.cache-hit != 'true'
run: |
xz -cd ${{ env.VERSION }}.tar.xz | tar xvf -
cd ${{ env.VERSION }}
make mrproper
- name: Install libelf-dev
run: sudo apt-get install -y libelf-dev
# https://docs.kernel.org/admin-guide/README.html#build-directory-for-the-kernel
- name: Configure and build the kernel
run: |
cd ${{ env.VERSION }}
make defconfig
make
sudo make INSTALL_MOD_PATH=${{ github.workspace }}/iso/boot INSTALL_PATH=${{ github.workspace }}/iso/boot modules_install install
# https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html
# https://docs.kernel.org/filesystems/ramfs-rootfs-initramfs.html#contents-of-initramfs
- name: Create initramfs image
run: |
mkdir initramfs
cat > hello.c << EOF
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
printf("Hello world!\n");
sleep(999999999);
}
EOF
gcc -static hello.c -o initramfs/init
(cd initramfs; find . | cpio -o -H newc | gzip) > iso/boot/initramfs.cpio.gz
# https://www.gnu.org/software/grub/manual/grub/html_node/Making-a-GRUB-bootable-CD_002dROM.html
- name: Make a GRUB bootable CD-ROM
run: |
sudo apt-get install -y mtools xorriso
mkdir -p iso/boot/grub
cat << EOF > iso/boot/grub/grub.cfg
set default=0
set timeout=0
menuentry 'Linux' {
linux /boot/vmlinuz console=ttyS0 console=tty0 ignore_loglevel
initrd /boot/initramfs.cpio.gz
}
EOF
grub-mkrescue -o grub.iso iso
- name: Archive the ISO
uses: actions/upload-artifact@v4
with:
name: grub.iso
path: grub.iso