Initial commit

This commit is contained in:
Nathan 2025-04-20 16:45:22 -05:00
commit c925d8418e
2 changed files with 97 additions and 0 deletions

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# Exynos 5 Series Linux Mainline Patchset Generator
## Description
This Git repository hosts the mainline patchset generator for 32-bit Exynos 5 series ARM platforms (e.g. Exynos 5 Chromebooks, Odroid XU3/XU4, etc).
This utility automatically:
- Retrieves the postmarketOS Exynos 5 kernel fork (master branch); a mainline or close-to-mainline kernel that targets Exynos 5 hardware)
- Determines what Linux release the postmarketOS kernel fork is based on (as it can vary; previously has it based on either a Linux release candidate or the 'linux-next' branch)
- Obtains the unmodified and unpatched Linux kernel that the kernel fork is based on
- Generates a mainline patchset via comparing both kernels that can be subsequently applied to unmodified mainlinue Linux kernels (with the benefit of improved support for 32-bit Exynos 5 ARM devices)
Note: The resulting generated patchset will be located in the 'results' folder along with a log that details what Linux kernel release the postmarketOS kernel fork was based on.
The resulting patchset can be applied with little to no additional work on regular unpatched mainline Linux kernels. All devices supported by the postmarketOS Exynos 5 kernel fork are supported by the generated patchset.
## Using the Mainline Patchset Generator
Executing 'generate_exynos_5_series_mainline_patchset.sh' will generate the mainline patchset and place it in the 'results' folder automatically
## Credits and Sources
| Repository | Branch | Organization |
|-------------------------------------------------------------|----------------------------------------------------------------|--------------|
| [Exynos5 Mainline/Linux](https://gitlab.com/exynos5-mainline/linux.git) | [master](https://gitlab.com/exynos5-mainline/linux/-/tree/master) | postmarketOS

View File

@ -0,0 +1,76 @@
#!/bin/bash
set -e
WORK_DIRECTORY="work-directory"
GENERATED_PATCHSET_FOLDER="results"
POSTMARKETOS_KERNEL_DIRECTORY_NAME="postmarketos-kernel"
POSTMARKETOS_KERNEL_FORK_GIT_CLONE_URL="https://gitlab.com/exynos5-mainline/linux.git"
UNPATCHED_LINUX_KERNEL_DIRECTORY_NAME="regular-linux-kernel"
if [ -d "$WORK_DIRECTORY" ]; then
rm -rf "$WORK_DIRECTORY"
fi
if [ -d "$GENERATED_PATCHSET_FOLDER" ]; then
rm -rf "$GENERATED_PATCHSET_FOLDER"
fi
mkdir "$WORK_DIRECTORY"
cd "$WORK_DIRECTORY"
git clone "$POSTMARKETOS_KERNEL_FORK_GIT_CLONE_URL" "$POSTMARKETOS_KERNEL_DIRECTORY_NAME"
cd "$POSTMARKETOS_KERNEL_DIRECTORY_NAME"
if [[ -f "localversion-next" ]]; then
LOCALVERSION=$(<"localversion-next")
LINUX_RELEASE="${LOCALVERSION/-/}"
GIT_CLONE_URL="https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
else
VERSION=$(grep '^VERSION =' Makefile | sed 's/^VERSION = //')
PATCHLEVEL=$(grep '^PATCHLEVEL =' Makefile | sed 's/^PATCHLEVEL = //')
SUBLEVEL=$(grep '^SUBLEVEL =' Makefile | sed 's/^SUBLEVEL = //')
EXTRAVERSION=$(grep '^EXTRAVERSION =' Makefile | sed 's/^EXTRAVERSION = //')
LINUX_RELEASE="${VERSION}.${PATCHLEVEL}"
if [[ "$EXTRAVERSION" == *rc* ]]; then
LINUX_RELEASE+="${EXTRAVERSION}"
else
if [[ $SUBLEVEL -ne 0 ]]; then
LINUX_RELEASE+=".$SUBLEVEL${EXTRAVERSION}"
else
LINUX_RELEASE+="${EXTRAVERSION}"
fi
fi
LINUX_RELEASE="v${LINUX_RELEASE}"
GIT_CLONE_URL="https://github.com/torvalds/linux.git"
fi
echo
echo "The postmarketOS Exynos 5 kernel fork is based on Linux $LINUX_RELEASE"
echo
PATCHSET_GENERATION_UTILITY_LOG="$(date +%F) | Linux Kernel Base: $LINUX_RELEASE"
git clone --depth 1 "$GIT_CLONE_URL" -b "$LINUX_RELEASE" ../"$UNPATCHED_LINUX_KERNEL_DIRECTORY_NAME"
cd ../"$UNPATCHED_LINUX_KERNEL_DIRECTORY_NAME"
git remote add "$POSTMARKETOS_KERNEL_DIRECTORY_NAME" ../"$POSTMARKETOS_KERNEL_DIRECTORY_NAME"
git remote update
mkdir ../../"$GENERATED_PATCHSET_FOLDER"
git diff "$POSTMARKETOS_KERNEL_DIRECTORY_NAME"/master -R > ../../"$GENERATED_PATCHSET_FOLDER"/"mainline-patchset-$(date +%F).patch"
echo "$PATCHSET_GENERATION_UTILITY_LOG" | tee ../../"$GENERATED_PATCHSET_FOLDER"/"mainline-patchset-$(date +%F).log"
cd ../..
rm -rf "$WORK_DIRECTORY"