Merge pull request #3664 from lrusak/dragonboard

New project and device: Qualcomm/Dragonboard
This commit is contained in:
MilhouseVH 2019-07-10 23:16:46 +01:00 committed by GitHub
commit e2c115dab6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 6365 additions and 0 deletions

View File

@ -0,0 +1,36 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="firmware-dragonboard"
PKG_VERSION="1.4.0"
PKG_SHA256="822d2f8506d9657dbce6aa2bfce81ccbf97dcfc40831b70703b14b3f296fa4c0"
PKG_ARCH="aarch64 arm"
PKG_LICENSE="proprietary"
PKG_SITE="https://developer.qualcomm.com/"
PKG_URL="https://developer.qualcomm.com/download/db410c/firmware-410c-${PKG_VERSION}.bin"
PKG_DEPENDS_TARGET="toolchain dosfstools:host"
PKG_LONGDESC="Additional firmware for Dragonboard 410c"
PKG_TOOLCHAIN="manual"
unpack() {
mkdir -p $PKG_BUILD
cd $PKG_BUILD
sh $SOURCES/$PKG_NAME/$PKG_NAME-$PKG_VERSION.bin --auto-accept
}
make_target() {
:
}
makeinstall_target() {
mkdir -p $INSTALL/$(get_full_firmware_dir)/qcom/venus-1.8/
cp -a linux-board-support-package-v${PKG_VERSION%.0}/proprietary-linux/* $INSTALL/$(get_full_firmware_dir)
cp -a linux-board-support-package-v${PKG_VERSION%.0}/proprietary-linux/venus* $INSTALL/$(get_full_firmware_dir)/qcom/venus-1.8/
rm $INSTALL/$(get_full_firmware_dir)/firmware.tar
MTOOLS_SKIP_CHECK=1 mcopy -n -i linux-board-support-package-v${PKG_VERSION%.0}/bootloaders-linux/NON-HLOS.bin \
::image/modem.* \
::image/mba.mbn \
::image/wcnss.* \
$INSTALL/$(get_full_firmware_dir)
}

View File

@ -12,6 +12,12 @@ PKG_DEPENDS_TARGET="toolchain"
PKG_LONGDESC="The Device Tree Compiler"
PKG_MAKE_OPTS_TARGET="dtc fdtput fdtget libfdt"
PKG_MAKE_OPTS_HOST="libfdt"
makeinstall_host() {
mkdir -p $TOOLCHAIN/lib
cp -P $PKG_BUILD/libfdt/libfdt.so $TOOLCHAIN/lib
}
makeinstall_target() {
mkdir -p $INSTALL/usr/bin

View File

@ -0,0 +1,45 @@
## Install Instructions
The Dragonboard is unique in the way that it uses and android bootloader to load the OS. This makes it difficult for a few reasons:
1) Requires a very specific partition layout
2) Typically requires a secondary bootloader (usually little kernel (LK). we use u-boot).
All this makes it difficult to create a disk image that can easily be flashed and booted natively. After some time trying various different configurations this is what I landed on:
#### Flash the .img file to and SD card (dd, rufus, LE disk image tool, etc)
```
gunzip LibreELEC-Dragonboard.arm-9.80-devel-20190706164625-ce7dc9b-410c.img.gz
dd if=LibreELEC-Dragonboard.arm-9.80-devel-20190706164625-ce7dc9b-410c.img of=/dev/sdx bs=4M
```
#### Mount the first partition
```
mount /dev/sdx1 /mnt (or similar)
```
#### Mount the squashfs SYSTEM file
```
mount -o loop /mnt/SYSTEM /mnt2 (or similar)
```
#### Write the u-boot bootloader using fastboot
to write u-boot to the boot partition on the emmc you will need to use fastboot. (NOTE: this will wipe out whatever you have in the boot partition on the emmc and will make it so that OS does not boot anymore).
To enter fastboot mode read the following instructions:
1) While holding the Vol (-) button, power on the DragonBoard™ 410c by plugging it in
2) Once DragonBoard™ 410c is plugged into power, release your hold on the Vol (-) button.
3) Wait for about 20 seconds.
4) Board should boot into fastboot mode.
```
fastboot flash boot /mnt2/usr/share/bootloader/u-boot.img
```
#### Unmount partitions
```
umount /mnt2
umount /mnt
```
#### Plug SD card into Dragonboard and power on

View File

@ -0,0 +1,18 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
dtbTool -o dt.img arch/arm/dts/
touch rd
mkbootimg --kernel=u-boot-dtb.bin \
--ramdisk=rd \
--dt=dt.img \
--pagesize 2048 \
--base 0x80000000 \
--cmdline="" \
--output=u-boot.img
rm rd
cp -av u-boot.img $INSTALL/usr/share/bootloader

View File

@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
mkdir -p $RELEASE_DIR/3rdparty/bootloader
if [ -n "$UBOOT_SYSTEM" ]; then
cp -a $(get_build_dir $BOOTLOADER)/u-boot.img $RELEASE_DIR/3rdparty/bootloader
fi
cp -a $(get_build_dir linux)/arch/$TARGET_KERNEL_ARCH/boot/dts/qcom/* $RELEASE_DIR/3rdparty/bootloader

View File

@ -0,0 +1,32 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
[ -z "$BOOT_ROOT" ] && BOOT_ROOT="/flash"
[ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '})
if [ -z "$BOOT_DISK" ]; then
case $BOOT_PART in
/dev/sd[a-z][0-9]*)
BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g")
;;
/dev/mmcblk*)
BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g")
;;
esac
fi
# mount $BOOT_ROOT r/w
mount -o remount,rw $BOOT_ROOT
# update Device Tree Blobs
for all_dtb in /flash/*.dtb; do
dtb=$(basename $all_dtb)
if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then
echo "*** updating Device Tree Blob: $dtb ..."
cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT
fi
done
# mount $BOOT_ROOT r/o
sync
mount -o remount,ro $BOOT_ROOT

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
################################################################################
# setup system defaults
################################################################################
# The TARGET_CPU variable controls which processor should be targeted for
# generated code.
case $TARGET_ARCH in
aarch64)
TARGET_CPU="cortex-a53"
TARGET_CPU_FLAGS="+crc+fp+simd"
TARGET_FEATURES="64bit"
;;
arm)
TARGET_KERNEL_ARCH="arm64"
TARGET_PATCH_ARCH="aarch64"
TARGET_FLOAT=hard
TARGET_CPU="cortex-a53"
TARGET_CPU_FLAGS="+crc"
TARGET_FPU="neon-fp-armv8"
TARGET_FEATURES="32bit"
;;
esac
# Bootloader to use (syslinux / u-boot / atv-bootloader / bcm2835-bootloader)
BOOTLOADER="u-boot"
# U-Boot firmware package(s) to use (this is a bit of a hack as mkbootimg isn't firmware but is needed by the host to build the u-boot uImage)
UBOOT_FIRMWARE="mkbootimg:host"
# Kernel target
KERNEL_TARGET="Image"
# Kernel uImage load address
KERNEL_UIMAGE_LOADADDR="0x80080000"
# Kernel uImage entry address
KERNEL_UIMAGE_ENTRYADDR="0x80080000"
# Additional kernel make parameters (for example to specify the u-boot loadaddress)
KERNEL_MAKE_EXTRACMD="dtbs"
# Kernel to use. values can be:
# default: default mainline kernel
LINUX="default"
################################################################################
# setup build defaults
################################################################################
# Project CFLAGS
PROJECT_CFLAGS=""
# SquashFS compression method (gzip / lzo / xz)
SQUASHFS_COMPRESSION="zstd"
################################################################################
# setup project defaults
################################################################################
# build and install ALSA Audio support (yes / no)
ALSA_SUPPORT="yes"
# OpenGL(X) implementation to use (no / Mesa)
OPENGL="no"
# OpenGL-ES implementation to use (no / bcm2835-driver / gpu-viv-bin-mx6q / opengl-meson6)
OPENGLES="mesa"
# include uvesafb support (yes / no)
UVESAFB_SUPPORT="no"
# Displayserver to use (x11 / no)
DISPLAYSERVER="no"
# Windowmanager to use (ratpoison / fluxbox / none)
WINDOWMANAGER="none"
# Xorg Graphic drivers to use (all / i915,i965,r200,r300,r600,nvidia,nouveau)
# Space separated list is supported,
# e.g. GRAPHIC_DRIVERS="i915 i965 r300 r600 radeonsi nvidia nouveau"
GRAPHIC_DRIVERS="freedreno"
# KODI Player implementation to use (default / bcm2835-driver / libfslvpuwrap / libamcodec)
KODIPLAYER_DRIVER="mesa"
# additional Firmware to use (dvb-firmware, misc-firmware, wlan-firmware)
# Space separated list is supported,
# e.g. FIRMWARE="dvb-firmware misc-firmware wlan-firmware"
FIRMWARE="misc-firmware wlan-firmware dvb-firmware firmware-dragonboard"
# build with installer (yes / no)
INSTALLER_SUPPORT="no"
# kernel serial console
EXTRA_CMDLINE="console=ttyMSM0,115200n8 console=tty0"
# debug tty path
DEBUG_TTY="/dev/ttyMSM0"

View File

@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="mkbootimg"
PKG_VERSION="1.6.0"
PKG_SHA256="7930b7dba25e5b4a39e6d19ccce9005e17c98a2b6c9e1aa6408a88c716755aaf"
PKG_LICENSE="GPL"
PKG_SITE="https://source.codeaurora.org/quic/kernel/skales/"
PKG_URL="https://source.codeaurora.org/quic/kernel/skales/snapshot/$PKG_VERSION.tar.xz"
PKG_DEPENDS_HOST="dtc:host"
PKG_LONGDESC="mkbootimg: Creates kernel boot images for Android"
PKG_TOOLCHAIN="manual"
make_host() {
sed "s|libfdt.so|$TOOLCHAIN/lib/libfdt.so|" -i dtbTool
}
makeinstall_host() {
cp mkbootimg $TOOLCHAIN/bin/
cp dtbTool $TOOLCHAIN/bin/
}

View File

@ -0,0 +1,19 @@
diff -Naur a/dtbTool b/dtbTool
--- a/dtbTool 2017-02-01 14:07:03.000000000 -0800
+++ b/dtbTool 2017-10-23 22:32:17.090949808 -0700
@@ -84,6 +84,7 @@
'apq8096' : 291,
'msm8998' : 292,
'msm8996sg' : 305,
+ 'ipq8074' : 306,
}
platform_type = {
@@ -108,6 +109,7 @@
'stp' : 23,
'sbc' : 24,
'cls' : 29,
+ 'hk01' : 30,
}
pmic_ids = {

View File

@ -0,0 +1,11 @@
diff -Naur a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi 2017-05-10 06:07:46.000000000 -0700
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi 2017-06-01 11:45:44.805705640 -0700
@@ -1177,6 +1177,7 @@
interrupts = <0 145 IRQ_TYPE_LEVEL_HIGH>,
<0 146 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "tx", "rx";
+ local-mac-address = [02 00 27 60 25 28];
qcom,smem-states = <&apps_smsm 10>, <&apps_smsm 9>;
qcom,smem-state-names = "tx-enable", "tx-rings-empty";

View File

@ -115,6 +115,14 @@ devices = \
},
},
},
'Qualcomm': {
'Dragonboard': {
'410c': {
'dtb': 'apq8016-sbc.dtb',
'config': 'dragonboard410c_defconfig'
},
},
},
'Rockchip': {
'MiQi': {
'rk3288': {