logo

blog

My website can't be that messy, right? git clone https://anongit.hacktivis.me/git/blog.git/

starfive_visionfive2.xhtml (3459B)


  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <!--#include file="/templates/head.shtml" -->
  5. <title>Notes: StarFive VisionFive2 — lanodan’s cyber-home</title>
  6. </head>
  7. <body>
  8. <!--#include file="/templates/en/nav.shtml" -->
  9. <main>
  10. <h1>Notes: StarFive VisionFive2</h1>
  11. <p>SoC Mainlining status: <a href="https://rvspace.org/en/project/JH7110_Upstream_Plan">JH7110 Upstream Status</a></p>
  12. <h2>bootchip</h2>
  13. <dl>
  14. <dt>OpenSBI</dt>
  15. <dd><a href="https://github.com/riscv-software-src/opensbi">https://github.com/riscv-software-src/opensbi</a></dd>
  16. <dt>U-Boot</dt>
  17. <dd><a href="https://docs.u-boot.org/en/latest/build/source.html">Obtaining the source</a> ; <a href="https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html">VisionFive2 Documentation</a></dd>
  18. </dl>
  19. <p>
  20. In u-boot: <code>make starfive_visionfive2_defconfig</code> then <code>make</code><br />
  21. If you want to configure how u-boot gets built, there is <code>make menuconfig</code>
  22. </p>
  23. <p>
  24. In OpenSBI, create &amp; execute a build script like this one, using u-boot as a payload for OpenSBI:
  25. </p>
  26. <pre><code><![CDATA[#!/bin/sh
  27. set -ex
  28. uboot_dir="${HOME}/Sources/source.denx.de/u-boot/u-boot/"
  29. uboot_bin="${uboot_dir}/u-boot.bin"
  30. uboot_dtb="${uboot_dir}/arch/riscv/dts/jh7110-starfive-visionfive-2.dtb"
  31. make PLATFORM=generic FW_PAYLOAD_PATH="${uboot_bin}" FW_FDT_PATH="${uboot_dtb}" FW_TEXT_START=0x40000000
  32. ]]></code></pre>
  33. <p>
  34. Then, back to u-boot:
  35. <ol>
  36. <li><code>wget https://github.com/starfive-tech/Tools/raw/0747c0510e090f69bf7d2884f44903b77b3db5c5/uboot_its/visionfive2-uboot-fit-image.its</code></li>
  37. <li><code>ln -s ~/Sources/github.com/riscv-software-src/opensbi//build/platform/generic/firmware/fw_payload.bin ./</code></li>
  38. <li><code>./tools/mkimage -f visionfive2-uboot-fit-image.its -A riscv -O u-boot -T firmware visionfive2_fw_payload.img</code></li>
  39. </ol>
  40. </p>
  41. <p>
  42. Finally, you can flash:
  43. <ol>
  44. <li><code>flashcp -v spl/u-boot-spl.bin.normal.out mtd:spl</code></li>
  45. <li><code>flashcp -v visionfive2_fw_payload.img mtd:uboot</code></li>
  46. </ol>
  47. </p>
  48. <h3>extlinux/extlinux.conf</h3>
  49. <p>
  50. No need to have anything flashed on SD/eMMC/NVMe like on x86-pc (MBR) or most other boards.
  51. U-Boot flashed on the bootchip will by default search for an <code>(/boot)/extlinux/extlinux.conf</code> file in a FAT or ext[34] filesystem.
  52. <br />
  53. See <a href="https://docs.u-boot.org/en/latest/develop/bootstd/overview.html">Standard Boot Overview - Das U-Boot documentation</a>
  54. and <a href="https://docs.u-boot.org/en/latest/develop/distro.html">Generic Distro Configuration Concept - Das U-Boot documentation</a>.
  55. </p>
  56. <p>
  57. For example with Alpine main system installed in a ZFS filesystem and <code>/boot</code> as ext4/fat/…:
  58. </p>
  59. <pre><code><![CDATA[menu title StarFive VisionFive
  60. timeout 50
  61. default lts
  62. label lts
  63. menu label Alpine LTS
  64. kernel /vmlinuz-lts
  65. initrd /initramfs-lts
  66. fdtdir /dtbs-lts/
  67. append earlycon=sbi rw root=panda/ROOT/alpine-edge rootfstype=zfs console=ttyS0,115200 console=tty0
  68. label edge
  69. menu label Alpine edge
  70. kernel /vmlinuz-edge
  71. initrd /initramfs-edge
  72. fdtdir /dtbs-edge/
  73. append earlycon=sbi rw root=panda/ROOT/alpine-edge rootfstype=zfs console=ttyS0,115200 console=tty0
  74. ]]></code></pre>
  75. </main>
  76. <!--#include file="/templates/en/footer.shtml" -->
  77. </body>
  78. </html>