summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2018-09-01 10:38:19 +0000
committertnn <tnn@pkgsrc.org>2018-09-01 10:38:19 +0000
commitfa35d804e2fb360f00968fc4a186c8d2dc2ad7fb (patch)
tree8b9cecf278620827969c96e3812013e15dc978f8 /sysutils
parent7b0e317126135fe9a8559372e3189dbaa2274bb0 (diff)
downloadpkgsrc-fa35d804e2fb360f00968fc4a186c8d2dc2ad7fb.tar.gz
sysutils/u-boot-rockpro64: import u-boot-rockpro64-2017.09
U-Boot is a bootloader for embedded boards based on PowerPC, ARM, MIPS and several other processors, which can be installed in a boot ROM and used to initialize and test the hardware or to download and run application code. This package provides U-Boot for the rk3389-based RockPRO64 from PINE64.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/u-boot-rockpro64/DESCR5
-rw-r--r--sysutils/u-boot-rockpro64/MESSAGE11
-rw-r--r--sysutils/u-boot-rockpro64/Makefile48
-rw-r--r--sysutils/u-boot-rockpro64/PLIST3
-rw-r--r--sysutils/u-boot-rockpro64/distinfo16
-rw-r--r--sysutils/u-boot-rockpro64/patches/patch-arch_arm_cpu_armv8_Kconfig15
-rw-r--r--sysutils/u-boot-rockpro64/patches/patch-lib_bch.c39
7 files changed, 137 insertions, 0 deletions
diff --git a/sysutils/u-boot-rockpro64/DESCR b/sysutils/u-boot-rockpro64/DESCR
new file mode 100644
index 00000000000..bd8baf47baf
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/DESCR
@@ -0,0 +1,5 @@
+U-Boot is a bootloader for embedded boards based on PowerPC, ARM, MIPS and
+several other processors, which can be installed in a boot ROM and used to
+initialize and test the hardware or to download and run application code.
+
+This package provides U-Boot for the rk3389-based RockPRO64 from PINE64.
diff --git a/sysutils/u-boot-rockpro64/MESSAGE b/sysutils/u-boot-rockpro64/MESSAGE
new file mode 100644
index 00000000000..de66fd5d5b3
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/MESSAGE
@@ -0,0 +1,11 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2018/09/01 10:38:19 tnn Exp $
+
+Example commands to install U-Boot to an empty SD card:
+
+# dd if=${LOCALBASE}/share/u-boot/rockpro64/sdloader.img seek=64 of=/dev/ld0d
+# dd if=${LOCALBASE}/share/u-boot/rockpro64/u-boot.itb seek=512 of=/dev/ld0d
+
+See also http://opensource.rock-chips.com/wiki_Boot_option
+
+===========================================================================
diff --git a/sysutils/u-boot-rockpro64/Makefile b/sysutils/u-boot-rockpro64/Makefile
new file mode 100644
index 00000000000..6d9e8cf2373
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/Makefile
@@ -0,0 +1,48 @@
+# $NetBSD: Makefile,v 1.1 2018/09/01 10:38:19 tnn Exp $
+
+UBOOT_TARGET= rockpro64
+UBOOT_CONFIG= rockpro64-rk3399_defconfig
+UBOOT_BIN= sdloader.img u-boot.itb
+
+# Switch to EL1 before booting kernel (required for 32-bit support)
+PKG_DEFAULT_OPTIONS+= el1
+
+UBOOT_VERSION= ${GITHUB_TAG:C/-.*$//}
+MASTER_SITES= ${MASTER_SITE_GITHUB:=ayufan-rock64/}
+GITHUB_PROJECT= linux-u-boot
+GITHUB_TAG= 2017.09-rockchip-ayufan-1033-gdf02018479
+DISTNAME= ${GITHUB_TAG}
+DISTINFO_FILE= ${.CURDIR}/../../sysutils/u-boot-rockpro64/distinfo
+PATCHDIR= ${.CURDIR}/../../sysutils/u-boot-rockpro64/patches
+DISTFILES= ${DEFAULT_DISTFILES}
+EXTRACT_SUFX= .tar.gz
+
+# Boot Loader stage 3-1 (BL31) EL3 Runtime Firmware
+# XXX LICENSE?
+BL31= rk3399_bl31_v1.18.elf
+DISTFILES+= ${BL31}
+SITES.${BL31}= ${MASTER_SITE_GITHUB:=rockchip-linux/rkbin/raw/9e6625e7551ffa591f0ac4c271f12a7ab5cedcf4/bin/rk33/}
+
+# DDR init binary
+DDR_BIN= rk3399_ddr_800MHz_v1.14.bin
+SITES.${DDR_BIN}= ${MASTER_SITE_GITHUB:=rockchip-linux/rkbin/raw/dbc8710a93406669fb2df2d57dc086228bf1979f/bin/rk33/}
+DISTFILES+= ${DDR_BIN}
+
+# pkgsrc tries to run distfiles that end in .bin; handle manually
+EXTRACT_ONLY= ${DISTFILES:N*.bin}
+
+USE_TOOLS+= gawk
+MAKE_ENV+= BL31=${WRKDIR}/${BL31}
+
+post-extract:
+ cp ${DISTDIR}/${DDR_BIN} ${WRKDIR}
+
+post-build:
+# build stage 3 package
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} u-boot.itb
+# build stage 1 loader
+ cd ${WRKSRC} && tools/mkimage -n rk3399 -T rksd -d ${WRKDIR}/${DDR_BIN} sdloader.img
+# append stage2 loader
+ cd ${WRKSRC} && cat spl/u-boot-spl.bin >> sdloader.img
+
+.include "../../sysutils/u-boot/u-boot-arm64.mk"
diff --git a/sysutils/u-boot-rockpro64/PLIST b/sysutils/u-boot-rockpro64/PLIST
new file mode 100644
index 00000000000..5b2118ab5ba
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2018/09/01 10:38:19 tnn Exp $
+share/u-boot/rockpro64/sdloader.img
+share/u-boot/rockpro64/u-boot.itb
diff --git a/sysutils/u-boot-rockpro64/distinfo b/sysutils/u-boot-rockpro64/distinfo
new file mode 100644
index 00000000000..8db6fff7d82
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/distinfo
@@ -0,0 +1,16 @@
+$NetBSD: distinfo,v 1.1 2018/09/01 10:38:19 tnn Exp $
+
+SHA1 (2017.09-rockchip-ayufan-1033-gdf02018479.tar.gz) = 3632ed4d62f7ea93a8fe493ad54c4a3966eaa29a
+RMD160 (2017.09-rockchip-ayufan-1033-gdf02018479.tar.gz) = 003f868c14c9612a2a9c4391c0b1fd66c086ff18
+SHA512 (2017.09-rockchip-ayufan-1033-gdf02018479.tar.gz) = 0badfef6f1bdae898db0f0383af8578c17d83f2afe50ba487cdd49d6dbd8dfc531badc72d3802b3c2542a831198779e187fe3db71f17e9d5ebf10a8b8644428c
+Size (2017.09-rockchip-ayufan-1033-gdf02018479.tar.gz) = 15119423 bytes
+SHA1 (rk3399_bl31_v1.18.elf) = 598be4ce91f088fa11f37ba09b30db98f2e5dc43
+RMD160 (rk3399_bl31_v1.18.elf) = 3505a2cc7685b8de0be1e88752e4ff42752f9bfc
+SHA512 (rk3399_bl31_v1.18.elf) = a191b60146099f220154540802be3c42452e9b3e989123f492ef04c9742717f67a2018039cf8049c5af7214d12ff50ea992edcfcff3e09b0d48bcbc17fe0af6e
+Size (rk3399_bl31_v1.18.elf) = 1297645 bytes
+SHA1 (rk3399_ddr_800MHz_v1.14.bin) = db827e863f594d30d0908288eadefe87242b699f
+RMD160 (rk3399_ddr_800MHz_v1.14.bin) = e8487d1a3193666aad4cd39cdabe19c60110a302
+SHA512 (rk3399_ddr_800MHz_v1.14.bin) = 560b6b67da688ceb541f3674829275e52a1d2894ccd8ee7b7b15fde8e68b49c754344b79f46e48426df11f6ca1742af9d36c883d5d672256ade38086a5fb3177
+Size (rk3399_ddr_800MHz_v1.14.bin) = 69876 bytes
+SHA1 (patch-arch_arm_cpu_armv8_Kconfig) = 375c79ebe0d593865fbaa7924c8446ea6712fca4
+SHA1 (patch-lib_bch.c) = 151e5f311742a7da919359950ccac2521bcfaaff
diff --git a/sysutils/u-boot-rockpro64/patches/patch-arch_arm_cpu_armv8_Kconfig b/sysutils/u-boot-rockpro64/patches/patch-arch_arm_cpu_armv8_Kconfig
new file mode 100644
index 00000000000..547ee39cdc7
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/patches/patch-arch_arm_cpu_armv8_Kconfig
@@ -0,0 +1,15 @@
+$NetBSD: patch-arch_arm_cpu_armv8_Kconfig,v 1.1 2018/09/01 10:38:19 tnn Exp $
+
+--- arch/arm/cpu/armv8/Kconfig.orig 2018-08-06 22:28:00.000000000 +0000
++++ arch/arm/cpu/armv8/Kconfig
+@@ -130,6 +130,10 @@ config ARMV8_PSCI_CPUS_PER_CLUSTER
+ A value 0 or no definition of it works for single cluster system.
+ System with multi-cluster should difine their own exact value.
+
++config ARMV8_SWITCH_TO_EL1
++ bool "Switch to EL1 before booting kernel"
++ default n
++
+ if SYS_HAS_ARMV8_SECURE_BASE
+
+ config ARMV8_SECURE_BASE
diff --git a/sysutils/u-boot-rockpro64/patches/patch-lib_bch.c b/sysutils/u-boot-rockpro64/patches/patch-lib_bch.c
new file mode 100644
index 00000000000..fa655794b34
--- /dev/null
+++ b/sysutils/u-boot-rockpro64/patches/patch-lib_bch.c
@@ -0,0 +1,39 @@
+$NetBSD: patch-lib_bch.c,v 1.1 2018/09/01 10:38:19 tnn Exp $
+
+u-boot: fix build on macos
+
+--- lib/bch.c.orig 2018-08-06 22:28:00.000000000 +0000
++++ lib/bch.c
+@@ -61,8 +61,10 @@
+ #include <linux/bitops.h>
+ #else
+ #include <errno.h>
+-#if defined(__FreeBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <sys/endian.h>
++#elif defined(__APPLE__)
++#include <machine/endian.h>
+ #else
+ #include <endian.h>
+ #endif
+@@ -71,7 +73,11 @@
+ #include <string.h>
+
+ #undef cpu_to_be32
++#if defined(__APPLE__)
++#define cpu_to_be32 htonl
++#else
+ #define cpu_to_be32 htobe32
++#endif
+ #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+ #define kmalloc(size, flags) malloc(size)
+ #define kzalloc(size, flags) calloc(1, size)
+@@ -117,7 +123,7 @@ struct gf_poly_deg1 {
+ };
+
+ #ifdef USE_HOSTCC
+-#if !defined(__DragonFly__) && !defined(__FreeBSD__)
++#if !defined(__DragonFly__) && !defined(__FreeBSD__) && !defined(__APPLE__)
+ static int fls(int x)
+ {
+ int r = 32;