前言
這里使用兩種燒錄方式,一種是PhoenixSuit官方燒錄,參考MaixII M2dock 燒錄系統,第二種是類似樹莓派直接燒寫鏡像的方式。官方的講解很完善了,這里主要講第二種。由於win10燒錄會導致GPT分區表錯誤,並且涉及到調整分區,這里將在linux系統下進行。
資源獲取
## 燒錄程序
采用流行的Etcher
格式化軟件
SDCardFormatter,這里用的win10的軟件,根據個人愛好自行選擇
鏡像獲取
系統燒錄
- 格式化sd卡。使用SDCardFormatter一鍵格式化,或者手動格式化為MBR分區,FAT32格式。
- 掛載sd卡。插入設備后,執行
sudo fdisk -l
,出現如下設備
/dev/sdb1 8192 7744511 7736320 3.7G b W95 FAT32
即掛載成功。
- 使用dd命令燒錄程序。先進入鏡像所在文件夾,然后執行如下命令
gzip -dc v831.img.gz |sudo dd of=/dev/sdb bs=1M status=progress
燒錄完畢后,執行執行sudo fdisk -l
,出現如下設備
/dev/sdb1 49152 49663 512 256K Microsoft basic data
/dev/sdb2 49664 61951 12288 6M Microsoft basic data
/dev/sdb3 61952 324095 262144 128M Microsoft basic data
/dev/sdb4 324096 487935 163840 80M Microsoft basic data
即燒錄完畢。
- 擴展分區。如下:(省時間版:
sudo fdisk /dev/sdb p n 回車 回車 w
)
lithromantic@ubuntu:~/Desktop$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (499711 != 7744511) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
Command (m for help): p
Disk /dev/sdb: 3.69 GiB, 3965190144 bytes, 7744512 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: AB6F3888-569A-4926-9668-80941DCB40BC
Device Start End Sectors Size Type
/dev/sdb1 49152 49663 512 256K Microsoft basic data
/dev/sdb2 49664 61951 12288 6M Microsoft basic data
/dev/sdb3 61952 324095 262144 128M Microsoft basic data
/dev/sdb4 324096 487935 163840 80M Microsoft basic data
Command (m for help): n
Selected partition 5
First sector (487936-7744508, default 489472):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (489472-7744508, default 7744508):
Created a new partition 5 of type 'Linux filesystem' and of size 3.5 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
lithromantic@ubuntu:~/Desktop$
- 格式化分區。
sudo mkfs -t ext4 /dev/sdb5
- 掛載分區。掛載分區要在v831上執行,所以在此之前我們先測試下系統能否使用。
插入sd卡至V831,連接USB UART口和電腦usb口,打開串口終端,出現
BusyBox v1.27.2 () built-in shell (ash)
------run profile file-----
__ ___ _ __ _
/ |/ /__ _(_)_ __ / / (_)__ __ ____ __
/ /|_/ / _ `/ /\ \ / / /__/ / _ \/ // /\ \ /
/_/ /_/\_,_/_//_\_\ /____/_/_//_/\_,_//_\_\
----------------------------------------------
root@sipeed:/#
執行fdisk -l
,出現
Number Start (sector) End (sector) Size Name
1 49152 49663 256K env
2 49664 61951 6144K boot
3 61952 324095 128M rootfs
4 324096 487935 80.0M swap
5 489472 7744508 3542M
- 掛載分區。
臨時掛載:mount /dev/mmcblk0p5 /home
這里是掛載到/home
路徑下,可以自行修改。執行df
查看效果:
root@sipeed:/home# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 125460 73284 49556 60% /
tmpfs 29864 12 29852 0% /tmp
none 29796 0 29796 0% /dev
/dev/mmcblk0p5 3504908 14172 3292980 0% /home
永久掛載:echo /dev/mmcblk0p5 /home ext4 defaults 0 0 >> /etc/fstab