Ports/riscv64: различия между версиями

Материал из ALT Linux Wiki
м (→‎RISC-V: небольшая вычитка)
(Русская версия)
Строка 1: Строка 1:
= '''RISC-V''' =
= '''RISC-V''' =


RISC-V is an [https://riscv.org/risc-v-isa open and free instruction set architecture (ISA)].
RISC-V является [https://riscv.org/risc-v-isa архитектурой с открытым набором комманд (ISA)].
The RISC-V ISA specifications are licensed under a [https://creativecommons.org/licenses/by/4.0/ Creative Commons license (CC BY 4.0)].
ISA RISC-V имеют лицензию [https://creativecommons.org/licenses/by/4.0/ Creative Commons license (CC BY 4.0)].
Anyone could get the final versions of the [https://riscv.org/specifications/ user-level ISA specifications] and drafts
Любой желающий может получить финальную версию [https://riscv.org/specifications/ ISA пользовательского уровня] и
of the [https://riscv.org/specifications/compressed-isa/ compressed] and [https://riscv.org/specifications/privileged-isa/ privileged] ISA specifications.
черновик [https://riscv.org/specifications/privileged-isa/ ISA привилегированного уровня].


Another key feature of the RISC-V architecture that it is scalable and allows multiple implementations. The minimal specification has the
Другая ключевая особенность архитектуры RISC-V - её расширяемость, что позволяет создавать разнообразные реализации.
commands to store and load, jump and integer arithmetic. It supports the 32-, 64- and 128-bit register sizes: "RV32I, RV64I and RV128I" ("I" stands for integer).
Минимальная спецификация архитектуры RISC-V включает в себя только инструкции для записи, сохранения, переходов и
This Linux port runs on "RV64IMAFDC" or "RV64GC" ("G" == "IMAFD"):
целочисленной арифметики. Код инструкций не зависит от размера регистра,
* <tt>'''I'''</tt> - Integer and basic instructions
минимальная спецификация обозначается RV32I, RV64I или RV128I ("I" означает integer) для размеров операнда
* <tt>'''M'''</tt> - Multiply and divide
4, 8 или 16 байт соответственно.
* <tt>'''A'''</tt> - Atomic operations
На данный момент порт Linux работает со спецификацией "RV64IMAFDC" или "RV64GC" ("G" == "IMAFD"):
* <tt>'''F'''</tt> - Single precision floating point
* <tt>'''I'''</tt> - целочисленные базовые инструкции;
* <tt>'''D'''</tt> - Double precision floating point
* <tt>'''M'''</tt> - умножение и деление целых чисел;
* <tt>'''C'''</tt> - Compressed instructions
* <tt>'''A'''</tt> - атомарные операции;
* <tt>'''F'''</tt> - число с плавающей запятой одинарной точности;
* <tt>'''D'''</tt> - число с плавающей запятой двойной точности;
* <tt>'''C'''</tt> - сжатые 16-битные инструкции.


At this page one could find the latest information about ALT port status for the new platform - RISC-V (RV64GC). We're building it on the [https://www.crowdsupply.com/sifive/hifive-unleashed HiFive Unleashed] board from SiFive.
На данной странице можно найти последнюю информацию о статусе порта ALT на RISC-V (RV64GC).
Сборка системы ведётся на плате SiFive [https://www.crowdsupply.com/sifive/hifive-unleashed HiFive Unleashed]


== '''Working plan''' ==
== '''Рабочий план''' ==


* The following Linux kernels have been bare metal tested on SiFive HiFive Unleashed:
* Следующие ядра Linux были протестированы на SiFive HiFive Unleashed:
** 4.15
** 4.15
** 4.19-rc2
** 4.19-rc2
** 4.19.6 ([http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/RPMS.hasher/kernel-image-un-def-4.19.6-alt3.riscv64.rpm image RPM], [http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/SRPMS.hasher/kernel-image-un-def-4.19.6-alt3.src.rpm SRPM], [http://git.altlinux.org/people/arei/packages/kernel-image.git?p=kernel-image.git;a=commit;h=a420ee4217797b60b27ce60fd80a39166ddf2143 git])
** 4.19.6 ([http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/RPMS.hasher/kernel-image-un-def-4.19.6-alt3.riscv64.rpm image RPM], [http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/SRPMS.hasher/kernel-image-un-def-4.19.6-alt3.src.rpm SRPM], [http://git.altlinux.org/people/arei/packages/kernel-image.git?p=kernel-image.git;a=commit;h=a420ee4217797b60b27ce60fd80a39166ddf2143 git])


* BOOT methods:
* Методы загрузки (boot):
** Berkeley bootloader -- '''DONE'''
** Berkeley bootloader -- '''ГОТОВО'''
** U-BOOT ([http://git.altlinux.org/people/lineprinter/public/u-boot.git?p=u-boot.git;a=blob;f=README.alt;hb=HEAD link]) -- '''DONE'''
** U-BOOT ([http://git.altlinux.org/people/lineprinter/public/u-boot.git?p=u-boot.git;a=blob;f=README.alt;hb=HEAD link]) -- '''ГОТОВО'''


* [[Sisyphus]] port -- '''IN PROGRESS'''
* Порт [[Sisyphus]] -- '''В ПРОЦЕССЕ'''
*# Toolchain (see the status above) -- '''DONE'''
*# Toolchain -- '''ГОТОВО'''
*# Linux Kernel -- '''DONE'''
*# Linux Kernel -- '''ГОТОВО'''
*# X11 -- '''DONE'''
*# X11 -- '''ГОТОВО'''
*# Desktop Environments -- '''IN PROGRESS'''
*# Desktop Environments -- '''В ПРОЦЕССЕ'''
* ALT image [[m-p|metaprofile]] -- '''IN PROGRESS'''
* образ ALT [http://sisyphus.ru/en/srpm/Sisyphus/mkimage-profiles metaprofile] -- '''В ПРОЦЕССЕ'''
* [[girar_builder|Girar Builder]] -- '''IN PROGRESS'''
* [http://git.altlinux.org/people/arei/packages/girar.git?p=girar.git;a=shortlog;h=refs/heads/riscvmod Girar Builder] -- '''ГОТОВО'''
* QEMU image ([[#QEMU|see below]]) -- '''DONE'''
* образ для QEMU ([[#QEMU|см. ниже]]) -- '''ГОТОВО'''


One could find the latest rootfs snapshot (Nov 2018) [http://ftp.altlinux.org/pub/people/arei/riscv/rootfs here].
RPM/SRPM репозиторий можно найти по [http://ftp.altlinux.org/pub/distributions/ALTLinux/ports/riscv64/Sisyphus/ этой ссылке].
The RPM/SRPM repository at [http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64 here].


== '''QEMU''' ==
== '''QEMU''' ==
Для запуска порта ALT на RISC-V необходимо установить QEMU с поддержкой riscv64.


You've got to install QEMU with riscv64 support to run ALT RISC-V port on QEMU.
Например, в случае хостовой системы на ALT x86_64: [http://sisyphus.ru/en/srpm/Sisyphus/qemu qemu-system-riscv-core].


In case of the ALT x86_64 host system, for example: [http://sisyphus.ru/en/srpm/Sisyphus/qemu qemu-system-riscv-core].
Также необходимы:
* ALT image -- в процессе
* [http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/RPMS.hasher/kernel-image-qemu-un-def-4.19.6-alt3.noarch.rpm ядро Linux для QEMU]


These bits are needed:
После этого, можно запускать ядро!
* rootfs -- [http://ftp.altlinux.org/pub/people/arei/riscv/qemu/rootfs.raw raw image] or to build a new one there is a [http://ftp.altlinux.org/pub/people/arei/riscv/qemu/rootfs.tgz tgz packed version]
* [http://ftp.altlinux.org/pub/people/arei/riscv/repo/riscv64/RPMS.hasher/kernel-image-qemu-un-def-4.19.6-alt3.noarch.rpm kernel for QEMU]


After these steps are done it's time to run a kernel!
(возможно, что необходимо изменить пути к ядру и rootfs для вашей системы)
 
(one possibly needs to change paths to the kernel and rootfs according to a particular system)
<source lang="shell">
<source lang="shell">
  qemu-system-riscv64 \
  qemu-system-riscv64 \
Строка 62: Строка 64:
</source>
</source>


To log into the shell:
Для входа в shell:
 
Username: root
Username: root
Password: 123
Password: 123


== Useful links: ==
== Полезные ссылки: ==


* [https://github.com/dalegr/riscv-bbl-utils Berkeley bootloader utils] to merge the linux kernel into the bbl.bin with dummy payload.
* [https://github.com/dalegr/riscv-bbl-utils утилиты для Berkeley bootloader] для слияния ядра Linux в bbl.bin с dummy payload.
* [https://riscv.org/specifications RISC-V specifications]
* [https://riscv.org/specifications RISC-V ISA]
* [https://www.sifive.com/blog/all-aboard-part-0-introduction All Aboard] -- cool series of blog posts by Palmer Dabbelt about RISC-V, toolchain, etc.
* [https://www.sifive.com/blog/all-aboard-part-0-introduction All Aboard] -- интересный блог Палмера Даббелта о RISC-V, toolchain, и т.д.
* [http://0x1.tv/20180929H OSSDEVCONF-2018 (in Russian)]
* [http://0x1.tv/20180929H OSSDEVCONF-2018]


[[Категория:Sisyphus]]
[[Категория:Sisyphus]]
{{Category navigation|title=Ports|category=Ports|sortkey=*}}
{{Category navigation|title=Ports|category=Ports|sortkey=*}}

Версия от 16:54, 15 марта 2019

RISC-V

RISC-V является архитектурой с открытым набором комманд (ISA). ISA RISC-V имеют лицензию Creative Commons license (CC BY 4.0). Любой желающий может получить финальную версию ISA пользовательского уровня и черновик ISA привилегированного уровня.

Другая ключевая особенность архитектуры RISC-V - её расширяемость, что позволяет создавать разнообразные реализации. Минимальная спецификация архитектуры RISC-V включает в себя только инструкции для записи, сохранения, переходов и целочисленной арифметики. Код инструкций не зависит от размера регистра, минимальная спецификация обозначается RV32I, RV64I или RV128I ("I" означает integer) для размеров операнда 4, 8 или 16 байт соответственно. На данный момент порт Linux работает со спецификацией "RV64IMAFDC" или "RV64GC" ("G" == "IMAFD"):

  • I - целочисленные базовые инструкции;
  • M - умножение и деление целых чисел;
  • A - атомарные операции;
  • F - число с плавающей запятой одинарной точности;
  • D - число с плавающей запятой двойной точности;
  • C - сжатые 16-битные инструкции.

На данной странице можно найти последнюю информацию о статусе порта ALT на RISC-V (RV64GC). Сборка системы ведётся на плате SiFive HiFive Unleashed

Рабочий план

  • Следующие ядра Linux были протестированы на SiFive HiFive Unleashed:
  • Методы загрузки (boot):
    • Berkeley bootloader -- ГОТОВО
    • U-BOOT (link) -- ГОТОВО
  • Порт Sisyphus -- В ПРОЦЕССЕ
    1. Toolchain -- ГОТОВО
    2. Linux Kernel -- ГОТОВО
    3. X11 -- ГОТОВО
    4. Desktop Environments -- В ПРОЦЕССЕ
  • образ ALT metaprofile -- В ПРОЦЕССЕ
  • Girar Builder -- ГОТОВО
  • образ для QEMU (см. ниже) -- ГОТОВО

RPM/SRPM репозиторий можно найти по этой ссылке.

QEMU

Для запуска порта ALT на RISC-V необходимо установить QEMU с поддержкой riscv64.

Например, в случае хостовой системы на ALT x86_64: qemu-system-riscv-core.

Также необходимы:

После этого, можно запускать ядро!

(возможно, что необходимо изменить пути к ядру и rootfs для вашей системы)

 qemu-system-riscv64 \
  -nographic -machine virt -kernel /boot/vmlinux-4.19.6-un-def-alt3 \
  -drive file=rootfs.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
  -append "earlyprintk root=/dev/vda rootwait fastboot console=ttyS0 debug sunrpc.debug STOP=udev" \
  -netdev user,id=eth0 -device virtio-net-device,netdev=eth0

Для входа в shell:

Username: root

Password: 123

Полезные ссылки: