* Added device package for the pine-a64lts

* Added linux-postmarketos-allwinner kernel
* Added copy of alpines u-boot package with pine-a64lts support
* Changed postmarketos-mkinitfs to add the plain .dtb file to the boot partition
This commit is contained in:
Martijn Braam 2018-09-16 17:53:45 +02:00
parent d7e1a2fb6e
commit fb23669e29
12 changed files with 8914 additions and 2 deletions

View file

@ -0,0 +1,30 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-pine-a64lts"
pkgdesc="PINE A64-LTS"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="noarch"
options="!check"
depends="postmarketos-base linux-postmarketos-allwinner mesa-dri-swrast u-boot-pine64 uboot-tools"
makedepends="devicepkg-dev"
source="
deviceinfo
uboot-script.cmd
"
build() {
devicepkg_build $startdir $pkgname
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n postmarketos -d "$srcdir/uboot-script.cmd" "$srcdir/boot.scr"
}
package() {
devicepkg_package $startdir $pkgname
install -D -m644 "$srcdir"/boot.scr \
"$pkgdir"/boot/boot.scr
}
sha512sums="b168306e0efd7d0a1d139d63d1a3c5ee44c656f128429ecdc8ae289aedf5f5267ed315ec6ce57c0da2dfacbcbd43a021760230defe36f62068d0937dfed13b1c deviceinfo
ef7d21144b8c33f80968a6a089dcc6b568abd54f66f30d21d5befc10e51217484440aa8edb1065cd871ffba7bc599f44502bb6d240ee01f59dc92706ec6eabfd uboot-script.cmd"

View file

@ -0,0 +1,25 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="PINE A64-LTS"
deviceinfo_manufacturer="PINE"
deviceinfo_date=""
deviceinfo_dtb="allwinner/sun50i-a64-sopine-baseboard"
deviceinfo_modules_initfs=""
deviceinfo_arch="aarch64"
deviceinfo_disable_dhcpd="true"
# Device related
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1024"
deviceinfo_screen_height="600"
deviceinfo_dev_touchscreen=""
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_generate_legacy_uboot_initfs="true"
deviceinfo_write_uboot_spl="sopine_baseboard/u-boot-sunxi-with-spl.bin"

View file

@ -0,0 +1,19 @@
setenv bootargs init=/init.sh rw console=tty0 console=ttyS0,115200 no_console_suspend earlycon=uart,mmio32,0x01c28000 panic=10 consoleblank=0 loglevel=1 PMOS_NO_OUTPUT_REDIRECT
printenv
echo Loading DTB
load mmc ${mmc_bootdev}:1 ${fdt_addr_r} dtb-postmarketos-allwinner.dtb
echo Loading Initramfs
load mmc ${mmc_bootdev}:1 ${ramdisk_addr_r} uInitrd-postmarketos-allwinner
echo Loading Kernel
load mmc ${mmc_bootdev}:1 ${kernel_addr_r} vmlinuz-postmarketos-allwinner-dtb
echo Resizing FDT
fdt addr ${fdt_addr_r}
fdt resize
echo Booting kernel
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

View file

@ -0,0 +1,180 @@
_flavor=postmarketos-allwinner
_config="config-${_flavor}.${CARCH}"
pkgname=linux-${_flavor}
pkgver=4.18.0
pkgrel=0
arch="aarch64"
pkgdesc="Kernel close to mainline with extra patches for Allwinner devices"
url="https://kernel.org/"
depends=""
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev libressl-dev file bison flex"
options="!strip !check !tracedeps"
install=
_commit="788a3dffccd03be306646cd3c9a1029f350df3f7"
source="
linux-${_commit}.tar.gz::https://github.com/anarsoul/linux-2.6/archive/${_commit}.tar.gz
config-${_flavor}.aarch64
"
subpackages="$pkgname-dev"
license="GPL2"
_abi_release=$_pkgver
_carch=${CARCH}
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
builddir="$srcdir/linux-2.6-${_commit}"
prepare() {
local _patch_failed=
ls "$srcdir"
cd "$builddir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch|*.patch::*)
_patch=${i%::*}
msg "Applying $_patch..."
if ! patch -s -p1 -N -i "$srcdir"/$_patch; then
echo $_patch >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
mkdir -p "$srcdir"/build
cp -v "$srcdir"/$_config "$srcdir"/build/.config
make -C "$builddir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
olddefconfig
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-${_flavor}" \
CFLAGS_MODULE=-fno-pic
}
package() {
cd "$srcdir/build/arch/${_carch}/boot"
if [ "$CARCH" == "aarch64" ]; then
install -Dm644 "$srcdir/build/arch/${_carch}/boot/Image" \
"$pkgdir/boot/vmlinuz-$_flavor"
else
install -Dm644 "$srcdir/build/arch/${_carch}/boot/"*zImage \
"$pkgdir/boot/vmlinuz-$_flavor"
fi
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
local _install
case "$CARCH" in
aarch64*|arm*) _install="modules_install dtbs_install" ;;
*) _install="modules_install" ;;
esac
make -j1 $_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
}
dev() {
# copy the only the parts that we really need for build 3rd party
# kernel modules and install those as /usr/src/linux-headers,
# simlar to what ubuntu does
#
# this way you dont need to install the 300-400 kernel sources to
# build a tiny kernel module
#
pkgdesc="Headers and script for third party modules for postmarketos kernel"
depends="gmp-dev bash perl"
local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
# first we import config, run prepare to set up for building
# external modules, and create the scripts
mkdir -p "$dir"
cp "$srcdir"/$_config "$dir"/.config
make -j1 -C "$builddir" O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \
olddefconfig prepare modules_prepare scripts
# needed for 3rd party modules
# https://bugzilla.kernel.org/show_bug.cgi?id=11143
case "$CARCH" in
ppc*) (cd "$dir" && make arch/powerpc/lib/crtsavres.o);;
esac
# remove the stuff that points to real sources. we want 3rd party
# modules to believe this is the soruces
rm "$dir"/Makefile "$dir"/source
# copy the needed stuff from real sources
#
# this is taken from ubuntu kernel build script
# http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk
cd "$builddir"
find . -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pdm "$dir"
cp -a scripts include "$dir"
find $(find arch -name include -type d -print) -type f \
| cpio -pdm "$dir"
install -Dm644 "$srcdir"/build/Module.symvers \
"$dir"/Module.symvers
mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
ln -sf /usr/src/linux-headers-${_abi_release} \
"$subpkgdir"/lib/modules/${_abi_release}/build
# cross-compiling: delete binaries with host arch and replace them with
# symlinks to binaries with the target arch (packaged in kernel-scripts)
if [ -n "$CROSS_COMPILE" ]; then
msg "Symlinking binary scripts..."
depends="$depends kernel-scripts"
local found="false"
cd "$dir/scripts"
local i
for i in $(find . -type f); do
local type="$(file -b --mime-type "$i")"
[ "$type" != "application/x-pie-executable" ] && continue
local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)"
ln -svf "$native" "$i"
found="true"
done
if [ "$found" = "false" ]; then
error "Failed to symlink binary scripts!"
error "Did the mime-type change (see #1659)?"
return 1
fi
fi
}
sha512sums="8a5b6cbb549360c93d80a888e00a3341333f692db959c9b9b4a182f5bafa471a39ffe2f77e2c5ce9d9b0c197715b04054c7343ec3a160e9e0b52650bbdaeef07 linux-788a3dffccd03be306646cd3c9a1029f350df3f7.tar.gz
b5a72a1b369f38b33adf1921292fc62ae15ddd13e7fabbd51fd2f31d9daa5db4b823c2f09209d527b95c2f2592a036c4c13c2e2584a851c5f405a61cdfa44fdd config-postmarketos-allwinner.aarch64"

View file

@ -0,0 +1,69 @@
// SOURCE:
// https://github.com/NextThingCo/CHIP-u-boot/issues/10#issuecomment-287515505
#ifndef __LINUX_COMPILER_H
#error "Please don't include <linux/compiler-gcc6.h> directly, include <linux/compiler.h> instead."
#endif
#define __used __attribute__((__used__))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
/* Mark functions as cold. gcc will assume any path leading to a call
to them will be unlikely. This means a lot of manual unlikely()s
are unnecessary now for any paths leading to the usual suspects
like BUG(), printk(), panic() etc. [but let's keep them for now for
older compilers]
Early snapshots of gcc 4.3 don't support this and we can't detect this
in the preprocessor, but we can live with this because they're unreleased.
Maketime probing would be overkill here.
gcc also has a __attribute__((__hot__)) to move hot functions into
a special section, but I don't see any sense in this right now in
the kernel context */
#define __cold __attribute__((__cold__))
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
#ifndef __CHECKER__
# define __compiletime_warning(message) __attribute__((warning(message)))
# define __compiletime_error(message) __attribute__((error(message)))
#endif /* __CHECKER__ */
/*
* Mark a position in code as unreachable. This can be used to
* suppress control flow warnings after asm blocks that transfer
* control elsewhere.
*
* Early snapshots of gcc 4.5 don't support this and we can't detect
* this in the preprocessor, but we can live with this because they're
* unreleased. Really, we need to have autoconf for the kernel.
*/
#define unreachable() __builtin_unreachable()
/* Mark a function definition as prohibited from being cloned. */
#define __noclone __attribute__((__noclone__))
/*
* Tell the optimizer that something else uses this function or variable.
*/
#define __visible __attribute__((externally_visible))
/*
* GCC 'asm goto' miscompiles certain code sequences:
*
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
*
* Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
*
* (asm goto is automatically volatile - the naming reflects this.)
*/
#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
#define __HAVE_BUILTIN_BSWAP32__
#define __HAVE_BUILTIN_BSWAP64__
#define __HAVE_BUILTIN_BSWAP16__
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs
pkgver=0.6.8
pkgver=0.7.0
pkgrel=0
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
@ -25,4 +25,4 @@ package() {
}
sha512sums="d5abfe9a1298069e6722555c6e16223b09b36af65d879feb64d540aa6cbc009a3aa7f00528bcf656370ec37cc64f925c72ebb77813961cd6ebf22107b57ea029 init.sh.in
4515bc6891110e9c8b1ed8d31a89818c7c222a364bdbdf90097d5d6bbdb97eb889d4dbaec78dc928aa5ff698a8e89a76338e7c63017bf8dfb93f44a293848ca0 init_functions.sh
f3dc19f6976a95f11ef15155a240574edb46fdaa6885733532abc942c22b43422f9be50b3ae93dc42f9b1a683a62f3246efdb85cd38dbb3abbfdff46bba96617 mkinitfs.sh"
01f8ce63c011fe565212d03e5b0be730c06885dbf7344509c8ea1b4f112c0ca582ff59faf30a366055d9f15295edd0fa2219542987456fe4d06c35584102bb8f mkinitfs.sh"

View file

@ -353,6 +353,7 @@ append_device_tree()
echo "==> kernel: appending device-tree ${deviceinfo_dtb}"
if [ -e "$dtb" ]; then
cat "$kernel" "$dtb" > "${kernel}-dtb"
cp "$dtb" "${outfile/initramfs-/dtb-}.dtb"
else
echo "NOTE: device tree does not exist, not appending it to the kernel."
echo "This is expected for downstream kernels."

125
temp/u-boot/APKBUILD Normal file
View file

@ -0,0 +1,125 @@
# Contributor: He Yangxuan <yangxuan8282@gmail.com>
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=u-boot
pkgver=2018.05
pkgrel=3
_atfversion="c9f55c023164a6c8c49f70f7ac6c68c626839d6f"
pkgdesc="u-boot bootloader common files"
url="http://www.denx.de/wiki/U-Boot/"
arch="armhf aarch64"
license="GPL-2.0"
depends=""
depends_dev=""
makedepends="$depends_dev bc dtc python2-dev swig binutils coreutils"
install=""
source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
arm-trusted-firmware-${_atfversion}.tar.gz::https://github.com/apritzel/arm-trusted-firmware/archive/${_atfversion}.tar.gz
README.txt
update-u-boot
sopine-baseboard.patch
"
builddir="$srcdir"/u-boot-${pkgver//_/-}
atfbuilddir="$srcdir"/arm-trusted-firmware-${_atfversion}
case "$CARCH" in
armhf) board_configs="
beagleboard:am335x_boneblack
cubieboard:Cubieboard,Cubieboard2
cuboxi:mx6cuboxi
raspberrypi:rpi_0_w,rpi,rpi_2,rpi_3_32b
wandboard:wandboard
";;
aarch64) board_configs="
thunderx:thunderx_88xx
raspberrypi:rpi_3
pine64:sopine_baseboard
";;
esac
_allboards=""
for board_config in $board_configs; do
_allboards="$_allboards $pkgname-${board_config%%:*}"
done
subpackages="$pkgname-all:_all $_allboards"
build() {
if [ "$CARCH" = "aarch64" ]; then
export LDFLAGS=""
msg "Building ARM trusted firmware for allwinner"
cd "$atfbuilddir"
make PLAT=sun50iw1p1 DEBUG=1 bl31
export BL31="$atfbuilddir"/build/sun50iw1p1/debug/bl31.bin
fi
cd "$builddir"
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
local board_config board
for board_config in $board_configs; do
local configs="${board_config#*:}"
for board in ${configs//,/ }; do
msg "Building u-boot for $board"
export BUILD_DIR="$builddir"/build/$board
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" ${board}_config || return 1
make O="$BUILD_DIR" all || return 1
done
done
}
package() {
cd "$builddir"/build
mkdir -p "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/sbin
install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt || return 1
install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin || return 1
}
_all() {
pkgdesc="u-boot for all boards (meta package)"
depends="$_allboards"
mkdir -p "$subpkgdir"/
}
_split_boards() {
cd "$builddir"/build
pkgdesc="u-boot for $1"
depends="u-boot"
shift
local board
for board; do
msg "Including board $board"
mkdir -p "$subpkgdir"/usr/share/$pkgname/$board
export BUILD_DIR="$builddir"/build/$board
local ok=no
for image in u-boot-sunxi-with-spl.bin -- MLO SPL u-boot.img -- u-boot.bin; do
if [ "$image" = "--" ]; then
[ "$ok" = yes ] && break
continue
fi
if [ -e "$BUILD_DIR"/$image ]; then
cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \
|| return 1
ok=yes
fi
done
[ "$ok" = yes ] || return 1
done
}
for board_config in $board_configs; do
_board="${board_config%%:*}"
_configs="${board_config#*:}"
eval "${_board}() { _split_boards $_board ${_configs//,/ }; }"
done
sha512sums="218f71282c9d027b0faf210ce2d4d713779e0c61ea4a23f03d5dec0ca8836a3c26b46c5e258d583834f5b5a2f4663f98729ca4b0101a60f85457eb892f8370d2 u-boot-2018.05.tar.bz2
e964f0903f29a08d3a4a3177bcbfa9df68f47d30cac7f0d2597a7101c00632efdcd2c6ecba7f8be2e66a9689388bf2fa03087c0023ef99a5e1d080af5518d53c arm-trusted-firmware-c9f55c023164a6c8c49f70f7ac6c68c626839d6f.tar.gz
f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt
f3bb656bbd13caf10a8ea619bc08b439e7dc27526c9cbdfa0374f4f8e277632ff4df06b34d441d6723a93d4a54aa03465d4270c44219d6a150d416b9c56edbbe update-u-boot
50b19c0452d58ff80dfd2643330bbfe2349db687af258e5cb61f3872e0cac800df160baee7d6b0133bcc8b60d743a03e513db62a1917388101cfdea634424ae4 sopine-baseboard.patch"

32
temp/u-boot/README.txt Normal file
View file

@ -0,0 +1,32 @@
WandBoard
---------
- ROM loads boot loader from raw MMC sectors at fixed address
- NOTE: 1st partition needs to start after boot loader
- Install u-boot with:
dd if=wandboard/SPL of=/dev/mmcblk0 bs=1k seek=1
dd if=wandboard/u-boot.img of=/dev/mmcblk0 bs=1k seek=69
sync
(Note - the SD card node may vary, so adjust this as needed).
- Insert the SD card into the slot located in the bottom of the board
(same side as the mx6 processor)
BeagleBoard
-----------
- ROM looks for 1st partition with FAT, and loads MLO from it
- NOTE: MLO needs to be the first file created on this partition
- Install u-boot with:
cp am335x_boneblack/{MLO,u-boot.img} /media/mmcblk0p1/
Sunxi (Cubie* etc)
------------------
- ROM loads boot loader from SD-CARD sectors at fixed address
- Install u-boot with:
sudo dd if=<board>/u-boot-sunxi-with-spl.bin of=/dev/sda bs=1024 seek=8

View file

@ -0,0 +1,207 @@
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6fe93a8..d67914f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -379,7 +379,8 @@ dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-olinuxino.dtb \
sun50i-a64-orangepi-win.dtb \
sun50i-a64-pine64-plus.dtb \
- sun50i-a64-pine64.dtb
+ sun50i-a64-pine64.dtb \
+ sun50i-a64-sopine-baseboard.dtb
dtb-$(CONFIG_MACH_SUN9I) += \
sun9i-a80-optimus.dtb \
sun9i-a80-cubieboard4.dtb \
diff --git a/configs/sopine_baseboard_defconfig b/configs/sopine_baseboard_defconfig
index 05436a1..c79c111 100644
--- a/configs/sopine_baseboard_defconfig
+++ b/configs/sopine_baseboard_defconfig
@@ -10,7 +10,7 @@ CONFIG_DRAM_ODT_EN=y
CONFIG_MMC0_CD_PIN=""
CONFIG_MMC_SUNXI_SLOT_EXTRA=2
CONFIG_SPL_SPI_SUNXI=y
-CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus"
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-sopine-baseboard"
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_SPL_DOS_PARTITION is not set
diff --git a/arch/arm/dts/sun50i-a64-sopine-baseboard.dts b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
new file mode 100644
index 0000000..42c0f10
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-sopine-baseboard.dts
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun50i-a64-pine64.dts, which is:
+ * Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-a64-sopine.dtsi"
+
+/ {
+ model = "SoPine with baseboard";
+ compatible = "pine64,sopine-baseboard", "pine64,sopine",
+ "allwinner,sun50i-a64";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ reg_vcc1v8: vcc1v8 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc1v8";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ };
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&mmc2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc2_pins>;
+ vmmc-supply = <&reg_vcc3v3>;
+ vqmmc-supply = <&reg_vcc1v8>;
+ bus-width = <8>;
+ non-removable;
+ cap-mmc-hw-reset;
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+&ohci1 {
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_pins_a>;
+ status = "okay";
+};
diff --git a/arch/arm/dts/sun50i-a64-sopine.dtsi b/arch/arm/dts/sun50i-a64-sopine.dtsi
new file mode 100644
index 0000000..475518b
--- /dev/null
+++ b/arch/arm/dts/sun50i-a64-sopine.dtsi
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun50i-a64-pine64.dts, which is:
+ * Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "sun50i-a64.dtsi"
+
+/ {
+ reg_vcc3v3: vcc3v3 {
+ compatible = "regulator-fixed";
+ regulator-name = "vcc3v3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ };
+};
+
+&mmc0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins>;
+ vmmc-supply = <&reg_vcc3v3>;
+ non-removable;
+ disable-wp;
+ bus-width = <4>;
+ status = "okay";
+};

128
temp/u-boot/update-u-boot Normal file
View file

@ -0,0 +1,128 @@
#!/bin/sh
verbose=
board=
device=
dryrun=
imagedir=
get_defaults() {
if [ -z "$board" -a -e /sys/firmware/devicetree/base/compatible ]; then
case "$(cat /sys/firmware/devicetree/base/compatible 2>/dev/null)" in
wand,*) board=wand ;;
pine64,*) board=pine64 ;;
esac
fi
if [ -z "$device" ]; then
case "$board" in
wand|cubie|cubie2) device=/dev/mmcblk0p0 ;;
mx6cuboxi) device=/dev/mmcblk0 ;;
esac
fi
if [ -z "$imagedir" ]; then
imagedir="$(realpath $(dirname $0))"
[ -f "$imagedir/README.txt" ] || imagedir="/usr/share/u-boot"
fi
}
die() {
echo "ERROR: $@"
exit 1
}
usage() {
get_defaults
cat <<EOF
usage: $0 [-b|--board <board-type>] [-d|--device <device>]
options:
-b,--board <board> Specify the board type: wand, cubie, cubie2, cuboxi, pine64
(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
wand|wandboard) board="wand" ;;
cubie|cubieboard) board="cubie" ;;
cuboxi|mx6cuboxi) board="mx6cuboxi" ;;
pine64) board="pine64" ;;
*) 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
get_defaults
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
wand)
[ -e "$imagedir/wandboard" ] || die "wandboard images not installed, apk add u-boot-wandboard"
$dryrun dd if=$imagedir/wandboard/SPL of=$device bs=1k seek=1 status=none
$dryrun dd if=$imagedir/wandboard/u-boot.img of=$device bs=1k seek=69 status=none
;;
cubie|cubie2)
[ -e "$imagedir/Cubieboard${board#cubie}" ] || die "Cubieboard images not installed, apk add u-boot-cubieboard"
$dryrun dd if=$imagedir/Cubieboard${board#cubie}/u-boot-sunxi-with-spl.bin of=$device bs=1024 seek=8 status=none
;;
mx6cuboxi)
[ -e "$imagedir/mx6cuboxi" ] || die "iMX6 Cubox-i images not installed, apk add u-boot-cuboxi"
$dryrun dd if=$imagedir/mx6cuboxi/SPL of=$device bs=1k seek=1 status=none
$dryrun dd if=$imagedir/mx6cuboxi/u-boot.img of=$device bs=1k seek=69 status=none
;;
pine64)
[ -e "$imagedir/sopine_baseboard" ] || die "PINE A64 images not installed, apk add u-boot-pine64"
$dryrun dd if=$imagedir/sopine_baseboard/u-boot-sunxi-with-spl.bin of=$device bs=1024 seek=8 status=none
;;
esac
$dryrun sync
) || die "U-Boot installation in $device failed"
[ -z "$dryrun" ] && echo "Completed successfully."