From patchwork Tue Sep 8 11:33:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 1359677 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=LfAO9tfs; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bm31v5pqrz9sTW for ; Tue, 8 Sep 2020 21:33:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E7B3D2746F; Tue, 8 Sep 2020 11:33:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OQ+JSFYjyxiy; Tue, 8 Sep 2020 11:33:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 322342040B; Tue, 8 Sep 2020 11:33:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 862A71BF82B for ; Tue, 8 Sep 2020 11:33:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 82E898641F for ; Tue, 8 Sep 2020 11:33:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8fqUey-L+-gl for ; Tue, 8 Sep 2020 11:33:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by whitealder.osuosl.org (Postfix) with ESMTPS id 03C3386146 for ; Tue, 8 Sep 2020 11:33:28 +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=1599564810; x=1631100810; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ho0X9OupYAUP7sjYiJUNKPt60jga3DYcvjEgZZk/17E=; b=LfAO9tfsv9g3Fg/xA3dWTNFmxl5/0nyYGYrP0Z8zq3JUaqgt74zYC/Mi 65txVlEbA3Dwp1l9zr8tnEdCzukaKhINCLEt0SMMiAxWQ94NtmGySUycj cWGvcVqmbRf9WqtWjb+aPlqbQ+1fengfsH4DEFEkMWqQSB8dP2zFzzKmX QmuQ8tsf3BbHx6t2ZJeZ2d6lcojgClbpr34QUFgkBQz1HRSwYy1LE0CaV ZJ3DlRPrf9VzY3EDF28uBBVEjIEiJeGitNr8rqOue/grXTzftMC5ErMGT kN7QR6+B1wVXt4ldkV4PiRrpKNUJQvrIAUXotDE+Fj3Fpo/I9PpeGPWLm w==; IronPort-SDR: D88vUZaSxQriapy/Rky8VtSVsgTPILkteQqIZ1uvWUagGcbfp+QgK+WisxO+rjuIQcF3Di+XVH tMB/20aC3SWL09Fr319MIwTnTAyG6QycM4aoAK+I9CQSxALkFsc/c6hOL8iWs+eNmwqp41QRpy pLxebP/vQkgDnAWJYjq4g6olA18NkUkb+IijaH3Fy2jvnfX5K+AzjsTY4ctUlsYzz5Dun9Ozp1 JsRTKMJAbq6/R/RxsvRSwf42LOg7HwsPpbEG4ZcxcopMIjSKpOT+bKGn/jqlvGH4U0MyXdkgu8 MPs= X-IronPort-AV: E=Sophos;i="5.76,405,1592841600"; d="scan'208";a="146809703" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Sep 2020 19:33:29 +0800 IronPort-SDR: 6PfyFU9rearv/2KUxNsrrvQnsL+Y8oMfQHx2RQ8h41HazKxIWiBNmV1v2nW+kPeEo3oD8oFqJO uwaSLRhmu7fA== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2020 04:19:54 -0700 IronPort-SDR: GRa+MI/2m9h2Gw6o132TSL5ULnSbyWvjSY5sO1K7ukXpEZTPsIL/zQTRQgbAszQmay76jB10+i txhfc2mOlUDw== WDCIronportException: Internal Received: from cnf002038.ad.shared (HELO localhost.hgst.com) ([10.84.70.94]) by uls-op-cesaip02.wdc.com with ESMTP; 08 Sep 2020 04:33:26 -0700 From: Damien Le Moal To: buildroot@buildroot.org Date: Tue, 8 Sep 2020 20:33:18 +0900 Message-Id: <20200908113324.1022230-1-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 0/6] Add support for Kendryte K210 RISC-V boards X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlos Eduardo , Alistair Francis , Drew Fustini , Thomas Petazzoni , Romain Naour , Christoph Hellwig , Thomas De Schampheleire Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This patch series adds support for building bootable images for RISC-V boards based on the Kendryte K210 SoC which is supported by the Linux kernel since version 5.8.0. This SoC has no MMU supported by Linux and requires uClibc flatbin binaries as gcc does not yet support FDPIC executables for RISC-V. The first four patches adjust buildroot configuration to allow building uClibc static no-MMU libraries for RISC-V. The last and fifth patch adds buildroot defconfig for the Kendryte K210 as well as uClibc and busybox configuration. Building is as simple as: make kendryte_k210_defconfig make Which generate the output/image/loader.bin bootable image. The result using a SiPeed Dan Dock board is: [ 0.000000] Linux version 5.8.0 (damien@localhost.localdomain) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2020.08-332-g6a6dcd0c4b) 9.3.0, GNU ld (GNU Binutils) 2.32) #6 SMP Tue Sep 8 20:21:30 JST 2020 [ 0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '') [ 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=0x18000 too large for vmalloc space 0x0 [ 0.000000] percpu: Embedded 12 pages/cpu s18336 r0 d30816 u49152 [ 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] Sorting __ex_table... [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off [ 0.000000] Memory: 6328K/8192K available (939K kernel code, 119K rwdata, 169K rodata, 289K init, 97K bss, 1864K 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] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0] [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns [ 0.000014] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns [ 0.008242] Console: colour dummy device 80x25 [ 0.012480] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200) [ 0.022682] pid_max: default: 4096 minimum: 301 [ 0.027300] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.034416] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear) [ 0.044878] rcu: Hierarchical SRCU implementation. [ 0.049777] smp: Bringing up secondary CPUs ... [ 0.055056] smp: Brought up 1 node, 2 CPUs [ 0.059453] devtmpfs: initialized [ 0.065614] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns [ 0.074637] futex hash table entries: 16 (order: -2, 1024 bytes, linear) [ 0.084149] Kendryte K210 SoC sysctl [ 0.097621] clocksource: Switched to clocksource riscv_clocksource [ 0.229791] workingset: timestamp_bits=62 max_order=11 bucket_order=0 [ 0.237036] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 0) is a SiFive UART v0 [ 0.245617] printk: console [ttySIF0] enabled [ 0.245617] printk: console [ttySIF0] enabled [ 0.254118] printk: bootconsole [sifive0] disabled [ 0.254118] printk: bootconsole [sifive0] disabled [ 0.266224] random: get_random_bytes called from 0x000000008004e75c with crng_init=0 [ 0.274702] Freeing unused kernel memory: 288K [ 0.278417] This architecture does not have kernel memory protection. [ 0.284857] Run /init as init process +---------------------------+ | Kendryte K210 NOMMU Linux | +---------------------------+ / # cat /proc/cpuinfo processor : 0 hart : 0 isa : rv64imafdc uarch : kendryte,k210 processor : 1 hart : 1 isa : rv64imafdc uarch : kendryte,k210 / # These patches are also available at git@github.com:damien-lemoal/buildroot.git (https://github.com/damien-lemoal/buildroot) Changes from v1: * Replace uclinux with linux in toolchain tuple name only for RISC-V (patch 4). * Moved uclibc patches under package/uclibc (new patch 5) * Simplified board specific support (patch 6): - Dropped board specific uclibc configuration. Usinf default uclibc.config now. - Removed board specific device table - Removed fakeroot.sh script - Reworked rootfs overlay init script to be similar to fs/cpio/init - Added the README.txt file to document builds Christoph Hellwig (2): package/elf2flt: add RISC-V support package make: build RISC-V nommu builds as linux Damien Le Moal (4): toolchain/buildroot: allow uclibc-ng for riscv arch/config: Make RISC-V MMU optional package/uclibc: fix compilation errors board: Add configuration for Kendryte K210 boards arch/Config.in | 2 +- board/kendryte/k210/README.txt | 28 + board/kendryte/k210/busybox.config | 1178 +++++++++++++++++ board/kendryte/k210/rootfs_overlay/init | 24 + configs/kendryte_k210_defconfig | 24 + package/Makefile.in | 7 +- .../0002-elf2flt-add-riscv-support.patch | 302 +++++ package/elf2flt/Config.in.host | 2 +- ...evert-Fix-static-linking-with-GCC-10.patch | 43 + ...0002-fix-static-builds-with-gcc-10.x.patch | 25 + ...-utils-getconf-Fix-compilation-error.patch | 103 ++ .../0004-librt-avoid-compilation-error.patch | 42 + package/uclibc/Config.in | 2 + toolchain/toolchain-buildroot/Config.in | 4 +- 14 files changed, 1782 insertions(+), 4 deletions(-) create mode 100644 board/kendryte/k210/README.txt create mode 100644 board/kendryte/k210/busybox.config create mode 100755 board/kendryte/k210/rootfs_overlay/init create mode 100644 configs/kendryte_k210_defconfig create mode 100644 package/elf2flt/0002-elf2flt-add-riscv-support.patch create mode 100644 package/uclibc/0001-Revert-Fix-static-linking-with-GCC-10.patch create mode 100644 package/uclibc/0002-fix-static-builds-with-gcc-10.x.patch create mode 100644 package/uclibc/0003-utils-getconf-Fix-compilation-error.patch create mode 100644 package/uclibc/0004-librt-avoid-compilation-error.patch