Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Hikey970 yocto support #272

Open
wants to merge 1 commit into
base: rocko
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions conf/machine/hikey970.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#@TYPE: Machine
#@NAME: HiKey970 machine
#@DESCRIPTION: HiKey970 development board

require conf/machine/include/arm/arch-armv8.inc

PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"

XSERVER ?= "xserver-xorg \
mesa-driver-swrast \
xf86-input-evdev \
xf86-video-fbdev \
"

MACHINE_FEATURES = "usbhost usbgadget alsa screen wifi bluetooth ext2 efi"

PREFERRED_PROVIDER_virtual/kernel ?= "linux-hikey970"

KERNEL_IMAGETYPE = "Image"
KERNEL_DEVICETREE = "hisilicon/kirin970-hikey970.dtb"

SERIAL_CONSOLE = "115200 ttyAMA6"

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "\
edk2-hikey970 \
grub \
"

MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "linux-firmware-wl12xx \
linux-firmware-wl18xx \
kernel-module-btwilink \
kernel-module-st-drv \
kernel-module-wl18xx \
kernel-module-wlcore \
kernel-module-wlcore-sdio \
kernel-module-ti-conf-wl18xx \
"

CMDLINE_ROOT_EMMC = "sdd12"
CMDLINE ?= "earlycon=pl011,0xfff32000,115200 clk_ignore_unused=true console=ttyAMA6,115200n8 root=/dev/${CMDLINE_ROOT_EMMC} rootwait rw quiet efi=noruntime"

# Fastboot expects an ext4 image, which needs to be 4096 bytes aligned
IMAGE_FSTYPES_append = " ext4.gz"
IMAGE_ROOTFS_ALIGNMENT = "4096"
EXTRA_IMAGECMD_ext4 += " -L rootfs "

EXTRA_IMAGEDEPENDS = "edk2-hikey970 grub"

# FIXME unless we set image rootfs extra space, the generated image is corrupted.
IMAGE_ROOTFS_EXTRA_SPACE = "1048576"
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From: Victor Chong <[email protected]>
To: [email protected]
Cc: [email protected],
[email protected],
[email protected],
Victor Chong <[email protected]>
Subject: [PATCH] atf-build.sh: Fix path to BL32* images
Date: Tue, 27 Mar 2018 17:46:22 +0100
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.16.2

Since TOS_BIN* images are not copied to UEFI dir anymore, set path to
the BL32 images where they are originally built.

Fixes: 0c485dab ("opteed-build.sh: Remove copy of images to UEFI dir")
Signed-off-by: Victor Chong <[email protected]>
---
atf-build.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/atf-build.sh b/atf-build.sh
index fb80ad0..eabfb32 100755
--- a/atf-build.sh
+++ b/atf-build.sh
@@ -99,17 +99,24 @@ function build_platform
if [ X"$TOS_DIR" != X"" ]; then
SPD="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_spd`"

+ TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_platform`"
+ if [ X"$TOS_PLATFORM" = X"" ]; then
+ TOS_PLATFORM="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o atf_platform`"
+ if [ X"$TOS_PLATFORM" = X"" ]; then
+ TOS_PLATFORM=$1
+ fi
+ fi
TOS_BIN="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin`"
TOS_BIN_EXTRA1="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra1`"
TOS_BIN_EXTRA2="`$TOOLS_DIR/parse-platforms.py $PLATFORM_CONFIG -p $1 get -o tos_bin_extra2`"
if [ X"$TOS_BIN" != X"" ]; then
- BL32=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN
+ BL32=$TOS_DIR/out/arm-plat-$TOS_PLATFORM/core/$TOS_BIN
fi
if [ X"$TOS_BIN_EXTRA1" != X"" ]; then
- BL32_EXTRA1=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA1
+ BL32_EXTRA1=$TOS_DIR/out/arm-plat-$TOS_PLATFORM/core/$TOS_BIN_EXTRA1
fi
if [ X"$TOS_BIN_EXTRA2" != X"" ]; then
- BL32_EXTRA2=$WORKSPACE/Build/$PLATFORM_IMAGE_DIR/$BUILD_PROFILE/FV/$TOS_BIN_EXTRA2
+ BL32_EXTRA2=$TOS_DIR/out/arm-plat-$TOS_PLATFORM/core/$TOS_BIN_EXTRA2
fi

if [ X"$SPD" != X"" ] && [ X"$BL32" != X"" ]; then
--
2.16.2

3 changes: 3 additions & 0 deletions recipes-bsp/uefi/edk2-hikey970/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./sec_usb_xloader.img 0x00022000
./sec_usb_xloader2.img 0x60049000
./l-loader.bin 0x16800000
12 changes: 12 additions & 0 deletions recipes-bsp/uefi/edk2-hikey970/grub.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set default="0"
set timeout=1

menuentry '@DISTRO_NAME (HiKey970)' {
linux /boot/@KERNEL_IMAGETYPE console=tty0 @CMDLINE
devicetree /boot/kirin970-hikey970.dtb
}

menuentry 'Fastboot' {
search.fs_label boot boot_part
chainloader ($boot_part)/EFI/BOOT/fastboot.efi
}
95 changes: 95 additions & 0 deletions recipes-bsp/uefi/edk2-hikey970_git .bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
require edk2_git.bb

COMPATIBLE_MACHINE = "hikey970"

DEPENDS_append = " dosfstools-native gptfdisk-native mtools-native virtual/fakeroot-native grub"

inherit deploy pythonnative

SRCREV_edk2="307624caaf3131b671868c5b326730f4c8be4ffb"
SRCREV_atf = "53f93e5c738c37378811cfc08ef0ccb8626e2d93"
SRCREV_openplatformpkg = "348ccb5022f452273236e36ebe4238443ba256f8"
SRCREV_uefitools = "fd431116e6e86677837d026f99279bf5b72347d1"
SRCREV_lloader = "9bc7a3e03d2af634cd9ef2fba28434609a259dc8"
SRCREV_toolsimageshikey970 = "7ea233bb060de5d8947a0019c3a45f20a4cfdb62"
SRC_URI = "git://github.com/96boards-hikey/edk2.git;name=edk2;branch=hikey970_v1.0;destsuffix=git \
git://github.com/96boards-hikey/arm-trusted-firmware.git;name=atf;branch=hikey970_v1.0;destsuffix=git/atf \
git://github.com/96boards-hikey/OpenPlatformPkg.git;name=openplatformpkg;branch=hikey970_v1.0;destsuffix=git/OpenPlatformPkg \
git://github.com/Mani-Sadhasivam/uefi-tools.git;name=uefitools;branch=hikey970_v1.0;destsuffix=git/uefi-tools \
git://github.com/96boards-hikey/l-loader.git;name=lloader;branch=hikey970_v1.0;destsuffix=git/l-loader \
git://github.com/96boards-hikey/tools-images-hikey970.git;name=toolsimageshikey970;branch=hikey970_v1.0;destsuffix=git/tools-images-hikey970 \
file://grub.cfg.in \
file://config \
file://atf-build-sh_fix_path_to_BL32_images.patch;patchdir=uefi-tools \
"

# /usr/lib/edk2/bl1.bin not shipped files. [installed-vs-shipped]
INSANE_SKIP_${PN} += "installed-vs-shipped"

# workaround EDK2 is confused by the long path used during the build
# and truncate files name expected by VfrCompile
do_patch[postfuncs] += "set_max_path"
set_max_path () {
sed -i -e 's/^#define MAX_PATH.*/#define MAX_PATH 511/' ${S}/BaseTools/Source/C/VfrCompile/EfiVfr.h
}

do_compile_prepend() {
# Fix hardcoded value introduced in
# https://git.linaro.org/uefi/uefi-tools.git/commit/common-functions?id=65e8e8df04f34fc2a87ae9d34f5ef5b6fee5a396
sed -i -e 's/aarch64-linux-gnu-/${TARGET_PREFIX}/' ${S}/uefi-tools/common-functions
}

do_compile_append() {
cd ${EDK2_DIR}/l-loader
ln -s ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/FV/bl1.bin
ln -s ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/FV/bl2.bin
ln -s ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/FV/fip.bin
ln -s ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/FV/BL33_AP_UEFI.fd
make -f ${UEFIMACHINE}.mk
make -f ${UEFIMACHINE}.mk l-loader.bin
PTABLE=aosp-32g SECTOR_SIZE=4096 SGDISK=./sgdisk bash -x generate_ptable.sh
}

do_install() {
install -D -p -m0644 ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/AARCH64/AndroidFastbootApp.efi ${D}/boot/EFI/BOOT/fastboot.efi
install -D -p -m0644 ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/FV/bl1.bin ${D}${libdir}/edk2/bl1.bin

# Install grub configuration
sed -e "s|@DISTRO_NAME|${DISTRO_NAME}|" \
-e "s|@KERNEL_IMAGETYPE|${KERNEL_IMAGETYPE}|" \
-e "s|@CMDLINE|${CMDLINE}|" \
< ${WORKDIR}/grub.cfg.in \
> ${WORKDIR}/grub.cfg
install -D -p -m0644 ${WORKDIR}/grub.cfg ${D}/boot/grub/grub.cfg
}

# Create a 64M boot image. block size is 1024. (64*1024=65536)
BOOT_IMAGE_SIZE = "65536"
BOOT_IMAGE_BASE_NAME = "boot-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
BOOT_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"

# HiKey970 boot image requires fastboot and grub EFI
# ensure we deploy grubaa64.efi before we try to create the boot image.
do_deploy[depends] += "grub:do_deploy"
do_deploy_append() {
cd ${EDK2_DIR}/l-loader
install -D -p -m0644 l-loader.bin ${DEPLOYDIR}/bootloader/l-loader.bin
cp -a prm_ptable.img ${DEPLOYDIR}/bootloader/
cd ${EDK2_DIR}/tools-images-hikey970
cp -a hikey_idt sec_usb_xloader.img sec_usb_xloader2.img sec_xloader.img ${DEPLOYDIR}/bootloader/
cp -a ${WORKDIR}/config ${DEPLOYDIR}/bootloader/

# Create boot image
mkfs.vfat -F32 -n "boot" -C ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img ${BOOT_IMAGE_SIZE}
mmd -i ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img ::EFI
mmd -i ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img ::EFI/BOOT
mcopy -i ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img ${EDK2_DIR}/Build/HiKey970/RELEASE_${AARCH64_TOOLCHAIN}/AARCH64/AndroidFastbootApp.efi ::EFI/BOOT/fastboot.efi
mcopy -i ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img ${DEPLOY_DIR_IMAGE}/grubaa64.efi ::EFI/BOOT/grubaa64.efi
chmod 644 ${DEPLOYDIR}/${BOOT_IMAGE_BASE_NAME}.uefi.img

(cd ${DEPLOYDIR} && ln -sf ${BOOT_IMAGE_BASE_NAME}.uefi.img boot-${MACHINE}.uefi.img)

# Fix up - move bootloader related files into a subdir
mv ${DEPLOYDIR}/fip.bin ${DEPLOYDIR}/bootloader/
rm -f ${DEPLOY_DIR_IMAGE}/grubaa64.efi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
From 2a9cea2ddec807fef58cfe46bccc9392a321eb87 Mon Sep 17 00:00:00 2001
From: nishantpoorswani <[email protected]>
Date: Thu, 20 Sep 2018 19:15:30 +0200
Subject: [PATCH] Fixed incompatible pointer errors in fbdev

---
drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.c | 6 +++---
drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.h | 1 -
drivers/gpu/drm/hisilicon/kirin9xx/kirin_fbdev.c | 6 +++---
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.c
index 1fae1a1..28208b2 100755
--- a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.c
@@ -146,9 +146,9 @@ static int kirin_drm_kms_init(struct drm_device *dev)
/* reset all the states of crtc/plane/encoder/connector */
drm_mode_config_reset(dev);

- if (fbdev)
- priv->fbdev = kirin_drm_fbdev_init(dev);
- else
+
+
+
priv->fbdev = drm_fbdev_cma_init(dev, 32, 1, 1);

/* init kms poll for handling hpd */
diff --git a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.h
index aa4ed5a..bac11af 100644
--- a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_drm_drv.h
@@ -46,7 +46,6 @@ struct kirin_drm_private {
struct kirin_fbdev {
struct drm_fb_helper fb_helper;
struct drm_framebuffer *fb;
-
struct ion_client *ion_client;
struct ion_handle *ion_handle;
struct iommu_map_format iommu_format;
diff --git a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_fbdev.c b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_fbdev.c
index 3d21a7f..2b03bda 100644
--- a/drivers/gpu/drm/hisilicon/kirin9xx/kirin_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/kirin9xx/kirin_fbdev.c
@@ -453,7 +453,7 @@ struct drm_fb_helper *kirin_drm_fbdev_init(struct drm_device *dev)
if (ret)
goto fini;

- priv->fbdev = helper;
+

return helper;

@@ -467,7 +467,7 @@ struct drm_fb_helper *kirin_drm_fbdev_init(struct drm_device *dev)
void kirin_drm_fbdev_fini(struct drm_device *dev)
{
struct kirin_drm_private *priv = dev->dev_private;
- struct drm_fb_helper *helper = priv->fbdev;
+ struct drm_fb_helper *helper = priv->fb_helper;
struct kirin_fbdev *fbdev;

drm_fb_helper_unregister_fbi(helper);
@@ -475,7 +475,7 @@ void kirin_drm_fbdev_fini(struct drm_device *dev)

drm_fb_helper_fini(helper);

- fbdev = to_kirin_fbdev(priv->fbdev);
+

/* this will free the backing object */
if (fbdev->fb) {
--
2.7.4

Loading