1. 概要
Githubにある64bitのRocketChip CPUを搭載したLinux on LiteXをベースに、Xilinx社のFPGAボードArty A7-100TにliteXとRocketChipを使ったSoCを作り、64bit Linuxを動作させます。
1.1. 動作環境
- OSはUbuntu 20.04.5を使用しています。
- FPGAボードは、Xilinx社製Arty A7-100Tを使用しています。
- Micro SDカードとPMOD Micro SDカードリーダー410-380を使用します。
1.2. 手続き方法
- Step 1: ハードウェアを接続します.
- Step 2: 前提条件のインストール
- Step 3: ゲートウェア(Gateware)の構築
- Step 4: ソフトウェアの構築
- Step 5: Litex+RocketでのLinuxの起動
2. ハードウェアの接続
- PmodMicroSD モジュールを Arty A7-100T の PMOD コネクタ
JD
に挿入します。VCCとGNDピンが正しく接続されていることを確認します。 - Arty A7-100T (J9)をLANケーブルでスイッチ/ルーター(Switch/Router)に接続します。
- Arty A7-100T (J10) を MicroUSB ケーブルで PC に接続します (電源、コンソール、プログラミング) 。
3. 前提条件のインストール
3.1. サポートパッケージのインストール
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install openocd fakeroot verilator python3 meson gtkterm gawk texinfo git python3-pip bison device-tree-compiler autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev build-essential flex gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build
3.2. LiteX開発環境のインストール
$ cd ~
$ mkdir litex
$ cd litex
$ wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py
$ chmod 777 litex_setup.py
$ python3 ./litex_setup.py --config=full --init --install --user
PATHに追加する
$ echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc
3.3. 64ビットRISC-V用クロスコンパイラ・ツールチェーンのインストール
$ cd ~
$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
$ pushd riscv-gnu-toolchain
$ ./configure --prefix=$HOME/RISCV --enable-multilib
$ make newlib linux -j8
$ popd
PATHに追加する
$ export PATH=$PATH:$HOME/RISCV/bin
$ echo 'export PATH=$PATH:$HOME/RISCV/bin' >> ~/.bashrc
3.4. Vivadoをインストール
サポートパッケージのインストール
$ sudo apt install libtinfo-dev
$ sudo ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5
ダウンロード Xilinx_Unified_2022.2_1014_8888_Lin64.bin, そして実行します:
$ sudo chmod +x ./Xilinx_Unified_2022.2_1014_8888_Lin64.bin
$ ./Xilinx_Unified_2022.2_1014_8888_Lin64.bin
インストーラーでVivadoを /tools
ディレクトリにインストールします。
PATHにVivadoを追加する
$ echo 'export PATH=$PATH:/tools/Xilinx/Vivado/2022.2/bin' >> ~/.bashrc
4. ゲートウェア(Gateware)の構築
$ cd ~/litex
$ litex-boards/litex_boards/targets/digilent_arty.py --build --cpu-type rocket --cpu-variant linuxd --sys-clk-freq 50e6 --with-ethernet --with-sdcard --variant=a7-100
ビルドでは、ビットストリームファイルが作成されます:
$HOME/litex/build/digilent_arty/gateware/digilent_arty.bit
ボードがプログラムされるたびに (--load オプションが与えられている場合はビルダーから直接、または openocd を使って直接に)、そして、プログラムされたボードがリセットされるたびに、ビットストリームに含まれるベアメタルファームウェア / bare-metal firmware (BIOS) は CPU、RAM、周辺機器を初期化し、boot.bin
をロードしようとします。 最初はmicroSDカード(msdos/fatとしてフォーマットされる最初のパーティション)から、次にネットワーク経由のTFTP(192.168.1.0/24ネットワークを想定、LiteX+RocketシステムはIPアドレス192.168.1.50を使っており、TFTP経由で192.168.1.100のサーバー)からboot.bin
をダウンロードしようとします。
注意事項
また、microSDカードからLiteXのブートイメージをロードできるゲートウェアを構築することもできました(ネットブート(netboot)は不可):
$ cd ~/litex
$ litex-boards/litex_boards/targets/digilent_arty.py --build --cpu-type rocket --cpu-variant linuxd --sys-clk-freq 50e6 --with-sdcard --variant=a7-100
あるいは、TFTP serverから(sdcardbootは不可):
$ cd ~/litex
$ litex-boards/litex_boards/targets/digilent_arty.py --build --cpu-type rocket --cpu-variant linuxd --sys-clk-freq 50e6 --with-ethernet --variant=a7-100
4.1. ビルドゲートウェア(Build Gateware )の動画
5. ソフトウェアの構築
5.1. linux-on-litex-rocket リポジトリをクローンする
$ cd ~/litex
$ git clone https://github.com/litex-hub/linux-on-litex-rocket
5.2. ビジーボックス(BusyBox)の構築
$ cd ~/litex/linux-on-litex-rocket
$ curl https://busybox.net/downloads/busybox-1.33.2.tar.bz2 | tar xfj -
$ sudo chmod 777 -R busybox-1.33.2
$ cp conf/busybox-1.33.2-rv64gc.config busybox-1.33.2/.config
$ cd busybox-1.33.2
$ make CROSS_COMPILE=riscv64-unknown-linux-gnu-
$ cd ..
5.3. カーネルルートRAMファイルシステムの作成 / Creating a Kernel Root RAM Filesystem
$ cd ~/litex/linux-on-litex-rocket
$ mkdir initramfs
$ pushd initramfs
$ mkdir -p bin sbin lib etc dev home proc sys tmp mnt nfs root usr/bin usr/sbin usr/lib
$ cp ../busybox-1.33.2/busybox bin/
$ ln -s bin/busybox ./init
$ cat > etc/inittab <<- "EOT"
::sysinit:/bin/busybox mount -t proc proc /proc
::sysinit:/bin/busybox mount -t devtmpfs devtmpfs /dev
::sysinit:/bin/busybox mount -t tmpfs tmpfs /tmp
::sysinit:/bin/busybox mount -t sysfs sysfs /sys
::sysinit:/bin/busybox --install -s
/dev/console::sysinit:-/bin/ash
EOT
$ fakeroot <<- "EOT"
find . | cpio -H newc -o > ../initramfs.cpio
EOT
$ popd
5.4. カーネルの構築
$ cd ~/litex/linux-on-litex-rocket
$ git clone https://github.com/litex-hub/linux.git
$ cp initramfs.cpio linux/
$ pushd linux
$ git checkout litex-rebase
カーネルコンフィグでCONFIG_RISCV_SBI_V01を有効化する/ Enable CONFIG_RISCV_SBI_V01 in kernel config
$ echo "CONFIG_RISCV_SBI_V01=y" >> ./arch/riscv/configs/litex_rocket_defconfig
カーネルをビルドする
$ make clean
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- litex_rocket_defconfig litex_rocket_initramfs.config
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
$ popd
5.5. DTSファイルの更新
UARTのベースアドレスを検索します:
$ grep "CSR_UART_BASE" "$HOME/litex/build/digilent_arty/software/include/generated/csr.h"
例)UARTのベースアドレスは、以下のように0x12006800
となります(CSR_BASE
は0x12000000
):
#define CSR_UART_BASE (CSR_BASE + 0x6800L)
DTSファイルのUARTベースアドレスを変更します(必要な場合):
(DTSファイルの現在のUARTベース・アドレスは0x12004000
です。0x12006800
に変更されます)
$ cd ~/litex/linux-on-litex-rocket
$ sed -i 's/12004000/12006800/g' conf/arty.dts
そうすると、arty.dts
は次のようになります:
...
bootargs = "console=liteuart earlycon=liteuart,0x12006800 swiotlb=noforce";
...
liteuart0: serial@0x12006800 {
compatible = "litex,liteuart";
reg = <0x12006800 0x100>;
interrupt-parent = <&L1>;
interrupts = <1>;
};
...
参考:
Option in building gateware | UART base address |
---|---|
--with-ethernet | 0x12004000 |
--with-sdcard | 0x12005800 |
--with-sdcard --with-pmod-gpio | 0x12006000 |
--with-ethernet --with-sdcard | 0x12006800 |
5.6. LiteXブートイメージの構築
$ cd ~/litex/linux-on-litex-rocket
$ git clone https://github.com/riscv/riscv-pk
$ mkdir riscv-pk/build
$ pushd riscv-pk/build
$ make clean
$ rm -f *
$ ../configure --host=riscv64-unknown-linux-gnu \
--with-arch=rv64imac \
--with-payload=../../linux/vmlinux \
--with-dts=../../conf/arty.dts \
--enable-logo
$ make bbl
$ riscv64-unknown-linux-gnu-objcopy -O binary bbl ../../boot.bin
$ popd
出力ファイル(LiteXブートイメージ):
~/litex/linux-on-litex-rocket/boot.bin
5.7 ビルドソフトウェアの動画
6. Litex+RocketでLinuxを起動する
6.1 LiteXブートイメージの準備
6.1.1. OPTION 1: MicroSDカードを使ってLiteXブートイメージをロードする
- microSDカードのパーティションテーブルを作成します(/dev/sdXをmicroSDカードと仮定):
$ sudo fdisk /dev/sdX
: o // 新しい空のDOSパーティションテーブルを作成する / Create a new empty DOS partition table
: n // 新しいパーティションを作成する / Create a new partition
: p // プライマリパーティションを作成する / Create a primary partition
: 1 // パーティション番号を指定する / Specify partition number
: (Enter) // 第1セクターを指定する(デフォルト)Specify first sector (default)
: +1GiB // 最後のセクタを指定する / Specify last sector
: t // 領域のシステム ID を指定する / Specify the system ID of the region
: 6 // システム ID を FAT16 に設定する / Set system ID to FAT16
: p // パーティションテーブルを表示する / Show partition table
: w // パーティションテーブルを書き込む / Write partition table
実行すると、以下のようになります:
$ sudo fdisk /dev/sdX
Welcome to fdisk (util-linux 2.35.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/sdX: 29.74 GiB, 31914983424 bytes, 62333952 sectors
Disk model: SD/MMC
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x67f480f9
Device Boot Start End Sectors Size Id Type
/dev/sdX1 2048 2099199 2097152 1G 6 FAT16
...
- パーティションをフォーマットしてマウントし、
boot.bin
をコピーします:
$ cd ~/litex/linux-on-litex-rocket
$ sudo su
# mkdosfs /dev/sdX1
# mount /dev/sdX1 /mnt
# cp boot.bin /mnt
# umount /mnt
# exit
6.1.2. OPTION 2: TFTPサーバーを使用してLiteXブートイメージをロードする
ボードのイーサネットポートをスイッチ/ルーターポートに接続し、TFTPサーバーとして動作するマシンと同じレイヤー2ブロードキャストドメイン(つまり、同じLAN上)に配置します。TFTPディレクトリに boot.bin
があることを確認し、TFTPサーバ(systemdを使う場合はソケット)が起動していることを確認します:
$ cd ~/litex/linux-on-litex-rocket
$ sudo cp boot.bin /var/lib/tftpboot/
$ sudo systemctl start tftp.socket
また、TFTPサーバーがIPアドレス192.168.1.100
に送られたリクエストに応答することを確認します。
microSDスロットが空であることを確認する(ハードコードされたBIOSの起動順でイーサネットより優先されるため)。
6.2. システムのコンソールに接続する
システムのコンソールに接続するには、screen
ユーティリティを使用します(以下、/dev/ttyUSB1
が使用されていると仮定):
$ screen /dev/ttyUSB1 115200
6.3. FPGAのプログラミングとブート
ボードをプログラムする(Build Gatewareに内蔵されているGatewareで):
$ cd ~/litex
$ litex-boards/litex_boards/targets/digilent_arty.py --load
microSDカードまたはTFTPで boot.bin
をコピーし、コンソールでBBL、Linux、BusyBoxのシェルの順で起動する予定です。
6.3.1. SD Card:
[1m __ _ __ _ __[0m
[1m / / (_) /____ | |/_/[0m
[1m / /__/ / __/ -_)> <[0m
[1m /____/_/\__/\__/_/|_|[0m
[1m Build your hardware, easily![0m
(c) Copyright 2012-2022 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 11 2023 11:49:46
BIOS CRC passed (c7f0f0fc)
LiteX git sha1: e1f847ef
--=============== [1mSoC[0m ==================--
[1mCPU[0m: RocketRV64[imac] @ 50MHz
[1mBUS[0m: WISHBONE 32-bit @ 4GiB
[1mCSR[0m: 32-bit data
[1mROM[0m: 128.0KiB
[1mSRAM[0m: 8.0KiB
[1mSDRAM[0m: 256.0MiB 16-bit @ 400MT/s (CL-7 CWL-5)
[1mMAIN-RAM[0m: 256.0MiB
--========== [1mInitialization[0m ============--
Ethernet init...
Initializing SDRAM @0x80000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000000000000000000000000000| delays: -
m0, b01: |01111111111111111111111111111110| delays: 15+-14
m0, b02: |00000000000000000000000000000000| delays: -
m0, b03: |00000000000000000000000000000000| delays: -
m0, b04: |00000000000000000000000000000000| delays: -
m0, b05: |00000000000000000000000000000000| delays: -
m0, b06: |00000000000000000000000000000000| delays: -
m0, b07: |00000000000000000000000000000000| delays: -
best: m0, b01 delays: 15+-14
m1, b00: |00000000000000000000000000000000| delays: -
m1, b01: |01111111111111111111111111111110| delays: 15+-14
m1, b02: |00000000000000000000000000000000| delays: -
m1, b03: |00000000000000000000000000000000| delays: -
m1, b04: |00000000000000000000000000000000| delays: -
m1, b05: |00000000000000000000000000000000| delays: -
m1, b06: |00000000000000000000000000000000| delays: -
m1, b07: |00000000000000000000000000000000| delays: -
best: m1, b01 delays: 15+-14
Switching SDRAM to hardware control.
Memtest at 0x80000000 (2.0MiB)...
Write: 0x80000000-0x80000000 0B
Write: 0x80000000-0x80020000 128.0KiB
Write: 0x80000000-0x80040000 256.0KiB
Write: 0x80000000-0x80060000 384.0KiB
Write: 0x80000000-0x80080000 512.0KiB
Write: 0x80000000-0x800a0000 640.0KiB
Write: 0x80000000-0x800c0000 768.0KiB
Write: 0x80000000-0x800e0000 896.0KiB
Write: 0x80000000-0x80100000 1.0MiB
Write: 0x80000000-0x80120000 1.1MiB
Write: 0x80000000-0x80140000 1.2MiB
Write: 0x80000000-0x80160000 1.3MiB
Write: 0x80000000-0x80180000 1.5MiB
Write: 0x80000000-0x801a0000 1.6MiB
Write: 0x80000000-0x801c0000 1.7MiB
Write: 0x80000000-0x801e0000 1.8MiB
Write: 0x80000000-0x80200000 2.0MiB
Read: 0x80000000-0x80000000 0B
Read: 0x80000000-0x80020000 128.0KiB
Read: 0x80000000-0x80040000 256.0KiB
Read: 0x80000000-0x80060000 384.0KiB
Read: 0x80000000-0x80080000 512.0KiB
Read: 0x80000000-0x800a0000 640.0KiB
Read: 0x80000000-0x800c0000 768.0KiB
Read: 0x80000000-0x800e0000 896.0KiB
Read: 0x80000000-0x80100000 1.0MiB
Read: 0x80000000-0x80120000 1.1MiB
Read: 0x80000000-0x80140000 1.2MiB
Read: 0x80000000-0x80160000 1.3MiB
Read: 0x80000000-0x80180000 1.5MiB
Read: 0x80000000-0x801a0000 1.6MiB
Read: 0x80000000-0x801c0000 1.7MiB
Read: 0x80000000-0x801e0000 1.8MiB
Read: 0x80000000-0x80200000 2.0MiB
Memtest OK
Memspeed at 0x80000000 (Sequential, 2.0MiB)...
Write speed: 37.9MiB/s
Read speed: 54.3MiB/s
--============== [1mBoot[0m ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Booting from SDCard in SD-Mode...
Booting from boot.json...
boot.json file not found.
Booting from boot.bin...
Copying boot.bin to 0x80000000 (17922920 bytes)...
[ ]
[########################################
Executing booted program at 0x80000000
--============= [1mLiftoff![0m ===============--
bbl loader
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvvvv rr
rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr
rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr
rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr
rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr
rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr
rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr
rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr
INSTRUCTION SETS WANT TO BE FREE
[ 0.000000] Linux version 6.2.0-rc6-314526-g4368aad2af2b-dirty (shc@ubuntu) (riscv64-unknown-linux-gnu-gcc (g2ee5e430018) 12.2.0, GNU ld (GNU Binutils) 2.39) #34 SMP Sun Mar 5 18:53:58 JST 2023
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Machine model: freechips,rocketchip-unknown
[ 0.000000] earlycon: liteuart0 at I/O port 0x0 (options '')
[ 0.000000] Malformed early option 'console'
[ 0.000000] earlycon: liteuart0 at MMIO 0x0000000012006800 (options '')
[ 0.000000] printk: bootconsole [liteuart0] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] SBI specification v0.1 detected
[ 0.000000] riscv: base ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: Embedded 14 pages/cpu s25320 r0 d32024 u57344
[ 0.000000] pcpu-alloc: s25320 r0 d32024 u57344 alloc=14*4096
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 64008
[ 0.000000] Kernel command line: console=liteuart earlycon=liteuart,0x12006800 swiotlb=noforce
[ 0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[ 0.000000] Memory: 239148K/260096K available (4843K kernel code, 4015K rwdata, 2048K rodata, 2878K init, 366K bss, 20948K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 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 8 interrupts with 1 handlers for 2 contexts.
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 7052723233920 ns
[ 0.000044] sched_clock: 64 bits at 500kHz, resolution 2000ns, wraps every 4398046511000ns
[ 0.014086] Console: colour dummy device 128x32
[ 0.018384] Calibrating delay loop (skipped), value calculated using timer frequency.. 1.00 BogoMIPS (lpj=5000)
[ 0.028422] pid_max: default: 32768 minimum: 301
[ 0.036322] LSM: initializing lsm=capability,integrity
[ 0.046174] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.053262] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.150992] cblist_init_generic: Setting adjustable number of callback queues.
[ 0.157854] cblist_init_generic: Setting shift to 0 and lim to 1.
[ 0.169374] riscv: ELF compat mode unsupported
[ 0.169752] ASID allocator disabled (0 bits)
[ 0.184590] rcu: Hierarchical SRCU implementation.
[ 0.188386] rcu: Max phase no-delay instances is 1000.
[ 0.207128] EFI services will not be available.
[ 0.217412] smp: Bringing up secondary CPUs ...
[ 0.220950] smp: Brought up 1 node, 1 CPU
[ 0.241748] devtmpfs: initialized
[ 0.301642] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.311542] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.375634] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.387194] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[ 0.394154] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.524034] pps_core: LinuxPPS API ver. 1 registered
[ 0.528598] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti
[ 0.538040] PTP clock support registered
[ 0.575772] clocksource: Switched to clocksource riscv_clocksource
[ 0.996518] NET: Registered PF_INET protocol family
[ 1.009064] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 1.046762] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.055374] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 1.062640] TCP established hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 1.071804] TCP bind hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 1.084704] TCP: Hash tables configured (established 2048 bind 2048)
[ 1.093312] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 1.100190] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 1.111400] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 1.315482] workingset: timestamp_bits=46 max_order=16 bucket_order=0
[ 1.441506] LiteX SoC Controller driver initialized
[ 5.033542] 12006800.serial: ttyLXU0 at MMIO 0x0 (irq = 0, base_baud = 0) is a liteuart
[ 5.046656] printk: console [liteuart0] enabled
[ 5.046656] printk: console [liteuart0] enabled
[ 5.055354] printk: bootconsole [liteuart0] disabled
[ 5.055354] printk: bootconsole [liteuart0] disabled
[ 5.305766] loop: module loaded
[ 5.890194] liteeth 12001000.mac eth0: irq 1 slots: tx 2 rx 2 size 2048
[ 5.916542] NET: Registered PF_INET6 protocol family
[ 5.970540] Segment Routing with IPv6
[ 5.977042] In-situ OAM (IOAM) with IPv6
[ 5.982838] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 6.016568] NET: Registered PF_PACKET protocol family
[ 6.776552] Warning: unable to open an initial console.
[ 6.887680] Freeing unused kernel image (initmem) memory: 2876K
[ 6.897770] Run /init as init process
[ 6.900452] with arguments:
[ 6.903404] /init
[ 6.906180] with environment:
[ 6.908790] HOME=/
[ 6.911126] TERM=linux
# uname -a
Linux litex 6.2.0-rc6-314526-g4368aad2af2b-dirty #34 SMP Sun Mar 5 18:53:58 JST 2023 riscv64 GNU/Linux
# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 116.8M 1.1M 115.7M 1% /
devtmpfs 116.8M 0 116.8M 0% /dev
tmpfs 118.2M 0 118.2M 0% /tmp
# ls -l
drwxr-xr-x 2 0 0 1120 Jan 1 00:00 bin
drwxr-xr-x 2 0 0 12400 Jan 1 00:00 dev
drwxr-xr-x 2 0 0 60 Mar 5 2023 etc
drwxr-xr-x 2 0 0 40 Mar 5 2023 home
lrwxrwxrwx 1 0 0 11 Mar 5 2023 init -> bin/busybox
drwxr-xr-x 2 0 0 40 Mar 5 2023 lib
lrwxrwxrwx 1 0 0 12 Jan 1 00:00 linuxrc -> /bin/busybox
drwxr-xr-x 2 0 0 40 Mar 5 2023 mnt
drwxr-xr-x 2 0 0 40 Mar 5 2023 nfs
dr-xr-xr-x 91 0 0 0 Jan 1 00:00 proc
drwxr-xr-x 2 0 0 40 Mar 5 2023 root
drwxr-xr-x 2 0 0 620 Jan 1 00:00 sbin
dr-xr-xr-x 11 0 0 0 Jan 1 00:00 sys
drwxrwxrwt 2 0 0 40 Jan 1 00:00 tmp
drwxr-xr-x 5 0 0 100 Mar 5 2023 usr
#
6.3.2. Netboot (TFTP):
ネットワークからLiteXのブートイメージを読み込むのに少し時間がかかります。(1時間30分程度)
[1m __ _ __ _ __[0m
[1m / / (_) /____ | |/_/[0m
[1m / /__/ / __/ -_)> <[0m
[1m /____/_/\__/\__/_/|_|[0m
[1m Build your hardware, easily![0m
(c) Copyright 2012-2023 Enjoy-Digital
(c) Copyright 2007-2015 M-Labs
BIOS built on Mar 12 2023 15:26:52
BIOS CRC passed (5a795c2d)
LiteX git sha1: 67e8d774
--=============== [1mSoC[0m ==================--
[1mCPU[0m: RocketRV64[imac] @ 50MHz
[1mBUS[0m: WISHBONE 32-bit @ 4GiB
[1mCSR[0m: 32-bit data
[1mROM[0m: 128.0KiB
[1mSRAM[0m: 8.0KiB
[1mSDRAM[0m: 256.0MiB 16-bit @ 400MT/s (CL-7 CWL-5)
[1mMAIN-RAM[0m: 256.0MiB
--========== [1mInitialization[0m ============--
Ethernet init...
Initializing SDRAM @0x80000000...
Switching SDRAM to software control.
Read leveling:
m0, b00: |00000000000000000000000000000000| delays: -
m0, b01: |01111111111111111111111111111100| delays: 15+-14
m0, b02: |00000000000000000000000000000000| delays: -
m0, b03: |00000000000000000000000000000000| delays: -
m0, b04: |00000000000000000000000000000000| delays: -
m0, b05: |00000000000000000000000000000000| delays: -
m0, b06: |00000000000000000000000000000000| delays: -
m0, b07: |00000000000000000000000000000000| delays: -
best: m0, b01 delays: 15+-14
m1, b00: |00000000000000000000000000000000| delays: -
m1, b01: |01111111111111111111111111111110| delays: 15+-14
m1, b02: |00000000000000000000000000000000| delays: -
m1, b03: |00000000000000000000000000000000| delays: -
m1, b04: |00000000000000000000000000000000| delays: -
m1, b05: |00000000000000000000000000000000| delays: -
m1, b06: |00000000000000000000000000000000| delays: -
m1, b07: |00000000000000000000000000000000| delays: -
best: m1, b01 delays: 15+-14
Switching SDRAM to hardware control.
Memtest at 0x80000000 (2.0MiB)...
Write: 0x80000000-0x80000000 0B
Write: 0x80000000-0x80020000 128.0KiB
Write: 0x80000000-0x80040000 256.0KiB
Write: 0x80000000-0x80060000 384.0KiB
Write: 0x80000000-0x80080000 512.0KiB
Write: 0x80000000-0x800a0000 640.0KiB
Write: 0x80000000-0x800c0000 768.0KiB
Write: 0x80000000-0x800e0000 896.0KiB
Write: 0x80000000-0x80100000 1.0MiB
Write: 0x80000000-0x80120000 1.1MiB
Write: 0x80000000-0x80140000 1.2MiB
Write: 0x80000000-0x80160000 1.3MiB
Write: 0x80000000-0x80180000 1.5MiB
Write: 0x80000000-0x801a0000 1.6MiB
Write: 0x80000000-0x801c0000 1.7MiB
Write: 0x80000000-0x801e0000 1.8MiB
Write: 0x80000000-0x80200000 2.0MiB
Read: 0x80000000-0x80000000 0B
Read: 0x80000000-0x80020000 128.0KiB
Read: 0x80000000-0x80040000 256.0KiB
Read: 0x80000000-0x80060000 384.0KiB
Read: 0x80000000-0x80080000 512.0KiB
Read: 0x80000000-0x800a0000 640.0KiB
Read: 0x80000000-0x800c0000 768.0KiB
Read: 0x80000000-0x800e0000 896.0KiB
Read: 0x80000000-0x80100000 1.0MiB
Read: 0x80000000-0x80120000 1.1MiB
Read: 0x80000000-0x80140000 1.2MiB
Read: 0x80000000-0x80160000 1.3MiB
Read: 0x80000000-0x80180000 1.5MiB
Read: 0x80000000-0x801a0000 1.6MiB
Read: 0x80000000-0x801c0000 1.7MiB
Read: 0x80000000-0x801e0000 1.8MiB
Read: 0x80000000-0x80200000 2.0MiB
Memtest OK
Memspeed at 0x80000000 (Sequential, 2.0MiB)...
Write speed: 37.9MiB/s
Read speed: 54.3MiB/s
--============== [1mBoot[0m ==================--
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
Timeout
Booting from SDCard in SD-Mode...
Booting from boot.json...
Booting from boot.bin...
SDCard boot failed.
Booting from network...
Local IP: 192.168.1.50
Remote IP: 192.168.1.100
Booting from boot.json...
Booting from boot.bin...
Copying boot.bin to 0x80000000... \|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|(17922920 bytes)
Executing booted program at 0x80000000
--============= [1mLiftoff![0m ===============--
bbl loader
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
vvvvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvv
rr vvvvvvvvvvvvvvvvvvvvvvvv rr
rrrr vvvvvvvvvvvvvvvvvvvvvvvvvv rrrr
rrrrrr vvvvvvvvvvvvvvvvvvvvvv rrrrrr
rrrrrrrr vvvvvvvvvvvvvvvvvv rrrrrrrr
rrrrrrrrrr vvvvvvvvvvvvvv rrrrrrrrrr
rrrrrrrrrrrr vvvvvvvvvv rrrrrrrrrrrr
rrrrrrrrrrrrrr vvvvvv rrrrrrrrrrrrrr
rrrrrrrrrrrrrrrr vv rrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrrrr
INSTRUCTION SETS WANT TO BE FREE
[ 0.000000] Linux version 6.2.0-rc6-314526-g4368aad2af2b-dirty (shc@ubuntu) (riscv64-unknown-linux-gnu-gcc (g2ee5e430018) 12.2.0, GNU ld (GNU Binutils) 2.39) #34 SMP Sun Mar 5 18:53:58 JST 2023
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Machine model: freechips,rocketchip-unknown
[ 0.000000] earlycon: liteuart0 at I/O port 0x0 (options '')
[ 0.000000] Malformed early option 'console'
[ 0.000000] earlycon: liteuart0 at MMIO 0x0000000012006800 (options '')
[ 0.000000] printk: bootconsole [liteuart0] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] Normal empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x000000008fffffff]
[ 0.000000] SBI specification v0.1 detected
[ 0.000000] riscv: base ISA extensions acdfim
[ 0.000000] riscv: ELF capabilities acdfim
[ 0.000000] percpu: Embedded 14 pages/cpu s25320 r0 d32024 u57344
[ 0.000000] pcpu-alloc: s25320 r0 d32024 u57344 alloc=14*4096
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 64008
[ 0.000000] Kernel command line: console=liteuart earlycon=liteuart,0x12006800 swiotlb=noforce
[ 0.000000] Dentry cache hash table entries: 32768 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:all(zero), heap alloc:off, heap free:off
[ 0.000000] Memory: 239148K/260096K available (4843K kernel code, 4015K rwdata, 2048K rodata, 2878K init, 366K bss, 20948K reserved, 0K cma-reserved)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
[ 0.000000] Tracing variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 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 8 interrupts with 1 handlers for 2 contexts.
[ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 7052723233920 ns
[ 0.000044] sched_clock: 64 bits at 500kHz, resolution 2000ns, wraps every 4398046511000ns
[ 0.014088] Console: colour dummy device 128x32
[ 0.018384] Calibrating delay loop (skipped), value calculated using timer frequency.. 1.00 BogoMIPS (lpj=5000)
[ 0.028424] pid_max: default: 32768 minimum: 301
[ 0.036322] LSM: initializing lsm=capability,integrity
[ 0.046174] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.053264] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 0.150898] cblist_init_generic: Setting adjustable number of callback queues.
[ 0.157760] cblist_init_generic: Setting shift to 0 and lim to 1.
[ 0.169280] riscv: ELF compat mode unsupported
[ 0.169658] ASID allocator disabled (0 bits)
[ 0.184496] rcu: Hierarchical SRCU implementation.
[ 0.188292] rcu: Max phase no-delay instances is 1000.
[ 0.207034] EFI services will not be available.
[ 0.217320] smp: Bringing up secondary CPUs ...
[ 0.220856] smp: Brought up 1 node, 1 CPU
[ 0.241718] devtmpfs: initialized
[ 0.301632] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.311528] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[ 0.375610] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[ 0.387162] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
[ 0.394120] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[ 0.523988] pps_core: LinuxPPS API ver. 1 registered
[ 0.528552] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti
[ 0.537992] PTP clock support registered
[ 0.575732] clocksource: Switched to clocksource riscv_clocksource
[ 0.996586] NET: Registered PF_INET protocol family
[ 1.009126] IP idents hash table entries: 4096 (order: 3, 32768 bytes, linear)
[ 1.046806] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.055400] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 1.062670] TCP established hash table entries: 2048 (order: 2, 16384 bytes, linear)
[ 1.071834] TCP bind hash table entries: 2048 (order: 4, 65536 bytes, linear)
[ 1.085306] TCP: Hash tables configured (established 2048 bind 2048)
[ 1.093336] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 1.100214] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[ 1.111424] NET: Registered PF_UNIX/PF_LOCAL protocol family
[ 1.315472] workingset: timestamp_bits=46 max_order=16 bucket_order=0
[ 1.441522] LiteX SoC Controller driver initialized
[ 5.033496] 12006800.serial: ttyLXU0 at MMIO 0x0 (irq = 0, base_baud = 0) is a liteuart
[ 5.046610] printk: console [liteuart0] enabled
[ 5.046610] printk: console [liteuart0] enabled
[ 5.055304] printk: bootconsole [liteuart0] disabled
[ 5.055304] printk: bootconsole [liteuart0] disabled
[ 5.305662] loop: module loaded
[ 5.890132] liteeth 12001000.mac eth0: irq 1 slots: tx 2 rx 2 size 2048
[ 5.916484] NET: Registered PF_INET6 protocol family
[ 5.970470] Segment Routing with IPv6
[ 5.976972] In-situ OAM (IOAM) with IPv6
[ 5.982768] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 6.016506] NET: Registered PF_PACKET protocol family
[ 6.776514] Warning: unable to open an initial console.
[ 6.887650] Freeing unused kernel image (initmem) memory: 2876K
[ 6.897740] Run /init as init process
[ 6.900422] with arguments:
[ 6.903374] /init
[ 6.906142] with environment:
[ 6.908760] HOME=/
[ 6.911096] TERM=linux
# unamme -a
-/bin/ash: unamme: not found
# uname -a
Linux litex 6.2.0-rc6-314526-g4368aad2af2b-dirty #34 SMP Sun Mar 5 18:53:58 JST 2023 riscv64 GNU/Linux
# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 116.8M 1.1M 115.7M 1% /
devtmpfs 116.8M 0 116.8M 0% /dev
tmpfs 118.2M 0 118.2M 0% /tmp
# ls -l
drwxr-xr-x 2 0 0 1120 Jan 1 00:00 bin
drwxr-xr-x 2 0 0 12400 Jan 1 00:00 dev
drwxr-xr-x 2 0 0 60 Mar 5 2023 etc
drwxr-xr-x 2 0 0 40 Mar 5 2023 home
lrwxrwxrwx 1 0 0 11 Mar 5 2023 init -> bin/busybox
drwxr-xr-x 2 0 0 40 Mar 5 2023 lib
lrwxrwxrwx 1 0 0 12 Jan 1 00:00 linuxrc -> /bin/busybox
drwxr-xr-x 2 0 0 40 Mar 5 2023 mnt
drwxr-xr-x 2 0 0 40 Mar 5 2023 nfs
dr-xr-xr-x 90 0 0 0 Jan 1 00:00 proc
drwxr-xr-x 2 0 0 40 Mar 5 2023 root
drwxr-xr-x 2 0 0 620 Jan 1 00:00 sbin
dr-xr-xr-x 11 0 0 0 Jan 1 00:00 sys
drwxrwxrwt 2 0 0 40 Jan 1 00:00 tmp
drwxr-xr-x 5 0 0 100 Mar 5 2023 usr
#