Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stracciatella kernel #582

Merged
merged 11 commits into from
Sep 26, 2022
59 changes: 59 additions & 0 deletions package/linux-stracciatella/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash
# Copyright (c) 2022 The Toltec Contributors
# SPDX-License-Identifier: MIT

archs=(rm1 rm2)
pkgnames=(linux-stracciatella)
pkgdesc="RemarkableAS's vanilla kernel with a few extra flakes"
url=https://github.com/Etn40ff/linux-remarkable
pkgver=5.4.70-1
timestamp=2022-06-26T23:50:04+02:00
section="kernel"
maintainer="Salvatore Stella <etn45p4m@gmail.com>"
makedepends=(build:flex build:bison build:libssl-dev build:bc build:lzop build:libgmp-dev build:libmpc-dev build:kmod)
license=GPL-2.0-only
flags=(nostrip)
installdepends=(kernelctl)
image=base:v2.3
source=(https://github.com/Etn40ff/linux-remarkable/archive/c6aa07709109f9b5879628396052f60a97ec9197.tar.gz)
sha256sums=(529fe57ddc25bbaed5f0b3a9f7f79b51ab9ea3388d2acf8a933a8a4c77bd93c0)

build() {
if [[ $arch = rm1 ]]; then
ARCH=arm make zero-gravitas_defconfig
elif [[ $arch = rm2 ]]; then
ARCH=arm make zero-sugar_defconfig
fi
ARCH=arm make -j8
}

package() {
# Prepare files for the kernel archive
local staging="$srcdir"/staging
mkdir -p "$staging/boot"

cp --no-dereference {"$srcdir"/arch/arm,"$staging"}/boot/zImage
if [[ $arch = rm1 ]]; then
cp --no-dereference "$srcdir"/arch/arm/boot/dts/zero-gravitas.dtb "$staging"/boot/zero-gravitas.dtb
elif [[ $arch = rm2 ]]; then
cp --no-dereference "$srcdir"/arch/arm/boot/dts/zero-sugar.dtb "$staging"/boot/zero-sugar.dtb
fi

ARCH=arm make -C "$srcdir" modules_install INSTALL_MOD_PATH="$staging"
rm "$staging"/lib/modules/*/{source,build}

# Create the kernel archive
local archive="stracciatella-${pkgver%-*}.tar.bz2"
install -d "$pkgdir"/opt/usr/share/kernelctl
(cd "$staging" && tar --owner root:0 --group root:0 --mtime=$timestamp \
-cjf "$pkgdir"/opt/usr/share/kernelctl/"$archive" boot/* lib/modules/*)
}

configure() {
if [[ $(< /etc/version) -le 20210709090000 ]]; then
echo "WARNING: Your system is too old; this kernel will most likely not work unless you add the appropriate firmware blobs to /lib/firmware."
echo "Please consider updating your system instead."
fi
echo "The new kernel files have been copied, but not installed."
echo "Please use kernelctl to select the kernel to boot."
}