v831 dd鏡像制做及擴容腳本的使用


准備工作

linux操作系統電腦一台

Windows操作系統電腦一台

讀卡器一枚

512M tf卡一張

PhoenixCard v4.26

balenaEtcher

Maix Ⅱ dock

resize.sh

resize_root.sh

燒錄鏡像

首先獲取原始鏡像下載站 - Sipeed,解壓后使用PhoenixCard 燒錄到tf卡中。

然后將tf卡插入linux操作系統電腦中。

導出鏡像:sudo dd if=/dev/sdb of=dd.img status=progress

導出dd鏡像后,使用fdisk修改分區信息。

~ fdisk dd.img    

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.
#刪除分區5
Command (m for help): d 
Partition number (1-5, default 5): 

Partition 5 has been deleted.
#刪除分區4
Command (m for help): d
Partition number (1-4, default 4): 4

Partition 4 has been deleted.
#新增分區4
Command (m for help): n
Partition number (4-8, default 4): 
#設置起始扇區
First sector (225792-983036, default 227328): 225792
#設置大小300M
Last sector, +/-sectors or +/-size{K,M,G,T,P} (225792-983036, default 983036): +300M

Created a new partition 4 of type 'Linux filesystem' and of size 299.8 MiB.
刪除分區文件系統簽名
Partition #4 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: y

The signature will be removed by a write command.
#保存文件
Command (m for help): w
The partition table has been altered.
Syncing disks.

制作dd鏡像,將reseze_root.sh,dd.img 放到同一個文件夾中,使用./resize_root.sh ./dd.img ./ v831.img將dd.img轉化為v831.img.xz

(base) ~ ❯ ./resize_root.sh ./dd.img ./ v831.img
input_addr=./dd.img,output_addr=./, name is v831.img

you can run xx.sh <intputaddr> <outputaddr> <name> to specify them or use defult
Such as 
dd.sh ./dd.img /root test.img 
or
dd.sh ./dd.img
losetup: /dev/loop404: detach failed: No such device or address

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.


Command (m for help): -: unknown command

Command (m for help): 

Command (m for help): 
Expert command (m for help): Partition number (1-4, default 4): 
New name: 
Partition name changed from '' to 'rootfs'.

Expert command (m for help): Partition number (1-4, default 4): 
New UUID (in 8-4-4-4-12 format): 
Partition UUID changed from 0B8BFEAD-2829-554C-9E98-73EEBA7EB79B to A0085546-4166-744A-A353-FCA9272B8E48.

Expert command (m for help): 
Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).

e2fsck 1.45.7 (28-Jan-2021)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
Backing up journal inode block information.

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure                                           
Pass 3: Checking directory connectivity                                        
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Free blocks count wrong (0, counted=8324).
Fix? yes

Free inodes count wrong (0, counted=1872).                                     
Fix? yes

Padding at end of inode bitmap is not set. Fix? yes


/dev/loop404p4: ***** FILE SYSTEM WAS MODIFIED *****
/dev/loop404p4: 4144/6016 files (0.0% non-contiguous), 42876/51200 blocks
resize2fs 1.45.7 (28-Jan-2021)
Resizing the filesystem on /dev/loop404p4 to 76736 (4k) blocks.
The filesystem on /dev/loop404p4 is now 76736 (4k) blocks long.

Compressing the mirror takes some time, and you can use <progress -m> at other terminals to see progress
all ok,use xz -dc v831.img.xz |sudo dd of=/dev/sdb bs=1M status=progress oflag=direct to create a tf Startup Disk
(base) ~ ❯ 

現在得到了v831.img.xz,將該文件移動到windows操作系統電腦上,通過balenaEtcher燒錄到另外一張大一些的卡里

擴容磁盤大小

resize.sh導入到Maix Ⅱ dock的根目錄中。

執行resize.sh

擴容root

root@sipeed:/# chmod 777 ./resize.sh 
root@sipeed:/# ./resize.sh 
your input begin
choose you want do:
	1):UDISK
	2):root
	If you want to view your disks on different platforms,you should do 1
	IF you just want expand your root filesystem,do 2
	maybe you all want,then do 2 before do 1
	You will can't change the size of your root filesystem after you get UDISK
	
#選擇2,擴容ROOT分區	

defult 1):2
You choose 2;
#增加1G
+size{K,M,G,T,P} , such as: +1G
	default all size:+1G

日志輸出如下:

#以下是log

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (983039 != 15605759) will be corrected by w(rite).
GPT PMBR size mismatch (983039 != 15605759) will be corrected by w(rite).

Command (m for help): Partition number (1-4, default 4): 
Partition 4 has been deleted.

Command (m for help): Partition number (4-8, default 4): First sector (225792-15605756, default 227328): Last sector, +sectors or +size{K,M,G,T,P} (225792-15605756, default 15605756): 
Created a new partition 4 of type 'Linux filesystem' and of size 1023.8 MiB.

Command (m for help): 
Expert command (m for help): Partition number (1-4, default 4): 
New name: 
Partition name changed from '' to 'rootfs'.

Expert command (m for help): Partition number (1-4, default 4): 
New UUID (in 8-4-4-4-12 format): 
Partition UUID changed from A087BF69-5B80-4148-BCA7-0835259265DB to A0085546-4166-744A-A353-FCA9272B8E49.

Expert command (m for help): 
Command (m for help): GPT PMBR size mismatch (983039 != 15605759) will be corrected by w(rite).

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@sipeed:/# Stopping ntpd: done
Stop dropbear: OK
Stopping telnetd: start-stop-daemon: warning: killing process 820: No such process
FAIL
Stopping network...
Saving random seed... done.
disable android usb
sh: write error: No such device
Stopping app...
killall: python3: no process killed
Stopping logging: OK
save /etc/asound.conf ...
Unload mpp modules
umount: none busy - remounted read-only
The system is going down NOW!
Sent SIGTERM to all processes
Sent[31]HELLO! BOOT0 is starting!
[34]BOOT0 commit : e3b2a9e
[36]board init start
[38]set pll start
[41]set pll end
[42][pmu]: bus read error
[45][pmu]: bus read error
[47]board init ok
[49]chip id check OK
[51]DRAM BOOT DRIVE INFO: V0.41
[54]DRAM CLK = 528 MHz
[56]DRAM Type = 2 (2:DDR2,3:DDR3)
[60]DRAMC read ODT  off.
[62]DRAM ODT off.
[64]DRAM SIZE =64 M
[70]DRAM simple test OK.
[73]rtc standby flag is 0x0, super standby flag is 0x0
[78]dram size =64
MESSAGE: [0x0] TEE-CORE: OP-TEE version: sun8iw19p1_v0.6.0-14-gf6954e7 #1 2019年 11月 21日 星期四 01:34:42 UTC arm
ERROR:   [0x0] TEE-CORE:platform_standby_fdt_parse:126: no pmu node
ERROR:   [0x0] TEE-CORE:sunxi_twi_parse_from_dt:84: no pmu node
------run rc.preboot file-----
------run rc.modules file-----
------run rc.final file-----
Load mpp modules
load /etc/asound.conf ...
alsactl: set_control:1461: Cannot write control '2:0:0:codec trigger playback time value:0' : Operation not permitted
alsactl: set_control:1461: Cannot write control '2:0:0:codec trigger capture time value:0' : Operation not permitted
Starting app...
enable android usb
Initializing random number generator... done.
Starting network...
Starting telnetd: OK
Start dropbear: OK
Starting ntpd: done
your input resize
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/root is now 262080 (4k) blocks long.

change root size ok


BusyBox v1.27.2 () built-in shell (ash)

------run profile file-----
   __  ___     _        __   _               
  /  |/  /__ _(_)_ __  / /  (_)__  __ ____ __
 / /|_/ / _ `/ /\ \ / / /__/ / _ \/ // /\ \ /
/_/  /_/\_,_/_//_\_\ /____/_/_//_/\_,_//_\_\ 
 ----------------------------------------------
root@sipeed:/# sh: write error: Resource busy

#日志結束,查看新空間
root@sipeed:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root              1038104    172424    859544  17% /
tmpfs                    30100        16     30084   0% /tmp
none                     30028         0     30028   0% /dev
/dev/root              1038104    172424    859544  17% /root
root@sipeed:/# 

擴容UDISK分區:

root@sipeed:/# ./resize.sh 
your input begin
choose you want do:
	1):UDISK
	2):root
	If you want to view your disks on different platforms,you should do 1
	IF you just want expand your root filesystem,do 2
	maybe you all want,then do 2 before do 1
	You will can't change the size of your root filesystem after you get UDISK
	
defult 1):
You choose 1;

日志輸出如下:

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Partition number (5-8, default 5): First sector (2322432-15605756, default 2322432): Last sector, +sectors or +size{K,M,G,T,P} (2322432-15605756, default 15605756): 
Created a new partition 5 of type 'Linux filesystem' and of size 6.3 GiB.

Command (m for help): 
Expert command (m for help): Partition number (1-5, default 5): 
New name: 
Partition name changed from '' to 'UDISK'.

Expert command (m for help): 
Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@sipeed:/# Stopping ntpd: done
Stop dropbear: OK
Stopping telnetd: start-stop-daemon: warning: killing process 820: No such process
FAIL
Stopping network...
Saving random seed... done.
disable android usb
sh: write error: No such device
Stopping app...
killall: python3: no process killed
Stopping logging: OK
save /etc/asound.conf ...
Unload mpp modules
umount: none busy - remounted read-only
The system is going down NOW!
Sent SIGTERM to all processes
Sent[31]HELLO! BOOT0 is starting!
[34]BOOT0 commit : e3b2a9e
[36]board init start
[38]set pll start
[41]set pll end
[42][pmu]: bus read error
[45][pmu]: bus read error
[47]board init ok
[49]chip id check OK
[51]DRAM BOOT DRIVE INFO: V0.41
[54]DRAM CLK = 528 MHz
[56]DRAM Type = 2 (2:DDR2,3:DDR3)
[60]DRAMC read ODT  off.
[62]DRAM ODT off.
[64]DRAM SIZE =64 M
[70]DRAM simple test OK.
[73]rtc standby flag is 0x0, super standby flag is 0x0
[78]dram size =64
MESSAGE: [0x0] TEE-CORE: OP-TEE version: sun8iw19p1_v0.6.0-14-gf6954e7 #1 2019年 11月 21日 星期四 01:34:42 UTC arm
ERROR:   [0x0] TEE-CORE:platform_standby_fdt_parse:126: no pmu node
ERROR:   [0x0] TEE-CORE:sunxi_twi_parse_from_dt:84: no pmu node
------run rc.preboot file-----
------run rc.modules file-----
------run rc.final file-----
Load mpp modules
load /etc/asound.conf ...
alsactl: set_control:1461: Cannot write control '2:0:0:codec trigger playback time value:0' : Operation not permitted
alsactl: set_control:1461: Cannot write control '2:0:0:codec trigger capture time value:0' : Operation not permitted
Starting app...
enable android usb
Initializing random number generator... done.
Starting network...
Starting telnetd: OK
Start dropbear: OK
Starting ntpd: done
your input mkfs
sh: write error: Resource busy
all ok


BusyBox v1.27.2 () built-in shell (ash)

------run profile file-----
   __  ___     _        __   _               
  /  |/  /__ _(_)_ __  / /  (_)__  __ ____ __
 / /|_/ / _ `/ /\ \ / / /__/ / _ \/ // /\ \ /
/_/  /_/\_,_/_//_\_\ /____/_/_//_/\_,_//_\_\ 
 ----------------------------------------------

查看新空間:

root@sipeed:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root              1038104    172424    849296  17% /
tmpfs                    30100        16     30084   0% /tmp
none                     30028         0     30028   0% /dev
/dev/mmcblk0p5         6628712         4   6628708   0% /mnt/UDISK
/dev/mmcblk0p5         6628712         4   6628708   0% /root
root@sipeed:/# 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM