Skip to content

Commit

Permalink
uboot-pine64-git: new pkgbuild
Browse files Browse the repository at this point in the history
Signed-off-by: Danct12 <[email protected]>
  • Loading branch information
Danct12 committed Dec 6, 2019
1 parent 9689dfc commit 862e30e
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 0 deletions.
13 changes: 13 additions & 0 deletions PKGBUILDS/uboot-pine64-git/0001-ATF-set-fno-stack-protector.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index d634b33..dcbe98f 100644
--- a/Makefile
+++ b/Makefile
@@ -286,7 +286,7 @@ ASFLAGS += $(CPPFLAGS) $(ASFLAGS_$(ARCH)) \
-ffreestanding -Wa,--fatal-warnings
TF_CFLAGS += $(CPPFLAGS) $(TF_CFLAGS_$(ARCH)) \
-ffreestanding -fno-builtin -std=gnu99 \
- -Os -ffunction-sections -fdata-sections
+ -Os -ffunction-sections -fdata-sections -fno-stack-protector

ifeq (${SANITIZE_UB},on)
TF_CFLAGS += -fsanitize=undefined -fno-sanitize-recover
76 changes: 76 additions & 0 deletions PKGBUILDS/uboot-pine64-git/0001-sunxi-Add-Pinetab-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
From a82b0ab885a89a921c7027fac68e78adb909dc5f Mon Sep 17 00:00:00 2001
From: Danct12 <[email protected]>
Date: Fri, 6 Dec 2019 13:55:51 +0700
Subject: [PATCH] sunxi: Add Pinetab support

Signed-off-by: Danct12 <[email protected]>
---
arch/arm/dts/Makefile | 1 +
arch/arm/dts/sun50i-a64-pinetab.dts | 13 +++++++++++++
configs/pinetab_defconfig | 22 ++++++++++++++++++++++
3 files changed, 36 insertions(+)
create mode 100644 arch/arm/dts/sun50i-a64-pinetab.dts
create mode 100644 configs/pinetab_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3dc9c4d4..36bb865f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -555,6 +555,7 @@ dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-pine64-plus.dtb \
sun50i-a64-pine64.dtb \
sun50i-a64-pinebook.dtb \
+ sun50i-a64-pinetab.dtb \
sun50i-a64-sopine-baseboard.dtb \
sun50i-a64-teres-i.dtb
dtb-$(CONFIG_MACH_SUN9I) += \
diff --git a/arch/arm/dts/sun50i-a64-pinetab.dts b/arch/arm/dts/sun50i-a64-pinetab.dts
new file mode 100644
index 00000000..14522cb3
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-pinetab.dts
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ *
+ * Copyright (c) 2018 ARM Ltd.
+ */
+
+#include "sun50i-a64-sopine-baseboard.dts"
+
+/ {
+ model = "PineTab";
+ compatible = "pine64,pinetab", "allwinner,sun50i-r18",
+ "allwinner,sun50i-a64";
+};
diff --git a/configs/pinetab_defconfig b/configs/pinetab_defconfig
new file mode 100644
index 00000000..aad3c268
--- /dev/null
+++ b/configs/pinetab_defconfig
@@ -0,0 +1,22 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SPL=y
+CONFIG_MACH_SUN50I=y
+CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y
+CONFIG_DRAM_CLK=552
+CONFIG_DRAM_ZQ=3881949
+CONFIG_MMC0_CD_PIN=""
+CONFIG_MMC_SUNXI_SLOT_EXTRA=2
+CONFIG_SPL_SPI_SUNXI=y
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_USE_PREBOOT=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x8000
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pinetab"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
--
2.24.0

66 changes: 66 additions & 0 deletions PKGBUILDS/uboot-pine64-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# U-Boot: Pine64
# Maintainer: Kevin Mihelich <[email protected]>

buildarch=8

pkgname=uboot-pine64-git
pkgver=v2019.01.rc3.r35.g64abfc9b6b
pkgrel=2
pkgdesc="U-Boot for Pine64"
arch=('aarch64')
url='http://www.denx.de/wiki/U-Boot/WebHome'
license=('GPL')
makedepends=('bc' 'git' 'python' 'swig' 'dtc')
install=${pkgname}.install
source=('git+https://github.com/u-boot/u-boot.git#commit=28a4516cf154d6f7e738f8e0519b41eccef5af5c'
'git+https://github.com/ARM-software/arm-trusted-firmware.git#commit=87b582ef5b31c5893a470b61c217931fc7602da3'
'0001-ATF-set-fno-stack-protector.patch'
'0001-sunxi-Add-Pinetab-support.patch'
'boot.txt'
'mkscr')
md5sums=('SKIP'
'SKIP'
'a61996f31a3546d411df5417867994a8'
'b1504e07f26af47b5fa42c15a1e38ecc'
'6d048eeb9808f6624a8a4db9803d622c'
'021623a04afd29ac3f368977140cfbfd')

pkgver() {
cd u-boot
git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
cd u-boot
git apply ../0001-sunxi-Add-Pinetab-support.patch

cd ../arm-trusted-firmware
git apply ../0001-ATF-set-fno-stack-protector.patch
}

build() {
unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS

cd arm-trusted-firmware

make PLAT=sun50i_a64 DEBUG=1 bl31
cp build/sun50i_a64/debug/bl31.bin ../u-boot

cd ../u-boot

make distclean
make pinetab_defconfig
echo 'CONFIG_IDENT_STRING=" Arch Linux ARM"' >> .config
make EXTRAVERSION=-${pkgrel}
cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl-pinetab.bin
}

package() {
cd u-boot

mkdir -p "${pkgdir}"/boot

cp u-boot-sunxi-with-spl-pinetab.bin "${pkgdir}"/boot
cp ../boot.txt ../mkscr "${pkgdir}"/boot
tools/mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d "${pkgdir}"/boot/boot.txt "${pkgdir}"/boot/boot.scr
}
15 changes: 15 additions & 0 deletions PKGBUILDS/uboot-pine64-git/boot.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
part uuid ${devtype} ${devnum}:${distro_bootpart} uuid
setenv kernel_addr_z 0x44080000

setenv bootargs fbcon=rotate:1 console=${console} console=tty0 root=PARTUUID=${uuid} rw rootwait

if load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_z} /boot/Image.gz; then
unzip ${kernel_addr_z} ${kernel_addr_r}
if load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
booti ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
9 changes: 9 additions & 0 deletions PKGBUILDS/uboot-pine64-git/mkscr
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions PKGBUILDS/uboot-pine64-git/uboot-pine64-git.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
flash_uboot() {
echo "Install new bootloader by running:"
echo "# dd if=/boot/u-boot-sunxi-with-spl-pinetab.bin of=/dev/mmcblk0 bs=8k seek=1 for Pinetab SD"
echo "# dd if=/boot/u-boot-sunxi-with-spl-pinetab.bin of=/dev/mmcblk2 bs=8k seek=1 for Pinetab eMMC"
}

## arg 1: the new package version
post_install() {
flash_uboot
}

## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
flash_uboot
}

0 comments on commit 862e30e

Please sign in to comment.