<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Opensbi on SROEMER</title>
    <link>/tags/opensbi/</link>
    <description>Recent content in Opensbi on SROEMER</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>Stefan Römer</copyright>
    <lastBuildDate>Mon, 13 Jan 2025 01:00:00 +0700</lastBuildDate><atom:link href="/tags/opensbi/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Building a custom firmware for the Banana Pi BPI-F3</title>
      <link>/posts/2025/01/bpi-f3_fw_build/</link>
      <pubDate>Mon, 13 Jan 2025 01:00:00 +0700</pubDate>
      
      <guid>/posts/2025/01/bpi-f3_fw_build/</guid>
      <description>&lt;p&gt;I started building the firmware components for booting the &lt;code&gt;BPI-F3&lt;/code&gt; myself. While &lt;code&gt;SpacemiT&lt;/code&gt; provides the source code
of the different components the official firmware is built from forks of older versions and without the
commit history. In my attempt to build a custom firmware I will use mainline versions where possible and
otherwise create my own forks from mainline sources and merge necessary changes into it.&lt;/p&gt;
&lt;p&gt;Contents:
&lt;nav id=&#34;TableOfContents&#34;&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href=&#34;#status&#34;&gt;Status&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#bootinfo&#34;&gt;Bootinfo&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#fsbl-u-boot-spl&#34;&gt;FSBL (U-Boot SPL)&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#opensbi&#34;&gt;OpenSBI&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#u-boot&#34;&gt;U-Boot&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/nav&gt;&lt;/p&gt;</description>
      <content>&lt;p&gt;I started building the firmware components for booting the &lt;code&gt;BPI-F3&lt;/code&gt; myself. While &lt;code&gt;SpacemiT&lt;/code&gt; provides the source code
of the different components the official firmware is built from forks of older versions and without the
commit history. In my attempt to build a custom firmware I will use mainline versions where possible and
otherwise create my own forks from mainline sources and merge necessary changes into it.&lt;/p&gt;
&lt;p&gt;Contents:
&lt;nav id=&#34;TableOfContents&#34;&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href=&#34;#status&#34;&gt;Status&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#bootinfo&#34;&gt;Bootinfo&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#fsbl-u-boot-spl&#34;&gt;FSBL (U-Boot SPL)&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#opensbi&#34;&gt;OpenSBI&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#34;#u-boot&#34;&gt;U-Boot&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
&lt;/nav&gt;&lt;/p&gt;
&lt;h1 id=&#34;status&#34;&gt;Status&lt;/h1&gt;
&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;name&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;build&lt;/th&gt;
          &lt;th style=&#34;text-align: center&#34;&gt;test&lt;/th&gt;
          &lt;th&gt;comment&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;bootinfo&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;✅&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;✅&lt;/td&gt;
          &lt;td&gt;generated files are identical to vendor files&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;fsbl&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;❌&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;❌&lt;/td&gt;
          &lt;td&gt;no build yet&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;opensbi&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;✅&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;✅&lt;/td&gt;
          &lt;td&gt;boot ok (opensbi messages shown in console)&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;u-boot&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;✅&lt;/td&gt;
          &lt;td style=&#34;text-align: center&#34;&gt;❌&lt;/td&gt;
          &lt;td&gt;doesn&amp;rsquo;t boot linux and only detects 4GB RAM&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;h1 id=&#34;bootinfo&#34;&gt;Bootinfo&lt;/h1&gt;
&lt;p&gt;The first part of the boot process we have control of is the &lt;code&gt;bootinfo&lt;/code&gt; binary. In the &lt;code&gt;SpacemiT&lt;/code&gt; &lt;code&gt;BSP&lt;/code&gt;
&lt;a href=&#34;https://gitee.com/bianbu-linux&#34;&gt;Bianbu Linux&lt;/a&gt; the &lt;code&gt;bootinfo&lt;/code&gt; is generated by a Python script during
the build of &lt;a href=&#34;https://gitee.com/bianbu-linux/uboot-2022.10&#34;&gt;u-boot&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With &lt;a href=&#34;https://github.com/sroemer/bpif3_gen_binary&#34;&gt;bpif3_gen_binary&lt;/a&gt; I extracted and slightly modified this
script and according configuration files to be used independent from the &lt;code&gt;u-boot&lt;/code&gt; source tree.&lt;/p&gt;
&lt;p&gt;The content of the generated &lt;code&gt;bootinfo&lt;/code&gt; is specified in a &lt;code&gt;JSON&lt;/code&gt; file and could be modified.
However, currently I do not see a need for that.&lt;/p&gt;
&lt;h1 id=&#34;fsbl-u-boot-spl&#34;&gt;FSBL (U-Boot SPL)&lt;/h1&gt;
&lt;p&gt;The &lt;code&gt;FSBL&lt;/code&gt; (First Stage Boot Loader) is generated by the same script as the &lt;code&gt;bootinfo&lt;/code&gt; but requires &lt;code&gt;u-boot-spl.bin&lt;/code&gt; at a path
specified in the according &lt;code&gt;JSON&lt;/code&gt; configuration file.&lt;/p&gt;
&lt;p&gt;While mainline &lt;code&gt;u-boot&lt;/code&gt; already has support for the &lt;code&gt;BPI-F3&lt;/code&gt;, it only generates a &lt;code&gt;u-boot proper&lt;/code&gt; stage
but not a &lt;code&gt;u-boot spl&lt;/code&gt; stage.&lt;/p&gt;
&lt;h1 id=&#34;opensbi&#34;&gt;OpenSBI&lt;/h1&gt;
&lt;p&gt;Mainline &lt;a href=&#34;https://github.com/riscv-software-src/opensbi&#34;&gt;OpenSBI&lt;/a&gt; does not have support for the &lt;code&gt;SpacemiT K1&lt;/code&gt; (yet).
Luckily &lt;a href=&#34;https://github.com/cyyself&#34;&gt;cyyself&lt;/a&gt; already merged support for the &lt;code&gt;SoC&lt;/code&gt; into a clean fork of &lt;code&gt;OpenSBI&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;With &lt;a href=&#34;https://github.com/sroemer/bpif3_opensbi&#34;&gt;bpif3_opensbi&lt;/a&gt; I merged &lt;a href=&#34;https://github.com/cyyself/opensbi/tree/k1-opensbi&#34;&gt;his work&lt;/a&gt;
on to the latest version of mainline &lt;code&gt;OpenSBI&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&#34;u-boot&#34;&gt;U-Boot&lt;/h1&gt;
&lt;p&gt;Mainline &lt;a href=&#34;https://github.com/u-boot/u-boot&#34;&gt;u-boot&lt;/a&gt; has support for the &lt;code&gt;BPI-F3&lt;/code&gt;. It lacks support for the &lt;code&gt;u-boot spl&lt;/code&gt;
stage but builds the &lt;code&gt;u-boot proper&lt;/code&gt; main stage.&lt;/p&gt;
</content>
    </item>
    
  </channel>
</rss>
