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 v3 14/14] meta-isar: Add HiFive Unleashed board as physical RISC-V target
Date: Wed, 29 Jan 2020 11:30:06 +0100	[thread overview]
Message-ID: <8b8876326fe10f3904a142ddf8c7f1e5035f4fe8.1580293806.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1580293806.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1580293806.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/local.conf.sample                   |  1 +
 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 ++++++++++
 6 files changed, 69 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/local.conf.sample b/meta-isar/conf/local.conf.sample
index 9a602bee..eeea867f 100644
--- a/meta-isar/conf/local.conf.sample
+++ b/meta-isar/conf/local.conf.sample
@@ -60,6 +60,7 @@ BBMULTICONFIG = " \
     hikey-stretch \
     nand-ubi-demo-buster \
     rpi-stretch \
+    sifive-fu540-sid-ports \
 "
 
 #
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-29 10:30 UTC|newest]

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

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=8b8876326fe10f3904a142ddf8c7f1e5035f4fe8.1580293806.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