From patchwork Sun Apr 28 14:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Corbin X-Patchwork-Id: 1092263 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.b="hhxmPqXz"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44sW2n2T7Sz9s7T for ; Mon, 29 Apr 2019 00:51:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8F995861B3; Sun, 28 Apr 2019 14:50:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 42D3LJnzDNV6; Sun, 28 Apr 2019 14:50:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id AE00186038; Sun, 28 Apr 2019 14:50:39 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 021711BF3E9 for ; Sun, 28 Apr 2019 14:50:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id E16F586038 for ; Sun, 28 Apr 2019 14:50:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pZh0jg5QYulJ for ; Sun, 28 Apr 2019 14:50:31 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by hemlock.osuosl.org (Postfix) with ESMTPS id 5BF6885FFD for ; Sun, 28 Apr 2019 14:50:31 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id y5so10787098wma.2 for ; Sun, 28 Apr 2019 07:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vYVv467zcUEe74jVAMra2UKnya7iTFQIESFXm6j010s=; b=hhxmPqXztIa0g2Hc6+2SuoT/Xai5sqe1UdjcabEUkuLs8DniN74+KXqRm9vX+hMr+1 9hc7App2j0pZie6o8Afl1B/L4oCfIMZY2pv8Z01lalVX7AQsvuM8J2+maNQhV1gH79Zg dinfxLM8H88cW/CVJthPXJv8t9bkFZ6XQdTieHtjQn6A7ZSHxZuuJNKsux2fgyplmhnv SRETvbA8FpAvEQOn/e4mEcts28QLYzuSFg+E5ejAqswP5D5Gh7qfAv0CL48dDyVVlOdY yxIDTzdvpm3ir0juT7L0b2wW7kxjGrkF1Zkiu2FSD2YgfjYcGwjkI6AfvdfWAPedt7wo k49Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vYVv467zcUEe74jVAMra2UKnya7iTFQIESFXm6j010s=; b=eOBbmCuIG0Zf9e2oOofkuBzkJRXHZgOLlQ2FIK4QY5mwtJMVuQPm9iJFETD6XlHx63 i4HQsnYwowZ/+4MwtiP+6KnFSpZY536vO7PqazVYyiWxXvJ66R2BOol751jQ0hkNA870 GbUNw4kd9MsVHw7qAPBztdznWuOIGJF/oQGSVT8UZo+MDrbAm9bl08PN/FGqELtmcrnl QCzzbxETgg1cbBpntAifFg4O24AzUxiQm3Zm68HvzIDL5FDjRgiQYSoUvXZsMPJNcYPb bE73wbpeqQt5uG6tIZw7cu8iX8r8QjO12fJ40KpynkyLmW0MDGnw7bLMR4KvXmbiM+fq hN0g== X-Gm-Message-State: APjAAAVr9R7Ikm2nzV5ucdDwrnxPH54K4AC8zdzikITfaRGwu9/Oz3mt ZvrRBvv+5Dhmb0fpsfIhNhrqBmZv8Iw9Dw== X-Google-Smtp-Source: APXvYqzTrIZfPSiUOI1AlfTIT2gNMzxHerTQ56R+L3EIipZIdAoTgKVzJNd+ym9uAkTNJ+ZnagdH3g== X-Received: by 2002:a1c:7a12:: with SMTP id v18mr3039055wmc.69.1556463029656; Sun, 28 Apr 2019 07:50:29 -0700 (PDT) Received: from godzilla.lym.embecosm-corp.com (cust64-dsl91-135-5.idnet.net. [91.135.5.64]) by smtp.gmail.com with ESMTPSA id u2sm26678185wru.36.2019.04.28.07.50.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 07:50:29 -0700 (PDT) From: Mark Corbin To: buildroot@buildroot.org Date: Sun, 28 Apr 2019 15:49:37 +0100 Message-Id: <20190428144939.28964-2-mark.corbin@embecosm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190428144939.28964-1-mark.corbin@embecosm.com> References: <20190428144939.28964-1-mark.corbin@embecosm.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 1/3] boot/riscv-pk: add generation of binary bbl file X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , Mark Corbin Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" In order to support the SiFive HiFive Unleashed board we need to generate a binary bootloader file ready for writing to an SD card. Signed-off-by: Mark Corbin --- Changes v1 -> v2: - moved generation of bbl binary file in riscv-pk.mk from INSTALL_CMDS to BUILD_CMDS (Arnout) --- boot/riscv-pk/riscv-pk.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/boot/riscv-pk/riscv-pk.mk b/boot/riscv-pk/riscv-pk.mk index 0ab5879ee4..8386dfe168 100644 --- a/boot/riscv-pk/riscv-pk.mk +++ b/boot/riscv-pk/riscv-pk.mk @@ -23,10 +23,12 @@ endef define RISCV_PK_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/build bbl + $(TARGET_OBJCOPY) -S -O binary $(@D)/build/bbl $(@D)/build/bbl.bin endef define RISCV_PK_INSTALL_IMAGES_CMDS $(INSTALL) -D -m 0755 $(@D)/build/bbl $(BINARIES_DIR)/bbl + $(INSTALL) -D -m 0755 $(@D)/build/bbl.bin $(BINARIES_DIR)/bbl.bin endef $(eval $(generic-package)) From patchwork Sun Apr 28 14:49:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Corbin X-Patchwork-Id: 1092267 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.b="EuTzqgHY"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44sW402ldyz9s9N for ; Mon, 29 Apr 2019 00:52:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9D91A84E7C; Sun, 28 Apr 2019 14:52:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wAU6sr7p-wOK; Sun, 28 Apr 2019 14:52:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6132884B60; Sun, 28 Apr 2019 14:52:40 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B680E1BF3E9 for ; Sun, 28 Apr 2019 14:50:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B0A4585C92 for ; Sun, 28 Apr 2019 14:50:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WqFO9fwCPHHQ for ; Sun, 28 Apr 2019 14:50:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by whitealder.osuosl.org (Postfix) with ESMTPS id 2C95885C90 for ; Sun, 28 Apr 2019 14:50:37 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id a12so11869500wrq.10 for ; Sun, 28 Apr 2019 07:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/EbXK9suZLEVuOLsXfdA8dfGv3kFMpPmp1wF61VT6vE=; b=EuTzqgHYOvBoqxhutblPsvwCSYzw0+xE669LTJEsMzeGP+qjpmQnxRXCCIV4SAX64a DIQ+jz7KsPPJvuf4n88w9c76j3IhHIbhBbIw1cCcIH7xGuoh9cCg3dNfbexBi7CYWs2F BVUj5hA02yH+KRK7hJsK+WnJ0Ij68vDdYgWbmC/TFk2zDdoRRhBBSztqFZ8+8tdlVBVG XVgV+1dfuIN6gFUxh1Uv4XtkF16mjojAu4/w9V4iEWp875oLJLvutX1lVGehtiWwaUUB S1lNU1R1DCKWaKGSHFjA76CMOyhWvqUXRc9TTWBwZBJgg0G8BQ4SFQiNf307iDNh3blj Mmew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/EbXK9suZLEVuOLsXfdA8dfGv3kFMpPmp1wF61VT6vE=; b=obz0OtagX73NTmXKWY6WF0ABEn2rbOAG3efUUw5983wzeD+4poWbQLckolxy1SOIpR DG6l+7DG3MS5BO251ATABuE19K5XY+Xbm2ioY0Dd3K3yMYttP+llgWLIMF8rSJNHrO3N H/8dNTDL6L9jnqQVadAOFQxAaVHPoSJh/f9IrYNErf6CDlrkCFNA+l8KQYNFz3pHlKdB gkpv8CVAao8oUBhEd1u0qRvEbJMIiN4grlJIbf/LgYELzO0Qv64wb9Cg8vUIcQENvK8z iNxHawNuoEWWZaNuvbtGIhAgfyxCWcmaUqjVhKZYdolmaH79GT0F1IPmhWK3opW2Xjov A9GA== X-Gm-Message-State: APjAAAUEJWq/DiWgd87yU/WrY5SUv0GciGzaA5DToPwl0PPqqeUPQXkz nohpX2C8dYv6Z/obkw41f/nLPOcTYz5OMg== X-Google-Smtp-Source: APXvYqxB+4AoyKb8MH79jXPYhLYeR9cVY+hhGEcqpSt2wLCffr5aAI0qU8mR6NNtFuw8pHsBzsfnDw== X-Received: by 2002:adf:f40d:: with SMTP id g13mr3098765wro.158.1556463035567; Sun, 28 Apr 2019 07:50:35 -0700 (PDT) Received: from godzilla.lym.embecosm-corp.com (cust64-dsl91-135-5.idnet.net. [91.135.5.64]) by smtp.gmail.com with ESMTPSA id u2sm26678185wru.36.2019.04.28.07.50.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 07:50:35 -0700 (PDT) From: Mark Corbin To: buildroot@buildroot.org Date: Sun, 28 Apr 2019 15:49:38 +0100 Message-Id: <20190428144939.28964-3-mark.corbin@embecosm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190428144939.28964-1-mark.corbin@embecosm.com> References: <20190428144939.28964-1-mark.corbin@embecosm.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/3] boot/riscv-pk: remove hardcoding of the ABI X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , Mark Corbin Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The riscv-pk package is currently hardcoded to always use the softfloat ABI when compiling, i.e. ilp32 for 32-bit and lp64 for 64-bit. The SiFive HiFive Unleashed board has hardware floating point support, so we need to be able to build riscv-pk with both softfloat and hardfloat toolchains. This patch adds the ability to specify the ABI via --with-abi when configuring riscv-pk. If this option is not provided then the compiler default ABI setting will be used instead. Signed-off-by: Mark Corbin --- ...-specify-ABI-or-use-compiler-default.patch | 72 +++++++++++++++++++ boot/riscv-pk/riscv-pk.mk | 5 +- 2 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 boot/riscv-pk/0001-Add-ability-to-specify-ABI-or-use-compiler-default.patch diff --git a/boot/riscv-pk/0001-Add-ability-to-specify-ABI-or-use-compiler-default.patch b/boot/riscv-pk/0001-Add-ability-to-specify-ABI-or-use-compiler-default.patch new file mode 100644 index 0000000000..3cee9a4fd6 --- /dev/null +++ b/boot/riscv-pk/0001-Add-ability-to-specify-ABI-or-use-compiler-default.patch @@ -0,0 +1,72 @@ +From 0f7e2c2f61c6bb36a33733e89ec8d79f89d618ae Mon Sep 17 00:00:00 2001 +From: Mark Corbin +Date: Thu, 18 Apr 2019 12:07:02 +0100 +Subject: [PATCH] Add ability to specify ABI or use compiler default + +Allow the ABI to be defined using --with-abi. If this option is +not provided then the compiler default ABI setting will be used. + +Signed-off-by: Mark Corbin +--- + Makefile.in | 15 +++++++++++---- + configure.ac | 4 ++++ + 2 files changed, 15 insertions(+), 4 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index aeabdc2..d6b988f 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -51,8 +51,7 @@ else + endif + + # If --with-arch is not specified, it defaults to whatever the compiler's +-# default is. The -with-abi is not necessary for this project. Unconditionally +-# compile it with a no-float ABI. i.e., ilp32 for 32-bit and lp64 for 64-bit. ++# default is. + + ifeq (@WITH_ARCH@,) + march := -march=$(shell @CC@ -v 2>&1 | \ +@@ -60,8 +59,16 @@ ifeq (@WITH_ARCH@,) + else + march := -march=@WITH_ARCH@ + endif +-is_32bit := $(findstring 32,$(march)) +-mabi := -mabi=$(if $(is_32bit),ilp32,lp64) ++ ++# If --with-abi is not specified, it defaults to whatever the compiler's ++# default is. ++ ++ifeq (@WITH_ABI@,) ++ mabi := -mabi=$(shell @CC@ -v 2>&1 | \ ++ sed 's/ /\n/g' | grep with-abi | awk -F= '{print $$2}') ++else ++ mabi := -mabi=@WITH_ABI@ ++endif + + # Installation directories + +diff --git a/configure.ac b/configure.ac +index 917179f..180a8db 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -83,6 +83,9 @@ AC_ARG_VAR(RISCV, [top-level RISC-V install directory]) + AC_ARG_WITH([arch], AS_HELP_STRING([--with-arch], [Set the RISC-V architecture]), + [AC_SUBST([WITH_ARCH], $with_arch, [Specify architecture to build the project])]) + ++AC_ARG_WITH([abi], AS_HELP_STRING([--with-abi], [Set the RISC-V ABI]), ++ [AC_SUBST([WITH_ABI], $with_abi, [Specify ABI to build the project])]) ++ + AC_ARG_ENABLE([print-device-tree], AS_HELP_STRING([--enable-print-device-tree], [Print DTS when booting])) + AS_IF([test "x$enable_print_device_tree" == "xyes"], [ + AC_DEFINE([PK_PRINT_DEVICE_TREE],,[Define if the DTS is to be displayed]) +@@ -95,6 +98,7 @@ AC_SUBST(CFLAGS) + AC_SUBST(LDFLAGS) + AC_SUBST([LIBS], ["-lgcc"]) + AC_SUBST(WITH_ARCH) ++AC_SUBST(WITH_ABI) + AC_SUBST(host_alias) + + #------------------------------------------------------------------------- +-- +2.19.1 + diff --git a/boot/riscv-pk/riscv-pk.mk b/boot/riscv-pk/riscv-pk.mk index 8386dfe168..f82520d221 100644 --- a/boot/riscv-pk/riscv-pk.mk +++ b/boot/riscv-pk/riscv-pk.mk @@ -9,8 +9,9 @@ RISCV_PK_SITE = git://github.com/riscv/riscv-pk.git RISCV_PK_LICENSE = BSD-3-Clause RISCV_PK_LICENSE_FILES = LICENSE RISCV_PK_DEPENDENCIES = linux -RISCV_PK_SUBDIR = build +RISCV_PK_INSTALL_TARGET = NO RISCV_PK_INSTALL_IMAGES = YES +RISCV_PK_AUTORECONF = YES define RISCV_PK_CONFIGURE_CMDS mkdir -p $(@D)/build @@ -31,4 +32,4 @@ define RISCV_PK_INSTALL_IMAGES_CMDS $(INSTALL) -D -m 0755 $(@D)/build/bbl.bin $(BINARIES_DIR)/bbl.bin endef -$(eval $(generic-package)) +$(eval $(autotools-package)) From patchwork Sun Apr 28 14:49:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Corbin X-Patchwork-Id: 1092266 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.b="KMBEQ8nS"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44sW401LYfz9s7T for ; Mon, 29 Apr 2019 00:52:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 71F2B838D9; Sun, 28 Apr 2019 14:52:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kjYw85Z2ZNyR; Sun, 28 Apr 2019 14:52:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id C21C68214C; Sun, 28 Apr 2019 14:52:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id D07381BF3E9 for ; Sun, 28 Apr 2019 14:50:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CD55A22D22 for ; Sun, 28 Apr 2019 14:50:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4DbIopUSGVAk for ; Sun, 28 Apr 2019 14:50:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by silver.osuosl.org (Postfix) with ESMTPS id 347F52262F for ; Sun, 28 Apr 2019 14:50:42 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id y5so10787542wma.2 for ; Sun, 28 Apr 2019 07:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Venn071UX2JwDzq+gLSNjakpJiweKhnzIGega7/xnc=; b=KMBEQ8nS8HH/w0IKZ3g8jU5VY9Xrb/1yq6d0OkqSCaeSGkNFl0FoFQv1YSMgZ/oAyO bYMwRH8OVGNgjg1SBVAKI18Bbg5VX1vaZs/r8spgBxtfDPCyUSEuacZB5Gx0v5dRSduj phK6yYqLBsyhBCPIQj6Ap1QSTds9VAZITezyXzkxxxL7GrupPNiseMk37FuRUPS5YcO9 iA4zNiJa1JT7nQpFq1nD3Gur7RiiMqxb2vcs57bSSgiSUEQpr2X1i+V++MApkxIM8Yr2 dCWhX9mldP0wyBYqTw609kJg7Y562rScLIX45vIIxYp5GKf7+YCgqAN+RKCM9fbm+sPj 4idA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Venn071UX2JwDzq+gLSNjakpJiweKhnzIGega7/xnc=; b=heuH9PvjfateTgWoH2xwCLmEB5XSj0zM7ZpBmSenrtfLxzhMDsHuIGX9mCqY9kmxLH N3N/wq+3iX6256kpJyVLiKg+JascJVk2bF9YwqnQr0VDq+mpcnoV9C0tcSc3OlcrQpq4 4FX4ET0e7k/LNs1yLOBB8bwYPQ32Ax+Hd/17tTGI+cBWDKKb0Y1DwIwI3iSa7ecfAxPe r6Jz7oXHAhQkrwAcB8H49fXqza3iFD9/wFfl2Yq12nrYHFzxTqJI9BZAC45SQKqZdhBs 7bii5c2K1/T4ashSX7Rr60mHuHbCj4/+ppSzuNdse9QQeJl1QFIvlNJzZtb5RuJyK7ga 0/3A== X-Gm-Message-State: APjAAAUdH1YDHYkNm0c0p0YE3A3yv4zuRl7bF804x96xmSiS4JTHQvQu N2xqjnVvf+CS7mwYgXWDps1udJ42E0huxQ== X-Google-Smtp-Source: APXvYqxZUpf3iFpnMr/T/SM6TPCSfZNsXv44Aue7Tsrs4NatWpiO6o9xOYlxRNp1lGE+Uz2s28CW4w== X-Received: by 2002:a1c:2dd2:: with SMTP id t201mr15291999wmt.10.1556463040288; Sun, 28 Apr 2019 07:50:40 -0700 (PDT) Received: from godzilla.lym.embecosm-corp.com (cust64-dsl91-135-5.idnet.net. [91.135.5.64]) by smtp.gmail.com with ESMTPSA id u2sm26678185wru.36.2019.04.28.07.50.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 07:50:39 -0700 (PDT) From: Mark Corbin To: buildroot@buildroot.org Date: Sun, 28 Apr 2019 15:49:39 +0100 Message-Id: <20190428144939.28964-4-mark.corbin@embecosm.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190428144939.28964-1-mark.corbin@embecosm.com> References: <20190428144939.28964-1-mark.corbin@embecosm.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 3/3] board/sifive: add support for the HiFive Unleashed board X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , Mark Corbin Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds basic support for the SiFive HiFive Unleashed board. Signed-off-by: Mark Corbin --- Changes v1 -> v2: - removed the large kernel patch and replaced it with a custom git repository (Arnout) - reduced the kernel config fragment to a minimum (Arnout) - use a separate root filesystem instead of a linked-in initramfs image (Arnout) - changed naming convention from sifive-u540* to sifive_hifive* (Arnout) - added post-image script to generate a complete SD card image file (Arnout) - updated the default configuration to make use of compressed instructions and the lp64d ABI for builds. - updated the DEVELOPERS file. --- DEVELOPERS | 1 + .../hifive-unleashed/linux.config.fragment | 14 ++++ board/sifive/hifive-unleashed/post-image.sh | 37 +++++++++++ board/sifive/hifive-unleashed/readme.txt | 65 +++++++++++++++++++ configs/sifive_hifive_unleashed_defconfig | 31 +++++++++ 5 files changed, 148 insertions(+) create mode 100644 board/sifive/hifive-unleashed/linux.config.fragment create mode 100755 board/sifive/hifive-unleashed/post-image.sh create mode 100644 board/sifive/hifive-unleashed/readme.txt create mode 100644 configs/sifive_hifive_unleashed_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 56556413aa..5f76b6951d 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -1417,6 +1417,7 @@ F: arch/arch.mk.riscv F: arch/Config.in.riscv F: board/qemu/riscv32-virt/ F: board/qemu/riscv64-virt/ +F: board/sifive/ F: boot/riscv-pk/ F: configs/qemu_riscv32_virt_defconfig F: configs/qemu_riscv64_virt_defconfig diff --git a/board/sifive/hifive-unleashed/linux.config.fragment b/board/sifive/hifive-unleashed/linux.config.fragment new file mode 100644 index 0000000000..8957eb5d36 --- /dev/null +++ b/board/sifive/hifive-unleashed/linux.config.fragment @@ -0,0 +1,14 @@ +CONFIG_CMDLINE_BOOL=y +CONFIG_CMDLINE="earlyprintk console=ttySIF0,115200 root=/dev/mmcblk0p2 rootwait" +CONFIG_SERIAL_SIFIVE=y +CONFIG_SERIAL_SIFIVE_CONSOLE=y +# CONFIG_HVC_RISCV_SBI is not set +CONFIG_SPI=y +CONFIG_SPI_SIFIVE=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SIFIVE=y +CONFIG_MMC=y +CONFIG_MMC_SPI=y +CONFIG_CLK_U54_PRCI=y +CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_SIFIVE_PLIC=y diff --git a/board/sifive/hifive-unleashed/post-image.sh b/board/sifive/hifive-unleashed/post-image.sh new file mode 100755 index 0000000000..ed2461995b --- /dev/null +++ b/board/sifive/hifive-unleashed/post-image.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +cd ${BINARIES_DIR} + +# GPT partition codes +KERNEL=2E54B353-1271-4842-806F-E436D6AF6985 +ROOTFS=0FC63DAF-8483-4772-8E79-3D69D8477DE4 + +# Partition offsets and sizes +KERNEL_PART_START=2048 +KERNEL_PART_SIZE=65536 +KERNEL_PART_END=$(( KERNEL_PART_START + KERNEL_PART_SIZE - 1 )) +ROOTFS_PART_START=$(( KERNEL_PART_END + 1 )) +ROOTFS_PART_SIZE=$(( $(stat -c %s rootfs.ext2) / 512 )) +ROOTFS_PART_END=$(( ROOTFS_PART_START + ROOTFS_PART_SIZE - 1 )) +GPT_SIZE=34 + +# Disk image size +IMAGE_SIZE=$(( GPT_SIZE + ROOTFS_PART_END + 1 )) + +# Create an empty SD image +dd if=/dev/zero of=sdcard.img bs=512 count=0 seek=$IMAGE_SIZE + +sgdisk --clear \ + --new=1:${KERNEL_PART_START}:${KERNEL_PART_END} \ + --change-name=1:kernel \ + --typecode=1:${KERNEL} \ + --new=2:${ROOTFS_PART_START}:${ROOTFS_PART_END} \ + --change-name=2:rootfs \ + --typecode=2:${ROOTFS} \ + sdcard.img + +dd if=bbl.bin of=sdcard.img bs=512 count=$KERNEL_PART_SIZE seek=$KERNEL_PART_START conv=notrunc +dd if=rootfs.ext2 of=sdcard.img bs=512 count=$ROOTFS_PART_SIZE seek=$ROOTFS_PART_START conv=notrunc + diff --git a/board/sifive/hifive-unleashed/readme.txt b/board/sifive/hifive-unleashed/readme.txt new file mode 100644 index 0000000000..842de5ee58 --- /dev/null +++ b/board/sifive/hifive-unleashed/readme.txt @@ -0,0 +1,65 @@ +SiFive HiFive Unleashed +======================= + +This file describes how to use the pre-defined Buildroot +configuration for the SiFive HiFive Unleashed board. + +Further information about the HiFive Unleashed board can be found +at https://www.sifive.com/boards/hifive-unleashed + +Building +======== + +Configure Buildroot using the default board configuration: + + $ make sifive_hifive_unleashed_defconfig + +Customise the build as necessary: + + $ make menuconfig + +Start the build: + + $ make + +Result of the build +=================== + +Once the build has finished you will have the following files: + + output/images/ + +-- bbl + +-- bbl.bin + +-- rootfs.ext2 + +-- rootfs.ext4 -> rootfs.ext2 + +-- rootfs.tar + +-- sdcard.img + +-- vmlinux + + +Creating a bootable SD card +=========================== + +WARNING! This will destroy the existing contents of the SD card. +Use with caution - ensure that you select the correct block device! + +The sdcard.img file is a complete bootable image containing two +partitions. The first partition contains the bootloader and +kernel (bbl.bin) and the second partition contains the rootfs. + +Write the image to an SD card: + + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 + +Make sure that the all DIP switches are set to the off position for +default boot mode (MSEL mode = 1111), insert the SD card and power +up the board. + +Connect the USB cable and open minicom (/dev/ttyUSB1, 115200, 8N1). + +See the 'SiFive HiFive Unleashed Getting Started Guide' for +more details (https://www.sifive.com/documentation). + +-- + +Mark Corbin April 2019 diff --git a/configs/sifive_hifive_unleashed_defconfig b/configs/sifive_hifive_unleashed_defconfig new file mode 100644 index 0000000000..715402339f --- /dev/null +++ b/configs/sifive_hifive_unleashed_defconfig @@ -0,0 +1,31 @@ +# Architecture +BR2_riscv=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_64=y +BR2_RISCV_ABI_LP64D=y + +# Linux headers same as kernel, a 4.20 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=y + +# System +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/sifive/hifive-unleashed/post-image.sh" + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/markcorbinuk/linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="hifive-4.20.17" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sifive/hifive-unleashed/linux.config.fragment" +BR2_LINUX_KERNEL_VMLINUX=y + +# Bootloader +BR2_TARGET_RISCV_PK=y + +# Filesystem +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y