m1n1-apple-idevice: new bootloader package

Adds the m1n1 bootloader with iDevice patches.

Signed-off-by: Aster Boese <asterboese@mailbox.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6775
This commit is contained in:
Aster Boese
2025-08-09 10:15:23 -07:00
committed by Clayton Craft
parent bd90af1032
commit 632d79d0b9
2 changed files with 204 additions and 0 deletions
@@ -0,0 +1,80 @@
From 4fa0cb9d3ae9231e30862083d6e112b01fd3eb66 Mon Sep 17 00:00:00 2001
From: Aster Boese <asterboese@mailbox.org>
Date: Sun, 13 Jul 2025 21:38:27 -0400
Subject: [PATCH] vendor dependencies with cargo instead of git
---
rust/Cargo.lock | 22 +++++++++++-----------
rust/Cargo.toml | 8 +-------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/rust/Cargo.lock b/rust/Cargo.lock
index ac41e15..0f70999 100644
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -1,18 +1,17 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "bitflags"
-version = "1.3.2"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
+version = "2.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "fatfs"
version = "0.4.0"
+source = "git+https://github.com/rafalh/rust-fatfs.git?rev=4eccb50d011146fbed20e133d33b22f3c27292e7#4eccb50d011146fbed20e133d33b22f3c27292e7"
dependencies = [
"bitflags",
"log",
@@ -20,10 +19,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.17"
-dependencies = [
- "cfg-if",
-]
+version = "0.4.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "rust"
@@ -35,4 +33,6 @@ dependencies = [
[[package]]
name = "uuid"
-version = "1.7.0"
+version = "1.17.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d"
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 39229e9..1f1126d 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -11,11 +11,5 @@ crate-type = [ "staticlib" ]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-fatfs = { path = "vendor/rust-fatfs", default-features = false, features = ["lfn", "alloc"] }
+fatfs = { git = "https://github.com/rafalh/rust-fatfs.git", rev = "4eccb50d011146fbed20e133d33b22f3c27292e7", default-features = false, features = ["lfn", "alloc"] }
uuid = { version = "1.7.0", default-features = false }
-
-[patch.crates-io]
-uuid = { path = "vendor/uuid" }
-log = { path = "vendor/log" }
-bitflags = { path = "vendor/bitflags" }
-cfg-if = { path = "vendor/cfg-if" }
--
2.50.1
+124
View File
@@ -0,0 +1,124 @@
maintainer="Aster Boese <asterboese@mailbox.org>"
pkgname=m1n1-apple-idevice
_pkgname=m1n1
pkgver=1.4.21_git20250805
_commit="8d18e2eca29abe47b216438608b454f69aabd538"
pkgrel=0
pkgdesc="m1n1 bootloader for Apple Generic iDevice"
url="https://github.com/HoolockLinux/m1n1"
arch="aarch64"
license="MIT"
makedepends="
inkscape
imagemagick
postmarketos-artwork-icons
rustup
"
checkdepends="
py3-construct
py3-pyserial
py3-pytest
python3
"
subpackages="
$pkgname-dev
$pkgname-doc
$pkgname-udev::noarch"
source="https://github.com/HoolockLinux/m1n1/archive/$_commit.tar.gz
0001-vendor-dependencies-with-cargo-instead-of-git.patch
"
builddir="$srcdir/$_pkgname-$_commit"
# net: Cargo pulls crates
options="net"
export CARGO_HOME="$srcdir/cargo"
export RUSTUP_HOME="$srcdir/rustup"
prepare() {
default_prepare
# Show postmarketOS logo on boot
rm -r "$builddir"/data/bootlogo*
inkscape -w 48 -h 48 \
/usr/share/pixmaps/postmarketos-logo.svg \
-o "$builddir"/data/bootlogo_48.png
magick "$builddir"/data/bootlogo_48.png \
-background black \
-flatten -depth 8 \
rgba:"$builddir"/data/bootlogo_48.bin
inkscape -w 128 -h 128 \
/usr/share/pixmaps/postmarketos-logo.svg \
-o "$builddir"/data/bootlogo_128.png
magick "$builddir"/data/bootlogo_128.png \
-background black \
-flatten -depth 8 \
rgba:"$builddir"/data/bootlogo_128.bin
inkscape -w 256 -h 256 \
/usr/share/pixmaps/postmarketos-logo.svg \
-o "$builddir"/data/bootlogo_256.png
magick "$builddir"/data/bootlogo_256.png \
-background black \
-flatten -depth 8 \
rgba:"$builddir"/data/bootlogo_256.bin
# Use rustup to install bare-metal aarch64 target and our toolchain
rustup-init -q -y --default-toolchain=none --profile=minimal
. "$srcdir"/cargo/env
rustup default stable
rustup target add aarch64-unknown-none-softfloat
cd "$builddir"/rust
cargo vendor --locked
}
build() {
. "$srcdir"/cargo/env
make RELEASE=1 CHAINLOADING=1
}
check() {
python3 -m venv --clear --without-pip --system-site-packages .testenv
.testenv/bin/python3 -m pytest -v
}
package() {
# mach-o binary for usage with iBoot
install -Dm644 "$builddir"/build/m1n1-idevice.macho \
"$pkgdir"/usr/share/m1n1/m1n1-idevice.macho
# mach-o stub for usage with building mock kernel images
install -Dm644 "$builddir"/build/monitor-stub.macho \
"$pkgdir"/usr/share/m1n1/idevice-monitor-stub.macho
# binary for usage with PongoOS bootm
# renamed to m1n1-idevice.bin to not conflict with m1n1
install -Dm644 "$builddir"/build/m1n1.bin \
"$pkgdir"/usr/share/m1n1/m1n1-idevice.bin
install -Dm644 "$builddir"/LICENSE \
"$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE
install -Dm644 "$builddir"/udev/80-m1n1.rules \
"$pkgdir"/usr/lib/udev/rules.d/80-m1n1.rules
}
dev() {
default_dev
amove usr/share/m1n1/m1n1-idevice.bin
}
# NOTE: This should be removed if m1n1 gets into aports
udev() {
pkgdesc="$pkgdesc (udev rules)"
amove usr/lib/udev/rules.d/80-m1n1.rules
}
sha512sums="
749f90a89547ce7b5d6cad5d3d1bdfde0a80a04796feae10f6d1ddd0341f97826b00852981d95187cdc7ea81949d34942b12d83204488d3c0d871b9207784f3d 8d18e2eca29abe47b216438608b454f69aabd538.tar.gz
ae5b1baed8a6d48e28e3e0db1840c4bfacb34e9b6c4c614e5275a672b04687f135f348aab612d918d2778521efaa1215bb5c071034f222798dd7865d2952d9e9 0001-vendor-dependencies-with-cargo-instead-of-git.patch
"