u-boot-manta: Introduce u-boot package for device-samsung-manta

Signed-off-by: Lukas Timmermann <lukas@timmermann.space>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7208>
This commit is contained in:
Lukas Timmermann 2025-11-17 17:30:38 +01:00 committed by The Friendly Merge Bot
parent 2b8e664a33
commit c087973349
No known key found for this signature in database
2 changed files with 165 additions and 0 deletions

View file

@ -0,0 +1,53 @@
# Maintainer: Lukas Timmermann <linux@timmermann.space>
pkgname=u-boot-manta
pkgver=2026.01
pkgrel=0
pkgdesc="U-Boot bootloader for the Samsung Manta (Google Nexus 10) Tablet"
url="https://gitlab.com/LaT3St/u-boot"
arch="armv7"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11"
makedepends="$depends_dev
bc
bison
dtc
flex
openssl-dev
py3-setuptools
python3-dev
swig
gnutls-dev
android-tools
"
options="!check"
source="https://gitlab.com/LaT3St/u-boot/-/archive/lat3st/samsung-manta/u-boot-lat3st-samsung-manta.tar.gz
update-u-boot
"
builddir="$srcdir/u-boot-lat3st-samsung-manta"
build() {
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
export BUILD_DIR="$builddir"/build
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm manta_defconfig
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm all
sha512sum -b "$BUILD_DIR/u-boot.bin" > "$BUILD_DIR/u-boot.bin.sha512"
}
package() {
install -D -m644 "build/u-boot.bin" \
"$pkgdir/usr/share/u-boot/samsung-manta/u-boot.bin"
install -D -m644 "build/u-boot.bin.sha512" \
"$pkgdir/usr/share/u-boot/samsung-manta/u-boot.bin.sha512"
install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
}
sha512sums="
aa47486537fa9f8b16f50919ae2f16a2556f1ac07acc24943a9798b35236ecc7de77c8b48aa07179e07422eda1435ed701d4a1e65b8993edc1c97f809efe72a3 u-boot-lat3st-samsung-manta.tar.gz
654c3fe5ed9eb078f97b990d2743dd875fb3d395bcbbb8a3082fd8e73bdf1842f8919f7b58a81c4446f00739e935d31cfabb59086d255c5d978e0f7a0bc3c3d8 update-u-boot
"

View file

@ -0,0 +1,112 @@
#!/bin/sh
partition=/dev/mmcblk0p3
verbose=
dryrun=
imagedir=/usr/share/u-boot/
skip_delay=
die() {
echo "ERROR: $@"
exit 1
}
usage() {
cat <<EOF
usage: $0 [-n,--dry-run] [-i,--imagedir <imagedir>] [-s|--skip-delay]
options:
-p, --partition <partition> Specify partition to flash u-boot to
(current default: ${partition})
-i,--imagedir <imagedir> Specify u-boot image directory
(current default: ${imagedir:-none})
-n,--dry-run Print commands but don't execute them
-s,--skip-delay Skip delay and flash the image immediately
EOF
}
validate_checksum() {
file="$1"
file_sha512="$file.sha512"
file_size=$(stat -c%s $file)
partition="$2"
bs="$3"
checksum0=$(cat $file_sha512 | awk {'print $1'})
checksum1=$(dd if=$partition bs=1 count=$file_size status=none | sha512sum | awk {'print $1'})
if [ "$checksum0" != "$checksum1" ]; then
echo "File: $checksum0"
echo "Part: $checksum1"
die "Checksum failed"
fi
echo "Successful U-Boot image checksum verification on $partition :"
echo -e "\t$checksum1"
}
while [ $# -gt 0 ]; do
opt="$1"
shift
case "$opt" in
-p|--partition)
partition="$1"
shift
;;
-i|--imagedir)
imagedir="$1"
shift
;;
-n|--dry-run)
dryrun="echo"
;;
-s|--skip-delay)
skip_delay="yes"
;;
--)
break
;;
-*)
usage
exit 1
;;
esac
done
echo "/!\ WARNING:"
echo "This upgrade may not work reliably, postmarketOS might not boot anymore!"
echo
read -p "Continue? (y/n) [n]: " -n 1 -r
echo
case "$REPLY" in
y|Y) ;;
*) exit 1 ;;
esac
if [ -z "$dryrun" ]; then
if [ -z "$skip_delay" ]; then
echo "Updating $board u-boot in $device in 3 seconds..."
sleep 3
else
echo "Updating $board u-boot in $device"
fi
fi
(
set -e
[ -e "$imagedir/samsung-manta/" ] || die "manta images not installed, apk add u-boot-manta"
$dryrun echo "Generating android boot image..."
$dryrun dd if=/dev/zero of=/tmp/ramdisk iflag=fullblock bs=4b count=1
$dryrun gzip /tmp/ramdisk
$dryrun mkbootimg --kernel "$imagedir"samsung-manta/u-boot.bin --ramdisk /tmp/ramdisk.gz --base "0x40000000" --kernel_offset "0x00008000" --ramdisk_offset "0x01000000" --tags_offset "0x00000100" --second_offset "0x00f00000" --pagesize "2048" -o /tmp/aboot.img
$dryrun sha512sum /tmp/aboot.img > /tmp/aboot.img.sha512
$dryrun dd if=/tmp/aboot.img of=$partition bs=512 oflag=direct status=none
[ -z "$dryrun" ] && validate_checksum /tmp/aboot.img $partition 512
$dryrun rm -f /tmp/aboot.img /tmp/ramdisk.gz /tmp/ramdisk /tmp/aboot.img.sha512
$dryrun sync
) || die "U-Boot installation in $partition failed"
[ -z "$dryrun" ] && echo "Completed successfully."