From patchwork Tue May 31 05:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637203 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=BPf9Zll5; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=XGSg8qQV; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1ZW3Xj2z9s1l for ; Tue, 31 May 2022 15:49:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 3ED8241834; Tue, 31 May 2022 05:49:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2_1cFmNCNnos; Tue, 31 May 2022 05:49:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id C94A34182D; Tue, 31 May 2022 05:49:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 57AFA1BF375 for ; Tue, 31 May 2022 05:49:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E745E400A4 for ; Tue, 31 May 2022 05:49:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="BPf9Zll5"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="XGSg8qQV" Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dgr9ba83NWYX for ; Tue, 31 May 2022 05:49:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id F08DD40232 for ; Tue, 31 May 2022 05:49:33 +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=1653976173; x=1685512173; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ss1H1SnnOBWDOAZXTwpipHdmDv59qxiwvyQwFmstenE=; b=BPf9Zll5/QKmZFRFzgnPBoLK5X2Ga6OI2p/WTG6CcOvR4tGvx4jVgkww VRRzqL3RbNcQ/oZKS6vOC+xkB/WE8EYu3Y1q/djEZGyCWHeVgu0IlZPmD CEK9tF8K2sSbRaZTyPCENJQS3VfxDbEolPo1BQe7QHFL/JG0VpPa3rCQK eKYGaipIALRCPQ22ZqxbYGwwup/prQU3apU3v0gyhx4FfRAaNGUuhoaWi Uo3UMfkWgOIiqKwDBZ0lPNEG5P1ql7oqLpsWSHL2wzOR4kMjYmoanxT3f rxuQBx0rYmaGEoJop1HoyIY1hYl1B24B21jRPfP4JftMyJiRMv47YA/KY w==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095076" 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; 31 May 2022 13:49:32 +0800 IronPort-SDR: dPJCWhMfZyi5C4SofvSQQOUbyaDPmj5+qizbBZw9588t/rKHsE/1pq2xfItD6PThSefMj0xPkp X1iOBW/wbEF3pDq7fxeIdPLDHxmdUoAjnwzrcxVfIx0KDQEMhXe2H8soCU7Do3MG3S0k9hiYbf 5sD7IVsZdz2jVz68e8yTTwVryhEfvU7AWTIKTBD4j06X7f6mX4Jz8CBW7rH0cFjmEHUfzMMOMt S4EqmENtU635i0gJt2g/tSpe2LeX6DOeE1UdSYswy78LBkNSXqduQaSajvFep+87z51d+6JrSO yzUJNOUQOrXdTRn6BMHZejs7 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:18 -0700 IronPort-SDR: QSHIPHvcBRbew702O7jB/+39fz8itWTtbtEJhFGrk8VGZtwqIjcQM3USzcprmoicpgDk9HBw+G rqhRuPQlONYMbMQQiHthIb3GrmSPHjdGXVfcxLQFEqKV00gbq8NwuA/R9cGQB//CttOYo+1g6E 4w8XsffMhFxoSCtoRwG74m8t6ThdD5rwzlwCDgNhFKZhBkO2qUoGSMV5MVxx11j1WCKFfiVdml LW0pcAvXJ9ZF3ZZPRZQHtVyhtSdJxDBMnxr+AnlUNRyTPOQfhnowDuzUrIMHmRKbAaY25nNR1U dc4= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:33 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1Z429M4z1Rwrw for ; Mon, 30 May 2022 22:49:32 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976170; x=1656568171; bh=ss1H1SnnOBWDOAZXTw pipHdmDv59qxiwvyQwFmstenE=; b=XGSg8qQVRUIcr5VjjKR3g2QGv/ac6xCW2C 30g33KZRsswRNCWgyBNWe+VrlWVqIdnm3lVDQqynHhE8KYt44tBVyfdDs/tP28mh UTrhe5ebyMGQ0ROzO/U6KCVr9aaKvCEsO+Xyr1EPwTBQQwiuzo+eBXkWkcOSlQXJ zg8nHHBVPv+GJmTd4gXcE4SOM+u6+KfAKoeim8+ifnJOgHlVlLwRFK0Oeppw7yId xy3oVhxyVBi6Qm2ooFgmCXhGdo7ufdimv6RUJnDiJOX+rYkN+8VFHlxzLelKISOO TbKet3zom8XnYoVFxnKJWQIkLA5EOCxHLSJ+g8GW59nXaK1XveeA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UkXMUNbMNWYM for ; Mon, 30 May 2022 22:49:30 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z20WN8z1Rvlx; Mon, 30 May 2022 22:49:29 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:20 +0900 Message-Id: <20220531054926.373713-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 1/7] package/elf2flt: Remove Config.in.host X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" There is no need to have configuration files direbtly set the BR2_PACKAGE_HOST_ELF2FLT option. The need for the elf2flt utility is automatically determined by gcc build in package/gcc/gcc.mk according to the BR2_BINFMT_FLAT option. Accordingly, we can remove the file package/elf2flt/Config.in.host to get rid of the BR2_PACKAGE_HOST_ELF2FLT option. BR2_STRIP_strip dependency on this option is replaced with a dependency on BR2_BINFMT_ELF. To stay consistent with the fact that elf2flt supports only the arm, sh, sparc, xtensa and riscv-64 architectures, a dependency on these architectures is added to the BR2_BINFMT_FLAT option in arch/Config.in. Board configuration files setting the BR2_PACKAGE_HOST_ELF2FLT option are also updated. Signed-off-by: Damien Le Moal --- Config.in | 2 +- arch/Config.in | 1 + configs/qemu_arm_versatile_nommu_defconfig | 1 - configs/qemu_riscv64_nommu_virt_defconfig | 1 - configs/qemu_xtensa_lx60_nommu_defconfig | 1 - package/elf2flt/Config.in.host | 13 ------------- toolchain/toolchain-buildroot/Config.in | 1 - 7 files changed, 2 insertions(+), 18 deletions(-) delete mode 100644 package/elf2flt/Config.in.host diff --git a/Config.in b/Config.in index f0cd6f48ed..7192292d10 100644 --- a/Config.in +++ b/Config.in @@ -432,7 +432,7 @@ config BR2_ENABLE_RUNTIME_DEBUG config BR2_STRIP_strip bool "strip target binaries" default y - depends on !BR2_PACKAGE_HOST_ELF2FLT + depends on BR2_BINFMT_ELF help Binaries and libraries in the target filesystem will be stripped using the normal 'strip' command. This allows to save diff --git a/arch/Config.in b/arch/Config.in index 49e16fce38..e89a58ac3b 100644 --- a/arch/Config.in +++ b/arch/Config.in @@ -392,6 +392,7 @@ config BR2_BINFMT_ELF config BR2_BINFMT_FLAT bool "FLAT" + depends on BR2_arm || BR2_sh || BR2_sparc || BR2_xtensa || BR2_RISCV_64 depends on !BR2_USE_MMU help FLAT binary is a relatively simple and lightweight executable diff --git a/configs/qemu_arm_versatile_nommu_defconfig b/configs/qemu_arm_versatile_nommu_defconfig index 0c49d1b67d..d88ade1fe9 100644 --- a/configs/qemu_arm_versatile_nommu_defconfig +++ b/configs/qemu_arm_versatile_nommu_defconfig @@ -3,7 +3,6 @@ BR2_arm=y BR2_arm926t=y # Toolchain -BR2_PACKAGE_HOST_ELF2FLT=y # BR2_USE_MMU is not set # Patches diff --git a/configs/qemu_riscv64_nommu_virt_defconfig b/configs/qemu_riscv64_nommu_virt_defconfig index bfee9e710a..33fad50a3c 100644 --- a/configs/qemu_riscv64_nommu_virt_defconfig +++ b/configs/qemu_riscv64_nommu_virt_defconfig @@ -6,7 +6,6 @@ BR2_RISCV_64=y BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" # Toolchain -BR2_PACKAGE_HOST_ELF2FLT=y # BR2_USE_MMU is not set # Busybox with hush diff --git a/configs/qemu_xtensa_lx60_nommu_defconfig b/configs/qemu_xtensa_lx60_nommu_defconfig index 44fb81bd74..f107b7e73b 100644 --- a/configs/qemu_xtensa_lx60_nommu_defconfig +++ b/configs/qemu_xtensa_lx60_nommu_defconfig @@ -4,7 +4,6 @@ BR2_XTENSA_CUSTOM=y BR2_XTENSA_OVERLAY_FILE="https://github.com/jcmvbkbc/xtensa-toolchain-build/raw/95291b7c39e6f790d0b2f062c945a630290f2c81/overlays/xtensa_dc233c.tar.gz" # Toolchain -BR2_PACKAGE_HOST_ELF2FLT=y # BR2_USE_MMU is not set # Use minimal busybox with hush and networking tools diff --git a/package/elf2flt/Config.in.host b/package/elf2flt/Config.in.host deleted file mode 100644 index 2bab0095c2..0000000000 --- a/package/elf2flt/Config.in.host +++ /dev/null @@ -1,13 +0,0 @@ -config BR2_PACKAGE_HOST_ELF2FLT - bool "Enable elf2flt support?" - depends on BR2_arm || BR2_sh || BR2_sparc || BR2_xtensa || BR2_RISCV_64 - depends on !BR2_USE_MMU - help - uCLinux uses a Binary Flat format commonly known as BFLT. It - is a relatively simple and lightweight executable format - based on the original a.out format. - - This option compiles the required tools and makes the required - modifications on your toolchain (linker). - - https://github.com/uclinux-dev/elf2flt diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in index 8d9cf4cc68..9c80f22afa 100644 --- a/toolchain/toolchain-buildroot/Config.in +++ b/toolchain/toolchain-buildroot/Config.in @@ -114,5 +114,4 @@ source "package/uclibc/Config.in" source "package/glibc/Config.in" source "package/binutils/Config.in.host" source "package/gcc/Config.in.host" -source "package/elf2flt/Config.in.host" endif From patchwork Tue May 31 05:49:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637204 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=SuhHc1HC; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=IJ5meFu0; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1Zl4Gb2z9s1l for ; Tue, 31 May 2022 15:50:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C96BA60B9D; Tue, 31 May 2022 05:50:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T5bhwNEgvGDp; Tue, 31 May 2022 05:50:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 63F9E61110; Tue, 31 May 2022 05:50:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5ACDD1BF375 for ; Tue, 31 May 2022 05:49:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 53B2740232 for ; Tue, 31 May 2022 05:49:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="SuhHc1HC"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="IJ5meFu0" Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L6nzuLAQJu6U for ; Tue, 31 May 2022 05:49:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2D4D54023F for ; Tue, 31 May 2022 05:49:34 +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=1653976174; x=1685512174; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2kTGs8ul4ilIgxtHDyuT82YTBVhCgeHXvYjiXAqmzpQ=; b=SuhHc1HCx+9QhQfunRy25aguUP/kMHqbdsVo5FD6OtS04+mpGOC2MQ5g KOhFxYzA5561E5MDhcL/ljl2z9lERfL+Y7ygFs1WWq3VfLnSZEeTBVpt2 +cAEweh2NyM/vlMGETDwWjNih7fBNTMXftmxQMRng1mNIeRv/uiwCcTfz TvjbBuV+1uOjI/PZC07328zmOvgVSqTN7Y1xWCNRJTmE1/1D6pBuAjQ5n 52YmagCN8fyxKsbkvXPt7CnGv2ONQ5OCBGTQDdSpXfYWqSlnog7CRv+GE h2WW0DvwR0F0u67yOURR8mMVkHNVmx1RcmWkhDAOmhgHhalo6kRnR52WF w==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095078" 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; 31 May 2022 13:49:33 +0800 IronPort-SDR: luHamoWxV6g/O0fHnaq6Go14I6KfPhP0OvJpzRw5GiVV7mz4XXxbl0NGsOVDnNWMxtoZhujz1D 2WiH4qlN6CZK29bQGv5pXOKPkBiEyOfyE9u10VOLU+1MXQhZ5UQvFid5+0D7aIQxbwSXiyam0I ma9xMWnjHzypXNz2/3mms1ZxrBlkpK2P35lQiJlRM6cRU4Q+DTLIe1oUq/ksfp1JLdNhS4N1zP s+iLobdgVyRgDmZlxjlM1qDcBz8p8UTqO39+Sq0rHfn9sf/vO982jnlAy+Za2l+vPN9iK75CWq zpKwpJCP16QyICaXA1ruc/i4 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:19 -0700 IronPort-SDR: yG2mUeHFwm0jp0dJwwfMrrR8KPkcCqcCtfAu/qbbnxi86X4FIx/uGr3Lwpa6YaUTcvCkaPeSba OSWnRNNZw4W5a2XBg+GXvh0dgEnAMs0XgUooKQomBvIUCAJz+uFoBs2HsB9KhA33WYwr0mPUKT riHCQpCFTYubfATUX45E9kIsZeG5rwEfkoCTPG068HRxFgPvV7QIG7C62S+TsLbEe2PU59T9z1 0fd1C5f21dGhy7N12I4W4gww97K7PvcwC+SOSSnGV3YBCBT0OeGYD7oUm3Z6nK11P0mSavW0JZ QV4= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:34 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1Z52gkcz1SVp0 for ; Mon, 30 May 2022 22:49:33 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976172; x=1656568173; bh=2kTGs8ul4ilIgxtHDy uT82YTBVhCgeHXvYjiXAqmzpQ=; b=IJ5meFu0yb5lOpdPdUKWn9pxwfN+PV9MUo h9FpWwUZF29vm63yLhvHPrhAdMfW1RuD4NT6sHXjFOqMG7BxsyKqOL3xQ2bkUy64 3/Md7dWZ2gSBn1pXMJc4DfbRM1nQyrs2OJbDuaxSeNz4zGB4hvAG+eickOhqa4Wb +CETqICFh4BGoiGoe8oHpFcnGoY3v5gP5W1IcKdkG4ZEYatXoTl4c7CO5SKz8aXY YRtXEHpo3GNl5pP1Jvl4SbIZS1QL19QyoHqp6kj3HGS4QhF1bgDLwisJ1RIkN6r5 20nCpXm9U3xaYd8ErWkqFHnM58nhMk7bRdlnxQApXdMWOtqYe50A== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Frw-9prKzdev for ; Mon, 30 May 2022 22:49:32 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z32JjDz1Rvlc; Mon, 30 May 2022 22:49:31 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:21 +0900 Message-Id: <20220531054926.373713-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 2/7] board: Add common support for Canaan K210 SoC-based boards X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" The Linux environment for all boards using the Canaan Kendryte K210 SoC can be built with the same process, using configurations that differ only by the device tree used for the build. This patch add the shared configurations, rootfs overlay and scripts used for all K210-based boards. Since the K210 SoC only has 8 MB of SRAM, a special busybox configuration and rootfs overlay are added to save memory at runtime: * For configurations using direct kernel boot (no boot loader), the default busybox configuration busybox-minimal.config is modified using the fragment file board/canaan/k210-soc/busybox-tiny.config. This reduces the size of the busybox executable to save memory when executing shell commands. * Busybox init system is not used and a special init scripts is provided using the rootfs_overlay root file system overlay. This init script simply mounts devtmpfs, /proc and /sys, and exec an interactive shell after printing a logo. This avoids (1) boot failures due to large memory allocations by the regular busybox init system (these allocations fail on the K210 for lack of enough memory) and avoids (2) keeping the init process sleeping in the background (wasted memory). The board/canaan/k210-soc/busybox-tiny.config and the rootfs overlay files in board/canaan/k210-soc/rootfs_overlay are used for all Canaan K210 SoC based boards. For board configurations booting using the U-Boot boot loader, a common set of linux kernel configuration parameters is provided by the file board/canaan/k210-soc/linux-sdcard.config. In addition, the post build script board/canaan/k210-soc/post-build.sh file and U-Boot image generation configuration file board/canaan/k210-soc/genimage.cfg are provided. The post-build script creates a generic "k210.dtb" symlink to the compiled device tree file for the target board. This symlink is used by the genimage.cfg configuration, making this file common for all boards. Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- DEVELOPERS | 1 + board/canaan/k210-soc/busybox-tiny.config | 231 ++++++++++++++++++ board/canaan/k210-soc/genimage.cfg | 30 +++ board/canaan/k210-soc/linux-sdcard.config | 4 + board/canaan/k210-soc/post-build.sh | 28 +++ board/canaan/k210-soc/rootfs_overlay/init | 1 + .../canaan/k210-soc/rootfs_overlay/sbin/init | 41 ++++ board/canaan/k210-soc/uboot.config | 1 + 8 files changed, 337 insertions(+) create mode 100644 board/canaan/k210-soc/busybox-tiny.config create mode 100644 board/canaan/k210-soc/genimage.cfg create mode 100644 board/canaan/k210-soc/linux-sdcard.config create mode 100755 board/canaan/k210-soc/post-build.sh create mode 120000 board/canaan/k210-soc/rootfs_overlay/init create mode 100755 board/canaan/k210-soc/rootfs_overlay/sbin/init create mode 100644 board/canaan/k210-soc/uboot.config diff --git a/DEVELOPERS b/DEVELOPERS index 096ca94f4e..972c5de380 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -632,6 +632,7 @@ F: package/log4cpp/ N: Damien Le Moal F: package/python-kflash/ +F: board/canaan/ N: Daniel Nicoletti F: package/cutelyst/ diff --git a/board/canaan/k210-soc/busybox-tiny.config b/board/canaan/k210-soc/busybox-tiny.config new file mode 100644 index 0000000000..9db12b560a --- /dev/null +++ b/board/canaan/k210-soc/busybox-tiny.config @@ -0,0 +1,231 @@ +# +# Additional config changes for busybox-minimal.config +# to reduce the size of the busybox executable. +# + +# +# Settings +# +# CONFIG_INCLUDE_SUSv2 is not set +# CONFIG_LONG_OPTS is not set +# CONFIG_LFS is not set +# CONFIG_FEATURE_DEVPTS is not set +# CONFIG_FEATURE_SYSLOG_INFO is not set +# CONFIG_FEATURE_SYSLOG is not set + +# +# Library Tuning +# +# CONFIG_FEATURE_RTMINMAX is not set +# CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS is not set +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_EDITING_VI is not set +# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set +# CONFIG_FEATURE_REVERSE_SEARCH is not set +# CONFIG_FEATURE_EDITING_WINCH is not set +# CONFIG_FEATURE_HWIB is not set + +# +# Archival Utilities +# +# CONFIG_ZCAT is not set +# CONFIG_BZCAT is not set +# CONFIG_LZCAT is not set +# CONFIG_XZCAT is not set +# CONFIG_UNLZOP is not set +# CONFIG_LZOPCAT is not set + +# +# Coreutils +# +# CONFIG_CKSUM is not set +# CONFIG_DOS2UNIX is not set +# CONFIG_UNIX2DOS is not set +# CONFIG_DU is not set +# CONFIG_FACTOR is not set +# CONFIG_FOLD is not set +# CONFIG_HEAD is not set +# CONFIG_INSTALL is not set +# CONFIG_LINK is not set +# CONFIG_LOGNAME is not set +# CONFIG_MD5SUM is not set +# CONFIG_SHA1SUM is not set +# CONFIG_SHA256SUM is not set +# CONFIG_SHA512SUM is not set +# CONFIG_SHA3SUM is not set +# CONFIG_MKFIFO is not set +# CONFIG_NICE is not set +# CONFIG_NL is not set +# CONFIG_NOHUP is not set +# CONFIG_OD is not set +# CONFIG_PASTE is not set +# CONFIG_SHRED is not set +# CONFIG_SORT is not set +# CONFIG_TAIL is not set +# CONFIG_TEE is not set +# CONFIG_TIMEOUT is not set +# CONFIG_TR is not set +# CONFIG_UNIQ is not set +# CONFIG_UUDECODE is not set +# CONFIG_BASE32 is not set +# CONFIG_UUENCODE is not set +# CONFIG_WC is not set +# CONFIG_WHOAMI is not set +# CONFIG_WHO is not set +# CONFIG_W is not set +# CONFIG_USERS is not set +# CONFIG_YES is not set + +# +# Common options +# +# CONFIG_FEATURE_VERBOSE is not set + +# +# Debian Utilities +# +# CONFIG_RUN_PARTS is not set +# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set +# CONFIG_FEATURE_RUN_PARTS_FANCY is not set +# CONFIG_START_STOP_DAEMON is not set +# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set +# CONFIG_WHICH is not set + +# +# klibc-utils +# +# CONFIG_NUKE is not set +# CONFIG_RESUME is not set +# CONFIG_RUN_INIT is not set + +# +# Editors +# +# CONFIG_SED is not set +CONFIG_VI=y +CONFIG_FEATURE_VI_MAX_LEN=4096 +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y +CONFIG_FEATURE_VI_UNDO=y + +# +# Finding Utilities +# +CONFIG_GREP=y +# CONFIG_EGREP is not set +# CONFIG_FGREP is not set +# CONFIG_XARGS is not set + +# +# Init Utilities +# +# CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +# CONFIG_FEATURE_WAIT_FOR_INIT is not set +# CONFIG_FEATURE_CALL_TELINIT is not set +# CONFIG_INIT is not set +# CONFIG_LINUXRC is not set + +# +# Login/Password Management Utilities +# +# CONFIG_FEATURE_SHADOWPASSWDS is not set +# CONFIG_USE_BB_CRYPT is not set +# CONFIG_USE_BB_CRYPT_SHA is not set +# CONFIG_ADDUSER is not set +# CONFIG_GETTY is not set +# CONFIG_LOGIN is not set +# CONFIG_PASSWD is not set + +# +# Linux System Utilities +# +# CONFIG_FALLOCATE is not set +# CONFIG_FREERAMDISK is not set +# CONFIG_FSFREEZE is not set +# CONFIG_GETOPT is not set +# CONFIG_XXD is not set +# CONFIG_MESG is not set +# CONFIG_MKE2FS is not set +# CONFIG_MKDOSFS is not set +# CONFIG_FEATURE_MOUNT_CIFS is not set +# CONFIG_FEATURE_MOUNT_FSTAB is not set +# CONFIG_FEATURE_MOUNT_OTHERTAB is not set +# CONFIG_NOLOGIN is not set +# CONFIG_LINUX32 is not set +# CONFIG_LINUX64 is not set +# CONFIG_SETPRIV is not set + +# +# Common options for mount/umount +# +# CONFIG_FEATURE_MOUNT_LOOP is not set +# CONFIG_FEATURE_MOUNT_LOOP_CREATE is not set + +# +# Miscellaneous Utilities +# +# CONFIG_BC is not set +# CONFIG_HEXEDIT is not set +# CONFIG_I2CTRANSFER is not set +# CONFIG_LSSCSI is not set +# CONFIG_MIM is not set +# CONFIG_PARTPROBE is not set +# CONFIG_SETFATTR is not set +# CONFIG_SETSERIAL is not set +# CONFIG_TS is not set + +# +# Networking Utilities +# +# CONFIG_HOSTNAME is not set +# CONFIG_DNSDOMAINNAME is not set +# CONFIG_IFCONFIG is not set +# CONFIG_IFUP is not set +# CONFIG_IFDOWN is not set +# CONFIG_IP is not set +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_NC is not set +# CONFIG_NETSTAT is not set +# CONFIG_PING is not set +# CONFIG_ROUTE is not set +# CONFIG_TC is not set +# CONFIG_TELNET is not set +# CONFIG_WGET is not set +# CONFIG_UDHCPC is not set + +# +# Process Utilities +# +# CONFIG_KILLALL is not set +# CONFIG_KILLALL5 is not set + +# +# Runit Utilities +# +# CONFIG_SVC is not set +# CONFIG_SVOK is not set + +# +# Shells +# +CONFIG_BASH_IS_HUSH=y +# CONFIG_BASH_IS_NONE is not set +# CONFIG_HUSH_SAVEHISTORY is not set + +# +# Options common to all shells +# +# CONFIG_FEATURE_SH_READ_FRAC is not set +# CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS is not set diff --git a/board/canaan/k210-soc/genimage.cfg b/board/canaan/k210-soc/genimage.cfg new file mode 100644 index 0000000000..da7d5dbafb --- /dev/null +++ b/board/canaan/k210-soc/genimage.cfg @@ -0,0 +1,30 @@ +image boot.vfat { + vfat { + file uImage { + image = "uImage" + } + + file k210.dtb { + image = "k210.dtb" + } + } + size = 4M +} + +image sdcard.img { + hdimage { + } + + partition boot { + partition-type = 0xC + image = "boot.vfat" + bootable = "true" + offset = 4M + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 64M + } +} diff --git a/board/canaan/k210-soc/linux-sdcard.config b/board/canaan/k210-soc/linux-sdcard.config new file mode 100644 index 0000000000..4b0ead78a7 --- /dev/null +++ b/board/canaan/k210-soc/linux-sdcard.config @@ -0,0 +1,4 @@ +CONFIG_BUILTIN_DTB=n +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=n +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="" +CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro" diff --git a/board/canaan/k210-soc/post-build.sh b/board/canaan/k210-soc/post-build.sh new file mode 100755 index 0000000000..5b6f56a2c5 --- /dev/null +++ b/board/canaan/k210-soc/post-build.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +MKIMAGE=${HOST_DIR}/bin/mkimage + +# Generate u-Boot kernel image +${MKIMAGE} -A riscv -O linux -T kernel -C none \ + -a 0x80000000 -e 0x80000000 \ + -n Linux -d ${BINARIES_DIR}/loader.bin ${BINARIES_DIR}/uImage + +# Link the kernel-built board dtb file to using the k210.dtb generic +# name for use by genimage.cfg +BOARDDTBKPATH="$(grep BR2_LINUX_KERNEL_INTREE_DTS_NAME ${BR2_CONFIG} | cut -d'=' -f2 | tr -d \")" + +BOARDDTB="$(basename ${BOARDDTBKPATH})" +if [ -z "${BOARDDTB}" ]; then + echo "Board DTB file not specified" + exit 1 +fi + +BOARDDTB="${BINARIES_DIR}/${BOARDDTB}.dtb" +if [ ! -f "${BOARDDTB}" ]; then + echo "Board DTB file not found in ${BINARIES_DIR}" + exit 1 +fi + +TARGETDTB=${BINARIES_DIR}/k210.dtb +rm -f ${TARGETDTB} +ln -s ${BOARDDTB} ${TARGETDTB} diff --git a/board/canaan/k210-soc/rootfs_overlay/init b/board/canaan/k210-soc/rootfs_overlay/init new file mode 120000 index 0000000000..a0b71977c0 --- /dev/null +++ b/board/canaan/k210-soc/rootfs_overlay/init @@ -0,0 +1 @@ +/sbin/init \ No newline at end of file diff --git a/board/canaan/k210-soc/rootfs_overlay/sbin/init b/board/canaan/k210-soc/rootfs_overlay/sbin/init new file mode 100755 index 0000000000..d4bf53d452 --- /dev/null +++ b/board/canaan/k210-soc/rootfs_overlay/sbin/init @@ -0,0 +1,41 @@ +#!/bin/sh + +# This script replaces the default busybox init process to avoid having that +# process staying alive and sleeping in the background, (uselessly) consuming +# precious memory. + +# Mount procfs and sysfs +/bin/mount -t proc proc /proc +/bin/mount -t sysfs sysfs /sys + +# When the kernel is directly booted, devtmpfs is not automatically mounted. +# Manually mount it if needed. +devmnt=$(mount | grep -c devtmpfs) +if [ ${devmnt} -eq 0 ]; then + /bin/mount -t devtmpfs devtmpfs /dev +fi + +# Use the /dev/console device node from devtmpfs if possible to not +# confuse glibc's ttyname_r(). +# This may fail (E.G. booted with console=), and errors from exec will +# terminate the shell, so use a subshell for the test +if (exec 0/dev/null; then + exec 0/dev/console + exec 2>/dev/console +fi + +# Clear memory to reduce page fragmentation +echo 3 > /proc/sys/vm/drop_caches + +# Print a fun logo :) +echo " __ _" +echo " / / (_) ____ _ _ __ __" +echo " / / | || _ \\ | | | |\\ \\/ /" +echo " / /___| || | | || |_| | > < " +echo " /_____/|_||_| |_| \\____|/_/\\_\\" +echo " 64-bits RISC-V Kendryte K210 NOMMU" +echo "" + +# Finally, let's start an interactive shell +exec /bin/sh diff --git a/board/canaan/k210-soc/uboot.config b/board/canaan/k210-soc/uboot.config new file mode 100644 index 0000000000..159085f802 --- /dev/null +++ b/board/canaan/k210-soc/uboot.config @@ -0,0 +1 @@ +# CONFIG_WATCHDOG_AUTOSTART is not set From patchwork Tue May 31 05:49:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637205 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=N0EJL2nv; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=kZZuU2bB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1b1116wz9s1l for ; Tue, 31 May 2022 15:50:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 60C9F60F84; Tue, 31 May 2022 05:50:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9X8LNrJcKP0p; Tue, 31 May 2022 05:50:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 688856125D; Tue, 31 May 2022 05:50:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 996971BF375 for ; Tue, 31 May 2022 05:49:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8190C61110 for ; Tue, 31 May 2022 05:49:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mr9IZYhowrYR for ; Tue, 31 May 2022 05:49:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id EB73860B9D for ; Tue, 31 May 2022 05:49:35 +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=1653976175; x=1685512175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WlzPnE6+PjfWrImw0aD7rTvKdMdVVqUpQT5rQ9vy+RE=; b=N0EJL2nv0hfAxaRWY5vD+y2dWNt0lPu6tsIyNvpOW3KOq1RvWZYqky7G VrP7yq0Yt8RR35RTLljmpnuubDWyYPdmADDR+uDPlyE8usvzI7fTArmt1 2UPvpEf3XGDHE9bAGwzgmNC4IfAk+URlwb2lwrqWArvfRjLBBLhwLtll1 cLVJj+G3AMrvdeSwMIjUN8fjf6EXilMKr1mN2zEoUy9a4/sJfmfyyY/Rv J/eeNnCtLEED+UOiEN4iU+eo4gcCAbf1FcN5BXHBQN67st0RwDmNMmZsi WfahC2AR4Iax+1j7BHPo7TJxvEikTPtrJQMyvWTwtQr176Y5Pzipe4Swm A==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095081" 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; 31 May 2022 13:49:35 +0800 IronPort-SDR: KAeLkZdjksVQZisPz4kp/gqPAePmXR5nuWWe+F+SY/A4G5m+6mueX0d473Q/qRvf+UHQym6Xjh NV6/YQ53MuT81NrD9vPRTYCJmrd9Rqy1FWaM0H3GIstaSLvWy1DbA/Z1oGsWgdzm5yfFXGeHSb +p5G15zPw6Nhg5WQWenzWs2Ljhpi2OAhj8UxUAPBC6TpJrYPHqS2GyPaA7EB3oFCGd3Uy727eu cTSy/L1rwcMcnaWMp48tkCEt0h6QmUybJvvX1kR5d7VWxKjwLpmx+XoBmenFThERtHtHAk/aD0 5GxS/R39nG2/11mTlMUwnC5x Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:21 -0700 IronPort-SDR: PXZDZxpYFZ4bLQ+p98MSS/gNR1f5a7s5MZ6r7BAzgP2W+TKfej+8PFj8JbiuT8s/V4S6xAAUGq QJXTftVTeDOw0Hdy7uc3G93t6GEUbkvPNTbIV6HGBIb0Uffn2SoI9uRmHjIbarWQwkOWGRsLPl Frpj1mEBHMvLi62hZZNzYbzof6tRgyQQbPJrMP4SOKHm2T/B424+WGO5AV8ENZgd44ugUKW9wI e5aG36XnL6xy3pDHMSXXcl4yp65jC7hTqiFXPZrV98n4q1kmmjx06tSkx1CnIC8ZOeLXHeSzi/ a5s= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:36 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1Z66F7Fz1SHwl for ; Mon, 30 May 2022 22:49:34 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976173; x=1656568174; bh=WlzPnE6+PjfWrImw0a D7rTvKdMdVVqUpQT5rQ9vy+RE=; b=kZZuU2bBE6O0K80x0vJ0WPDylNTrXQH3/c ncjPQBlrYHk+7e4Yxm/zAESiJw1xaVBaZdvX+y9DGsiTTx33QYXN+aajhOqEzZDm Mb3vXTtbACjkzKevYtgER1a9SoTAOjM418GKvOim8EajNqua2oU5IEn0D4Qmm9jZ 7Z9y7M+ElnzU4aqOf6Ckag+2kBEC2i44HO51eqr6Darhk0Ag/NgopXw+Mvh+j6MP jVg+CTm098/ycVIsT3OBDDOp8hsMKF7oDnXz5+MTAmAh0nSce8sWWzvSDC6YLUd+ jtrNT2rEWf5codnGbJe2yLoIjl8GU/H6i8P1z1VCN4tP+Z66WYCA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id B4fuuQEGZNND for ; Mon, 30 May 2022 22:49:33 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z43zM6z1Rvlx; Mon, 30 May 2022 22:49:32 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:22 +0900 Message-Id: <20220531054926.373713-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 3/7] board: Add Sipeed MAIX-Bit board support X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add two buildroot configuration files to build a minimal Linux environment for the Sipeed MAIX Bit board. The configurations are: * sipeed_maix_bit_defconfig: Build a bootable kernel image with an embedded initramfs root file system. The image built can be flashed to the board as is and does not require a boot loader. This configuration uses the tiny busybox configuration defined in board/canaan/k210-soc/busybox-tiny.config. * sipeed_maix_bit_sdcard_defconfig: Build a kernel image with a root file system on the SD card and using U-Boot as the boot loader. This uses the default busybox minimal configuration. Both configurations also enable the python-kflash and pyserial-miniterm host tools for flashing image files to the board and opening a terminal console. The readme.txt file documents how to build and boot the Sipeed MAIX-Bit board with these configurations. Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal --- DEVELOPERS | 3 + board/sipeed/maix-bit/linux-cpio.config | 2 + board/sipeed/maix-bit/readme.txt | 316 +++++++++++++++++++++++ configs/sipeed_maix_bit_defconfig | 39 +++ configs/sipeed_maix_bit_sdcard_defconfig | 57 ++++ 5 files changed, 417 insertions(+) create mode 100644 board/sipeed/maix-bit/linux-cpio.config create mode 100644 board/sipeed/maix-bit/readme.txt create mode 100644 configs/sipeed_maix_bit_defconfig create mode 100644 configs/sipeed_maix_bit_sdcard_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 972c5de380..3a5671e45b 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -633,6 +633,9 @@ F: package/log4cpp/ N: Damien Le Moal F: package/python-kflash/ F: board/canaan/ +F: board/sipeed/ +F: configs/sipeed_maix_bit_defconfig +F: configs/sipeed_maix_bit_sdcard_defconfig N: Daniel Nicoletti F: package/cutelyst/ diff --git a/board/sipeed/maix-bit/linux-cpio.config b/board/sipeed/maix-bit/linux-cpio.config new file mode 100644 index 0000000000..de2f8fd074 --- /dev/null +++ b/board/sipeed/maix-bit/linux-cpio.config @@ -0,0 +1,2 @@ +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_bit" diff --git a/board/sipeed/maix-bit/readme.txt b/board/sipeed/maix-bit/readme.txt new file mode 100644 index 0000000000..7cc53bca67 --- /dev/null +++ b/board/sipeed/maix-bit/readme.txt @@ -0,0 +1,316 @@ +Sipeed MAIX-Bit Board +===================== + +The Sipeed MAXI-Bit board is a dual-core RISC-V 64-bits board based on the +Canaan Kendryte K210 SoC. + +Prerequisite +------------ + +In order to use the kflash utility to program this board, the user must have +access to the board USB serial device file. The simplest way to do this is to +add your user to the same group as this device file. Assume the device file is +/dev/ttyUSB0, first identify the device group name. In most cases, it is +either "dialout" or "uucp". Also verify that read-write access is enabled for +the group: + +``` +$ ls -l /dev/ttyUSB0 +crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0 +``` + +Then add yourself to that group (dialout in this example): + +``` +$ sudo usermod -a -G dialout $(whoami) +``` + +To enable the above, it is sometimes necessary to logout and login again. + +Buildroot Configuration +----------------------- + +Two buildroot configuration files are provided: + +(1) Direct Linux Kernel Boot + +This is defined by the sipeed_maix_bit_defconfig configuration. This +configuration allows building a bootable kernel image with a built-in initramfs +root file system (the board SD card is not used). The built kernel image can be +flashed directly to the board ROM for direct booting. No boot loader is +required. + +(2) U-Boot SD-Card Boot + +The sipeed_maix_bit_sdcard_defconfig configuration allows building a kernel +image with the root file system on the board SD card. U-Boot is used as the +boot loader. + +Both configuration files will also compile and install the kflash and +pyserial-miniterm host utilities to program bootable image files to the board +and open a serial terminal console. + +Direct Linux Kernel Boot +------------------------- + +Using the sipeed_maix_bit_defconfig configuration, the bootable kernel binary +image is built as follows. + +``` +$ make sipeed_maix_bit_defconfig +$ make +``` + +The bootable binary image is the output/images/loader.bin file. This image file +can be written to the board boot ROM using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin +``` + +Once the kernel image file is fully programmed, a terminal console is open and +the board can be rebooted by pressing the reset button on the board (if it does +not reboot automatically). + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 14:30:02 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX BiT +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 5996K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 530K init, 66K bss, 2196K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008188] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018250] pid_max: default: 4096 minimum: 301 +[ 0.022860] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029972] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040244] rcu: Hierarchical SRCU implementation. +[ 0.045121] smp: Bringing up secondary CPUs ... +[ 0.050225] smp: Brought up 1 node, 2 CPUs +[ 0.054355] devtmpfs: initialized +[ 0.071168] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.080240] pinctrl core: initialized pinctrl subsystem +[ 0.119221] clocksource: Switched to clocksource clint_clocksource +[ 0.131498] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.176943] k210-sysctl 50440000.syscon: K210 system controller +[ 0.193558] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.201526] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.211611] i2c_dev: i2c /dev entries driver +[ 0.221375] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.233591] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.242529] printk: console [ttySIF0] enabled +[ 0.242529] printk: console [ttySIF0] enabled +[ 0.251165] printk: bootconsole [sifive0] disabled +[ 0.251165] printk: bootconsole [sifive0] disabled +[ 0.274348] Freeing unused kernel image (initmem) memory: 524K +[ 0.279504] This architecture does not have kernel memory protection. +[ 0.285908] Run /init as init process + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +To open a terminal console without re-flashing the board, the pyserial-miniterm +host tool can be used. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` + +The options "--raw" and "--eol=LF" are added here to avoid a double carriage +return each time a command is entered. + + +U-Boot SD-Card Boot +------------------- + +The build procedure is similar to the direct Linux kernel boot case. + +``` +$ make sipeed_maix_bit_sdcard_defconfig +$ make +``` + +The build process will generate two files under the output/images directory. + +* sdcard.img: The image file for the SD card filesystem. This image has 2 + partitions. The first partition is a vfat partition containing the kernel + uImage and the board device tree binary. The second partition is the root + filesystem with busybox installed. The second partition is formatted using + ext2 (rev1). + +* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD + card. + +The SD card can be prepared by writing the sdcard.img file, as follows. + +``` +$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M +$ sync +$ eject /dev/sdX +``` + +Where /dev/sdX is the device file name of the SD card. Once completed, the SD +card can be inserted into the board and the U-Boot binary image written to the +board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin +``` + +The above command will program U-Boot image to the board boot ROM and open a +terminal console once the u-boot.bin file is fully programmed. Reboot into the +newly programmed environment by pressing the board reset button. + +The output will be similar to the following. + +``` +U-Boot 2022.04 (May 24 2022 - 17:08:34 +0900) + +DRAM: 8 MiB +Core: 34 devices, 17 uclasses, devicetree: separate +WDT: Not starting watchdog@50400000 +MMC: spi@53000000:slot@0: 0 +Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB +*** Warning - bad CRC, using default environment + +In: serial@38000000 +Out: serial@38000000 +Err: serial@38000000 +Hit any key to stop autoboot: 0 +1668562 bytes read in 933 ms (1.7 MiB/s) +10468 bytes read in 11 ms (928.7 KiB/s) +## Booting kernel from Legacy Image at 80060000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 1668498 Bytes = 1.6 MiB + Load Address: 80000000 + Entry Point: 80000000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 80400000 + Booting using the fdt blob at 0x80400000 + Loading Kernel Image + Loading Device Tree to 00000000803fa000, end 00000000803ff8e3 ... OK + +Starting kernel ... + +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-1056-gc356b62332) 10.3.0, GNU ld (GNU Binutils) 2.37) #1 SMP Tue May 24 06:45:04 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX BiT +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: base ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15648 r0 d29408 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 6204K/8192K available (1134K kernel code, 150K rwdata, 239K rodata, 100K init, 68K bss, 1988K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008194] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018257] pid_max: default: 4096 minimum: 301 +[ 0.022869] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029982] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040424] rcu: Hierarchical SRCU implementation. +[ 0.045397] smp: Bringing up secondary CPUs ... +[ 0.050518] smp: Brought up 1 node, 2 CPUs +[ 0.054676] devtmpfs: initialized +[ 0.072365] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.081396] pinctrl core: initialized pinctrl subsystem +[ 0.123762] clocksource: Switched to clocksource clint_clocksource +[ 0.136796] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.181768] k210-sysctl 50440000.syscon: K210 system controller +[ 0.198397] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.207373] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.218270] spi spi1.0: setup: ignoring unsupported mode bits a00 +[ 0.224786] i2c_dev: i2c /dev entries driver +[ 0.235984] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.249172] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.258078] printk: console [ttySIF0] enabled +[ 0.258078] printk: console [ttySIF0] enabled +[ 0.266707] printk: bootconsole [sifive0] disabled +[ 0.266707] printk: bootconsole [sifive0] disabled +[ 0.307910] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling +[ 0.319869] Waiting for root device /dev/mmcblk0p2... +[ 0.345016] mmc0: host does not support reading read-only switch, assuming write-enable +[ 0.352330] mmc0: new SDHC card on SPI +[ 0.359338] mmcblk0: mmc0:0000 SA16G 14.5 GiB +[ 0.367589] random: fast init done +[ 0.371533] mmcblk0: p1 p2 +[ 0.391794] random: get_random_bytes called from 0x0000000080095ae8 with crng_init=1 +[ 0.393388] VFS: Mounted root (ext2 filesystem) readonly on device 179:2. +[ 0.411377] devtmpfs: mounted +[ 0.413922] Freeing unused kernel image (initmem) memory: 96K +[ 0.419344] This architecture does not have kernel memory protection. +[ 0.425777] Run /sbin/init as init process +[ 0.718314] random: crng init done +[ 0.799903] init (1): drop_caches: 3 + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +Of note is that the kernel mounts the SD card as read-only by default to avoid +corruptions of the ext2 root file system when the board is powered down. This +is recommended as this board does not support clean shutdown or halt. + +Similarly to the initramfs build case, a console can be open without +re-flashing the board using the host tool pyserial-miniterm. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` diff --git a/configs/sipeed_maix_bit_defconfig b/configs/sipeed_maix_bit_defconfig new file mode 100644 index 0000000000..dbc5af4e74 --- /dev/null +++ b/configs/sipeed_maix_bit_defconfig @@ -0,0 +1,39 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# Binary format +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sipeed/maix-bit/linux-cpio.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" + +# Packages +BR2_PACKAGE_HOST_PYTHON_KFLASH=y +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_bit_sdcard_defconfig b/configs/sipeed_maix_bit_sdcard_defconfig new file mode 100644 index 0000000000..9f1c3a305f --- /dev/null +++ b/configs/sipeed_maix_bit_sdcard_defconfig @@ -0,0 +1,57 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# System +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210_sdcard" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/linux-sdcard.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_bit" + +# Packages +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE=64M +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" + +# Bootloader and related host tools +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sipeed_maix_bitm" +BR2_TARGET_UBOOT_FORMAT_BIN=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_PYTHON_KFLASH=y From patchwork Tue May 31 05:49:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637206 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=QOmG3dzc; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=Jse0s5PH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1bJ0VXwz9s1l for ; Tue, 31 May 2022 15:50:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 0073040491; Tue, 31 May 2022 05:50:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2-B5FW8nM2oO; Tue, 31 May 2022 05:50:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id C090F40232; Tue, 31 May 2022 05:50:29 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 726BA1BF375 for ; Tue, 31 May 2022 05:49:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6E56161110 for ; Tue, 31 May 2022 05:49:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="QOmG3dzc"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="Jse0s5PH" Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HS6B4nnRqsTu for ; Tue, 31 May 2022 05:49:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id DA33960BF0 for ; Tue, 31 May 2022 05:49:36 +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=1653976176; x=1685512176; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=URR34Sq/O0xxE8zczvD+eCxT+51wqpd+mif22AgPEPM=; b=QOmG3dzcrGQ9kokWBfgXzec+tKFFZUfDgeHtO7Vllv+NBEn/oHDyfwU4 4gE1I7Ig11clxEDMY2vYFI8ig8T8xoz716FY6SIIPybTwiVZLEcoFHK+Z kHFephJlcly2Qg25aWqmk7hi6rokfvJIlDP8GWAr20KK5l2Vrt0RwftL8 HxTFlWTlH/IPXDd30sPQpTrOdiEeXfAEmlwodkpGbb4izBRbLf2kvFt9t YaxaOWIaDFDVN917x/4xMpW9Md8nDI8w4v4TwqbUHnOCJJk1G4ffM1vgq sIPBeeUfkyYX6apWcbbk/uTpOZqS8BLI0oge7wN5ManPKYzdnxTgskyw4 A==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095088" 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; 31 May 2022 13:49:36 +0800 IronPort-SDR: IZDvO06lk0imWwP1kcal0RyE+rUpLgsqFCRORxCE/q2bbvc2Fq9JIe0dh+4SskdP+lXFGwJSIg 3Gpks+VaEZiez1O7yAMPIFZv65T2REaYe/syUf0k4wZiYLPelzX2bfOBtNCs9ntUMdOv+Pv2xn tIEg3ysjrN5iiDH0Uvm0me/e3tzDaRnq9TpTmvfPFbXOxGVOXhJduaIDEzU2pr5dFvtVzrn9mo vDn0yppdwsxyKhZj7K0HuxwE5OALQGyNv/QCzASdcmyZNVNALW7L3gaS8YHvvy/9mdXTx92jqd o6MJajnvwsGV+8Ilb3Z/F5qe Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:22 -0700 IronPort-SDR: Gd+KRwhhqUKex3xm1wcHVN7cyUJPTLflyjuWEgPh8jquojlQrgsjSaZI6BEdvPf4Ldfuos/Fqg yOUWUxEeJ4rbyG5rShSgVZxKX06cGhk+VKLRjhmejwJATui7Mts1NVJvewRAGhLgO4aOrYu2r/ E9WkBz/pOk8fonWIWUGzFhkY56GXzvRCYI9AY3xnJmsbI816wNw+STlYO7getjeC/Ry4cMNlb+ miErPGb+qyUQ+7Jnwi6+3B6diBu/DS5AS4IjMGSGwE4sxmJXFMaxGgcaSbfvLGuXCII9BhTbFl azE= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:37 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1Z82pMqz1SHwl for ; Mon, 30 May 2022 22:49:36 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976174; x=1656568175; bh=URR34Sq/O0xxE8zczv D+eCxT+51wqpd+mif22AgPEPM=; b=Jse0s5PH+4XlNICKnaytZKMNyZB2EMpp7/ gT1HXqSlyXvU3gE9/DghioWg9J7Uzq+IvsyXeUqxNEK0Kxjyy05W4M+yON/tRm1Z Abvh6yqaDq+NsM26cnKcQrsx/+emKJ5opPRE9/yreuOLpKvH6eqf1Kq9jePnfqLf 9cUm0yfh1rVYy2TdakCeskq1j1LLBSa5Zx5kjZvIC4Ye9sJe8ZPkARmwP0ZI7hQx ki0R+3BNQ4OKvq11PSHxim+dIKrpHGFatJKDkST4C70qKjB6jM+He50xd4jOrMRS P268WGKbIUsdF7pE1m6jOOftH/aL9d+mBWryTJGa7n8gHRuP4BVA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id S1vsTR1kmIBt for ; Mon, 30 May 2022 22:49:34 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z56RNLz1Rvlc; Mon, 30 May 2022 22:49:33 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:23 +0900 Message-Id: <20220531054926.373713-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 4/7] board: Add Sipeed MAIXDUINO board support X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add two buildroot configuration files to build a minimal Linux environment for the Sipeed MAIXDUINO board. The configurations are: * sipeed_maixduino_defconfig: Build a bootable kernel image with an embedded initramfs root file system. The image built can be flashed to the board as is and does not require a boot loader. This configuration uses the tiny busybox configuration defined in board/canaan/k210-soc/busybox-tiny.config. * sipeed_maixduino_sdcard_defconfig: Build a kernel image with a root file system on the SD card and using U-Boot as the boot loader. This uses the default busybox minimal configuration. Both configurations also enable the kflash and pyserial-miniterm host tools for flashing image files to the board and opening a terminal console. The readme.txt file documents how to build and boot the Sipeed MAIXDUINO board with these configurations. Signed-off-by: Damien Le Moal --- DEVELOPERS | 2 + board/sipeed/maixduino/linux-cpio.config | 2 + board/sipeed/maixduino/readme.txt | 292 ++++++++++++++++++++++ configs/sipeed_maixduino_defconfig | 39 +++ configs/sipeed_maixduino_sdcard_defconfig | 57 +++++ 5 files changed, 392 insertions(+) create mode 100644 board/sipeed/maixduino/linux-cpio.config create mode 100644 board/sipeed/maixduino/readme.txt create mode 100644 configs/sipeed_maixduino_defconfig create mode 100644 configs/sipeed_maixduino_sdcard_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 3a5671e45b..802e5cdbcb 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -636,6 +636,8 @@ F: board/canaan/ F: board/sipeed/ F: configs/sipeed_maix_bit_defconfig F: configs/sipeed_maix_bit_sdcard_defconfig +F: configs/sipeed_maixduino_defconfig +F: configs/sipeed_maixduino_sdcard_defconfig N: Daniel Nicoletti F: package/cutelyst/ diff --git a/board/sipeed/maixduino/linux-cpio.config b/board/sipeed/maixduino/linux-cpio.config new file mode 100644 index 0000000000..049a2550c5 --- /dev/null +++ b/board/sipeed/maixduino/linux-cpio.config @@ -0,0 +1,2 @@ +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maixduino" diff --git a/board/sipeed/maixduino/readme.txt b/board/sipeed/maixduino/readme.txt new file mode 100644 index 0000000000..53a9e5c2ac --- /dev/null +++ b/board/sipeed/maixduino/readme.txt @@ -0,0 +1,292 @@ +Sipeed MAIXDUINO Board +====================== + +The Sipeed MAIXDUINO board is a dual-core RISC-V 64-bits board based on the +Canaan Kendryte K210 SoC. This board has the same form factor as the Arduino +UNO board. + +Prerequisite +------------ + +In order to use the kflash utility to program this board, the user must have +access to the board USB serial device file. The simplest way to do this is to +add your user to the same group as this device file. Assume the device file is +/dev/ttyUSB0, first identify the device group name. In most cases, it is +either "dialout" or "uucp". Also verify that read-write access is enabled for +the group: + +``` +$ ls -l /dev/ttyUSB0 +crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0 +``` + +Then add yourself to that group (dialout in this example): + +``` +$ sudo usermod -a -G dialout $(whoami) +``` + +To enable the above, it is sometimes necessary to logout and login again. + +Buildroot Configuration +----------------------- + +Two buildroot configurations are provided: + +(1) Direct Linux Kernel Boot + +This is defined by the sipeed_maixduino_defconfig configuration. This +configuration allows building a bootable kernel image with a built-in initramfs +root file system (the board SD card is not used). The built kernel image can be +flashed directly to the board ROM for direct booting. No boot loader is +required. + +(2) U-Boot SD-Card Boot + +The sipeed_maixduino_sdcard_defconfig configuration allows building a kernel +image with the root file system on the board SD card. U-Boot is used as the +boot loader. + +Note: U-Boot does not natively support the Sipeed MAIXDUINO board. However, the +board and device tree differences with the Sipeed MAIX-bit board are small +enough for U-Boot to work. + +Both configuration files will also compile and install the kflash and +pyserial-miniterm host utilities to program bootable image files to the board +and open a serial terminal console. + +Direct Linux Kernel Boot +------------------------ + +Using the sipeed_maixduino_defconfig configuration, the bootable kernel binary +image is built as follows. + +``` +$ make sipeed_maixduino_defconfig +$ make +``` + +The bootable binary image is the output/images/loader.bin file. This image file +can be written to the board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin +``` + +Once the kernel image file is fully programmed, a terminal console is open and +the board can be rebooted by pressing the reset button on the board (if it does +not reboot automatically). + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 15:16:00 JST 2022 +[ 0.000000] Machine model: SiPeed MAIXDUINO +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 6000K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 530K init, 66K bss, 2192K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008183] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018249] pid_max: default: 4096 minimum: 301 +[ 0.022860] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040242] rcu: Hierarchical SRCU implementation. +[ 0.045124] smp: Bringing up secondary CPUs ... +[ 0.050217] smp: Brought up 1 node, 2 CPUs +[ 0.054346] devtmpfs: initialized +[ 0.070924] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.079996] pinctrl core: initialized pinctrl subsystem +[ 0.119893] clocksource: Switched to clocksource clint_clocksource +[ 0.131992] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.179099] k210-sysctl 50440000.syscon: K210 system controller +[ 0.194904] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.203108] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.213867] i2c_dev: i2c /dev entries driver +[ 0.223397] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.235632] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.244585] printk: console [ttySIF0] enabled +[ 0.244585] printk: console [ttySIF0] enabled +[ 0.253190] printk: bootconsole [sifive0] disabled +[ 0.253190] printk: bootconsole [sifive0] disabled +[ 0.264820] panel@0 enforce active low on chipselect handle +[ 0.281482] Freeing unused kernel image (initmem) memory: 524K +[ 0.286621] This architecture does not have kernel memory protection. +[ 0.293047] Run /init as init process + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +To open a terminal console without re-flashing the board, the pyserial-miniterm +host tool can be used. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` + +The options "--raw" and "--eol=LF" are added here to avoid a double carriage +return each time a command is entered. + + +U-Boot SD-Card Boot +------------------- + +The build procedure is similar to the built-in initramfs case. + +``` +$ make sipeed_maixduino_sdcard_defconfig +$ make +``` + +The build process will generate two files under the output/images directory. + +* sdcard.img: The image file for the SD card filesystem. This image has 2 + partitions. The first partition is a vfat partition containing the kernel + uImage and the board device tree binary. The second partition is the root + filesystem with busybox installed. The second partition is formatted using + ext2 (rev1). + +* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD + card. + +The SD card can be prepared by writing the sdcard.img file, as follows. + +``` +$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M +$ sync +$ eject /dev/sdX +``` + +Where /dev/sdX is the device file name of the SD card. Once completed, the SD +card can be inserted into the board and the U-Boot binary image written to the +board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin +``` + +The above command will program U-Boot image to the board boot ROM and open a +terminal console once the u-boot.bin file is fully programmed. Reboot into the +newly programmed environment by pressing the board reset button. + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 15:30:18 JST 2022 +[ 0.000000] Machine model: SiPeed MAIXDUINO +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008191] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018255] pid_max: default: 4096 minimum: 301 +[ 0.022876] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029982] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040417] rcu: Hierarchical SRCU implementation. +[ 0.045397] smp: Bringing up secondary CPUs ... +[ 0.050513] smp: Brought up 1 node, 2 CPUs +[ 0.054680] devtmpfs: initialized +[ 0.072127] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.081205] pinctrl core: initialized pinctrl subsystem +[ 0.125074] clocksource: Switched to clocksource clint_clocksource +[ 0.138311] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.183471] k210-sysctl 50440000.syscon: K210 system controller +[ 0.199873] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.208858] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.221586] i2c_dev: i2c /dev entries driver +[ 0.232786] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.246572] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.255508] printk: console [ttySIF0] enabled +[ 0.255508] printk: console [ttySIF0] enabled +[ 0.264137] printk: bootconsole [sifive0] disabled +[ 0.264137] printk: bootconsole [sifive0] disabled +[ 0.275560] panel@0 enforce active low on chipselect handle +[ 0.313245] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling +[ 0.322845] Waiting for root device /dev/mmcblk0p2... +[ 0.345869] mmc0: host does not support reading read-only switch, assuming write-enable +[ 0.353221] mmc0: new SDHC card on SPI +[ 0.360233] mmcblk0: mmc0:0000 SA16G 14.5 GiB +[ 0.368350] random: fast init done +[ 0.372926] mmcblk0: p1 p2 +[ 0.391887] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1 +[ 0.400427] VFS: Mounted root (ext2 filesystem) readonly on device 179:2. +[ 0.410128] devtmpfs: mounted +[ 0.412628] Freeing unused kernel image (initmem) memory: 96K +[ 0.418137] This architecture does not have kernel memory protection. +[ 0.424530] Run /sbin/init as init process +[ 0.563384] random: crng init done + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +Of note is that the kernel mounts the SD card as read-only by default to avoid +corruptions of the ext2 root file system when the board is powered down. This +is recommended as this board does not support clean shutdown or halt. + +Similarly to the initramfs build case, a console can be open without +re-flashing the board using the host tool pyserial-miniterm. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` diff --git a/configs/sipeed_maixduino_defconfig b/configs/sipeed_maixduino_defconfig new file mode 100644 index 0000000000..a581ecbea5 --- /dev/null +++ b/configs/sipeed_maixduino_defconfig @@ -0,0 +1,39 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# Binary format +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sipeed/maixduino/linux-cpio.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" + +# Packages +BR2_PACKAGE_HOST_PYTHON_KFLASH=y +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maixduino_sdcard_defconfig b/configs/sipeed_maixduino_sdcard_defconfig new file mode 100644 index 0000000000..7e627e5d15 --- /dev/null +++ b/configs/sipeed_maixduino_sdcard_defconfig @@ -0,0 +1,57 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# System +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210_sdcard" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/linux-sdcard.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maixduino" + +# Packages +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE=64M +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" + +# Bootloader and related host tools +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sipeed_maix_bitm" +BR2_TARGET_UBOOT_FORMAT_BIN=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_PYTHON_KFLASH=y From patchwork Tue May 31 05:49:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637207 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=LMZG65um; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=aUuahyEG; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1bX1BLcz9s1l for ; Tue, 31 May 2022 15:50:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DD40083F00; Tue, 31 May 2022 05:50:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id spZ38TVAkxQN; Tue, 31 May 2022 05:50:44 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 1AEB784084; Tue, 31 May 2022 05:50:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id AF6D11BF375 for ; Tue, 31 May 2022 05:49:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9A5F260F84 for ; Tue, 31 May 2022 05:49:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="LMZG65um"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="aUuahyEG" Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 05f3uBxev2GX for ; Tue, 31 May 2022 05:49:39 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0A1DE60BF0 for ; Tue, 31 May 2022 05:49:39 +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=1653976178; x=1685512178; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V3MnWha2vcWEc6LItmDFXGAfgaSjukgXKQ3wi+zsXTk=; b=LMZG65um6rhpg9Sr8PE1bsB9AFsbxlPhBQQ82jm4+goFyVe+1O4gPcU4 vKdnNsx0FhWa682OoOs1ZOj7n7txswyzYUpuhQ6OEt9anE3LSEFq4dWHE JzZSDt5sIlt21Jb3LiB1cPsTjWE6nc3vYlRVCRUZsftXNYdWtCRDuHizZ HrLJe3nh9eb/YFTasJXKPL28GNL/vAI9kZg/XS6zskUvND1vqWfCWtWga 94GSc9eicVtpV73CCvdWOo/i9QgGSL0p6D4dfwd53/44857fhRU0EYCAM RYzvFrlxVKJfosGhaHX/YS5Oy5xrH7iv/0KUqhq5VXCeJdEksxujX+nY7 A==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095091" 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; 31 May 2022 13:49:38 +0800 IronPort-SDR: 5UfzJ9ix7eJJu1NqOYIaNGt407FNjhfmOCyfdGGvhiJlGMHujciHPgAxOHwHsXALeCex3dWtfX CYDRRrQlzJQmeRZ4fU1ghyTioZH8pmLkAloQ+/21Pj1BlE88ZFeZ66ndvSGWFCqy4CaSxn//OH vW1FNekmha1s4VJUOPo/Bi10Egtam516teY6bHskhQdbqOLo/aHINYgwC+XgvRkdd1PZqlytlD AmCcWwuPgO9ymQjQXhSd9vbW1l0Q31aOEFvDgr2p7Dc6Co7brjIzu3u+lcTM4HWsAarbuIJ0Qy PoeO2Z5lMVp8zgdlQT0tanFg Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:25 -0700 IronPort-SDR: akzIHCuJbPUmGZwNNBC/rawBOK4UKdmSLfGCpxFZLosLr4eTNLyLmv/nNAadzu0NzWuNCuyxKH gC4pW+oc65Lu6gJ1j6ujLYxpattBAj5XBOn1VoxSeuV5B4EOwCgeoqRTfK5MIbmhk13/tuSv8J LvI35niDBudXvfCkCKZr0rRcwQXRkiM84V7f8gxadn+W3ye5cTRrakTUmWfdip1YfFPAovV6d5 VG+0opL99pZlpRmMYBFbmsgja0OxFH6kBdehessb4V6DO1us/Ga2vyPZOFBnsOCq6x4JJ/9PkB 6eM= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:39 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1ZB28VGz1SVp0 for ; Mon, 30 May 2022 22:49:38 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976176; x=1656568177; bh=V3MnWha2vcWEc6LItm DFXGAfgaSjukgXKQ3wi+zsXTk=; b=aUuahyEG8yQEsAdZEJ8BQMjZZ59XWFts73 J6kKmofoypsr3iVucBE/s6xE8imE1GLXI6Bm3p9suadNSvg/gYtlEwssWRzPmtm3 En4HurkVTM6/WEC3RWDlvn+U86D4Dec47EqHrcxIDgPWcsZPjVgKrdWitQ+maCgM xNvWikdeKk8xyVLhV6IwMyP2Z7TqIaVODeklo53zC5RvQiLq8DN35exa0cpOXh13 ZEYLEw3qSDrlbvDGOMLnOiAJuNvrEaAEasCyTKDBhnzuuW1axGGBxWG4HUeyC4t+ /0VQHQ9IoDU9tGnMkz/tAo9yx1xDAXP5GHf4kCvUfs/YCAzyP+Fg== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Tm1DLVudENGQ for ; Mon, 30 May 2022 22:49:36 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z7249tz1Rwrw; Mon, 30 May 2022 22:49:35 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:24 +0900 Message-Id: <20220531054926.373713-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 5/7] board: Add Sipeed MAIX-Dock board support X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add two buildroot configuration files to build a minimal Linux environment for the Sipeed MAIX-Dock board. The configurations are: * sipeed_maix_dock_defconfig: Build a bootable kernel image with an embedded initramfs root file system. The image built can be flashed to the board as is and does not require a boot loader. This configuration uses the tiny busybox configuration defined in board/canaan/k210-soc/busybox-tiny.config. * sipeed_maix_dock_sdcard_defconfig: Build a kernel image with a root file system on the SD card and using U-Boot as the boot loader. This uses the default busybox minimal configuration. Both configurations also enable the kflash and pyserial-miniterm host tools for flashing image files to the board and opening a terminal console. The readme.txt file documents how to build and boot the Sipeed MAIX-Dock board with these configurations. Signed-off-by: Damien Le Moal --- DEVELOPERS | 2 + board/sipeed/maix-dock/linux-cpio.config | 2 + board/sipeed/maix-dock/readme.txt | 321 ++++++++++++++++++++++ configs/sipeed_maix_dock_defconfig | 39 +++ configs/sipeed_maix_dock_sdcard_defconfig | 57 ++++ 5 files changed, 421 insertions(+) create mode 100644 board/sipeed/maix-dock/linux-cpio.config create mode 100644 board/sipeed/maix-dock/readme.txt create mode 100644 configs/sipeed_maix_dock_defconfig create mode 100644 configs/sipeed_maix_dock_sdcard_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 802e5cdbcb..4a25418695 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -638,6 +638,8 @@ F: configs/sipeed_maix_bit_defconfig F: configs/sipeed_maix_bit_sdcard_defconfig F: configs/sipeed_maixduino_defconfig F: configs/sipeed_maixduino_sdcard_defconfig +F: configs/sipeed_maix_dock_defconfig +F: configs/sipeed_maix_dock_sdcard_defconfig N: Daniel Nicoletti F: package/cutelyst/ diff --git a/board/sipeed/maix-dock/linux-cpio.config b/board/sipeed/maix-dock/linux-cpio.config new file mode 100644 index 0000000000..b1ca3166f8 --- /dev/null +++ b/board/sipeed/maix-dock/linux-cpio.config @@ -0,0 +1,2 @@ +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_dock" diff --git a/board/sipeed/maix-dock/readme.txt b/board/sipeed/maix-dock/readme.txt new file mode 100644 index 0000000000..5971f6e50b --- /dev/null +++ b/board/sipeed/maix-dock/readme.txt @@ -0,0 +1,321 @@ +Sipeed MAIX-Dock Board +====================== + +The Sipeed MAXI-Dock board is a dual-core RISC-V 64-bits board based on the +Canaan Kendryte K210 SoC. + +Prerequisite +------------ + +In order to use the kflash utility to program this board, the user must have +access to the board USB serial device file. The simplest way to do this is to +add your user to the same group as this device file. Assume the device file is +/dev/ttyUSB0, first identify the device group name. In most cases, it is +either "dialout" or "uucp". Also verify that read-write access is enabled for +the group: + +``` +$ ls -l /dev/ttyUSB0 +crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0 +``` + +Then add yourself to that group (dialout in this example): + +``` +$ sudo usermod -a -G dialout $(whoami) +``` + +To enable the above, it is sometimes necessary to logout and login again. + +Buildroot Configuration +----------------------- + +Two buildroot configuration files are provided: + +(1) Direct Linux Kernel Boot + +This is defined by the sipeed_maix_dock_defconfig configuration. This +configuration allows building a bootable kernel image with a built-in initramfs +root file system (the board SD card is not used). The built kernel image can be +flashed directly to the board ROM for direct booting. No boot loader is +required. + +(2) U-Boot SD-Card Boot + +The sipeed_maix_dock_sdcard_defconfig configuration allows building a kernel +image with the root file system on the board SD card. U-Boot is used as the +boot loader. + +Note: U-Boot does not natively support the Sipeed MAIX-Dock board. However, the +board and device tree differences with the Sipeed MAIX-Bit board are small +enough for U-Boot to work. + +Both configuration files will also compile the pyserial-miniterm host tool open +a serial terminal console for the board. + +Direct Linux Kernel Boot +------------------------- + +Using the sipeed_maix_dock_defconfig configuration, the bootable kernel binary +image is built as follows. + +``` +$ make sipeed_maix_dock_defconfig +$ make +``` + +Both configuration files will also compile and install the kflash and +pyserial-miniterm host utilities to program bootable image files to the board +and open a serial terminal console. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin +``` + +Once the kernel image file is fully programmed, a terminal console is open and +the board can be rebooted by pressing the reset button on the board (if it does +not reboot automatically). + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 15:47:42 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX Dock +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 5980K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 546K init, 66K bss, 2212K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008187] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018250] pid_max: default: 4096 minimum: 301 +[ 0.022859] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040238] rcu: Hierarchical SRCU implementation. +[ 0.045110] smp: Bringing up secondary CPUs ... +[ 0.050215] smp: Brought up 1 node, 2 CPUs +[ 0.054345] devtmpfs: initialized +[ 0.071112] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.080182] pinctrl core: initialized pinctrl subsystem +[ 0.120689] clocksource: Switched to clocksource clint_clocksource +[ 0.133165] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.181750] k210-sysctl 50440000.syscon: K210 system controller +[ 0.198612] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.206644] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.216569] i2c_dev: i2c /dev entries driver +[ 0.225905] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.238866] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.247778] printk: console [ttySIF0] enabled +[ 0.247778] printk: console [ttySIF0] enabled +[ 0.256459] printk: bootconsole [sifive0] disabled +[ 0.256459] printk: bootconsole [sifive0] disabled +[ 0.268225] panel@0 enforce active low on chipselect handle +[ 0.285238] Freeing unused kernel image (initmem) memory: 540K +[ 0.290372] This architecture does not have kernel memory protection. +[ 0.296807] Run /init as init process + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +To open a terminal console without re-flashing the board, the pyserial-miniterm +host tool can be used. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` + +The options "--raw" and "--eol=LF" are added here to avoid a double carriage +return each time a command is entered. + + +U-Boot SD-Card Boot +------------------- + +The build procedure is similar to the built-in initramfs case. + +``` +$ make sipeed_maix_dock_sdcard_defconfig +$ make +``` + +The build process will generate two files under the output/images directory. + +* sdcard.img: The image file for the SD card filesystem. This image has 2 + partitions. The first partition is a vfat partition containing the kernel + uImage and the board device tree binary. The second partition is the root + filesystem with busybox installed. The second partition is formatted using + ext2 (rev1). + +* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD + card. + +The SD card can be prepared by writing the sdcard.img file, as follows. + +``` +$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M +$ sync +$ eject /dev/sdX +``` + +Where /dev/sdX is the device file name of the SD card. Once completed, the SD +card can be inserted into the board and the U-Boot binary image written to the +board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin +``` + +The above command will program U-Boot image to the board boot ROM and open a +terminal console once the u-boot.bin file is fully programmed. Reboot into the +newly programmed environment by pressing the board reset button if it does not +reboot automatically. + +The output will be similar to the following. + +``` +U-Boot 2022.04 (Apr 21 2022 - 15:59:50 +0900) + +DRAM: 8 MiB +Core: 34 devices, 17 uclasses, devicetree: separate +WDT: Not starting watchdog@50400000 +MMC: spi@53000000:slot@0: 0 +Loading Environment from SPIFlash... SF: Detected w25q128fw with page size 256 Bytes, erase size 4 KiB, total 16 MiB +*** Warning - bad CRC, using default environment + +In: serial@38000000 +Out: serial@38000000 +Err: serial@38000000 +Hit any key to stop autoboot: 0 +1717730 bytes read in 957 ms (1.7 MiB/s) +10382 bytes read in 11 ms (920.9 KiB/s) +## Booting kernel from Legacy Image at 80060000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 1717666 Bytes = 1.6 MiB + Load Address: 80000000 + Entry Point: 80000000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 80400000 + Booting using the fdt blob at 0x80400000 + Loading Kernel Image + Loading Device Tree to 00000000803fa000, end 00000000803ff88d ... OK + +Starting kernel ... + +[ 0.000000] Linux version 5.18.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 16:00:03 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX Dock +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008196] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018256] pid_max: default: 4096 minimum: 301 +[ 0.022876] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029980] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040401] rcu: Hierarchical SRCU implementation. +[ 0.045379] smp: Bringing up secondary CPUs ... +[ 0.050494] smp: Brought up 1 node, 2 CPUs +[ 0.054656] devtmpfs: initialized +[ 0.072338] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.081415] pinctrl core: initialized pinctrl subsystem +[ 0.123902] clocksource: Switched to clocksource clint_clocksource +[ 0.136898] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.182570] k210-sysctl 50440000.syscon: K210 system controller +[ 0.198158] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.207473] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.219724] i2c_dev: i2c /dev entries driver +[ 0.230080] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.243091] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.252034] printk: console [ttySIF0] enabled +[ 0.252034] printk: console [ttySIF0] enabled +[ 0.260656] printk: bootconsole [sifive0] disabled +[ 0.260656] printk: bootconsole [sifive0] disabled +[ 0.272546] panel@0 enforce active low on chipselect handle +[ 0.308098] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling +[ 0.320197] Waiting for root device /dev/mmcblk0p2... +[ 0.344667] mmc0: host does not support reading read-only switch, assuming write-enable +[ 0.352020] mmc0: new SDHC card on SPI +[ 0.358566] mmcblk0: mmc0:0000 SA16G 14.5 GiB +[ 0.366866] random: fast init done +[ 0.371439] mmcblk0: p1 p2 +[ 0.391314] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1 +[ 0.400977] VFS: Mounted root (ext2 filesystem) readonly on device 179:2. +[ 0.410966] devtmpfs: mounted +[ 0.413521] Freeing unused kernel image (initmem) memory: 96K +[ 0.418944] This architecture does not have kernel memory protection. +[ 0.425370] Run /sbin/init as init process +[ 0.633502] random: crng init done + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +Of note is that the kernel mounts the SD card as read-only by default to avoid +corruptions of the ext2 root file system when the board is powered down. This +is recommended as this board does not support clean shutdown or halt. + +Similarly to the initramfs build case, a console can be open without +re-flashing the board using the host tool pyserial-miniterm. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` diff --git a/configs/sipeed_maix_dock_defconfig b/configs/sipeed_maix_dock_defconfig new file mode 100644 index 0000000000..0f30e8d38f --- /dev/null +++ b/configs/sipeed_maix_dock_defconfig @@ -0,0 +1,39 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# Binary format +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sipeed/maix-dock/linux-cpio.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" + +# Packages +BR2_PACKAGE_HOST_PYTHON_KFLASH=y +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_dock_sdcard_defconfig b/configs/sipeed_maix_dock_sdcard_defconfig new file mode 100644 index 0000000000..fdbca11590 --- /dev/null +++ b/configs/sipeed_maix_dock_sdcard_defconfig @@ -0,0 +1,57 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# System +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210_sdcard" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/linux-sdcard.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_dock" + +# Packages +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE=64M +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" + +# Bootloader and related host tools +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sipeed_maix_bitm" +BR2_TARGET_UBOOT_FORMAT_BIN=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_PYTHON_KFLASH=y From patchwork Tue May 31 05:49:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637209 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=kQ/0ZMYw; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=K7ST8oJE; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1c30q93z9s1l for ; Tue, 31 May 2022 15:51:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9F11A40491; Tue, 31 May 2022 05:51:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s4R8AmtgmXzi; Tue, 31 May 2022 05:51:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id CD30940489; Tue, 31 May 2022 05:51:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id AA6211BF375 for ; Tue, 31 May 2022 05:49:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A648660B9D for ; Tue, 31 May 2022 05:49:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="kQ/0ZMYw"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="K7ST8oJE" Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zyOkdPCYBfhg for ; Tue, 31 May 2022 05:49:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 9E57360BF0 for ; Tue, 31 May 2022 05:49:40 +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=1653976180; x=1685512180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vbdT6li7pslvjVLUdSzfdzjghxo/4FNDUenKCoFWqqk=; b=kQ/0ZMYwlSjby/v8E/H+VdIW0REbo/t+iRMoj1ZqbBE5RMeT+denHNzr 5b+zKrw8hGylLFJogIPCnoORCwlbJh9KrqKAmNmfxZ/In6fD29mSD5BqN HFo/u/pwbKaRAygJGjgSsoWiRL8eaXiaeUKoXPVCMsCHGocX4XGqgrqd5 5YsMkyfp305kphHrCwSCaASH901a027pvcEV+MamLbCRT/CuTSqlcghn7 uwViYMEoDbqc/2Sigv4Li7v7HBJT+16nRN/+kKmHUIsWHP1Qtm7dPrhy2 l8U2W5UbzVbziSfHLDuX5QKpPQhNXAaknmQtnEGySJwSq/YautOs7AiDh A==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095093" 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; 31 May 2022 13:49:40 +0800 IronPort-SDR: wLmez+jI1CCixKQTTZirHrKz7vXcS/lPS++Hcldb1kB1mT8DW8rZDsq7Yg3xFcTNarQGG8H9Ea 4Vn7JL45P5n4c8lNevOAuDpYlkX035UgvIFtW0/gOlcSmBbu6DiNIMEr2IMpCnzarirp4XiF3i U0rxnXA4Sh8yQA39zI0d+tzCRsZeFStIBC7ncGORlcfgBp9TDegtdmu4OWjRrZis4ixIS2jGHg oYhOyAZJZDrIvKm3rnDstrCc+arCkvPmj6fFel01McbwyMTrdYZ8SwJMCSut3XJdoWvInCJ78C Iq9qpUUScvQR+UvKk3A7IZEW Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:26 -0700 IronPort-SDR: MYy6qdgmSYgywI0iImykAXUmlKMJvgDaS8uiD8v3+0YcyAB1PR9C6qEfpQvkswoSI618x3i+Dz IWhBKuya4JRl0OHQD585lWI7HOR3qQQNgsctoVz2CM5B5KTsnf8yi3fkOuam2Pm4pwD7amO1f3 wbTH63Awj+pIUibEvFtAjC22hUCskEEvjMEWeOy+Y1aQx7h9q0pjoOGPkJQbEYNGhby+dqf2Jn r72LGLcMvQqzvPtDvvgFNgWdB1gwmNQEpCGocOtv/2UifcccaGLRp7hDtJfsPOUg4UHaoItzMP +bY= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:40 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1ZC2J0yz1Rvlx for ; Mon, 30 May 2022 22:49:39 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976178; x=1656568179; bh=vbdT6li7pslvjVLUdS zfdzjghxo/4FNDUenKCoFWqqk=; b=K7ST8oJEJXVhb+NXOfgYk/BMj5KmAMl+2U qUran/ixQgaf6Vsr2FVSJG/vBm9aSwjqJXlkrAQNDIuHKFlQzCUjnSvCPhVd6JTC DHaYWMKwlSfjSN3IAF9VfR5FhiaF2ErLIwes2YB3PxHmwRfHpPHcfSCPz0k0gBo0 pkYKMXUeoKf1wTW+EuLM9YRBGpOMzDs+T2pv+w2x9i7NnOLw9o+C3LEHsbd6HhN6 v5V44eeDQZCgHbcPxtte4ky4cMim8mW62Un9OwDNeua/t65wMGNYk9FzLm2Wi9Xi LLMP7J4FkHAOgd8x4b0DdfcFIJ9vj/9UrwPSvgb+Rb9m6/raoOUw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5TCdmaQ_4XH8 for ; Mon, 30 May 2022 22:49:38 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1Z90cTzz1Rvlc; Mon, 30 May 2022 22:49:36 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:25 +0900 Message-Id: <20220531054926.373713-7-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 6/7] board: Add Sipeed MAIX-Go board support X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add two buildroot configuration files to build a minimal Linux environment for the Sipeed MAIX Bit board. The configurations are: * sipeed_maix_go_defconfig: Build a bootable kernel image with an embedded initramfs root file system. The image built can be flashed to the board as is and does not require a boot loader. This configuration uses the tiny busybox configuration defined in board/canaan/k210-soc/busybox-tiny.config. * sipeed_maix_go_sdcard_defconfig: Build a kernel image with a root file system on the SD card and using U-Boot as the boot loader. This uses the default busybox minimal configuration. Both configurations also enable the kflash and pyserial-miniterm host tools for flashing image files to the board and opening a terminal console. The readme.txt file documents how to build and boot the Sipeed MAIX-Go board with these configurations. Signed-off-by: Damien Le Moal --- DEVELOPERS | 2 + board/sipeed/maix-go/linux-cpio.config | 2 + board/sipeed/maix-go/readme.txt | 320 ++++++++++++++++++++++++ configs/sipeed_maix_go_defconfig | 39 +++ configs/sipeed_maix_go_sdcard_defconfig | 57 +++++ 5 files changed, 420 insertions(+) create mode 100644 board/sipeed/maix-go/linux-cpio.config create mode 100644 board/sipeed/maix-go/readme.txt create mode 100644 configs/sipeed_maix_go_defconfig create mode 100644 configs/sipeed_maix_go_sdcard_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 4a25418695..0116ab0815 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -640,6 +640,8 @@ F: configs/sipeed_maixduino_defconfig F: configs/sipeed_maixduino_sdcard_defconfig F: configs/sipeed_maix_dock_defconfig F: configs/sipeed_maix_dock_sdcard_defconfig +F: configs/sipeed_maix_go_defconfig +F: configs/sipeed_maix_go_sdcard_defconfig N: Daniel Nicoletti F: package/cutelyst/ diff --git a/board/sipeed/maix-go/linux-cpio.config b/board/sipeed/maix-go/linux-cpio.config new file mode 100644 index 0000000000..ea8c30e266 --- /dev/null +++ b/board/sipeed/maix-go/linux-cpio.config @@ -0,0 +1,2 @@ +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="sipeed_maix_go" diff --git a/board/sipeed/maix-go/readme.txt b/board/sipeed/maix-go/readme.txt new file mode 100644 index 0000000000..9f930fb6ac --- /dev/null +++ b/board/sipeed/maix-go/readme.txt @@ -0,0 +1,320 @@ +Sipeed MAIX-Go Board +==================== + +The Sipeed MAXI-Go board is a dual-core RISC-V 64-bits board based on the +Canaan Kendryte K210 SoC. + +Prerequisite +------------ + +In order to use the kflash utility to program this board, the user must have +access to the board USB serial device file. The simplest way to do this is to +add your user to the same group as this device file. Assume the device file is +/dev/ttyUSB0, first identify the device group name. In most cases, it is +either "dialout" or "uucp". Also verify that read-write access is enabled for +the group: + +``` +$ ls -l /dev/ttyUSB0 +crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0 +``` + +Then add yourself to that group (dialout in this example): + +``` +$ sudo usermod -a -G dialout $(whoami) +``` + +To enable the above, it is sometimes necessary to logout and login again. + +Buildroot Configuration +----------------------- + +Two buildroot configuration files are provided: + +(1) Direct Linux Kernel Boot + +This is defined by the sipeed_maix_go_defconfig configuration. This +configuration allows building a bootable kernel image with a built-in initramfs +root file system (the board SD card is not used). The built kernel image can be +flashed directly to the board ROM for direct booting. No boot loader is +required. + +(2) U-Boot SD-Card Boot + +The sipeed_maix_go_sdcard_defconfig configuration allows building a kernel +image with the root file system on the board SD card. U-Boot is used as the +boot loader. + +Note: U-Boot does not natively support the Sipeed MAIX-Go board. However, the +board and device tree differences with the Sipeed MAIX-bit board are small +enough for U-Boot to work. + +Both configuration files will also compile and install the kflash and +pyserial-miniterm host utilities to program bootable image files to the board +and open a serial terminal console. + +Direct Linux Kernel Boot +------------------------- + +Using the sipeed_maix_go_defconfig configuration, the bootable kernel binary +image is built as follows. + +``` +$ make sipeed_maix_go_defconfig +$ make +``` + +The bootable binary image is the output/images/loader.bin file. This image file +can be written to the board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin +``` + +Once the kernel image file is fully programmed, a terminal console is open and +the board can be rebooted by pressing the reset button on the board (if it does +not reboot automatically). + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.17.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 16:09:24 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX GO +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 5980K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 546K init, 66K bss, 2212K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008193] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018250] pid_max: default: 4096 minimum: 301 +[ 0.022862] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040239] rcu: Hierarchical SRCU implementation. +[ 0.045118] smp: Bringing up secondary CPUs ... +[ 0.050204] smp: Brought up 1 node, 2 CPUs +[ 0.054336] devtmpfs: initialized +[ 0.071519] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.080591] pinctrl core: initialized pinctrl subsystem +[ 0.121163] clocksource: Switched to clocksource clint_clocksource +[ 0.133221] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.180960] k210-sysctl 50440000.syscon: K210 system controller +[ 0.196811] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.204879] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.214087] i2c_dev: i2c /dev entries driver +[ 0.222736] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.236173] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.245104] printk: console [ttySIF0] enabled +[ 0.245104] printk: console [ttySIF0] enabled +[ 0.253726] printk: bootconsole [sifive0] disabled +[ 0.253726] printk: bootconsole [sifive0] disabled +[ 0.265588] panel@0 enforce active low on chipselect handle +[ 0.282358] Freeing unused kernel image (initmem) memory: 540K +[ 0.287492] This architecture does not have kernel memory protection. +[ 0.293926] Run /init as init process + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +To open a terminal console without re-flashing the board, the pyserial-miniterm +host tool can be used. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` + +The options "--raw" and "--eol=LF" are added here to avoid a double carriage +return each time a command is entered. + + +U-Boot SD-Card Boot +------------------- + +The build procedure is similar to the built-in initramfs case. + +``` +$ make sipeed_maix_go_sdcard_defconfig +$ make +``` + +The build process will generate two files under the output/images directory. + +* sdcard.img: The image file for the SD card filesystem. This image has 2 + partitions. The first partition is a vfat partition containing the kernel + uImage and the board device tree binary. The second partition is the root + filesystem with busybox installed. The second partition is formatted using + ext2 (rev1). + +* uboot.bin: U-Boot bootable binary to load and boot the kernel from the SD + card. + +The SD card can be prepared by writing the sdcard.img file, as follows. + +``` +$ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M +$ sync +$ eject /dev/sdX +``` + +Where /dev/sdX is the device file name of the SD card. Once completed, the SD +card can be inserted into the board and the U-Boot binary image written to the +board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/u-boot.bin +``` + +The above command will program U-Boot image to the board boot ROM and open a +terminal console once the u-boot.bin file is fully programmed. Reboot into the +newly programmed environment by pressing the board reset button. + +The output will be similar to the following. + +``` +U-Boot 2022.04 (Apr 21 2022 - 16:28:58 +0900) + +DRAM: 8 MiB +Core: 34 devices, 17 uclasses, devicetree: separate +WDT: Not starting watchdog@50400000 +MMC: spi@53000000:slot@0: 0 +Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB +*** Warning - bad CRC, using default environment + +In: serial@38000000 +Out: serial@38000000 +Err: serial@38000000 +Hit any key to stop autoboot: 0 +1717730 bytes read in 956 ms (1.7 MiB/s) +10502 bytes read in 11 ms (931.6 KiB/s) +## Booting kernel from Legacy Image at 80060000 ... + Image Name: Linux + Image Type: RISC-V Linux Kernel Image (uncompressed) + Data Size: 1717666 Bytes = 1.6 MiB + Load Address: 80000000 + Entry Point: 80000000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 80400000 + Booting using the fdt blob at 0x80400000 + Loading Kernel Image + Loading Device Tree to 00000000803fa000, end 00000000803ff905 ... OK + +Starting kernel ... + +[ 0.000000] Linux version 5.17.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #1 SMP Thu Apr 21 16:29:10 JST 2022 +[ 0.000000] Machine model: SiPeed MAIX GO +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15392 r0 d29664 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 root=/dev/mmcblk0p2 rootwait ro +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 6156K/8192K available (1180K kernel code, 151K rwdata, 239K rodata, 102K init, 69K bss, 2036K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008201] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018256] pid_max: default: 4096 minimum: 301 +[ 0.022875] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029983] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040405] rcu: Hierarchical SRCU implementation. +[ 0.045387] smp: Bringing up secondary CPUs ... +[ 0.050501] smp: Brought up 1 node, 2 CPUs +[ 0.054662] devtmpfs: initialized +[ 0.072840] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.081918] pinctrl core: initialized pinctrl subsystem +[ 0.124601] clocksource: Switched to clocksource clint_clocksource +[ 0.137869] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.183507] k210-sysctl 50440000.syscon: K210 system controller +[ 0.199987] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.209219] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.221062] i2c_dev: i2c /dev entries driver +[ 0.232254] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.245342] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.254281] printk: console [ttySIF0] enabled +[ 0.254281] printk: console [ttySIF0] enabled +[ 0.262908] printk: bootconsole [sifive0] disabled +[ 0.262908] printk: bootconsole [sifive0] disabled +[ 0.274939] panel@0 enforce active low on chipselect handle +[ 0.308760] mmc_spi spi3.0: SD/MMC host mmc0, no WP, no poweroff, cd polling +[ 0.321220] Waiting for root device /dev/mmcblk0p2... +[ 0.344805] mmc0: host does not support reading read-only switch, assuming write-enable +[ 0.352142] mmc0: new SDHC card on SPI +[ 0.358622] mmcblk0: mmc0:0000 SA16G 14.5 GiB +[ 0.366636] random: fast init done +[ 0.371323] mmcblk0: p1 p2 +[ 0.392887] random: get_random_bytes called from 0x000000008009b7d2 with crng_init=1 +[ 0.394338] VFS: Mounted root (ext2 filesystem) readonly on device 179:2. +[ 0.411277] devtmpfs: mounted +[ 0.413836] Freeing unused kernel image (initmem) memory: 96K +[ 0.419267] This architecture does not have kernel memory protection. +[ 0.425683] Run /sbin/init as init process +[ 0.594251] random: crng init done + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +Of note is that the kernel mounts the SD card as read-only by default to avoid +corruptions of the ext2 root file system when the board is powered down. This +is recommended as this board does not support clean shutdown or halt. + +Similarly to the initramfs build case, a console can be open without +re-flashing the board using the host tool pyserial-miniterm. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` diff --git a/configs/sipeed_maix_go_defconfig b/configs/sipeed_maix_go_defconfig new file mode 100644 index 0000000000..2054e49ae2 --- /dev/null +++ b/configs/sipeed_maix_go_defconfig @@ -0,0 +1,39 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# Binary format +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/sipeed/maix-go/linux-cpio.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" + +# Packages +BR2_PACKAGE_HOST_PYTHON_KFLASH=y +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" diff --git a/configs/sipeed_maix_go_sdcard_defconfig b/configs/sipeed_maix_go_sdcard_defconfig new file mode 100644 index 0000000000..a16943608c --- /dev/null +++ b/configs/sipeed_maix_go_sdcard_defconfig @@ -0,0 +1,57 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# System +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210_sdcard" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/linux-sdcard.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="canaan/sipeed_maix_go" + +# Packages +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE=64M +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/canaan/k210-soc/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/canaan/k210-soc/genimage.cfg" + +# Bootloader and related host tools +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.04" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/uboot.config" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sipeed_maix_bitm" +BR2_TARGET_UBOOT_FORMAT_BIN=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_PYTHON_KFLASH=y From patchwork Tue May 31 05:49:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1637208 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=WlKwpuio; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=opensource.wdc.com header.i=@opensource.wdc.com header.a=rsa-sha256 header.s=dkim header.b=BA+7R+/H; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC1bn2Fb4z9s1l for ; Tue, 31 May 2022 15:51:01 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3DEFA840B4; Tue, 31 May 2022 05:50:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AuivbvuXzmH5; Tue, 31 May 2022 05:50:58 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 57EC8840A2; Tue, 31 May 2022 05:50:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 2C93B1BF375 for ; Tue, 31 May 2022 05:49:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 1B04560B9D for ; Tue, 31 May 2022 05:49:42 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=wdc.com header.b="WlKwpuio"; dkim=pass (2048-bit key) header.d=opensource.wdc.com header.b="BA+7R+/H" Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gpvhm1n0UkRb for ; Tue, 31 May 2022 05:49:41 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id E5D3E60F84 for ; Tue, 31 May 2022 05:49:40 +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=1653976180; x=1685512180; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Vwiz4DZIPHAVgao2kncJplSbpomlnzP4/0gCAzlrvPM=; b=WlKwpuiooiosgZuxEYUBlF5Aw3+Ru6MUaobJJNbfZqHtr9bpxJLRkSxF Rgz/6cu5xXYnq3NvVegpwUJQM2ebynco0TKB6JWF6RAsGzdzTxaaCunkj 51gEppkgr3YxPY+CxPeF1dOvPVxfTbldEYOhHNb03RegFhz/wwCDZf9Ye 2iHrs7CszLz32Zd1KRm927aiPNJknYbRziaM3/11ld1LAsCM5z0mio7Tw wnfvWqlfx5He8z/RoLlR2tYEgKm837zY8dw10i+NZW/eXkDqAvXP+EDoo M8whw2D8VpQAeC9I9D9+2lwhZLqvi5z2r7ULhJxs1tfVTvNeGLSGtKPEA A==; X-IronPort-AV: E=Sophos;i="5.91,264,1647273600"; d="scan'208";a="306095094" 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; 31 May 2022 13:49:40 +0800 IronPort-SDR: N2G7dpDXKBVjH1cLQ5l8h+WTJSjupT38m/zOpNdwVxiZrFNeMQOdT+4mJ79yHTyp/Hzoy+HuuG gjEcnx6Gz8/C5LGaCZdxVyM2HOIq3Lm+rlbtiCGvlM7EBmUR9J/no0yOuPG2ZRbuEGIz+jHNc/ wFwat/xjsoASM9HfOULZEGTqmtpS1BakpnAkW6kmlFFV0pFXELM8OAnWpZIWayLN4QiPhIulin xWd610d6pL2Z88/1oYR2sOW3dDLL4QZ9vTKXaYSYIqmdXc2efULs2dAhOBNaZbPG12jhRVmSRd M6N1irA5++d49DoCDzsYHn1F Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:13:26 -0700 IronPort-SDR: sx2a4BkXLci4s4/eMTDYd7QuS+t4pVX9b/Zan761U9WDRMD/li/77n+OL+8SYxoAIB0lgYbHNt gwSqfbty4CR6PnNbkpiB96SJEkU+eUAqvQEALC8MJNF9Iu5n1kQtrqP/HV84P+mMUcb+6ZYUP8 Lp0Ve+4X8fDLEz47caM2FMAsq5OlJbbjoam9srCrGwTsRXYhRlOif9jLVpiyfbkObh/zpDeTkL upv5FgvdYw+FnHF35A9Lr7kWofnkpLvHl8E3L9u981pVW3anP4KfobBEWKqOH38W1d1duzfr2i C7M= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2022 22:49:41 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4LC1ZD2ZP0z1Rvlc for ; Mon, 30 May 2022 22:49:40 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1653976179; x=1656568180; bh=Vwiz4DZIPHAVgao2kn cJplSbpomlnzP4/0gCAzlrvPM=; b=BA+7R+/Hkxsfbs2UKuR++lgTxS/10WoSgE ZBi3NZlVR/f/Hwt+q04ItD/Gq2KJoIJoxDXT4xjvvoNVJto/kFCCKBoQmIxNYx2Q c4Fc+9SDnENxsJxE21VWfPXBVpNCb23m/qMQo6UUb5OSUY+AXK6uoqpYceCcfA9H cE0SuVc657jetf6vh/sBSoMfeoSkiK3M9JKcp84pOYCpYaU9+Q0WIA+dELsHWD6z txPgv6iuW28MpO1504d7EAHik61W5O++VIU/iYkbnXS0KgOL7whGbUXjv30LOb2G fo97FJ1Q6GUAmTzbdq8Q6RxuCiXOkNl1lNvaOiSOrlAss1Bt0j5Q== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WeSnGACZQlq6 for ; Mon, 30 May 2022 22:49:39 -0700 (PDT) Received: from twashi.fujisawa.hgst.com (unknown [10.225.163.61]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4LC1ZB370Vz1SVp2; Mon, 30 May 2022 22:49:38 -0700 (PDT) To: buildroot , Thomas Petazzoni Date: Tue, 31 May 2022 14:49:26 +0900 Message-Id: <20220531054926.373713-8-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> References: <20220531054926.373713-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v3 7/7] board: Add Canaan KD233 board support X-BeenThere: buildroot@buildroot.org 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: , X-Patchwork-Original-From: Damien Le Moal via buildroot From: Damien Le Moal Reply-To: Damien Le Moal Cc: Niklas Cassel , Alistair Francis , "Yann E . MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Add a buildroot configuration file to build a minimal Linux environment for the Sipeed MAIX Bit board. The configuration file is canaan_kd233_defconfig. It builds a bootable kernel image with an embedded initramfs root file system. The image built can be flashed to the board as is and does not require a boot loader. This configuration uses the tiny busybox configuration defined in board/canaan/k210-soc/busybox-tiny.config. U-Boot currently does not support this board, making it impossible to boot the kernel after loading it from the SD card. However, the SD card is usable from Linux once booted using the canaan_kd233_defconfig configuration. The configuration also enable the kflash and pyserial-miniterm host tools for flashing image files to the board and opening a terminal console. The readme.txt file documents how to build and boot the Canaan KD233 board with this configuration. Signed-off-by: Damien Le Moal --- DEVELOPERS | 1 + board/canaan/kd233/linux-cpio.config | 2 + board/canaan/kd233/readme.txt | 149 +++++++++++++++++++++++++++ configs/canaan_kd233_defconfig | 39 +++++++ 4 files changed, 191 insertions(+) create mode 100644 board/canaan/kd233/linux-cpio.config create mode 100644 board/canaan/kd233/readme.txt create mode 100644 configs/canaan_kd233_defconfig diff --git a/DEVELOPERS b/DEVELOPERS index 0116ab0815..b459d2ef52 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -633,6 +633,7 @@ F: package/log4cpp/ N: Damien Le Moal F: package/python-kflash/ F: board/canaan/ +F: configs/canaan_kd233_defconfig F: board/sipeed/ F: configs/sipeed_maix_bit_defconfig F: configs/sipeed_maix_bit_sdcard_defconfig diff --git a/board/canaan/kd233/linux-cpio.config b/board/canaan/kd233/linux-cpio.config new file mode 100644 index 0000000000..d5b107124a --- /dev/null +++ b/board/canaan/kd233/linux-cpio.config @@ -0,0 +1,2 @@ +CONFIG_SOC_CANAAN_K210_DTB_BUILTIN=y +CONFIG_SOC_CANAAN_K210_DTB_SOURCE="canaan_kd233" diff --git a/board/canaan/kd233/readme.txt b/board/canaan/kd233/readme.txt new file mode 100644 index 0000000000..47b78fa2d7 --- /dev/null +++ b/board/canaan/kd233/readme.txt @@ -0,0 +1,149 @@ +Canaan KD233 Board +================== + +The Canaan KD233 is a dual-core RISC-V 64-bits board based on the Canaan +Kendryte K210 SoC. + +Prerequisite +------------ + +In order to use the kflash utility to program this board, the user must have +access to the board USB serial device file. The simplest way to do this is to +add your user to the same group as this device file. Assume the device file is +/dev/ttyUSB0, first identify the device group name. In most cases, it is +either "dialout" or "uucp". Also verify that read-write access is enabled for +the group: + +``` +$ ls -l /dev/ttyUSB0 +crw-rw---- 1 root dialout 188, 0 May 26 13:48 /dev/ttyUSB0 +``` + +Then add yourself to that group (dialout in this example): + +``` +$ sudo usermod -a -G dialout $(whoami) +``` + +To enable the above, it is sometimes necessary to logout and login again. + +Buildroot Configuration +----------------------- + +Unlike other K210 based boards (Sipeed boards), U-Boot does not work on the +KD233 board due to the different wiring for the SD-Card mmc controller. As such, +the KD233 board can only be used by directly booting into Linux Kernel. + +buildroot can be configured to do so using the canaan_kd233_defconfig +configuration file. This configuration allows building a bootable kernel image +with a built-in initramfs root file system (the board SD card is not used). The +built kernel image can be flashed directly to the board ROM for direct booting. +No boot loader is required. + +Once booted, the on-board SD card can be used by Linux. + +The configuration file will also compile and install the kflash and +pyserial-miniterm host utilities to program bootable image files to the board +and open a serial terminal console. + +Direct Linux Kernel Boot +------------------------- + +Using the canaan_kd233_defconfig configuration, the bootable kernel binary image +is built as follows. + +``` +$ make canaan_kd233_defconfig +$ make +``` + +The bootable binary image is the output/images/loader.bin file. This image file +can be written to the board boot flash using the kflash utility. + +``` +$ output/host/bin/kflash -b 1500000 -p /dev/ttyUSB0 -t output/images/loader.bin +``` + +Once the kernel image file is fully programmed, a terminal console is open and +the board can be rebooted by pressing the reset button on the board (if it does +not reboot automatically). + +The output will be similar to the following. + +``` +[ 0.000000] Linux version 5.17.0 (foo@bar.com) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2022.02-560-g6a2b542a09-dirty) 10.3.0, GNU ld (GNU Binutils) 2.32) #2 SMP Thu Apr 21 16:40:44 JST 2022 +[ 0.000000] Machine model: Kendryte KD233 +[ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '115200n8') +[ 0.000000] printk: bootconsole [sifive0] enabled +[ 0.000000] Zone ranges: +[ 0.000000] DMA32 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Normal empty +[ 0.000000] Movable zone start for each node +[ 0.000000] Early memory node ranges +[ 0.000000] node 0: [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff] +[ 0.000000] riscv: ISA extensions acdfim +[ 0.000000] riscv: ELF capabilities acdfim +[ 0.000000] percpu: max_distance=0x16000 too large for vmalloc space 0x0 +[ 0.000000] percpu: Embedded 11 pages/cpu s15264 r0 d29792 u45056 +[ 0.000000] percpu: wasting 10 pages per chunk +[ 0.000000] Built 1 zonelists, mobility grouping off. Total pages: 2020 +[ 0.000000] Kernel command line: earlycon console=ttySIF0 +[ 0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.000000] Memory: 5984K/8192K available (964K kernel code, 137K rwdata, 205K rodata, 546K init, 66K bss, 2208K reserved, 0K cma-reserved) +[ 0.000000] rcu: Hierarchical RCU implementation. +[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0 +[ 0.000000] riscv-intc: 64 local interrupts mapped +[ 0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts. +[ 0.000000] k210-clk: clock-controller: CPU running at 390 MHz +[ 0.000000] clint: timer@2000000: timer running at 7800000 Hz +[ 0.000000] clocksource: clint_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns +[ 0.000001] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns +[ 0.008178] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) +[ 0.018251] pid_max: default: 4096 minimum: 301 +[ 0.022861] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.029971] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) +[ 0.040234] rcu: Hierarchical SRCU implementation. +[ 0.045110] smp: Bringing up secondary CPUs ... +[ 0.050211] smp: Brought up 1 node, 2 CPUs +[ 0.054340] devtmpfs: initialized +[ 0.070401] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.079473] pinctrl core: initialized pinctrl subsystem +[ 0.117795] clocksource: Switched to clocksource clint_clocksource +[ 0.130245] workingset: timestamp_bits=62 max_order=11 bucket_order=0 +[ 0.176925] k210-sysctl 50440000.syscon: K210 system controller +[ 0.192947] k210-rst 50440000.syscon:reset-controller: K210 reset controller +[ 0.200870] cacheinfo: Unable to detect cache hierarchy for CPU 0 +[ 0.210947] i2c_dev: i2c /dev entries driver +[ 0.220535] k210-fpioa 502b0000.pinmux: K210 FPIOA pin controller +[ 0.232253] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 115200) is a SiFive UART v0 +[ 0.241202] printk: console [ttySIF0] enabled +[ 0.241202] printk: console [ttySIF0] enabled +[ 0.249818] printk: bootconsole [sifive0] disabled +[ 0.249818] printk: bootconsole [sifive0] disabled +[ 0.261664] panel@0 enforce active low on chipselect handle +[ 0.275950] Freeing unused kernel image (initmem) memory: 540K +[ 0.281098] This architecture does not have kernel memory protection. +[ 0.287520] Run /init as init process + __ _ + / / (_) ____ _ _ __ __ + / / | || _ \ | | | |\ \/ / + / /___| || | | || |_| | > < + /_____/|_||_| |_| \____|/_/\_\ + 64-bits RISC-V Kendryte K210 NOMMU + +/ # +``` + +To open a terminal console without re-flashing the board, the pyserial-miniterm +host tool can be used. + +``` +$ output/host/bin/pyserial-miniterm --raw --eol=LF /dev/ttyUSB0 115200 +``` + +The options "--raw" and "--eol=LF" are added here to avoid a double carriage +return each time a command is entered. diff --git a/configs/canaan_kd233_defconfig b/configs/canaan_kd233_defconfig new file mode 100644 index 0000000000..85b7b14fbd --- /dev/null +++ b/configs/canaan_kd233_defconfig @@ -0,0 +1,39 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_64=y +BR2_riscv_custom=y +BR2_RISCV_ISA_CUSTOM_RVM=y +BR2_RISCV_ISA_CUSTOM_RVA=y +BR2_RISCV_ISA_CUSTOM_RVF=y +BR2_RISCV_ISA_CUSTOM_RVD=y +BR2_RISCV_ISA_CUSTOM_RVC=y +BR2_RISCV_ABI_LP64D=y + +# Patches +BR2_GLOBAL_PATCH_DIR="board/riscv/nommu/patches" + +# Binary format +# BR2_USE_MMU is not set +BR2_BINFMT_FLAT=y +BR2_BINFMT_FLAT_ONE=y +# BR2_TARGET_ENABLE_ROOT_LOGIN is not set + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.18" +BR2_LINUX_KERNEL_DEFCONFIG="nommu_k210" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/canaan/kd233/linux-cpio.config" +BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y +BR2_LINUX_KERNEL_IMAGE_NAME="loader.bin" + +# Packages +BR2_PACKAGE_HOST_PYTHON_KFLASH=y +BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" +BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/canaan/k210-soc/busybox-tiny.config" +# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set + +# Filesystem +BR2_INIT_NONE=y +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_ROOTFS_OVERLAY="board/canaan/k210-soc/rootfs_overlay"