logo

blog

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

starfive_visionfive2.xhtml (3048B)


  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. <h2>bootchip</h2>
  12. <dl>
  13. <dt>OpenSBI</dt>
  14. <dd><a href="https://github.com/riscv-software-src/opensbi">https://github.com/riscv-software-src/opensbi</a></dd>
  15. <dt>U-Boot</dt>
  16. <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>
  17. </dl>
  18. <p>
  19. In u-boot: <code>make starfive_visionfive2_defconfig</code> then <code>make</code><br />
  20. If you want to configure how u-boot gets built, there is <code>make menuconfig</code>
  21. </p>
  22. <p>
  23. In OpenSBI, create &amp; execute a build script like this one, using u-boot as a payload for OpenSBI:
  24. </p>
  25. <pre><code><![CDATA[#!/bin/sh
  26. set -ex
  27. uboot_dir="${HOME}/Sources/source.denx.de/u-boot/u-boot/"
  28. uboot_bin="${uboot_dir}/u-boot.bin"
  29. uboot_dtb="${uboot_dir}/arch/riscv/dts/jh7110-starfive-visionfive-2.dtb"
  30. make PLATFORM=generic FW_PAYLOAD_PATH="${uboot_bin}" FW_FDT_PATH="${uboot_dtb}" FW_TEXT_START=0x40000000
  31. ]]></code></pre>
  32. <p>
  33. Then, back to u-boot:
  34. <ol>
  35. <li><code>wget https://github.com/starfive-tech/Tools/raw/0747c0510e090f69bf7d2884f44903b77b3db5c5/uboot_its/visionfive2-uboot-fit-image.its</code></li>
  36. <li><code>ln -s ~/Sources/github.com/riscv-software-src/opensbi//build/platform/generic/firmware/fw_payload.bin ./</code></li>
  37. <li><code>./tools/mkimage -f visionfive2-uboot-fit-image.its -A riscv -O u-boot -T firmware visionfive2_fw_payload.img</code></li>
  38. </ol>
  39. </p>
  40. <p>
  41. Finally, you can flash:
  42. <ol>
  43. <li><code>flashcp -v spl/u-boot-spl.bin.normal.out mtd:spl</code></li>
  44. <li><code>flashcp -v visionfive2_fw_payload.img mtd:uboot</code></li>
  45. </ol>
  46. </p>
  47. <h3>extlinux.conf</h3>
  48. <p>
  49. No need to have it flashed as MBR like on x86, just have it present into a FAT or ext{3,4} filesystem, u-boot will then use it as configuration.
  50. </p>
  51. <pre><code><![CDATA[menu title StarFive VisionFive
  52. timeout 50
  53. default lts
  54. label starfive
  55. menu label Alpine visionfive V2
  56. kernel /vmlinuz-starfive
  57. initrd /initramfs-starfive
  58. fdtdir /dtbs-starfive/
  59. append earlycon=sbi rw root=panda/ROOT/alpine-edge rootfstype=zfs console=ttyS0,115200 console=tty0
  60. label lts
  61. menu label Alpine LTS
  62. kernel /vmlinuz-lts
  63. initrd /initramfs-lts
  64. fdtdir /dtbs-lts/
  65. append earlycon=sbi rw root=panda/ROOT/alpine-edge rootfstype=zfs console=ttyS0,115200 console=tty0
  66. label edge
  67. menu label Alpine edge
  68. kernel /vmlinuz-edge
  69. initrd /initramfs-edge
  70. fdtdir /dtbs-edge/
  71. append earlycon=sbi rw root=panda/ROOT/alpine-edge rootfstype=zfs console=ttyS0,115200 console=tty0
  72. ]]></code></pre>
  73. </main>
  74. <!--#include file="/templates/en/footer.shtml" -->
  75. </body>
  76. </html>