7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HiFive Unleashed でLinuxを動かす

Last updated at Posted at 2018-04-16

Linuxが走るRISC-Vマルチコアプロセッサ搭載SBC、HiFive Unleashed を動かした際のメモ(作成中)

1. HiFive Unleashed の仕様

  • SiFive Freedom U540 SoCの仕様
    • 最速の RISC-V プロセッサ (2018年4月時点)
    • Linuxが走る唯一のRISC-V SoC (2018年4月時点)
    • 4+1 のマルチコア構成、 動作周波数は最大 1.5 GHz
      • 4つの U54 RV64GC アプリケーションコア、仮想メモリサポート
      • 1つの E51 RV64IMAC 管理コア
    • コヒーレントな 2MB L2 Cache
    • 主記憶はECC対応な64-bit DDR4
    • 1つの Gigabit Ethernet
    • 製造は 28nm プロセス
  • HiFive Unleashed ボードの仕様
    • SiFive Freedom U540 SoCを1つ搭載
    • 主記憶は 8GB DDR4 (ECC付)
    • ネットワークは Gigabit Ethernet 1ポート
    • 32MB Quad SPI フラッシュメモリ搭載
    • MicroSD Card スロット
    • 拡張用FMCコネクタ
    • USBコネクタ(シリアルコンソール)

Screenshot from 2018-04-17 05-00-53.png

1-1. HiFive Unleashed の入手方法

CROUDSUPPLYから購入、値段は$999 (ただし現在品切れで募集停止中、再入荷は5月以降?)

2. 実機で動作させてみる

2-1. 付属のSDカード(8GB)からの起動

BuildrootのLinuxを書き込み済み。普通にLinuxが起動します。

  • 準備
    • 電源接続
    • USBケーブル接続
    • イーサーネットケーブル接続
    • DIPスイッチ(S1)は全部Off側にセット(SDカードから起動)
  • 起動
    • 電源スイッチ(トグルタイプ)をオンに
  • シリアルコンソールに接続
    • screen /dev/ttyUSB1 115200 で
    • 電源ONからシリアルにメッセージが出るまでに少し時間がかかります。
  • ログイン
    • IDはroot、PWはsifive
  • シャットダウン
    • halt コマンド
    • 電源スイッチで電源OFF
    SiFive FSBL:       2018-03-20
    HiFive-U serial #: 00000049
    bbl loader
     
                    SIFIVE, INC.
     
             5555555555555555555555555
            5555                   5555
           5555                     5555
          5555                       5555
         5555       5555555555555555555555
        5555       555555555555555555555555
       5555                             5555
      5555                               5555
     5555                                 5555
    5555555555555555555555555555          55555
     55555           555555555           55555
       55555           55555           55555
         55555           5           55555
           55555                   55555
             55555               55555
               55555           55555
                 55555       55555
                   55555   55555
                     555555555
                       55555
                         5
     
               SiFive RISC-V Coreplex
    [    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
    [    0.000000] Linux version 4.15.0-00044-g2b0aa1d (terpstra@gamma03.internal.sifive.com) (gcc version 7.2.0 (GCC)) #1 SMP Tue Mar 20 12:18:35 PDT 2018
    [    0.000000] bootconsole [early0] enabled
    [    0.000000] Initial ramdisk at: 0x        (ptrval) (9436160 bytes)
    [    0.000000] Zone ranges:
    [    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
    [    0.000000]   Normal   [mem 0x0000000100000000-0x000027ffffffffff]
    [    0.000000] Movable zone start for each node
    [    0.000000] Early memory node ranges
    [    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
    [    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000027fffffff]
    [    0.000000] software IO TLB [mem 0xfbfff000-0xfffff000] (64MB) mapped at [        (ptrval)-        (ptrval)]
    [    0.000000] CPU with hartid=0 has a non-okay status of "masked"
    [    0.000000] elf_hwcap is 0x1105
    [    0.000000] percpu: Embedded 14 pages/cpu @        (ptrval) s28632 r0 d28712 u57344
    [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 2067975
    [    0.000000] Kernel command line: earlyprintk
    [    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
    [    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
    [    0.000000] Sorting __ex_table...
    [    0.000000] Memory: 8179080K/8386560K available (3055K kernel code, 215K rwdata, 829K rodata, 9371K init, 775K bss, 207480K reserved, 0K cma-reserved)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=5, Nodes=1
    [    0.000000] Hierarchical RCU implementation.
    [    0.000000]  RCU event tracing is enabled.
    [    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=5.
    [    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=5
    [    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
    [    0.000000] CPU with hartid=0 has a non-okay status of "masked"
    [    0.000000] riscv,cpu_intc,1: 64 local interrupts mapped
    [    0.000000] riscv,cpu_intc,2: 64 local interrupts mapped
    [    0.000000] riscv,cpu_intc,3: 64 local interrupts mapped
    [    0.000000] riscv,cpu_intc,4: 64 local interrupts mapped

SSHでもrootでログインできます。cpuinfoで4コア動作を確認。

# cat /proc/cpuinfo 
hart	: 1
isa	: rv64imafdc
mmu	: sv39
uarch	: sifive,rocket0

hart	: 2
isa	: rv64imafdc
mmu	: sv39
uarch	: sifive,rocket0

hart	: 3
isa	: rv64imafdc
mmu	: sv39
uarch	: sifive,rocket0

hart	: 4
isa	: rv64imafdc
mmu	: sv39
uarch	: sifive,rocket0

2-2. Freedom-U-SDK を使って自分でシステムをビルドして走らせる

自分でイメージを作成する作業については Getting started guide ( https://www.sifive.com/documentation/boards/hifive-unleashed/hifive-unleashed-getting-started-guide/ )を参照します。以下はUbuntu16.04のPC上でで作業した際のメモです。

ビルドに必要となる関連パッケージの追加

sudo apt-get install autoconf automake autotools-dev bc bison build-essential curl flex gawk gdisk git gperf libgmp-dev libmpc-dev libmpfr-dev libncurses-dev libssl-dev libtool patchutils python screen texinfo unzip zlib1g-dev

ソースコードの取得

git clone https://github.com/sifive/freedom-u-sdk.git
cd freedom-u-sdk
git submodule update --init --recursive

ビルド(2時間弱かかります)

unset RISCV
make

SDカードの準備、gdiskを使ってGPT パーティション作成(/dev/exbは各自の環境に合わせて変更)

sudo gdisk /dev/exb

SDカードへの書き込み(各種ビルドも走るので時間がかかります)

sudo make DISK=/dev/exb format-boot-loader

最後に Error: Could not find bootloader partition エラーが出ましたが、再度上記コマンドを実行すると2回目では成功しました。何かのタイミングかもしれません。ガイドにもありますUSBーSDアダプタ経由の場合、遅くてエラーになるとか。

SDカードのパーティションの確認

$ sudo gdisk /dev/mmcblk0
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/mmcblk0: 31275008 sectors, 14.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 4ECB91B1-5C15-455D-9FD1-7EA416B1A9EC
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 31274974
Partitions will be aligned on 2048-sector boundaries
Total free space is 198622 sectors (97.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048           67583   32.0 MiB    FFFF  bootloader
   2          264192        31274974   14.8 GiB    8300  root

Command (? for help): q

作成したSDカードを挿して起動。シリアルコンソール経由でログイン

screen /dev/ttyUSB1 115200

2-3. Fedora (TBD)

サポート開始、大まかな手順は

  • NBD server を立ち上げて stage4-disk.img を提供
  • U540用のBBLをSDにコピーして起動、その際に、NBDサーバーのIPアドレスを修正

2-4. Debian (TBD)

サポート開始、 HiFive Unleashed への導入ガイドはこちら https://wiki.debian.org/InstallingDebianOn/SiFive/HiFiveUnleashed

3. 参照

7
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?