From: Eric Chung <eric.chung@riscstar.com>
To: u-boot-spacemit@groups.io, u-boot@lists.u-boot-project.org,
u-boot@lists.u-boot-project.org
Cc: Tom Rini <trini@konsulko.com>, Tim Ouyang <tim609@andestech.com>,
Leo Liang <leo.liang@sifive.com>, Peng Fan <peng.fan@nxp.com>,
Huan Zhou <pericycle.cc@gmail.com>,
Raymond Mao <raymond.mao@riscstar.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Bhimeswararao Matsa <bhimeswararao.matsa@gmail.com>,
Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
Kaustabh Chakraborty <kauschluss@disroot.org>,
Han Xu <han.xu@nxp.com>, Yanir Levin <yanir.levin@tandemg.com>,
Christoph Stoidner <c.stoidner@phytec.de>,
Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>,
Daniel Palmer <daniel@thingy.jp>, Anshul Dalal <anshuld@ti.com>,
Bastien Curutchet <bastien.curutchet@bootlin.com>,
Angelo Dureghello <angelo@kernel-space.org>,
Johan Jonker <jbx6244@gmail.com>,
Sam Protsenko <semen.protsenko@linaro.org>,
Guodong Xu <guodong@riscstar.com>, Yao Zi <me@ziyao.cc>,
Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
Eric Chung <eric.chung@riscstar.com>
Subject: [PATCH v6 09/11] doc: spacemit: flash on K1 SoC based boards
Date: Mon, 27 Jul 2026 14:59:11 +0800 [thread overview]
Message-ID: <20260727-m4-v6-9-2f58566d48ca@riscstar.com> (raw)
In-Reply-To: <20260727-m4-v6-0-2f58566d48ca@riscstar.com>
Add document on how to flash images into eMMC of K1 SoC based boards.
Signed-off-by: Eric Chung <eric.chung@riscstar.com>
---
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 | 320 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 322 insertions(+), 1 deletion(-)
diff --git a/board/spacemit/k1/MAINTAINERS b/board/spacemit/k1/MAINTAINERS
index 4b2bc4ecfc1..e12288a206e 100644
--- a/board/spacemit/k1/MAINTAINERS
+++ b/board/spacemit/k1/MAINTAINERS
@@ -6,7 +6,7 @@ S: Maintained
F: arch/riscv/dts/k1-*-u-boot.dtsi
F: board/spacemit/k1/
F: configs/spacemit_k1_defconfig
-F: doc/board/spacemit/bananapi-f3.rst
+F: doc/board/spacemit/
F: drivers/gpio/spacemit_gpio.c
F: drivers/i2c/k1_i2c.c
F: drivers/mmc/spacemit_sdhci.c
diff --git a/doc/board/spacemit/index.rst b/doc/board/spacemit/index.rst
index a5e35ee12ab..71854e5735b 100644
--- a/doc/board/spacemit/index.rst
+++ b/doc/board/spacemit/index.rst
@@ -6,5 +6,6 @@ SpacemiT
:maxdepth: 1
bananapi-f3
+ k1-mmc
k1-spl
diff --git a/doc/board/spacemit/k1-mmc.rst b/doc/board/spacemit/k1-mmc.rst
new file mode 100644
index 00000000000..b0fe78c75ce
--- /dev/null
+++ b/doc/board/spacemit/k1-mmc.rst
@@ -0,0 +1,320 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+SpacemiT K1 eMMC and SD Card Boot Guide
+=======================================
+
+This guide covers two separate methods for booting and flashing U-Boot on
+SpacemiT K1 based boards:
+
+1. **eMMC Flash**: Flashing U-Boot and SPL images to eMMC via USB fastboot.
+2. **SD Card Boot**: Creating a bootable Bianbu SD card and optionally
+ replacing U-Boot on the card.
+
+Tested boards: Banana Pi BPI-F3, MusePi Pro.
+
+
+Chapter 1: eMMC Flash (U-Boot via USB Fastboot)
+===============================================
+
+SpacemiT K1 U-Boot Flash Guide
+==============================
+
+This guide explains how to flash U-Boot on SpacemiT K1 based boards. It covers
+flashing images via USB fastboot.
+
+.. note::
+
+ This procedure flashes images to eMMC over USB fastboot. The fastboot
+ function is not enabled in our SPL yet, so the download stage runs the
+ SpacemiT released SPL; our built FSBL.bin and fit.itb are the images
+ written to eMMC and used on the next normal boot.
+
+Prerequisites
+~~~~~~~~~~~~~
+
+- A SpacemiT K1 board with USB Type-C and UART access
+- USB-to-UART adapter (3.3V TTL)
+- ``minicom`` or equivalent serial terminal, configured at 115200 8N1
+- ``fastboot`` and ``flashserver`` tool on the host
+
+Hardware Setup
+~~~~~~~~~~~~~~
+
+Refer to k1-spl.rst.
+
+Flash images on eMMC
+~~~~~~~~~~~~~~~~~~~~
+
+**1. Obtain the release images**
+
+Get the release package from Spacemit website. It contains SPL image, and so on.
+
+https://archive.spacemit.com/image/k1/version/bianbu/v2.3.3/Bianbu-Minimal-K1-V2.3.3-20260128183217.zip
+
+Unzip images and store them into a directory.
+
+**2. Obtain flashserver tool**
+
+Get ``flashserver`` from Spacemit website.
+
+.. code-block:: bash
+
+ $wget https://cdn-resource.spacemit.com/file/flash/flashserver
+ $chmod +x flashserver
+ $mv flashserver {flash image path}/
+
+**3. Copy built SPL and U-Boot images**
+
+Build U-Boot as mentioned in k1-spl.rst. Create a new directory to save.
+The official u-boot.itb is used to download images. So the built U-Boot should
+not replace the official one.
+
+.. code-block:: bash
+
+ $mkdir {flash image path}/build
+ $cd {flash image path}
+ $ln -sf {path to FSBL.bin} ./build/
+ $ln -sf {path to u-boot.itb} ./build/fit.itb
+
+``{path to FSBL.bin}`` is the signed FSBL produced by ``fsbl.sh`` in
+k1-spl.rst, e.g. ``~/uboot-2022.10/spl_bin/FSBL.bin``.
+``{path to u-boot.itb}`` is the U-Boot build output, e.g.
+``~/u-boot/u-boot.itb``.
+
+**4. Update configuration files**
+
+The ``partition_2M.json`` and ``partition_universal.json`` files come from
+the release package. Patch the ``fsbl`` and ``uboot`` entries to point at
+the images staged under ``build/`` (pick the layout that matches your eMMC):
+
+.. code-block:: diff
+
+ diff -puNr bianbu-25/partition_2M.json clean/partition_2M.json
+ --- bianbu-25/partition_2M.json 2026-03-02 11:55:58.631116807 +0800
+ +++ clean/partition_2M.json 2026-05-20 11:25:21.683801401 +0800
+ @@ -13,7 +13,7 @@
+ "name": "fsbl",
+ "offset": "128K",
+ "size": "256K",
+ - "image": "factory/FSBL.bin"
+ + "image": "build/FSBL.bin"
+ },
+ {
+ "name": "env",
+ @@ -31,7 +31,7 @@
+ "name": "uboot",
+ "offset": "640K",
+ "size": "-",
+ - "image": "u-boot.itb"
+ + "image": "build/fit.itb"
+ }
+ ]
+ }
+ diff -puNr bianbu-25/partition_universal.json clean/partition_universal.json
+ --- bianbu-25/partition_universal.json 2026-03-02 11:55:58.642116862 +0800
+ +++ clean/partition_universal.json 2026-05-20 11:26:23.932581853 +0800
+ @@ -14,7 +14,7 @@
+ "name": "fsbl",
+ "offset": "128K",
+ "size": "256K",
+ - "image": "factory/FSBL.bin"
+ + "image": "build/FSBL.bin"
+ },
+ {
+ "name": "env",
+ @@ -32,7 +32,7 @@
+ "name": "uboot",
+ "offset": "2M",
+ "size": "2M",
+ - "image": "u-boot.itb"
+ + "image": "build/fit.itb"
+ },
+ {
+ "name": "bootfs",
+
+Deploying via USB Fastboot
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To enter BootROM fastboot mode:
+
+1. Power off the board by unplugging its power supply.
+2. **Press and hold** the FDL button (called "Boot Key" on some boards;
+ see the board layout above for the BPI-F3).
+3. While holding the button, use a USB cable to connect the OTG port to
+ your host. This cable is also used by fastboot to upload the firmware.
+4. Release the button.
+
+On the host, ``fastboot devices`` should list the board::
+
+ dfu-device DFU download
+
+The serial console shows the BootROM's USB download handler trace,
+including a line like::
+
+ usb2d_initialize : enter
+
+This indicates the board is ready to accept an image via USB.
+
+.. tip::
+
+ If you are worried about insufficient USB power, you can first plug
+ in the power, then release the button, and then plug in the USB
+ cable.
+
+On the host:
+
+.. code-block:: console
+
+ $sudo ./flashserver
+
+When ``flashserver`` is running, it lists the detected fastboot devices.
+Enter the corresponding number to select one.
+
+
+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 8 GB capacity recommended)
+- A card reader for your host computer
+- A Linux host system (for ``dd``, ``fdisk``, ``lsblk`` commands)
+- The Bianbu SD card image from
+ <https://spacemit.com/community/resources-download/Images%20Collects/K1/Bianbu>
+- A custom ``u-boot.itb`` file (device tree blob or U-Boot FIT image) to be
+ written to the U-Boot partition
+
+Prepare the SD Card & the image
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+**1. Download the image**
+
+Download the released package from the official SpacemiT website:
+
+<https://archive.spacemit.com/image/k1/version/bianbu/v2.3.5/Bianbu-Minimal-K1-sdcard-V2.3.5-20260601180942.img.zip>
+
+**2. Extract the image**
+
+.. code-block:: console
+
+ $ unzip Bianbu-Minimal-K1-sdcard-V2.3.5-20260601180942.img.zip
+
+**3. 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``.
+
+**4. Write the image to the SD card**
+
+.. code-block:: console
+
+ $ sudo dd if=./Bianbu-Minimal-K1-sdcard-V2.3.5-20260601180942.img of=/dev/sdb bs=1M status=progress
+
+The SD card is now ready as a bootable Bianbu system disk.
+
+
+Understanding the SD Card Partition Layout
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+After writing the image, the SD card has the following partition structure
+(verified with ``sudo fdisk -l /dev/sdb``):
+
+.. code-block:: text
+
+ Device Start End Sectors Size Type
+ /dev/sdb1 256 767 512 256K Linux filesystem
+ /dev/sdb2 768 895 128 64K Linux filesystem
+ /dev/sdb3 2048 4095 2048 1M Linux filesystem
+ /dev/sdb4 4096 8191 4096 2M Linux filesystem
+ /dev/sdb5 8192 532479 524288 256M Linux filesystem
+ /dev/sdb6 532480 4726783 4194304 2G Linux filesystem
+
+The role of each partition:
+
++----------+----------+--------------------------------------------------+
+| Partition| Size | Purpose |
++==========+==========+==================================================+
+| ``sdb1`` | 256 KB | Boot information for Boot ROM |
++----------+----------+--------------------------------------------------+
+| ``sdb2`` | 64 KB | FSBL (First Stage Bootloader) |
++----------+----------+--------------------------------------------------+
+| ``sdb3`` | 1 MB | OpenSBI / U-Boot environment |
++----------+----------+--------------------------------------------------+
+| ``sdb4`` | 2 MB | **U-Boot binary (``u-boot.itb``)** |
++----------+----------+--------------------------------------------------+
+| ``sdb5`` | 256 MB | Boot partition (FAT32, kernel + device tree) |
++----------+----------+--------------------------------------------------+
+| ``sdb6`` | 2 GB | Root filesystem (ext4) |
++----------+----------+--------------------------------------------------+
+
+
+Replacing U-Boot on the SD Card
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This section explains how to replace the U-Boot binary on the SD card
+with your own custom ``u-boot.itb`` file. For this guide, the custom file
+is a ``Device Tree Blob`` , which fits within
+the 2 MB ``/dev/sdb4`` partition.
+
+
+**1. Confirm the SD card device and partition**
+
+.. code-block:: console
+
+ $ sudo fdisk -l /dev/sdb
+
+Ensure that ``/dev/sdb4`` exists and has the expected size (2 MB),
+and that the replacement ``u-boot.itb`` is no larger than the size.
+
+
+**2. Write the new U-Boot image**
+
+.. code-block:: console
+
+ $ sudo dd if=./u-boot.itb of=/dev/sdb4 bs=1M status=progress
+
+Example successful output:
+
+.. code-block:: text
+
+ 0+1 records in
+ 0+1 records out
+ 873033 bytes (873 kB, 853 KiB) copied, 1.22109 s, 715 kB/s
+
+
+**3. Synchronize**
+
+.. code-block:: console
+
+ $ sync
+
+**4. Eject the SD card**
+
+.. code-block:: console
+
+ $ sudo eject /dev/sdb
+
+Booting and Testing
+~~~~~~~~~~~~~~~~~~~
+
+Insert the SD card into the development board, connect the serial
+console (115200 8N1), and power on the board.
+
+- If the board boots successfully, the new device tree or U-Boot image
+ is compatible with your hardware.
--
2.51.0
next prev parent reply other threads:[~2026-07-27 7:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 6:59 [PATCH v6 00/11] spacemit mmc driver Eric Chung
2026-07-27 6:59 ` [PATCH v6 01/11] spacemit: k1: select boot device via config registers Eric Chung
2026-07-27 6:59 ` [PATCH v6 02/11] pinctrl: k1: fix drive strength configuration Eric Chung
2026-07-27 6:59 ` [PATCH v6 03/11] pinctrl: k1: fix pull-up/pull-down configuration Eric Chung
2026-07-27 8:20 ` Yao Zi
2026-07-27 8:24 ` Yao Zi
2026-07-27 6:59 ` [PATCH v6 04/11] pinctrl: k1: add IO power domain configuration support Eric Chung
2026-07-28 17:15 ` Junhui Liu
2026-07-27 6:59 ` [PATCH v6 05/11] mmc: k1: add sdhci platform driver Eric Chung
2026-07-27 6:59 ` [PATCH v6 06/11] dts: k1: add SD card support in u-boot overlay Eric Chung
2026-07-27 11:51 ` Yao Zi
2026-07-27 13:08 ` Eric Chung
2026-07-27 17:07 ` Yao Zi
2026-07-28 1:04 ` Eric Chung
2026-07-28 9:10 ` Yao Zi
2026-07-29 14:05 ` Eric Chung
2026-07-29 15:58 ` Yao Zi
2026-07-30 5:18 ` Eric Chung
2026-07-27 6:59 ` [PATCH v6 07/11] configs: k1: enable SD and eMMC support Eric Chung
2026-07-27 17:15 ` Yao Zi
2026-07-27 6:59 ` [PATCH v6 08/11] MAINTAINER: update Spacemit K1 entry Eric Chung
2026-07-27 6:59 ` Eric Chung [this message]
2026-07-27 17:26 ` [PATCH v6 09/11] doc: spacemit: flash on K1 SoC based boards Yao Zi
2026-07-28 0:53 ` Eric Chung
2026-07-28 9:45 ` Yao Zi
2026-07-29 13:49 ` Eric Chung
2026-07-29 15:32 ` Yao Zi
2026-07-30 6:25 ` Eric Chung
2026-07-30 15:20 ` Yao Zi
2026-07-31 0:31 ` Eric Chung
2026-07-27 6:59 ` [PATCH v6 10/11] config: k1: enable ENV support for eMMC Eric Chung
2026-07-27 6:59 ` [PATCH v6 11/11] spacemit: k1: load product name from environment variable Eric Chung
2026-07-27 17:41 ` Yao Zi
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=20260727-m4-v6-9-2f58566d48ca@riscstar.com \
--to=eric.chung@riscstar.com \
--cc=angelo@kernel-space.org \
--cc=anshuld@ti.com \
--cc=balsundar.ponnusamy@altera.com \
--cc=bastien.curutchet@bootlin.com \
--cc=bhimeswararao.matsa@gmail.com \
--cc=c.stoidner@phytec.de \
--cc=daniel@thingy.jp \
--cc=guodong@riscstar.com \
--cc=han.xu@nxp.com \
--cc=jbx6244@gmail.com \
--cc=jh80.chung@samsung.com \
--cc=kauschluss@disroot.org \
--cc=leo.liang@sifive.com \
--cc=me@ziyao.cc \
--cc=peng.fan@nxp.com \
--cc=pericycle.cc@gmail.com \
--cc=raymond.mao@riscstar.com \
--cc=rick@andestech.com \
--cc=semen.protsenko@linaro.org \
--cc=tanmay.kathpalia@altera.com \
--cc=tim609@andestech.com \
--cc=trini@konsulko.com \
--cc=u-boot-spacemit@groups.io \
--cc=u-boot@lists.u-boot-project.org \
--cc=yanir.levin@tandemg.com \
--cc=ycliang@andestech.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.