summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Chen2021-06-28 17:49:27 +0800
committerJack Chen2021-06-28 17:49:27 +0800
commitfa54d6739e5d0072c4224b019733ce784b7a9b1d (patch)
tree21dc486a6a1cb2c3377344c18719cc427d8d56d2
downloadaur-fa54d6739e5d0072c4224b019733ce784b7a9b1d.tar.gz
init commit
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD44
-rw-r--r--boot.txt13
-rwxr-xr-xmkscr9
-rw-r--r--uboot-tinkerboard.install50
5 files changed, 137 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..4db42982ff87
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = uboot-tinkerboard
+ pkgdesc = U-Boot for Tinker Board / S
+ pkgver = 21.05.1
+ pkgrel = 1
+ url = https://github.com/armbian/build
+ install = uboot-tinkerboard.install
+ arch = armv7h
+ license = GPL2
+ makedepends = uboot-tools
+ noextract = mkscr
+ noextract = boot.txt
+ noextract = linux-u-boot-current-tinkerboard_21.05.1_armhf.deb
+ backup = boot/boot.txt
+ source = mkscr
+ source = boot.txt
+ source = https://apt.armbian.com/pool/main/l/linux-u-boot-tinkerboard-current/linux-u-boot-current-tinkerboard_21.05.1_armhf.deb
+ sha512sums = 7046ab4d88efbba636be049be2f660e18c05e48d161d39437c1580b12795ba4d9197ad57ac4572398f80a38d4777507b57228abf4cc41f0081d196ece27ea9d0
+ sha512sums = ef07def032a97f4f8aac3d2a422a3934984ebac923c2c5ee67b6f50e8d406a42476948078868edbc02325bbcc3392a6006c4842f084961203acbd8a8404b6b23
+ sha512sums = SKIP
+
+pkgname = uboot-tinkerboard
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..1dd5f3e6bbcd
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,44 @@
+# Maintainer: Jack Chen <redchenjs@live.com>
+
+pkgname=uboot-tinkerboard
+pkgver=21.05.1
+pkgrel=1
+pkgdesc="U-Boot for Tinker Board / S"
+arch=('armv7h')
+url="https://github.com/armbian/build"
+license=('GPL2')
+backup=('boot/boot.txt')
+makedepends=('uboot-tools')
+install="$pkgname.install"
+source=(
+ "mkscr"
+ "boot.txt"
+ "https://apt.armbian.com/pool/main/l/linux-u-boot-tinkerboard-current/linux-u-boot-current-tinkerboard_${pkgver}_armhf.deb"
+)
+sha512sums=(
+ '7046ab4d88efbba636be049be2f660e18c05e48d161d39437c1580b12795ba4d9197ad57ac4572398f80a38d4777507b57228abf4cc41f0081d196ece27ea9d0'
+ 'ef07def032a97f4f8aac3d2a422a3934984ebac923c2c5ee67b6f50e8d406a42476948078868edbc02325bbcc3392a6006c4842f084961203acbd8a8404b6b23'
+ 'SKIP'
+)
+noextract=("${source[@]##*/}")
+
+prepare() {
+ cd "$srcdir"
+
+ rm -rf $(find -mindepth 1 -maxdepth 1 -type d)
+}
+
+package() {
+ cd "$srcdir"
+
+ ar x "linux-u-boot-current-tinkerboard_${pkgver}_armhf.deb"
+ tar -xf data.tar.xz
+
+ install -Dm755 mkscr "$pkgdir/boot/mkscr"
+ install -Dm644 "usr/lib/linux-u-boot-current-tinkerboard_${pkgver}_armhf/u-boot-rockchip-with-spl.bin" "$pkgdir/boot/rksd_loader.img"
+
+ major="$(mountpoint -d / | cut -f 1 -d ':')"
+ minor="$(mountpoint -d / | cut -f 2 -d ':')"
+ device="$(cat /proc/partitions | awk {'if ($1 == "'$major'" && $2 == "'$minor'") print $4 '})"
+ sed "s|%ROOTDEV%|$device|g" boot.txt | install -Dm644 /dev/stdin "$pkgdir/boot/boot.txt"
+}
diff --git a/boot.txt b/boot.txt
new file mode 100644
index 000000000000..49c36946e3c2
--- /dev/null
+++ b/boot.txt
@@ -0,0 +1,13 @@
+# After modifying, run ./mkscr
+
+setenv bootargs earlyprintk root=/dev/%ROOTDEV% rw rootwait console=ttyS2,115200n8 console=tty1 panic=10 consoleblank=0 loglevel=3 quiet
+
+if load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}zImage; then
+ if load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtbs/${fdtfile}; then
+ if load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}Initrd; then
+ bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
+ else
+ bootz ${kernel_addr_r} - ${fdt_addr_r}
+ fi
+ fi
+fi
diff --git a/mkscr b/mkscr
new file mode 100755
index 000000000000..272b6a7a500f
--- /dev/null
+++ b/mkscr
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [[ ! -x /usr/bin/mkimage ]]; then
+ echo "mkimage not found. Please install uboot-tools:"
+ echo " pacman -S uboot-tools"
+ exit 1
+fi
+
+mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr
diff --git a/uboot-tinkerboard.install b/uboot-tinkerboard.install
new file mode 100644
index 000000000000..a87118f9f033
--- /dev/null
+++ b/uboot-tinkerboard.install
@@ -0,0 +1,50 @@
+msg() {
+ # check if messages are to be printed using color
+ unset ALL_OFF BOLD BLUE GREEN RED YELLOW
+ # prefer terminal safe colored and bold text when tput is supported
+ if tput setaf 0 &>/dev/null; then
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
+ else
+ ALL_OFF="\e[0m"
+ BOLD="\e[1m"
+ BLUE="${BOLD}\e[34m"
+ GREEN="${BOLD}\e[32m"
+ RED="${BOLD}\e[31m"
+ YELLOW="${BOLD}\e[33m"
+ fi
+
+ local mesg=$1; shift
+ printf "${RED} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+flash_uboot() {
+ msg "A new U-Boot version needs to be flashed onto /dev/mmcblk0."
+ msg "Do you want to do this now? [y|N]"
+ read -r shouldwe
+ if [[ $shouldwe =~ ^([yY][eE][sS]|[yY])$ ]]; then
+ dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1023 seek=1 status=noxfer
+ dd if=/boot/rksd_loader.img of=/dev/mmcblk0 seek=64 conv=notrunc
+ else
+ msg "You can do this later by running:"
+ msg "# dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1023 seek=1 status=noxfer"
+ msg "# dd if=/boot/rksd_loader.img of=/dev/mmcblk0 seek=64 conv=notrunc"
+ msg "# if you are using the emmc interface, take care to use the correct device identifier! (probably mmcblk1)"
+ fi
+}
+
+## arg 1: the new package version
+post_install() {
+ mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d "/boot/boot.txt" "/boot/boot.scr"
+ flash_uboot
+}
+
+## arg 1: the new package version
+## arg 2: the old package version
+post_upgrade() {
+ post_install
+}