public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 13/13] meta-isar: Add HiFive Unleashed board as physical RISC-V target
Date: Mon, 13 Jan 2020 09:28:18 +0100	[thread overview]
Message-ID: <ff55b61055faf62a9767a55d20e420e059783c40.1578904098.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1578904098.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1578904098.git.jan.kiszka@siemens.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

The Unleashed board (https://www.sifive.com/boards/hifive-unleashed) was
the first one running regular Linux. This target generates a Debian
sid image that starts fine from an SD-card in default boot mode.

The Debian kernel does not work, though, because of an excessive
initramfs being generated (45MB) that gets stuck. As the MMC driver is
in that image, we also cannot disable the initramfs. So build the
mainline kernel which is starts also faster.

We can use the binary U-Boot from Debian sid, though.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta-isar/conf/machine/sifive-fu540.conf           | 15 ++++++++++++++
 .../conf/multiconfig/sifive-fu540-sid-ports.conf   |  7 +++++++
 .../recipes-bsp/opensbi/files/sifive-fu540-rules   | 13 ++++++++++++
 .../opensbi/opensbi-sifive-fu540_0.5.bb            | 23 ++++++++++++++++++++++
 .../scripts/lib/wic/canned-wks/sifive-fu540.wks    | 10 ++++++++++
 5 files changed, 68 insertions(+)
 create mode 100644 meta-isar/conf/machine/sifive-fu540.conf
 create mode 100644 meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf
 create mode 100644 meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
 create mode 100644 meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.5.bb
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/sifive-fu540.wks

diff --git a/meta-isar/conf/machine/sifive-fu540.conf b/meta-isar/conf/machine/sifive-fu540.conf
new file mode 100644
index 00000000..c815f4a8
--- /dev/null
+++ b/meta-isar/conf/machine/sifive-fu540.conf
@@ -0,0 +1,15 @@
+#
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+DISTRO_ARCH = "riscv64"
+
+KERNEL_NAME ?= "mainline"
+
+IMAGE_TYPE ?= "wic-img"
+WKS_FILE ?= "sifive-fu540"
+IMAGER_INSTALL += "opensbi-sifive-fu540"
+IMAGER_BUILD_DEPS += "opensbi-sifive-fu540"
+
+IMAGE_INSTALL += "u-boot-script"
diff --git a/meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf b/meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf
new file mode 100644
index 00000000..e4e0248c
--- /dev/null
+++ b/meta-isar/conf/multiconfig/sifive-fu540-sid-ports.conf
@@ -0,0 +1,7 @@
+#
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+MACHINE = "sifive-fu540"
+DISTRO = "debian-sid-ports"
diff --git a/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules b/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
new file mode 100644
index 00000000..c8feb715
--- /dev/null
+++ b/meta-isar/recipes-bsp/opensbi/files/sifive-fu540-rules
@@ -0,0 +1,13 @@
+#!/usr/bin/make -f
+
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
+endif
+
+PARALLEL_BUILD=-j $(shell echo $$(($$(nproc) * 2)))
+
+override_dh_auto_build:
+	CFLAGS= LDFLAGS= $(MAKE) $(PARALLEL_BUILD) PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=/usr/lib/u-boot/sifive_fu540/u-boot.bin
+
+%:
+	dh $@
diff --git a/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.5.bb b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.5.bb
new file mode 100644
index 00000000..b9d0c3e1
--- /dev/null
+++ b/meta-isar/recipes-bsp/opensbi/opensbi-sifive-fu540_0.5.bb
@@ -0,0 +1,23 @@
+#
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg
+
+SRC_URI = " \
+    https://github.com/riscv/opensbi/archive/v${PV}.tar.gz;downloadfilename=opensbi-${PV}.tar.gz \
+    file://sifive-fu540-rules"
+SRC_URI[sha256sum] = "bc82f1e63663cafb7976b324d8a01263510cfd816063dc89e0ccffb9763fb1dd"
+
+S = "${WORKDIR}/opensbi-${PV}"
+
+do_prepare_build[cleandirs] += "${S}/debian"
+do_prepare_build() {
+    cp ${WORKDIR}/sifive-fu540-rules ${WORKDIR}/rules
+    deb_debianize
+
+    sed -i 's/\(Build-Depends:.*\)/\1, u-boot-sifive/' ${S}/debian/control
+
+    echo "build/platform/sifive/fu540/firmware/fw_payload.bin /usr/lib/opensbi/sifive-fu540/" > ${S}/debian/install
+}
diff --git a/meta-isar/scripts/lib/wic/canned-wks/sifive-fu540.wks b/meta-isar/scripts/lib/wic/canned-wks/sifive-fu540.wks
new file mode 100644
index 00000000..445b9d02
--- /dev/null
+++ b/meta-isar/scripts/lib/wic/canned-wks/sifive-fu540.wks
@@ -0,0 +1,10 @@
+#
+# Copyright (c) Siemens AG, 2020
+#
+# SPDX-License-Identifier: MIT
+
+part --source rawcopy --sourceparams "file=/usr/lib/opensbi/sifive-fu540/fw_payload.bin" --ondisk mmcblk0 --fixed-size 8M --align 1 --part-type 2e54b353-1271-4842-806f-e436d6af6985
+
+part / --source rootfs-u-boot --ondisk mmcblk0 --fstype ext4 --label platform --active --align 1024 --sourceparams "no_initrd=yes,script_prepend=setenv fdtfile sifive/hifive-unleashed-a00.dtb"
+
+bootloader --ptable gpt --append "rootwait"
-- 
2.16.4


  parent reply	other threads:[~2020-01-13  8:28 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13  8:28 [PATCH v2 00/13] RISC-V support Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 01/13] meta: Add debian-sid-ports distro config Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 02/13] meta: Add RISC-V architecture Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 03/13] meta: Allow cross-compilation for RISC-V Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 04/13] start_vm: Add RISC-V 64-bit support Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 05/13] meta-isar: Add qemuriscv64 virtual target Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 06/13] meta-isar: Clean up qemu multiconfigs Jan Kiszka
2020-01-28 21:51   ` Henning Schild
2020-01-28 22:06     ` Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 07/13] u-boot-script: Account for variations of kernel files and boot commands Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 08/13] linux-custom: Tune strip rule to cover vmlinux images as well Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 09/13] linux-custom: Add support for RISC-V Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 10/13] linux-modules: " Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 11/13] linux-mainline: Avoid failing UBIFS test when defconfig does not support it Jan Kiszka
2020-01-13  8:28 ` [PATCH v2 12/13] linux-mainline: Update to 5.4.10 Jan Kiszka
2020-01-13  8:28 ` Jan Kiszka [this message]
2020-01-28 11:31 ` [PATCH v2 00/13] RISC-V support Jan Kiszka
2020-01-28 15:51   ` vijai kumar
2020-01-28 16:02     ` Jan Kiszka
2020-01-28 16:09       ` vijai kumar
2020-01-28 19:23       ` vijai kumar
2020-01-28 22:06         ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff55b61055faf62a9767a55d20e420e059783c40.1578904098.git.jan.kiszka@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox