PageSourceSearch

https://milkv.io/assets/js/a31a92ab.b0f7d5fe.js

js milkv.io collected 2026-09-24 19:35:08 UTC 26,106 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmilkv_website=self.webpackChunkmilkv_website||[]).push([[6168],{42827:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>h,frontMatter:()=>r,metadata:()=>d,toc:()=>l});var s=o(85893),t=o(11151);const r={sidebar_label:"Bootloader Update",sidebar_position:40},i="Milk-V Mars Bootloader Update Guide",d={id:"mars/getting-started/bootloader",title:"Milk-V Mars Bootloader Update Guide",description:"Whether Mars starts the system through the SD card or the eMMC module, it must be started through the Bootloader boot program. This boot program is stored in an SPI Flash on the board and contains two parts: SPL and U-Boot.",source:"@site/docs/mars/getting-started/bootloader.md",sourceDirName:"mars/getting-started",slug:"/mars/getting-started/bootloader",permalink:"/docs/mars/getting-started/bootloader",draft:!1,unlisted:!1,editUrl:"https://github.com/milk-v/milkv.io/edit/main/docs/mars/getting-started/bootloader.md",tags:[],version:"current",sidebarPosition:40,frontMatter:{sidebar_label:"Bootloader Update",sidebar_position:40},sidebar:"mars",previous:{title:"Extend Partition",permalink:"/docs/mars/getting-started/extendpartition"},next:{title:"Images Download",permalink:"/docs/mars/getting-started/images"}},a={},l=[{value:"Update Bootloader using flashcp command",id:"update-bootloader-using-flashcp-command",level:2},{value:"Use UsbFlashTool to upgrade bootloader under Windows",id:"use-usbflashtool-to-upgrade-bootloader-under-windows",level:2},{value:"Download UsbFlashTool burning tool and Bootloader firmware",id:"download-usbflashtool-burning-tool-and-bootloader-firmware",level:3},{value:"Install driver for the burning tool",id:"install-driver-for-the-burning-tool",level:3},{value:"Upgrade Bootloader",id:"upgrade-bootloader",level:3},{value:"Flash the new version of U-Boot",id:"flash-the-new-version-of-u-boot",level:2},{value:"Download Bootloader Firmware",id:"download-bootloader-firmware",level:3},{value:"SD Card Partition",id:"sd-card-partition",level:3},{value:"Refresh u-boot",id:"refresh-u-boot",level:3},{value:"Use Uart to start U-BOOT under Linux",id:"use-uart-to-start-u-boot-under-linux",level:2},{value:"Download Bootloader Firmware",id:"download-bootloader-firmware-1",level:3},{value:"Download tio",id:"download-tio",level:3},{value:"Boot from UART",id:"boot-from-uart",level:3}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",...(0,t.a)(),...e.components},{Image:r}=n;return r||function(e,n){throw new Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Image",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"milk-v-mars-bootloader-update-guide",children:"Milk-V Mars Bootloader Update Guide"}),"\n",(0,s.jsxs)(n.p,{children:["Whether Mars starts the system through the SD card or the eMMC module, it must be started through the Bootloader boot program. This boot program is stored in an SPI Flash on the board and contains two parts: ",(0,s.jsx)(n.code,{children:"SPL"})," and ",(0,s.jsx)(n.code,{children:"U-Boot"}),"."]}),"\n",(0,s.jsx)(n.admonition,{type:"tip",children:(0,s.jsx)(n.p,{children:"The Bootloader in Mars can be understood as the BIOS in PC"})}),"\n",(0,s.jsx)(n.p,{children:"When Mars is shipped, it already comes with a pre-installed initial Bootloader program. There is no need to upgrade this program during normal usage. Bootloader upgrade is only necessary in the following situations:"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"When the bootloader program in SPI Flash is accidentally damaged, causing the system to fail to start normally."}),"\n",(0,s.jsx)(n.li,{children:"When upgrading the official system image (such as Debian), it must be matched with the new bootloader, otherwise it cannot be started."}),"\n",(0,s.jsx)(n.li,{children:"U-Boot has fixed some bugs or added new functions. When you need to use these new functions."}),"\n"]}),"\n",(0,s.jsxs)(n.p,{children:["There are several ways to update the Bootloader in SPI Flash on Mars, such as Windows burning tools, TFTP, flashcp commands, etc. Here are the methods of using the ",(0,s.jsx)(n.code,{children:"flashcp"})," command and using the ",(0,s.jsx)(n.code,{children:"UsbFlashTool"})," burning tool in Windows systems."]}),"\n",(0,s.jsx)(n.h2,{id:"update-bootloader-using-flashcp-command",children:"Update Bootloader using flashcp command"}),"\n",(0,s.jsxs)(n.p,{children:["If the current bootloader of your Mars can boot the Debian system normally, you can use the ",(0,s.jsx)(n.code,{children:"flashcp"})," command in the Debian system to update the bootloader."]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Install flashcp command"}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"flashcp"})," command in the Debian system is included in the ",(0,s.jsx)(n.code,{children:"mtd-utils"})," package. Execute the following command to install:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"sudo apt install mtd-utils\n"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Download Bootloader Firmware"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/milkv-mars/mars-buildroot-sdk/releases",children:"Bootloader firmware"})}),"\n",(0,s.jsxs)(n.p,{children:["The firmware contains two files, ",(0,s.jsx)(n.code,{children:"SPL"})," and ",(0,s.jsx)(n.code,{children:"U-Boot"}),":"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"SPL:    mars_u-boot-spl.bin.normal.out\nU-Boot: mars_visionfive2_fw_payload.img\n"})}),"\n",(0,s.jsx)(n.p,{children:"You can download it directly on Mars, or download it on PC and then transfer it to Mars through scp command or USB flash drive."}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"View SPI Flash partition information"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"cat /proc/mtd\n"})}),"\n",(0,s.jsx)(n.p,{children:"The output is as follows:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:'user@milkv:~$ cat /proc/mtd\ndev:    size   erasesize  name\nmtd0: 00040000 00001000 "spl"\nmtd1: 00300000 00001000 "uboot"\nmtd2: 00100000 00001000 "data"\n'})}),"\n",(0,s.jsxs)(n.p,{children:["We need to update ",(0,s.jsx)(n.code,{children:"SPL"})," to the ",(0,s.jsx)(n.code,{children:"mtd0"})," partition and ",(0,s.jsx)(n.code,{children:"U-Boot"})," to the ",(0,s.jsx)(n.code,{children:"mtd1"})," partition."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Update Bootloader"}),"\n",(0,s.jsx)(n.p,{children:"Update SPL:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"sudo flashcp -v mars_u-boot-spl.bin.normal.out /dev/mtd0\n"})}),"\n",(0,s.jsx)(n.p,{children:"Update U-Boot:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"sudo flashcp -v mars_visionfive2_fw_payload.img /dev/mtd1\n"})}),"\n",(0,s.jsx)(n.p,{children:"The output of successful execution is as follows:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"user@milkv:~$ sudo flashcp -v mars_u-boot-spl.bin.normal.out /dev/mtd0\nErasing blocks: 36/36 (100%)\nWriting data: 143k/143k (100%)\nVerifying data: 143k/143k (100%)\nuser@milkv:~$\nuser@milkv:~$ sudo flashcp -v mars_visionfive2_fw_payload.img /dev/mtd1\nErasing blocks: 723/723 (100%)\nWriting data: 2890k/2890k (100%)\nVerifying data: 2890k/2890k (100%)\n"})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"After powering on again, you can determine whether the bootloader has been updated based on the timestamp in the UART serial port log:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"U-Boot SPL 2021.10 (Nov 24 2023 - 10:21:39 +0800)\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"U-Boot 2021.10 (Nov 24 2023 - 10:21:39 +0800)\n"})}),"\n",(0,s.jsx)(n.h2,{id:"use-usbflashtool-to-upgrade-bootloader-under-windows",children:"Use UsbFlashTool to upgrade bootloader under Windows"}),"\n",(0,s.jsx)(n.h3,{id:"download-usbflashtool-burning-tool-and-bootloader-firmware",children:"Download UsbFlashTool burning tool and Bootloader firmware"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/milkv-mars/mars-tools/blob/main/Mars-UsbFlashTool-v2.4-Windows.zip",children:"UsbFlashTool"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/milkv-mars/mars-buildroot-sdk/releases",children:"Bootloader firmware"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"SPL:    mars_u-boot-spl.bin.normal.out\nU-Boot: mars_visionfive2_fw_payload.img\n"})}),"\n",(0,s.jsx)(n.h3,{id:"install-driver-for-the-burning-tool",children:"Install driver for the burning tool"}),"\n",(0,s.jsx)(n.admonition,{type:"tip",children:(0,s.jsx)(n.p,{children:"Driver installation is only required for the first use."})}),"\n",(0,s.jsxs)(n.p,{children:["Extract the downloaded ",(0,s.jsx)(n.code,{children:"Mars-UsbFlashTool-*-Windows.zip"})," into the Windows system."]}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Connect the USB to TTL serial port cable to the 40 pin header on Mars, connect the USB to the PC and note down the serial port number"}),"\n",(0,s.jsxs)(n.p,{children:["How to connect USB to serial cable: ",(0,s.jsx)(n.a,{href:"https://milkv.io/docs/mars/getting-satrted/setup#use-serial-console",children:"Use Serial Console"})]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(32328).Z+"",width:"2747",height:"1602"})}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.strong,{children:"Note: If any other serial port program is open and using the serial port, please exit the program to release the port and avoid occupying it."})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Connect the PC and Mars using a USB 2.0 interface with a type A Male to Male USB data cable"}),"\n",(0,s.jsx)(r,{src:"/docs/common/usba2usba.webp",maxWidth:"60%",align:"left"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(39907).Z+"",width:"2180",height:"922"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Press and hold the ",(0,s.jsx)(n.code,{children:"upgrade button"})," on Mars, and then power on Mars through the Type C interface. At this time, Mars will enter the upgrade mode. You can release the ",(0,s.jsx)(n.code,{children:"upgrade button"})," to continue the operation."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(1904).Z+"",width:"2364",height:"1545"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Run the ",(0,s.jsx)(n.code,{children:"UsbFlashTool-*-Windows.exe"})," flashing program in the flashing tool directory"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(58380).Z+"",width:"2371",height:"1521"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Set the serial port number in the ",(0,s.jsx)(n.code,{children:"Serial Setting"})," on the right side to the serial port number noted in step 1"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(32783).Z+"",width:"2172",height:"1710"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Select ",(0,s.jsx)(n.code,{children:"Firmware"})," in ",(0,s.jsx)(n.code,{children:"File Type"}),", then click ",(0,s.jsx)(n.code,{children:"File Select"})," to select the ",(0,s.jsx)(n.code,{children:"usbprog-mars-230510.out"})," in the ",(0,s.jsx)(n.code,{children:"update"})," directory, then click ",(0,s.jsx)(n.code,{children:"Load"}),", and wait for the message ",(0,s.jsx)(n.code,{children:"Loaded"})," to appear after loading"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(30975).Z+"",width:"2281",height:"1745"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"At this time, the JH7110 device has been identified in the Windows Device Manager and the driver needs to be installed"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(86388).Z+"",width:"2551",height:"1779"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Run the ",(0,s.jsx)(n.code,{children:"zadig-2.5"})," program in the flashing tool directory, select ",(0,s.jsx)(n.code,{children:"List All Devices"})," in the menu ",(0,s.jsx)(n.code,{children:"Options"}),", select ",(0,s.jsx)(n.code,{children:"StarFive JH7110 Device"})," in the drop-down list, and then click ",(0,s.jsx)(n.code,{children:"Install Driver"})," to complete the driver installation"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(3273).Z+"",width:"1725",height:"762"})}),"\n",(0,s.jsx)(n.p,{children:"After the driver is successfully installed, check whether the status in the device manager has become a normal USB device"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(5608).Z+"",width:"1668",height:"1163"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"After the driver is successfully installed, close the UsbFlashTool window and power off Mars."}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h3,{id:"upgrade-bootloader",children:"Upgrade Bootloader"}),"\n",(0,s.jsx)(n.p,{children:"The first 6 steps of burning the bootloader are the same as the first 5 steps of installing the driver above."}),"\n",(0,s.jsxs)(n.ol,{start:"7",children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Flash the ",(0,s.jsx)(n.code,{children:"SPL"})]}),"\n",(0,s.jsxs)(n.p,{children:["Click ",(0,s.jsx)(n.code,{children:"File Select"}),", select the ",(0,s.jsx)(n.code,{children:"SPL"})," firmware ",(0,s.jsx)(n.code,{children:"mars_u-boot-spl.bin.normal.out"})," to be burned, select ",(0,s.jsx)(n.code,{children:"SPL"})," in ",(0,s.jsx)(n.code,{children:"File Type"}),", select ",(0,s.jsx)(n.code,{children:"FLASH"})," in ",(0,s.jsx)(n.code,{children:"Memory Type"}),", Click ",(0,s.jsx)(n.code,{children:"Load"})," to start burning firmware."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(18895).Z+"",width:"2389",height:"1881"})}),"\n",(0,s.jsxs)(n.p,{children:["After successful burning, ",(0,s.jsx)(n.code,{children:"SUCCEED"})," and ",(0,s.jsx)(n.code,{children:"Complete"})," will be displayed."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(96464).Z+"",width:"2389",height:"1828"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Flash the ",(0,s.jsx)(n.code,{children:"U-BOOT"})]}),"\n",(0,s.jsxs)(n.p,{children:["Click ",(0,s.jsx)(n.code,{children:"File Select"}),", select the ",(0,s.jsx)(n.code,{children:"U-BOOT"})," firmware ",(0,s.jsx)(n.code,{children:"mars_visionfive2_fw_payload.img"})," to be burned, select ",(0,s.jsx)(n.code,{children:"U-Boot"})," in ",(0,s.jsx)(n.code,{children:"File Type"}),", select ",(0,s.jsx)(n.code,{children:"FLASH"})," in ",(0,s.jsx)(n.code,{children:"Memory Type"}),", and then click ",(0,s.jsx)(n.code,{children:"Load"})," to start burning firmware."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(65717).Z+"",width:"2606",height:"1994"})}),"\n",(0,s.jsxs)(n.p,{children:["After successful burning, ",(0,s.jsx)(n.code,{children:"SUCCEED"})," and ",(0,s.jsx)(n.code,{children:"Complete"})," will be displayed."]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{alt:"mars",src:o(95933).Z+"",width:"2606",height:"1994"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"After burning is completed, close the UsbFlashTool window and power off Mars."}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"After powering on again, you can determine whether the bootloader has been updated based on the time information in the serial port log."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"U-Boot SPL 2021.10 (Aug 31 2023 - 12:55:45 +0800)\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"U-Boot 2021.10 (Aug 31 2023 - 12:55:45 +0800), Build: jenkins-github_visionfive2-17\n"})}),"\n",(0,s.jsx)(n.h2,{id:"flash-the-new-version-of-u-boot",children:"Flash the new version of U-Boot"}),"\n",(0,s.jsx)(n.h3,{id:"download-bootloader-firmware",children:"Download Bootloader Firmwa
1re"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/milkv-mars/mars-buildroot-sdk/releases",children:"Bootloader Firmware"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"SPL: mars_u-boot-spl.bin.normal.out\nU-Boot: mars_visionfive2_fw_payload.img\n"})}),"\n",(0,s.jsx)(n.h3,{id:"sd-card-partition",children:"SD Card Partition"}),"\n",(0,s.jsx)(n.p,{children:"The following takes /dev/sdc as an example:"}),"\n",(0,s.jsxs)(n.p,{children:["Run the command ",(0,s.jsx)(n.code,{children:"sudo fdisk /dev/sdc"})," to start fdisk."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"milkv@milkv-desktop:~$ sudo fdisk /dev/sdc\n\nWelcome to fdisk (util-linux 2.37.2).\nChanges will remain in memory only, until you decide to write them.\nBe careful before using the write command.\n\nCommand (m for help):\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Enter ",(0,s.jsx)(n.code,{children:"n"})," as prompted to create a new partition."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"Command (m for help): n\nPartition number (1-128, default 1):\nFirst sector (34-122131422, default 2048):\nLast sector, +/-sectors or +/-size{K,M,G,T,P} (2048-122131422, default 122131422):\nCreated a new partition 1 of type 'Linux filesystem' and of size 58.2 GiB.\n"})}),"\n",(0,s.jsx)(n.p,{children:"Enter as prompted, or press enter directly."}),"\n",(0,s.jsx)(n.p,{children:"Note: If Do you want to remove the signature? [Y]es/[N]o appears, select N."}),"\n",(0,s.jsxs)(n.p,{children:["After creation, enter ",(0,s.jsx)(n.code,{children:"w"})," to save and exit."]}),"\n",(0,s.jsxs)(n.p,{children:["Enter the command ",(0,s.jsx)(n.code,{children:"sudo mkfs.vfat -I /dev/sdc1"})," to format the partition as FAT32."]}),"\n",(0,s.jsxs)(n.p,{children:["Run the command ",(0,s.jsx)(n.code,{children:"lsdlk -f "})," to check whether the formatting is successful."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"milkv@milkv-desktop:~$ sudo mkfs.vfat -I /dev/sdc1\nmkfs.fat 4.2 (2021-01-31)\nmilkv@milkv-desktop:~$ lsblk -f\nNAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS\nloop0\n     squash 4.0                                                    0   100% /snap/bare/5\nloop1\n     squash 4.0                                                    0   100% /snap/core18/2846\nloop2\n     squash 4.0                                                    0   100% /snap/core20/2379\n\n...\n\nsda                                                                         \nsdc                                                                         \n\u2514\u2500sdc1\n     vfat   FAT32       6A8E-8C2A                                           \nnvme0n1\n\u2502                                                                           \n\u251c\u2500nvme0n1p1\n\u2502    vfat   FAT32       0BA1-44C9                             504.9M     1% /boot/efi\n\u2514\u2500nvme0n1p2\n     ext4   1.0         1ad0a4fe-c1e1-4dbe-a6cb-8488144bd6b7     49G    84% /var/snap/firefox/common/host-hunspell\n                                                                            /\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Run the command ",(0,s.jsx)(n.code,{children:"sudo mount /dev/sdc1 /mnt"})," to mount it to the /mnt directory. You can decide which directory to mount to based on the actual situation."]}),"\n",(0,s.jsxs)(n.p,{children:["Copy the downloaded ",(0,s.jsx)(n.code,{children:"mars_u-boot-spl.bin.normal.out"})," and ",(0,s.jsx)(n.code,{children:"mars_visionfive2_fw_payload.img"})," to the mnt directory."]}),"\n",(0,s.jsx)(n.h3,{id:"refresh-u-boot",children:"Refresh u-boot"}),"\n",(0,s.jsx)(n.p,{children:"Assuming your new U-Boot version is on the 1st partition of the SD card, you can install it to the SPI flash using the following commands"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"sf probe\nload mmc 0:1 $kernel_addr_r mars_u-boot-spl.bin.normal.out\nsf update $kernel_addr_r 0 $filesize\nload mmc 0:1 $kernel_addr_r mars_visionfive2_fw_payload.img\nsf update $kernel_addr_r 0x100000 $filesize\n"})}),"\n",(0,s.jsx)(n.p,{children:"Note: load mmc may be 0:1 or 1:1."}),"\n",(0,s.jsxs)(n.p,{children:["You can run the commands ",(0,s.jsx)(n.code,{children:"ls mmc 0:1"})," and ",(0,s.jsx)(n.code,{children:"ls mmc 1:1"})," to see if the files exist."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"StarFive # ls mmc 1:1\n147336 mars_u-boot-spl.bin.normal.out\n2959557 mars_visionfive2_fw_payload.img\n\n2 file(s), 0 dir(s)\n"})}
1),"\n",(0,s.jsx)(n.p,{children:"After updating U-Boot, you may need to reboot and reset the environment to defaults."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"env default -f -a\nenv save\n"})}),"\n",(0,s.jsx)(n.h2,{id:"use-uart-to-start-u-boot-under-linux",children:"Use Uart to start U-BOOT under Linux"}),"\n",(0,s.jsx)(n.p,{children:"When U-BOOT in SPI is damaged and SD card cannot be started, you can use uart to start."}),"\n",(0,s.jsx)(n.h3,{id:"download-bootloader-firmware-1",children:"Download Bootloader Firmware"}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.a,{href:"https://github.com/milkv-mars/mars-buildroot-sdk/releases",children:"Bootloader Firmware"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"SPL: mars_u-boot-spl.bin.normal.out\nU-Boot: mars_visionfive2_fw_payload.img\n"})}),"\n",(0,s.jsx)(n.h3,{id:"download-tio",children:"Download tio"}),"\n",(0,s.jsxs)(n.p,{children:["For reference: ",(0,s.jsx)(n.a,{href:"https://github.com/tio/tio",children:"https://github.com/tio/tio"})]}),"\n",(0,s.jsx)(n.admonition,{type:"tip",children:(0,s.jsxs)(n.p,{children:["Note that you need to download the latest version. The version downloaded by directly running the command ",(0,s.jsx)(n.code,{children:"sudo apt-get install tio"})," does not meet the requirements."]})}),"\n",(0,s.jsx)(n.h3,{id:"boot-from-uart",children:"Boot from UART"}),"\n",(0,s.jsxs)(n.p,{children:["Press and hold the upgrade button on Mars, power the board and upload ",(0,s.jsx)(n.code,{children:"mars_u-boot-spl.bin.normal.out"})," via XMODEM."]}),"\n",(0,s.jsxs)(n.p,{children:["Run the command ",(0,s.jsx)(n.code,{children:"tio -b 115200 --databits 8 --flow none --stopbits 1 /dev/ttyUSB0"})]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"$ tio -b 115200 --databits 8 --flow none --stopbits 1 /dev/ttyUSB0\n[08:14:54.700] tio v2.7\n[08:14:54.700] Press ctrl-t q to quit\n[08:14:54.701] Connected\n\n(C)StarFive\nCCC\n(C)StarFive\nCCCCCCCC\n"})}),"\n",(0,s.jsx)(n.p,{children:"Press ctrl-t x to start XMODEM-1K transmission, and enter according to the prompts."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-[15:37:49.827]",metastring:"Please enter which X modem protocol to use: [15:37:49.827] (0) XMODEM-1K send [15:37:49.827] (1) XMODEM-CRC send [15:37:49.827] (2) XMODEM-CRC receive CCCCCCCCCCCCCCCC [15:37:51.940] Send file with XMODEM-1K [15:38:15.230] Sending file '/tmp/mars_u-boot-spl.bin.normal.out' [15:38:15.230] Press any key to abort transfer .................................................................................................................................................................| [15:38:29.151] Done U-Boot SPL 2021.10 (Nov 24 2023 - 10:21:39 +0800)",children:"LPDDR4: 1G version: g8ad50857.\nTrying to boot from SPI\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Note: ",(0,s.jsx)(n.code,{children:"Sending file '/path/to/mars_u-boot-spl.bin.normal.out' "}),", after entering the file to be sent, wait for the | that appears after ..., which means the sending is complete."]})]})}function h(e={}){const{wrapper:n}={...(0,t.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},1904:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-upgrade-key-8fecc73a755ba812ea5e7b4c92841de1.jpg"},32328:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_02-61bdf5c852365c99e253d071ed3e1eab.png"},58380:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_05-e927dc22fd308e8821aff09f16e83318.png"},32783:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_06-0b8970ecd756004213d61339299e0ba9.png"},30975:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_07-01a81eb2bbe95f36c5cda574bd101c01.png"},86388:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_08-096faaabaecfb3be88d4e69c0cbc40e7.png"},3273:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_09-f0a3f3c5e7ca47f7c313e40f1386ba2e.png"},5608:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_10-140e95a74bdcfcb54f9a135271c4077c.png"},18895:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_16-5eb53bfd7cdfecf6618985145d536d20.png"},96464:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_17-0a6781814eb57c239b3ecc3e9679de09.png"},65717:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_18-939cd6b72c001448a7ab08cad42ffbcb.png"},95933:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-flash-tool_19-009673de5dffbe4f4cf5b8da24661ec9.png"},39907:(e,n,o)=>{o.d(n,{Z:()=>s});const s=o.p+"assets/images/mars-usb-port-a-b48fe1ff1003539d42bf5e1dde1725a3.jpg"},11151:(e,n,o)=>{o.d(n,{Z:()=>d,a:()=>i});var s=o(67294);const t={},r=s.createContext(t);function i(e){const n=s.useContext(r);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:i(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.