Last active
November 17, 2023 07:47
-
-
Save TheBrokenRail/069bd0eb23ed3967fb96be7e9a7742c1 to your computer and use it in GitHub Desktop.
Cross-compile a Linux kernel with FunctionFS for the PinePhone running postmarketOS v23.06.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Setup | |
sudo apk update | |
abuild-keygen -a -i -n | |
cp ~/.abuild/*.rsa.pub /data/out | |
# Clone Repository | |
git clone https://gitlab.com/postmarketOS/pmaports.git -b "${PMOS_VERSION}" | |
cd pmaports | |
patch -p1 < /data/pmaports.patch | |
# Build | |
cd device/main/linux-postmarketos-allwinner | |
abuild checksum | |
abuild -r | |
# Copy Output | |
cp -r ~/packages /data/out/packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change this when changing the postmarketOS version! | |
FROM arm64v8/alpine:3.18 | |
# The postmarketOS Version | |
ENV PMOS_VERSION="v23.06" | |
# Use postmarketOS | |
RUN \ | |
echo "https://mirror.postmarketos.org/postmarketos/${PMOS_VERSION}" > temp && \ | |
cat /etc/apk/repositories >> temp && \ | |
cat temp > /etc/apk/repositories && \ | |
rm -f temp && \ | |
apk add --update --no-cache --no-progress --allow-untrusted postmarketos-keys | |
# Install Dependencies | |
RUN apk add --update --no-cache --no-progress alpine-sdk git sudo | |
# Create User | |
RUN \ | |
addgroup -g 1000 user && \ | |
adduser -D -u 1000 -G user -s /bin/bash user && \ | |
adduser user abuild && \ | |
echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
# Switch To User | |
USER user | |
WORKDIR /home/user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/device/main/linux-postmarketos-allwinner/APKBUILD | |
+++ b/device/main/linux-postmarketos-allwinner/APKBUILD | |
@@ -32,7 +32,7 @@ options="!strip !check !tracedeps | |
pmb:cross-native | |
pmb:kconfigcheck-community | |
" | |
-source="$pkgname-$_tag.tar.gz::https://github.com/megous/linux/archive/$_tag.tar.gz | |
+source="$pkgname-$_tag.tar.gz::https://codeberg.org/megi/linux/archive/$_tag.tar.gz | |
config-$_flavor.aarch64 | |
config-$_flavor.armv7 | |
0001-dts-add-dontbeevil-pinephone-devkit.patch | |
@@ -48,7 +48,7 @@ source="$pkgname-$_tag.tar.gz::https://github.com/megous/linux/archive/$_tag.tar | |
0011-sunxi-mmc-h6-fix.patch | |
0012-arm64-dts-allwinner-orangepi-3-fix-ethernet.patch | |
" | |
-builddir="$srcdir/linux-$_tag" | |
+builddir="$srcdir/linux" | |
case "$CARCH" in | |
aarch64*) _carch="arm64" ;; | |
--- a/device/main/linux-postmarketos-allwinner/config-postmarketos-allwinner.aarch64 | |
+++ b/device/main/linux-postmarketos-allwinner/config-postmarketos-allwinner.aarch64 | |
@@ -4442,7 +4442,7 @@ CONFIG_USB_CONFIGFS_F_TCM=y | |
# CONFIG_USB_ETH is not set | |
# CONFIG_USB_G_NCM is not set | |
# CONFIG_USB_GADGETFS is not set | |
-# CONFIG_USB_FUNCTIONFS is not set | |
+CONFIG_USB_FUNCTIONFS=m | |
# CONFIG_USB_MASS_STORAGE is not set | |
# CONFIG_USB_GADGET_TARGET is not set | |
# CONFIG_USB_G_SERIAL is not set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Build Docker Image | |
docker build -t pinephone-kernel-build . | |
# Create Output Directory | |
rm -rf out | |
mkdir out | |
# Run | |
docker run --rm -v "$(pwd):/data" pinephone-kernel-build /data/build.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment