From patchwork Mon Jul 22 20:44:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1135269 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.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="jajVkMK2"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45styz5lftz9sBZ for ; Tue, 23 Jul 2019 06:50:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C1418203C5; Mon, 22 Jul 2019 20:49:59 +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 R6cclW0g6gQ5; Mon, 22 Jul 2019 20:49:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 9E71D2042A; Mon, 22 Jul 2019 20:49:56 +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 905DA1BF36E for ; Mon, 22 Jul 2019 20:49:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8D97520455 for ; Mon, 22 Jul 2019 20:49:54 +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 E7SBoV3DO+IR for ; Mon, 22 Jul 2019 20:49:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by silver.osuosl.org (Postfix) with ESMTPS id 8FF08203C5 for ; Mon, 22 Jul 2019 20:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1563828593; x=1595364593; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DLIdzsi6DHHy8FVueJeqGqtu6ltmYiRd+mDvE7RQu/g=; b=jajVkMK2uQLTiOUWKG3g37xvLb5E34AQKrCBxtnfnssszVbjIpAg63xB IwnSu12Gr6g4AORQojcHX9kKTJt1BILXy5e3y7gf5DGxGxnvjjde2x2M0 eCmMvZKuSs26KPu/7fFsSxj0X8y+18Qa/lksshOKWWmW+Z64xpGwhoHxi knJPA63KuUy+mzGVzVCRL8OausBpzEKbINaw2N5isSqQ6afgWZvwhlQLZ jJ6+nd6dCP1dV67VsqvxK87Dc0D+SjWPz7P0a4LK7kJTzWojxfBbopDZX 17BvPYE9JbbyoeZFXwWC6Mvk8Z64JsEqS/GR0MFP4hN/bhHjOxjkkjK0k g==; IronPort-SDR: BxVFWX3SoMVObGlWgTuwGeblqrPcF7EjUHPCqGBAspljfxaZfhTtDdHWRSWstAwWqGpkLLJSNp CFyK2PWRRPUksSf+GsewDZM9efI1KQU63Nxfha2xVqUXGABw9HYATI6u4Squlg/yWdny4kaRNX 4A0InaVmlJFTX00Q4WFCW/JOwKbLY+P/4xXNTdNIQcNc3RImfW7J1sOZ0U2O9OQJblINfLus5A mb6nbzQdt5Ikvi8K7ZxSeyY3fyrDVzduG0IQ6maVhq9nENaniNsFWsOv9XL1J7DhI8Tc9qcdS/ bq4= X-IronPort-AV: E=Sophos;i="5.64,296,1559491200"; d="scan'208";a="220161630" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2019 04:47:51 +0800 IronPort-SDR: 2uCNhEKOs1VlIV4/WmXbcB9d+x7lwcsoeufuaPGTkFwuwKT9MB47IsvF8BvtHSfNylkd3KyinH VahtKDUg6k/3uq6n2/zvr9/2FPQGRxSK2TnvaOa1Xxyph+NbBxrXe2+UTsLuN7Bx/4VDWucqGk 9zj02lhV3YI2pMF1VB+Tw6ogTxWg4/LDicP/C5tALimxbADwUFuF0xMoxWBrQxO7adk3rexKD5 mehwvXlB7NfkCtYuLzbFV7F9dZUA3QvrLagqx3Wsvak/r5GbFtTerenXultKKC4L2RHdzeUtNm 7uzA8KOyJfC3kefd5q/CWH0Q Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 22 Jul 2019 13:46:07 -0700 IronPort-SDR: 4rTg1jkYEPPiZRQ3RVUL0V0bgQvDQjszEcL823SUxWtfqUnsVz0XmFPA+r6OA7cwBT0YQoNtWW T2tmCJrAWor7G0Ywcnn/SqSA6/OXFS3tbzRyuSwaA0TUJgqM1e+k61z57r56HosbfAfrzmCWTv EwE8+sWSWKA1JSB/kdlCIdLmdcjoggwSWYKjNZwzo4vVHbBXXBSHv4lAf1wZhe+77a7InwUCfu tg3ZZf1/NaHdVITQFSczcoIJGvT/DG9cCDrQBRDXBwoiIVjXddXJM9DwHL3EpLgZ0suL1UlXd7 vKc= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jul 2019 13:47:52 -0700 From: Alistair Francis To: mark.corbin@embecosm.com, buildroot@buildroot.org Date: Mon, 22 Jul 2019 13:44:46 -0700 Message-Id: <20190722204447.7935-1-alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 1/2] boot/opensbi: Add support for including Linux payload 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: alistair23@gmail.com, Alistair Francis Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Alistair Francis --- boot/opensbi/Config.in | 10 ++++++++++ boot/opensbi/opensbi.mk | 26 +++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/boot/opensbi/Config.in b/boot/opensbi/Config.in index 5f3cc13312..686aac8798 100644 --- a/boot/opensbi/Config.in +++ b/boot/opensbi/Config.in @@ -22,4 +22,14 @@ config BR2_TARGET_OPENSBI_PLAT library libsbi.a is built. If a platform is specified then the platform specific static library libplatsbi.a and firmware examples are built. + +if BR2_TARGET_OPENSBI_PLAT != "" +config BR2_TARGET_OPENSBI_LINUX_PAYLOAD + bool "Include Linux as OpenSBI Payload" + depends on BR2_LINUX_KERNEL + depends on BR2_LINUX_KERNEL_IMAGE + depends on !BR2_TARGET_OPENSBI_LIBRARY_ONLY + help + Build OpenSBI with the Linux kernel as a Payload. +endif endif diff --git a/boot/opensbi/opensbi.mk b/boot/opensbi/opensbi.mk index 83552a5442..14657cac06 100644 --- a/boot/opensbi/opensbi.mk +++ b/boot/opensbi/opensbi.mk @@ -19,19 +19,35 @@ ifneq ($(OPENSBI_PLAT),) OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT) endif +OPENSBI_LINUX_PAYLOAD = $(call qstrip,$(BR2_TARGET_OPENSBI_LINUX_PAYLOAD)) +ifeq ($(OPENSBI_LINUX_PAYLOAD), y) +OPENSBI_DEPENDENCIES = linux +OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/Image" +endif + define OPENSBI_BUILD_CMDS $(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D) endef ifneq ($(OPENSBI_PLAT),) OPENSBI_INSTALL_IMAGES = YES +OPENSBI_INSTALL_IMAGES_CMDS_PLAT = \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.bin $(BINARIES_DIR)/fw_jump.bin; \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.elf $(BINARIES_DIR)/fw_jump.elf; \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_dynamic.bin $(BINARIES_DIR)/fw_dynamic.bin; \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_dynamic.elf $(BINARIES_DIR)/fw_dynamic.elf; +endif + +ifeq ($(OPENSBI_LINUX_PAYLOAD), y) +OPENSBI_INSTALL_IMAGES_CMDS_PAYLOAD = \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_payload.bin $(BINARIES_DIR)/fw_payload.bin; \ + $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_payload.elf $(BINARIES_DIR)/fw_payload.elf; +endif + define OPENSBI_INSTALL_IMAGES_CMDS - $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.bin $(BINARIES_DIR)/fw_jump.bin - $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.elf $(BINARIES_DIR)/fw_jump.elf - $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_dynamic.bin $(BINARIES_DIR)/fw_dynamic.bin - $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_dynamic.elf $(BINARIES_DIR)/fw_dynamic.elf + $(OPENSBI_INSTALL_IMAGES_CMDS_PLAT) + $(OPENSBI_INSTALL_IMAGES_CMDS_PAYLOAD) endef -endif # libsbi.a is not a library meant to be linked in user-space code, but # with bare metal code, which is why we don't install it in From patchwork Mon Jul 22 20:44:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1135270 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=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="LX1dZTtb"; 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 45styy5w7rz9s7T for ; Tue, 23 Jul 2019 06:50:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D3D3C872A6; Mon, 22 Jul 2019 20:49:58 +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 dFCFtA3E1qHc; Mon, 22 Jul 2019 20:49:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id CAAF786FE7; Mon, 22 Jul 2019 20:49:57 +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 E1EF71BF36E for ; Mon, 22 Jul 2019 20:49:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DF34D203C5 for ; Mon, 22 Jul 2019 20:49:54 +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 sIODfZDet2F7 for ; Mon, 22 Jul 2019 20:49:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by silver.osuosl.org (Postfix) with ESMTPS id C22022042A for ; Mon, 22 Jul 2019 20:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1563828593; x=1595364593; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WmZnUCZrGVnOaMYA5lXsbR8WIBDEjpcm0yf434mkwU0=; b=LX1dZTtbnonfrMV6dIg679QQ7M0Y62ZUiLqKTQE9rulXs2fxcieamvB/ JmGI3Zjqlwm+iljaRbobUzn/u4ywFH49FchJGSdUrw8yoDq7wJRcgQr92 H7scm+PaK7iVE0crQnk5oeTaUa09xBmd2gSJF8UcHYlACV6EVyb8lanyn EH4uC/YU5gm0wmrKbEzsy4JY7B3V06dG0f1GyZJq83RVDPyGxNPRqPMTJ u467OgFE75jS6F6u/RmwJGHC7fXehShehr929EYMAqzWjxJDGSrZMyRVR F02DTqfXH6itNXTEnp/CSSlpRFAHAJWM5zAPxVItTKKbAsUZ/3jGmbe/e g==; IronPort-SDR: 2d29lJrFH0jxpFq9BiCy/3PyF7tPHm6BPl8HHVo0IAAxoZWN1uHIIPcp0aBF0ZaA24Y3bbEMgd biHKrGmPdqZGRrWyknkFXAUfKaP9s5U5wajRHPmADr0zjkkQoDsbpm8tNUIxp3qnmOOsb5M6+H ojTqOstczTDRYuIIBBQ6NYCHInhCwSwzreue1DAHj8j7XRdHDfajSxMCUAKgrm2raNywPtrMJ1 t82+sNlRotDHk2vr43o+eeJ6ZzXgt5Km/3A9CddqyQhU2Yc2HU3lRa6s1xPcQzICXNJvIAFJ1G Ecc= X-IronPort-AV: E=Sophos;i="5.64,296,1559491200"; d="scan'208";a="220161631" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 23 Jul 2019 04:47:52 +0800 IronPort-SDR: TFVO1NS9V0KBsfvgjaKd7QXTcvOt5w86t6WqIbr3aFyJaQ/JWtSxJdUAAs8vKhA/SueIXD//RN sXYIT+8qTWTAe8aNu5oVsCJBa4ZuZH2F/+1ZWsQZJC2vHgMqB8U+EB0aTuD4ZJoH8AfiBq6jYg adFZPu9NJYRAtQEVQDr91Hqn6RpHwWsgSkppHDYAGS1QH6NlU4u7/veiEgXl00wm4spNkWGQ9v Pucfk/VNNKYM/C1JQnSq8bnxdqGVqJ65QIDta+tRxJQAVdvhIec8CO39R00kjtsGDaQUiKJEtz jpzYbLLfHLhnfvGoUW+Qefg8 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 22 Jul 2019 13:46:07 -0700 IronPort-SDR: MfgvpCsGcPmqyrS7Zyjwd3OB8bpXGWPSMYqI0xb/X8/cOhDtXkic3ZX/6fMI4mMjHztPekcWaM k5NtnzXsTiHKobG6Ts6QULuZ63crQLeQEvDxzzQivJFsxk7ltMgI4VxGO115llY5XvEYUn+oJF df7rdh6bOcgAQ9YXlbyy//5lTJ5QQ2No0jT7KaWEzqe3QKoXimnjkyBtLG48uOcrlPmjU/1o1Z KsWPx5eTxRYbgKwf3YzsIzLj2BcW39BBi6i8emalqQSlmpVF4+svoI+vF22Hhb5kTqNCAnCRTB V8w= Received: from risc6-mainframe.sdcorp.global.sandisk.com (HELO risc6-mainframe.int.fusionio.com) ([10.196.157.140]) by uls-op-cesaip01.wdc.com with ESMTP; 22 Jul 2019 13:47:52 -0700 From: Alistair Francis To: mark.corbin@embecosm.com, buildroot@buildroot.org Date: Mon, 22 Jul 2019 13:44:47 -0700 Message-Id: <20190722204447.7935-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190722204447.7935-1-alistair.francis@wdc.com> References: <20190722204447.7935-1-alistair.francis@wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/2] board/sifive: Add the HiFive Unleased 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: alistair23@gmail.com, Alistair Francis Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch adds support for the HiFive Unleashed board. This includes building the firmware, kernel and rootFS for the HiFive Unleased. This patch includes a post-image.sh script and genimage.cfg file used to generate a sdcard image that can be dd-ed to an SD card. The manual steps are useful even when genimage works as users won't always need to flash the entire SD card. For example a kernel update will only require one partition being updated manually via dd instead of a full reflash. Signed-off-by: Alistair Francis --- DEVELOPERS | 2 + board/sifive/hifive_unleased/genimage.cfg | 17 +++ .../hifive_unleased/linux.config.fragment | 16 +++ board/sifive/hifive_unleased/post-image.sh | 9 ++ board/sifive/hifive_unleased/readme.txt | 103 ++++++++++++++++++ configs/hifive_unleashed_defconfig | 39 +++++++ 6 files changed, 186 insertions(+) create mode 100644 board/sifive/hifive_unleased/genimage.cfg create mode 100644 board/sifive/hifive_unleased/linux.config.fragment create mode 100755 board/sifive/hifive_unleased/post-image.sh create mode 100644 board/sifive/hifive_unleased/readme.txt create mode 100644 configs/hifive_unleashed_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 4ab4e36593..dd15ea2cb7 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -123,7 +123,9 @@ F: package/kvazaar/ F: package/v4l2loopback/ N: Alistair Francis +F: board/sifive/ F: boot/opensbi/ +F: configs/hifive_unleashed_defconfig F: package/xen/ N: Alvaro G. M diff --git a/board/sifive/hifive_unleased/genimage.cfg b/board/sifive/hifive_unleased/genimage.cfg new file mode 100644 index 0000000000..8eebc52355 --- /dev/null +++ b/board/sifive/hifive_unleased/genimage.cfg @@ -0,0 +1,17 @@ +image sdcard.img { + hdimage { + gpt = true + } + + partition bootloader { + image = "fw_payload.bin" + offset = 1M + size = 32M + partition-type-uuid = 2E54B353-1271-4842-806F-E436D6AF6985 + } + + partition rootfs { + image = "rootfs.ext4" + partition-type-uuid = 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + } +} diff --git a/board/sifive/hifive_unleased/linux.config.fragment b/board/sifive/hifive_unleased/linux.config.fragment new file mode 100644 index 0000000000..f4f384088a --- /dev/null +++ b/board/sifive/hifive_unleased/linux.config.fragment @@ -0,0 +1,16 @@ +CONFIG_HZ_100=y +CONFIG_CMDLINE="earlycon=sbi root=/dev/mmcblk0p2 rootwait" +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_SERIAL_SIFIVE=y +CONFIG_SERIAL_SIFIVE_CONSOLE=y +CONFIG_SPI=y +CONFIG_SPI_SIFIVE=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_SYSFS=y +CONFIG_GPIO_SIFIVE=y +CONFIG_MMC=y +CONFIG_MMC_SPI=y +CONFIG_CLK_U54_PRCI=y +CONFIG_CLK_GEMGXL_MGMT=y +CONFIG_PWM=y +CONFIG_PWM_SIFIVE=y diff --git a/board/sifive/hifive_unleased/post-image.sh b/board/sifive/hifive_unleased/post-image.sh new file mode 100755 index 0000000000..2051ee49cb --- /dev/null +++ b/board/sifive/hifive_unleased/post-image.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Script to generate a SD card image for the HiFive Unleashed. + +# We need to make sure that this is updated +make opensbi-rebuild + +support/scripts/genimage.sh -c board/sifive/hifive_unleased/genimage.cfg + diff --git a/board/sifive/hifive_unleased/readme.txt b/board/sifive/hifive_unleased/readme.txt new file mode 100644 index 0000000000..3714fe4f71 --- /dev/null +++ b/board/sifive/hifive_unleased/readme.txt @@ -0,0 +1,103 @@ +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 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/ + +-- fw_jump.bin + +-- fw_jump.elf + +-- fw_payload.bin + +-- fw_payload.elf + +-- Image + +-- rootfs.ext2 + +-- rootfs.ext4 + +-- rootfs.tar + +-- sdcard.img + + +Creating a bootable SD card with genimage +========================================= + +Buildroot builds a SD card image for you. All you need to do is dd the +image to your SD card, which can be done with the following command: + + $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4096 + +Creating a bootable SD card with sgdisk +======================================= + +Below are manual instructions to setup the SD card. + +Create the partitions on the SD card: + + $ sudo sgdisk -g --clear \ + --new=1:2048:67583 \ + --change-name=1:bootloader \ + --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985 \ + --new=2:264192: \ + --change-name=2:root \ + --typecode=2:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \ + /dev/mmcblk0 + +The first partition will contain the bootloader and kernel +(fw_payload.bin). The second partition contains the Linux +filesystem. + +Copy the bootloader and kernel to the SD card: + + $ sudo dd if=output/images/fw_payload.bin of=/dev/mmcblk0p1 bs=4096 + +Copy the rootFS to the SD card: + + $ sudo dd if=output/images/rootfs.ext4 of=/dev/mmcblk0p2 bs=4096 + +Booting the SD card on the board +================================ + +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). + +You will get a warning reported by fdisk when you examine the SD card. +This is because the genimage.cfg file doesn't specify the SD card size +(as people will naturally have different sized cards), so the +secondary GPT header is placed after the rootfs rather than at the end +of the disk where it is expected to be. + +You will see something like this at boot time: + +[ 2.318722] GPT:Primary header thinks Alt. header is not at the end of the disk. +[ 2.325390] GPT:190496 != 122142719 +[ 2.328843] GPT:Alternate GPT header not at the end of the disk. +[ 2.334824] GPT:190496 != 122142719 +[ 2.338302] GPT: Use GNU Parted to correct GPT errors. +[ 2.343456] mmcblk0: p1 p2 diff --git a/configs/hifive_unleashed_defconfig b/configs/hifive_unleashed_defconfig new file mode 100644 index 0000000000..83cb33d3da --- /dev/null +++ b/configs/hifive_unleashed_defconfig @@ -0,0 +1,39 @@ +# 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 + +# System +BR2_SYSTEM_DHCP="eth0" +BR2_TARGET_GENERIC_GETTY=y +BR2_TARGET_GENERIC_GETTY_PORT="ttySIF0" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/sifive/hifive_unleased/post-image.sh" + +# Filesystem +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y + +# Linux headers same as kernel, a 5.1 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/alistair23/linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="hifive-unleashed-5.1" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sifive/hifive_unleased/linux.config.fragment" +BR2_LINUX_KERNEL_IMAGE=y + +# Bootloader +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_PLAT="sifive/fu540" +BR2_TARGET_OPENSBI_LINUX_PAYLOAD=y + +# Host tools +BR2_PACKAGE_HOST_GENIMAGE=y