U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yao Zi <me@ziyao.cc>
To: Eric Chung <eric.chung@riscstar.com>,
	u-boot-spacemit@groups.io, u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>, Tim Ouyang <tim609@andestech.com>,
	Leo Liang <leo.liang@sifive.com>, Yao Zi <me@ziyao.cc>,
	Wei Fu <wefu@redhat.com>, Huan Zhou <pericycle.cc@gmail.com>,
	Guodong Xu <guodong@riscstar.com>,
	Raymond Mao <raymond.mao@riscstar.com>,
	Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Anshul Dalal <anshuld@ti.com>,
	Bastien Curutchet <bastien.curutchet@bootlin.com>,
	Johan Jonker <jbx6244@gmail.com>,
	Sumit Garg <sumit.garg@kernel.org>, Yixun Lan <dlan@kernel.org>,
	Iker Pedrosa <ikerpedrosam@gmail.com>,
	Alex Elder <elder@riscstar.com>,
	Andre Heider <a.heider@gmail.com>,
	Trevor Gamblin <tgamblin@baylibre.com>
Subject: Re: [PATCH v12 6/7] doc: spacemit: flash on K1 SoC based boards
Date: Mon, 7 Sep 2026 08:50:24 +0000	[thread overview]
Message-ID: <ap560PSIq5GenBe4@pie> (raw)
In-Reply-To: <20260906-m4-v12-6-89eb5a8f879d@riscstar.com>

On Sun, Sep 06, 2026 at 05:11:08PM +0800, Eric Chung wrote:
> Add document on how to flash images into eMMC of K1 SoC based boards.
> 
> Signed-off-by: Eric Chung <eric.chung@riscstar.com>
> 
> ---
> v9:
> - Add to generate the partition table of SD card.
> v3:
> - Add document on how to flash images into SD card.
> ---
>  board/spacemit/k1/MAINTAINERS |   2 +-
>  doc/board/spacemit/index.rst  |   1 +
>  doc/board/spacemit/k1-mmc.rst | 271 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 273 insertions(+), 1 deletion(-)

...

> diff --git a/doc/board/spacemit/k1-mmc.rst b/doc/board/spacemit/k1-mmc.rst
> new file mode 100644
> index 000000000000..0be5d5fa1c39
> --- /dev/null
> +++ b/doc/board/spacemit/k1-mmc.rst

...

> +Chapter 2: SD Card Boot
> +=======================
> +
> +
> +SpacemiT K1 Bianbu SD Card Image Flashing and U-Boot Update Guide
> +==================================================================
> +
> +This guide explains how to prepare a bootable SD card with Bianbu OS for
> +SpacemiT K1 based boards and how to replace the U-Boot binary on the SD
> +card with a custom build.
> +
> +Prerequisites
> +~~~~~~~~~~~~~
> +
> +- A SpacemiT K1 based development board
> +- A microSD card (at least 4GB capacity recommended)
> +- A card reader for your host computer
> +- A Linux host system (for ``dd``, ``sgdisk``, ``lsblk`` commands)
> +- The Bianbu release package from
> +  <https://archive.spacemit.com/image/k1/version/bianbu/v2.3.3/Bianbu-Minimal-K1-V2.3.3-20260128183217.zip>
> +- A custom ``FSBL.bin`` and ``u-boot.itb`` file to be written to the U-Boot
> +  partition
> +
> +Prepare the SD Card & the image
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +**1. Obtain the release images**
> +
> +Unpack the release package to get the image files. Replace the ``FSBL.bin``
> +and ``u-boot.itb`` with your custom builds.
> +
> +**2. Identify the SD card device**
> +
> +Insert the microSD card into your card reader, then run:
> +
> +.. code-block:: console
> +
> +   $ lsblk
> +
> +Compare the output before and after inserting the card to identify
> +the new device. It will typically appear as ``/dev/sdb``, ``/dev/sdc``,
> +or ``/dev/mmcblk0``.
> +
> +**3. Write the image to the SD card**
> +
> +Run ``sgdisk`` to generate the partition table, then use ``dd`` to write
> +the images to the corresponding partitions.
> +
> +.. code-block:: console
> +
> +    $sudo sgdisk -o /dev/sdb
> +    $sudo sgdisk -a 128 \
> +        -n 1:256:767 -t 1:8300 \
> +        -n 2:768:895 -t 2:8300 \
> +        -n 3:2048:4095 -t 3:8300 \
> +        -n 4:4096:8191 -t 4:8300 \
> +        -n 5:8192:532479 -t 5:8300 \
> +        -n 6:532480:4726783 -t 6:8300 \
> +        /dev/sdb
> +    $sudo dd if=FSBL.bin of=/dev/sdb1 bs=512 seek=0 status=progress
> +    $sudo dd if=env.bin of=/dev/sdb2 bs=512 seek=0 status=progress
> +    $sudo dd if=fw_dynamic.itb of=/dev/sdb3 bs=512 seek=0 status=progress
> +    $sudo dd if=u-boot.itb of=/dev/sdb4 bs=512 seek=0 status=progress
> +    $sudo dd if=bootfs.img of=/dev/sdb5 bs=1M status=progress
> +    $sudo dd if=rootfs.ext4 of=/dev/sdb6 bs=1M status=progress

The bootfs/rootfs part aren't U-Boot-related stuff, so please omit them
from this documentation to keep it simplified.

Then the only binary we need to extract from the "SpacemiT release
package" is env.bin and fw_dynamic.bin.

For env.bin, I think this U-Boot port depends on no specific environment
setttings? If no, please omit it, too; otherwise please provide a .env
file in upstream U-Boot tree, and make it the default environment to
use.

For fw_dynamic.bin, I think SpacemiT K1 support has been landed in the
upstream OpenSBI tree? Please check if it works with upstream U-Boot.
If no, please try fixing it, and then it's okay to stick to the
downstream OpenSBI, but you need providing a guidance to build it from
source if possible.

Then you could fully omit the step of downloading the "SpacemiT release
package".

> +The SD card is now ready as a bootable system disk.
> +
> +Understanding the SD Card Partition Layout
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The role of each partition:
> +
> ++----------+----------+------------------------------------+
> +| Partition| Size     | Purpose                            |
> ++==========+==========+====================================+
> +| ``sdb1`` | 256 KB   | FSBL (First Stage Bootloader)      |
> ++----------+----------+------------------------------------+
> +| ``sdb2`` | 64 KB    | ENV                                |
> ++----------+----------+------------------------------------+
> +| ``sdb3`` | 1 MB     | OpenSBI                            |
> ++----------+----------+------------------------------------+
> +| ``sdb4`` | 2 MB     | U-Boot binary (``u-boot.itb``)     |
> ++----------+----------+------------------------------------+
> +| ``sdb5`` | 256 MB   | Boot partition (kernel)            |
> ++----------+----------+------------------------------------+
> +| ``sdb6`` | 2 GB     | Root filesystem (ext4)             |
> ++----------+----------+------------------------------------+

...

> +- If the board boots successfully, the new device tree or U-Boot image
> +  is compatible with your hardware.

This sentence looks extra, please drop it.

Best regards,
Yao Zi

  reply	other threads:[~2026-09-07  8:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06  9:11 [PATCH v12 0/7] spacemit mmc driver Eric Chung
2026-09-06  9:11 ` [PATCH v12 1/7] spacemit: k1: select boot device via config registers Eric Chung
2026-09-06  9:11 ` [PATCH v12 2/7] mmc: k1: add sdhci platform driver Eric Chung
2026-09-07  8:32   ` Yao Zi
2026-09-07 16:27     ` Eric Chung
2026-09-08 21:24       ` Yixun Lan
2026-09-06  9:11 ` [PATCH v12 3/7] dts: k1: enable mmc devices in SPL Eric Chung
2026-09-06  9:11 ` [PATCH v12 4/7] configs: k1: enable SD and eMMC support Eric Chung
2026-09-06  9:11 ` [PATCH v12 5/7] MAINTAINER: update Spacemit K1 entry Eric Chung
2026-09-06  9:11 ` [PATCH v12 6/7] doc: spacemit: flash on K1 SoC based boards Eric Chung
2026-09-07  8:50   ` Yao Zi [this message]
2026-09-07 16:31     ` Eric Chung
2026-09-07 17:59       ` Yao Zi
2026-09-08 12:52   ` Yixun Lan
2026-09-06  9:11 ` [PATCH v12 7/7] spacemit: k1: fix product name detection and DTB matching in SPL Eric Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ap560PSIq5GenBe4@pie \
    --to=me@ziyao.cc \
    --cc=a.heider@gmail.com \
    --cc=anshuld@ti.com \
    --cc=bastien.curutchet@bootlin.com \
    --cc=dlan@kernel.org \
    --cc=elder@riscstar.com \
    --cc=eric.chung@riscstar.com \
    --cc=guodong@riscstar.com \
    --cc=ikerpedrosam@gmail.com \
    --cc=jbx6244@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=leo.liang@sifive.com \
    --cc=peng.fan@nxp.com \
    --cc=pericycle.cc@gmail.com \
    --cc=raymond.mao@riscstar.com \
    --cc=sumit.garg@kernel.org \
    --cc=tgamblin@baylibre.com \
    --cc=tim609@andestech.com \
    --cc=trini@konsulko.com \
    --cc=u-boot-spacemit@groups.io \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=wefu@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox