diff options
author | Eric Woudstra | 2023-05-09 13:48:15 +0200 |
---|---|---|
committer | Eric Woudstra | 2023-05-09 13:48:15 +0200 |
commit | 60df8bec26941d6227febdf3b2e14bfdee3b76dc (patch) | |
tree | 271db0c81d1af0fc49ba8f523bd3956cb2aedaba | |
download | aur-60df8bec26941d6227febdf3b2e14bfdee3b76dc.tar.gz |
U-Boot for Banana Pi Router Boards
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 70 | ||||
-rw-r--r-- | bpir-uboot-git.install | 31 | ||||
-rw-r--r-- | clk-uclass-log_ret.patch | 18 | ||||
-rw-r--r-- | mt7xxx.h | 45 |
6 files changed, 189 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7c5aaf23dfae --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = bpir-uboot-git + pkgdesc = U-Boot for BPI Router Boards + pkgver = 2023.04r84964.fd4ed6b7e8 + pkgrel = 1 + url = https://github.com/u-boot/u-boot + install = bpir-uboot-git.install + arch = aarch64 + license = GPL3 + makedepends = git + makedepends = bc + makedepends = vim + source = git+https://github.com/u-boot/u-boot.git#tag=v2023.04 + source = mt7xxx.h + source = clk-uclass-log_ret.patch + sha256sums = SKIP + sha256sums = SKIP + sha256sums = SKIP + +pkgname = bpir-uboot-git diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..4b3085810bc5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +src/ +pkg/ +*.xz +*.zst +*.bin +*.gz diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ae9b70bf8c52 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,70 @@ +# Maintainer: Eric Woudstra <ericwouds AT gmail DOT com> + +#mediatek distroboot see: include/configs/mt7623.h +# include/configs/<CONFIG_SYS_CONFIG_NAME>.h +# arch/<CONFIG_SYS_ARCH>/cpu/<CONFIG_SYS_CPU> +# board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> + +pkgname=bpir-uboot-git +#_pkgver=2021.10 # last build of u-boot tested for R64 +_pkgver=2023.04 +pkgver=2023.04r84964.fd4ed6b7e8 +pkgrel=1 +pkgdesc='U-Boot for BPI Router Boards' +arch=('aarch64') +url='https://github.com/u-boot/u-boot' +license=(GPL3) +depends=() +makedepends=('git' 'bc' 'vim') +source=( + "git+https://github.com/u-boot/u-boot.git#tag=v${_pkgver}" + 'mt7xxx.h' + 'clk-uclass-log_ret.patch' +) +sha256sums=(SKIP SKIP SKIP) +install=${pkgname}.install + +pkgver() { + cd "${srcdir}/u-boot" + _year=$(grep '^VERSION = ' Makefile | cut -b 11-) + _month=$(grep '^PATCHLEVEL = ' Makefile | cut -b 14-) + printf "%s.%sr%s.%s" "$_year" "$_month" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +_buildimage() { + _target=$1; _def=$2; _devtree=$3 + echo ^^^ BUILDING $_target ^^^ + cp -vf ./configs/$_def configs/bpir_my_defconfig + cat <<EOT | tee -a configs/bpir_my_defconfig +CONFIG_AUTOBOOT=y +CONFIG_BOOTDELAY=1 +CONFIG_SYS_CONFIG_NAME="mt7xxx" +CONFIG_DEFAULT_DEVICE_TREE="${_devtree}" +CONFIG_DEFAULT_FDT_FILE="${_devtree}" +CONFIG_CMD_EXT4=y +CONFIG_CMD_SETEXPR=y +CONFIG_HUSH_PARSER=y +CONFIG_EFI_PARTITION=y +CONFIG_ENV_IS_IN_MMC=n +CONFIG_DISTRO_DEFAULTS=y +EOT + unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS + ARCH=aarch64 make bpir_my_defconfig +# export KCFLAGS='-Wno-error=address' + ARCH=arm64 make u-boot.bin + cp u-boot.bin u-boot-${_target}.bin +} + +build() { + cd "${srcdir}/u-boot" + rm -f u-boot-bpir*.bin + patch -p1 -N -r - < "${srcdir}/clk-uclass-log_ret.patch" + cp -vf "${srcdir}/mt7xxx.h" include/configs/ + _buildimage bpir64 mt7622_rfb_defconfig mt7622-bananapi-bpi-r64 + _buildimage bpir3 mt7986a_bpir3_sd_defconfig mt7986a-sd-rfb +} + +package() { + cd "${srcdir}/u-boot" + install -vDt "$pkgdir/boot" -m644 u-boot-bpir*.bin +} diff --git a/bpir-uboot-git.install b/bpir-uboot-git.install new file mode 100644 index 000000000000..c219be24bf11 --- /dev/null +++ b/bpir-uboot-git.install @@ -0,0 +1,31 @@ +post_upgrade() { + _partlabelroot=$(lsblk -plno partlabel $rootdev | grep -G '\-root$' ) + [ -z "$_partlabelroot" ] && return + _target=$(echo $_partlabelroot | cut -d'-' -f1) + cp -vf /boot/u-boot-${_target}.bin /boot/u-boot.bin # This is the file that boots +} + +post_install() { + _partlabelroot=$(lsblk -plno partlabel $rootdev | grep -G '\-root$' ) + [ -z "$_partlabelroot" ] && return + mkdir -p /boot/extlinux + cat <<EOT | tee /boot/extlinux/extlinux.conf +DEFAULT linux-bpir64-git + MENU title U-Boot menu + PROMPT 0 + TIMEOUT 50 +LABEL linux-bpir64-git + MENU LABEL Archlinux AUR package BananaPi Routers + LINUX $(cat /boot/bootcfg/linux 2>/dev/null | cut -c6-) + INITRD $(cat /boot/bootcfg/initrd 2>/dev/null | cut -c6-) + FDT $(cat /boot/bootcfg/atfdtb 2>/dev/null | cut -c6-) + APPEND root=PARTLABEL=${_partlabelroot} $(cat /boot/bootcfg/cmdline 2>/dev/null) +EOT + post_upgrade +} + +post_remove() { + rm -vf /boot/u-boot.bin + rm -vrf /boot/extlinux +} + diff --git a/clk-uclass-log_ret.patch b/clk-uclass-log_ret.patch new file mode 100644 index 000000000000..624bc07e8f89 --- /dev/null +++ b/clk-uclass-log_ret.patch @@ -0,0 +1,18 @@ +diff -Naur a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c +--- a/drivers/clk/clk-uclass.c 2021-09-04 14:06:27.036885707 +0200 ++++ b/drivers/clk/clk-uclass.c 2021-09-04 14:06:08.405490429 +0200 +@@ -512,11 +512,14 @@ + if (!ops->get_rate) + return -ENOSYS; + ++ return ops->get_rate(clk); ++/* + ret = ops->get_rate(clk); + if (ret) + return log_ret(ret); + + return 0; ++*/ + } + + struct clk *clk_get_parent(struct clk *clk) diff --git a/mt7xxx.h b/mt7xxx.h new file mode 100644 index 000000000000..76ed0410ba8f --- /dev/null +++ b/mt7xxx.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Configuration for MediaTek MT7622/MT7986 SoC + * + */ + +#ifndef __MT7XXX_H +#define __MT7XXX_H + +/* Uboot definition */ +#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE + +/* SPL -> Uboot */ +#define CFG_SYS_UBOOT_START CONFIG_TEXT_BASE + +/* DRAM */ +#define CFG_SYS_SDRAM_BASE 0x40000000 + +/* This is needed for kernel booting */ +#define FDT_HIGH "0x4fd00000" + +#define ENV_MEM_LAYOUT_SETTINGS \ + "fdt_high=" FDT_HIGH "\0" \ + "kernel_addr_r=0x44000000\0" \ + "ramdisk_addr_r=0x48000000\0" \ + "scriptaddr=0x4fc00000\0" \ + "fdt_addr_r=" FDT_HIGH "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" + +#ifdef CONFIG_DISTRO_DEFAULTS + +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 1) \ + func(MMC, mmc, 0) + +#include <config_distro_bootcmd.h> + +/* Extra environment variables */ +#define CFG_EXTRA_ENV_SETTINGS \ + ENV_MEM_LAYOUT_SETTINGS \ + BOOTENV + +#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/ + +#endif |