dongshanpi-nezhastu: new device (MR 3814)

[ci:skip-build]: Already built successfully in CI
This commit is contained in:
Bastindo 2023-01-22 19:12:20 +01:00 committed by Newbyte
parent 68defa831e
commit cd1ddc03b6
No known key found for this signature in database
GPG key ID: 990600ED1DB95E02
4 changed files with 218 additions and 0 deletions

View file

@ -0,0 +1,62 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-dongshanpi-nezhastu
pkgdesc="DongshanPi NeZha STU"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="riscv64"
# pmb:strict: avoid grub-related install error during build with pmbootstrap
options="!check !archcheck pmb:strict"
depends="
linux-postmarketos-allwinner-d1
postmarketos-base
u-boot-dongshanpi-nezhastu
"
makedepends="
devicepkg-dev
grub
grub-efi
"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
grub-mkimage \
--prefix="/grub" \
--output="bootriscv64.efi" \
--format="riscv64-efi" \
--compression="xz" \
\
all_video \
cat \
configfile \
disk \
echo \
efi_gop \
fat \
ext2 \
gzio \
help \
iso9660 \
linux \
ls \
normal \
part_gpt \
part_msdos \
search \
search_label \
test \
true
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/bootriscv64.efi \
"$pkgdir"/boot/efi/boot/bootriscv64.efi
}
sha512sums="
35daa118d1c1df00c3e1bf5ad9c1b484031630e89a1ae5a28c1fb94353d5b2eafd238395493f0a58988d43ae45428edb2a34fb728e2354666b4b819ccf0e785d deviceinfo
"

View file

@ -0,0 +1,27 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="DongshanPi NeZha STU"
deviceinfo_manufacturer="DongshanPi"
deviceinfo_codename="dongshanpi-nezhastu"
deviceinfo_year="2022"
deviceinfo_dtb="allwinner/sun20i-d1-dongshan-nezha-stu"
deviceinfo_arch="riscv64"
# Device related
deviceinfo_gpu_accelerated="false"
deviceinfo_chassis="embedded"
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1920"
deviceinfo_screen_height="1080"
deviceinfo_getty="ttyS0;115200"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_sd_embed_firmware="u-boot/dongshan_nezha_stu/u-boot-sunxi-with-spl.bin:8"
deviceinfo_boot_part_start="8192"
deviceinfo_kernel_cmdline="console=ttyS0,115200 no_console_suspend panic=10 PMOS_NO_OUTPUT_REDIRECT"
deviceinfo_generate_grub_config="true"

View file

@ -0,0 +1,39 @@
pkgname=u-boot-dongshanpi-nezhastu
pkgver=2022.10_git20221101
pkgrel=0
pkgdesc="U-Boot for DongshanPi NeZhaSTU"
url="https://github.com/smaeul/u-boot/tree/d1-wip"
arch="riscv64"
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 py3-setuptools bc dtc python3-dev swig bison flex openssl-dev opensbi"
options="!check"
# d1-wip branch
_commit="528ae9bc6c55edd3ffe642734b4132a8246ea777"
source="u-boot-$_commit.tar.gz::https://github.com/smaeul/u-boot/archive/$_commit.tar.gz
update-u-boot
"
builddir="$srcdir"/u-boot-$_commit
build() {
touch include/config.h
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 OPENSBI="/usr/share/opensbi/generic/firmware/fw_dynamic.bin"
export BUILD_DIR="$builddir"/build
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" dongshan_nezha_stu_defconfig
make O="$BUILD_DIR" all
}
package() {
install -Dm644 build/u-boot-sunxi-with-spl.bin \
"$pkgdir"/usr/share/u-boot/dongshan_nezha_stu/u-boot-sunxi-with-spl.bin
install -Dm755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
}
sha512sums="
41cac25c10c6a1ac951a10af336df96ad77283b036cf17d7aca64bf81bc7e04b8c145778fb250b429cae71ac3350e1ba42ef8d9604d52d03c5fe8715901994b3 u-boot-528ae9bc6c55edd3ffe642734b4132a8246ea777.tar.gz
5e3473031bacf6443fb476373f5f40d01f63a0369f0c93814421b6937db15baa7b20dc9ecfac0cc9f8e43491b1e61d581bf9542e215368c537c365aa388de711 update-u-boot
"

View file

@ -0,0 +1,90 @@
#!/bin/sh
verbose=
board=
device=
dryrun=
imagedir=
die() {
echo "ERROR: $@"
exit 1
}
usage() {
get_defaults
cat <<EOF
usage: $0 [-n,--dry-run] [-i,--imagedir <imagedir>] [-b|--board <board-type>] [-d|--device <device>]
options:
-b,--board <board> Specify the board type: dongshanpi-nezhastu
(current default: ${board:-none})
-d,--device <device> Specify the device where to install u-boot
(current default: ${device:-none})
-i,--imagedir <imagedir> Specify u-boot image directory
(current default: ${imagedir:-none})
-n,--dry-run Print commands but don't execute them
EOF
}
while [ $# -gt 0 ]; do
opt="$1"
shift
case "$opt" in
-b|--board)
case "$1" in
dongshanpi-nezhastu) board="dongshan_nezha_stu" ;;
*) usage; exit 1;;
esac
shift
;;
-d|--device)
device="$1"
shift
;;
-i|--imagedir)
imagedir="$1"
shift
;;
-n|--dry-run)
dryrun="echo"
;;
--)
break
;;
-*)
usage
exit 1
;;
esac
done
if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then
usage
exit 1
fi
if [ -z "$dryrun" ]; then
echo "Updating $board u-boot in $device in 3 seconds..."
sleep 3
fi
(
set -e
case "$board" in
dongshan_nezha_stu)
[ -e "$imagedir/dongshan_nezha_stu" ] || die "dongshanpi-nezhastu images not installed, apk add u-boot-dongshanpi-nezhastu"
$dryrun dd if=$imagedir/dongshan_nezha_stu/u-boot-sunxi-with-spl.bin of=$device bs=8192 seek=16 status=none
;;
esac
$dryrun sync
) || die "U-Boot installation in $device failed"
[ -z "$dryrun" ] && echo "Completed successfully."