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:/# 
posted @ 2021-10-20 22:52  USTHzhanglu  阅读(1181)  评论(0编辑  收藏  举报