3917

arm开发板(orangepi)系统烧制

乐果   发表于   2019 年 02 月 22 日 标签:arm

准备工作

1、下载镜像压缩包,解压成img

2、准备一张sd卡,读卡器

3、orangepi/或bananapi/或树莓派等arm开发板

烧制系统到sd卡

本例将介绍在linux系统下。

xiao@xiao-desktop cd /dev
xiao@xiao-desktop ls

ls命令,记录未插入sd卡前,dev目录下的文件。然后再将sd卡放入读卡器插上电脑的usb插口, 再ls命令,对比发现sd卡,例如本例发现dev目录下多了: sdc、sdc1、sdc2三个文件。 或用fdisk -l命令,找到sd卡。

清除sd卡分区,重新建分区:

xiao@xiao-desktop /dev $ sudo umount /dev/sdc*
xiao@xiao-desktop /dev $ sudo fdisk /dev/sdc

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

////////清除所有分区
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xf22376e6.

////////查看分区,分区已被清除
Command (m for help): p
Disk /dev/sdd: 30 GiB, 32220643328 bytes, 62930944 sectors
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: dos
Disk identifier: 0xf22376e6

////////新建分区
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-62930943, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-62930943, default 62930943): 

Created a new partition 1 of type 'Linux' and of size 30 GiB.

////////保存修改
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

格式化sd卡:

xiao@xiao-desktop /dev $ sudo mkfs.vfat /dev/sdc1

写入镜像:

xiao@xiao-desktop /dev $ sudo dd if=/home/xiao/work/orange-pi/OrangePi_Plus2E_Ubuntu16.04_Desktop_Lxde_v2.0.img of=/dev/sdc bs=1M
3200+0 records in
3200+0 records out
3355443200 bytes (3.4 GB, 3.1 GiB) copied, 232.066 s, 14.5 MB/s

扩大系统分区容量

成功烧制系统到sd卡后,发现原本32G的sd卡,系统分区大小只有3G~4G容量,以后使用很容易造成系统目录空间不足,为此需要扩大系统所在分区的容量。

fdisk修改扇区柱头起始值,例如本例将主分区容量扩大到10G:

xiao@xiao-desktop /dev $ sudo fdisk /dev/sdc
[sudo] password for xiao: 

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


Command (m for help): p
Disk /dev/sde: 30 GiB, 32220643328 bytes, 62930944 sectors
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: dos
Disk identifier: 0x0003c1e0

Device     Boot  Start     End Sectors Size Id Type
/dev/sdc1        40960  172031  131072  64M  b W95 FAT32
/dev/sdc2       172032 6547455 6375424   3G 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (2-4, default 2): 
First sector (2048-62930943, default 2048): 172032
Last sector, +sectors or +size{K,M,G,T,P} (172032-62930943, default 62930943): +10G

Created a new partition 2 of type 'Linux' and of size 10 GiB.

Command (m for help): p
Disk /dev/sde: 30 GiB, 32220643328 bytes, 62930944 sectors
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: dos
Disk identifier: 0x0003c1e0

Device     Boot  Start      End  Sectors Size Id Type
/dev/sde1        40960   172031   131072  64M  b W95 FAT32
/dev/sde2       172032 21143551 20971520  10G 83 Linux

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

e2fsck、resize2fs命令检查修改后的分区:

xiao@xiao-desktop /dev $ sudo e2fsck -f /dev/sdc2
e2fsck 1.42.13 (17-May-2015)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
linux: 109564/197600 files (0.2% non-contiguous), 719369/796928 blocks

xiao@xiao-desktop /dev $ sudo resize2fs /dev/sdc2
resize2fs 1.42.13 (17-May-2015)
Resizing the filesystem on /dev/sde2 to 2621440 (4k) blocks.
The filesystem on /dev/sde2 is now 2621440 (4k) blocks long.

乐果   发表于   2019 年 02 月 22 日 标签:arm

0

文章评论