Skip to content

Commit

Permalink
Github action to publish a kernel and an initramfs package
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK authored and frno7 committed Mar 7, 2024
1 parent 0582120 commit f5a3a13
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: build

on:
push:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/frno7/gentoo-mipsr5900el:main
steps:
- uses: actions/checkout@v3

- name: Archive tag
run: |
echo "ARCHIVE_TAG=${GITHUB_REF_NAME}-${GITHUB_SHA:0:8}" >> $GITHUB_ENV
- name: Compile IOP modules
run: |
emaint sync -r frno7
ACCEPT_KEYWORDS="**" USE="modules -tools" mipsr5900el-unknown-linux-musl-emerge -v sys-firmware/iopmod
rm -rf /srv/initramfs/lib/firmware/ps2
mkdir /srv/initramfs/lib/firmware/ps2
cp /usr/mipsr5900el-unknown-linux-musl/lib/firmware/ps2/* /srv/initramfs/lib/firmware/ps2/
- name: Compile kernel and initramfs archive
env:
ARCH: mips
CROSS_COMPILE: mipsr5900el-unknown-linux-musl-
INSTALL_MOD_PATH: /srv/initramfs
INSTALL_MOD_STRIP: 1
run: |
JOBS="$(getconf _NPROCESSORS_ONLN)"
reconfig() { sed -i "/$1[ =]/"'s#^.*$'"#$1=$2#" .config; }
unconfig() { sed -i "/^$1=/"'s/^.*$'"/# $1 is not set/" .config; }
make -j "$JOBS" ps2_defconfig
reconfig CONFIG_INITRAMFS_SOURCE '"/srv/initramfs"'
# Enable EXPERT mode.
# reconfig CONFIG_EMBEDDED y
# Disable 640x512i early printk.
# unconfig CONFIG_EARLY_PRINTK
make -j "$JOBS" olddefconfig
make -j "$JOBS" vmlinux
make -j "$JOBS" modules
make -j "$JOBS" modules_install
# Reduce initramfs size by removing incompatible kernel module files.
# Busybox will make the files it needs anyway.
rm /srv/initramfs/lib/modules/*/{build,modules.*,source}
make_vmlinuz()
{
local variant="$1"
local vidmode="$2"
sed -i "/^modprobe ps2fb/s/mode_option=[^[:space:]]\+/mode_option=$vidmode/" /srv/initramfs/sbin/init
make -j "$JOBS" vmlinuz
ln vmlinuz vmlinuz-"$variant"-${{ env.ARCHIVE_TAG }}.elf
# Exclude kernel modules that won't work with other kernels anyway.
tar cvzf usr/initramfs-"$variant".tar.gz -C /srv --exclude initramfs/lib/modules initramfs
}
make_vmlinuz ntsc 640x448i@60
make_vmlinuz pal 640x512i@50
- name: Publish NTSC kernel
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: "vmlinuz-ntsc-${{ env.ARCHIVE_TAG }}"
path: vmlinuz-ntsc-${{ env.ARCHIVE_TAG }}.elf

- name: Publish PAL kernel
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: "vmlinuz-pal-${{ env.ARCHIVE_TAG }}"
path: vmlinuz-pal-${{ env.ARCHIVE_TAG }}.elf

- name: Publish NTSC initramfs archive
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: "initramfs-ntsc-${{ env.ARCHIVE_TAG }}"
path: usr/initramfs-ntsc.tar.gz

- name: Publish PAL initramfs archive
if: ${{ success() }}
uses: actions/upload-artifact@v3
with:
name: "initramfs-pal-${{ env.ARCHIVE_TAG }}"
path: usr/initramfs-pal.tar.gz

- name: Publish PAL kernel and PAL initramfs archive as a prerelease package
if: ${{ success() && github.ref == 'refs/heads/ps2-main' }}
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
automatic_release_tag: "${{ github.ref_name }}-package"
title: Linux kernel and initramfs archive package
files: |
vmlinuz-pal-${{ env.ARCHIVE_TAG }}.elf
vmlinuz-ntsc-${{ env.ARCHIVE_TAG }}.elf
usr/initramfs-pal.tar.gz
usr/initramfs-ntsc.tar.gz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ modules.order
!.gitattributes
!.gitignore
!.mailmap
!.github

#
# Generated include files
Expand Down

0 comments on commit f5a3a13

Please sign in to comment.