当前位置: 首页 > news >正文

【嵌入式Linux】MBR分区表 和 GPT分区表

文章目录

  • GUID以及分区表
    • MBR分区方案
    • GPT 分区方案
    • GPT分区表结构
  • GPT分区表LBA
    • LBA0(MBR兼容部分)
    • LBA1
    • LBA 2-33
    • python生成GPT分区表
    • gpt分区表实例
  • gpt分区表查看
    • 查看百问网T113-s3固件
    • 查看友善之臂nanopi-m1-plus官方固件
    • 查看荣品RV1126固件
    • 查看f1c200s固件
    • 查看V3s的SD启动卡

原文:http://www.pedestrian.com.cn/embedded/gpt/gpt_partition.html

 GPT分区表中有一个比较重要的概念是LBA, 翻译为中文可解释为逻辑区块地址。是描述存储设备上数据所在区块的通用机制,一般用在硬盘或者SD卡这种记忆设备,我们俗称扇区。

  • MBR:主引导记录(Master Boot Record)
  • GPT:GUID分区表(GUID Partition Table)
  • GUID:全局唯一标识符(Globally Unique Identifier),是一种由算法生成的二进制长度为16字节(128位)的数字标识符。通常表示成32个16进制数字(0-9,A-F)组成的字符串,GUID 的格式为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”。例如:6F9619FF-8B86-D011-B42D-00C04FC964FF 即为有效的 GUID 值。

GUID以及分区表

MBR分区方案

 传统的分区方案是将分区信息保存在磁盘的第一个扇区中的64个字节中,每个分区项占16个字节。由于MBR扇区只有64个字节用于分区表,所以只能记录4个分区信息,这就是硬盘主分区数目 不能超过4个的原因,后来为了支持更多的分区引入了扩展分区及逻辑分区的概念,但每个分区项仍用16个字节存储。

 MBR分区有一个比较大的缺陷是不能支持超过2T容量的磁盘,因为这一方案用4个字节存储分区的总扇区数,最大能表示2的32次方的扇区个数,按每个扇区512字节计算,每个分区最大不能超过2T。

计算机硬盘分区:
 MBR(Main Boot Record 主引导记录区)位于整个硬盘的0磁道0柱面1扇区。在512字节的主引导扇区中,MBR只占用了其中的446个字节,另外的64个字节交给了 DPT(Disk Partition Table硬盘分区表),最后两个字节“55,AA”是分区的结束标志。这个整体构成了硬盘的主引导扇区。

主引导扇区由三个部分组成:主引导记录(MBR,Master Boot Record)、硬盘分区表(DPT,Disk Partition Table)、引导记录标志(或者说结束标志)(BRID,Boot Record ID)。

在这里插入图片描述

主引导扇区大小是512字节,其中MBR占据446个字节,DPT占据64字节,BRID占据两个字节。
在这里插入图片描述

相对来说复杂一些。

嵌入式Linux SD启动卡:

地址描述长度(Byte)
0代码区440(最大446)
440选用磁盘标志4
444一般为空值: 0x00002
446标准MBR分区规划(第一个主分区入口)16
462标准MBR分区规划(第二个主分区入口)16
478标准MBR分区规划(第三个主分区入口)16
494标准MBR分区规划(第四个主分区入口)16
510MBR有效标志2

全志V3s的SD卡固件
在这里插入图片描述

数据起始字节数长度描述
08 4F 8A 2B4404标志
00 004442空值
下图红色框区域44616分区表
下图绿色框区域46216分区表
55 AA5102标志

在这里插入图片描述
16字节分区表描述

偏移长度(字节)意义
00H1分区状态:00–>非活动分区;80–>活动分区;其它数值没有意义
01H1分区起始磁头号(HEAD),用到全部8位
02H2分区起始扇区号(SECTOR),占据02H的位0-5;该分区的起始磁柱号(CYLINDER),占据02H的位6-7和03H的全部8位
04H1文件系统标志位
05H1分区结束磁头号(HEAD),用到全部8位
06H2分区结束扇区号(SECTOR),占据06H的位0-5;该分区的结束磁柱号(CYLINDER),占据06H的位6-7和
08H4分区起始相对扇区号
0CH4分区总的扇区数

在这里插入图片描述

软件winhex中在ANSI ASCII区域下拉菜单中选择“分区表(模板)”,可以获取该部分一些信息。
在这里插入图片描述
有两个分区信息。

不是绝对的是在百问网T113-s3的固件里面(如下)地址440~445就没有数据。
在这里插入图片描述
总结

  • ARM开发板的启动卡的MBR,前0~440字节区域都是0,计算机MBR的这块区域有大量的数据和代码。
  • MBR的446~510字节区域,ARM开发板和计算机的都是一样的。四个16字节的分区描述区域(DPT)。

GPT 分区方案

 GUID分区表(简称GPT)是源自EFI标准的一种新的磁盘分区表结构的标准。相较于mbr有以下优点:

  1. 支持2TB 以上的磁盘。
  2. 分区表自带备份,在磁盘的收尾部分分别保存了一份相同的分区表,其中一份被破坏后可通过另一份恢复。
  3. 增加CRC校验机制。
  4. GPT使用一个16字节的全局唯一标识符(guid)来标识分区类型,这使分区类型不容易冲突
  5. 每个分区可以有一个名称。

GPT分区表结构

  • LBA:逻辑区块地址
    在这里插入图片描述

从上图可以看到的是,GPT 的结构是有着 主备两部分的,

  • 上面有Primary GUID Partition(主区),下面有Backup GUID Partition(备用区)。
  • 跟现代的MBR一样,GPT也使用LBA(Logical Block Address,逻辑区块地址)取代了早期的CHS寻址方式。传统MBR信息仅存储于LBA 0,而GPT使用了34个LBA,GPT头存储于LBA 1,接下来才是分区表本身。
  • GPT的每一个分区都可以独立存在,没有所谓的扩展、逻辑分区的概念,即所有分区都是主分区。

GPT分区表LBA

下图是百问网T113-s3(双核ARM A7)的固件:
在这里插入图片描述

  • 可以看出红框内就是一个典型的MBR数据块,这个应该就是LBA0(MBR兼容部分)。
  • 绿框内的前八个字节是"EFI PART",代表这是一个LBA区域。

LBA0(MBR兼容部分)

 在GPT分区表的最开头处,由于兼容性考虑仍然存储了一份传统的MBR,这个MBR叫做保护性
MBR(protective MBR)。在这个MBR中只有一个标识为0xEE的分区,以此来表示这块磁盘使用GPT分区表。

LBA1

分区表头(LBA1)定义了磁盘的可用空间以及组成分区的大小和数量,分区表头结构的详细信息如下

起始字节偏移量内容
08签名(“EFI PART”)
84修订
124分区表头的大小
164分区表头(92字节)的CRC32校验,在计算时先把这个字段写作0处理
204保留,必须是0
248当前LBA(这个分区表头的位置)
328备份LBA(另一个分区表头的位置)
408第一个可用于分区的LBA(主分区表的最后一个LBA+1)
488最后一个可用于分区的LBA(备份分区表的第一个LBA‐1)
5616磁盘GUID(在类unix系统中也叫UUID)
728分区表项的起始LBA(在主分区中是2)
804分区表的数量(windows是128,没用这么多页先占用空间)
844一个分区表项的大小
884分区表项的CRC32校验(计算的是所有分区表项的校验和即128*128字节)
92420保留,剩余字节必须是0(420是针对512字节的LBA磁盘)

LBA 2-33

LBA2‐33的位置存放的是分区表项,分区表项的结构如下

起始字节偏移量内容
016分区类型GUID
1616分区GUID
328起始LBA(小端格式)
408末尾LBA
488属性标签
5272分区名

GUID为固定值,以下列举常见几种

在这里插入图片描述在这里插入图片描述

分区属性:低位4字节表示与主分区类型无关的属性,高位4字节表示与主分区类型有关的属性

BIT解释
0系统分区
1EFI隐藏分区
2传统的BIOS的可引导分区标志
60只读
62隐藏
63不自动挂载,也就是不自动分配盘符

python生成GPT分区表

使用python脚本生成gpt分区表

gen_gpt.py

#!/usr/bin/env python2import binascii
import uuid
from struct import pack, unpackimport sysOS_TYPES = {0x00: 'Empty',0xEE: 'GPT Protective',0xFF: 'UEFI System Partition'
}PARTITION_TYPE_GUIDS = {'024DEE41-33E7-11D3-9D69-0008C781F39F': 'Legacy MBR','C12A7328-F81F-11D2-BA4B-00A0C93EC93B': 'EFI System Partition','21686148-6449-6E6F-744E-656564454649': 'BIOS boot partition','0FC63DAF-8483-4772-8E79-3D69D8477DE4': 'Linux filesystem data','4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709': 'Root partition (x86-64)','0657FD6D-A4AB-43C4-84E5-0933C84B4F4F': 'Swap partition','7C3457EF-0000-11AA-AA11-00306543ECAC': 'Apple APFS'
}def decode_guid(guid_as_bytes):return uuid.UUID(bytes_le=guid_as_bytes)def nts_to_str(buf):s = buf.decode('utf-16')return s.split('\0', 1)[0]def decode_gpt_partition_type_guid(guid):if isinstance(guid, uuid.UUID):guid = str(guid)guid = guid.upper()return PARTITION_TYPE_GUIDS.get(guid, "?")def decode_gpt_partition_entry_attribute(attribute_value):r = []if (attribute_value & 0x1):r.append("Requitted Partition")if (attribute_value & 0x2):r.append("No Block Io Protocal")if (attribute_value & 0x4):r.append("Legacy BIOS Bootable")return rdef decode_gpt_partition_entry(data):(partition_type_guid,unique_partition_guid,starting_lba,ending_lba,attributes,partition_name) = unpack('< 16s 16s Q Q Q 72s', data[0:128])return GPTPartitionEntry(partition_type_guid,unique_partition_guid,starting_lba,ending_lba,attributes,partition_name)def encode_gpt_partition_entry(gpt_partition_entry):  data = pack('<16s 16s Q Q Q 72s',gpt_partition_entry.partition_type_guid_raw,gpt_partition_entry.unique_partition_guid_raw, gpt_partition_entry.starting_lba,        gpt_partition_entry.ending_lba,        gpt_partition_entry.attributes_raw,gpt_partition_entry.partition_name_raw)return datadef encode_gpt_partition_entry_array(gpt_partition_entries, size, count):data  = bytearray()for i in range(0, count):d = encode_gpt_partition_entry(gpt_partition_entries[i])data.extend(d)if len(d) < size:data.extend(bytearray(size - len(d)))return bytes(data)def calculate_partition_entry_array_crc32(data):return binascii.crc32(data) & 0xffffffffclass GPTPartitionEntry():def __init__(self,partition_type_guid,unique_partition_guid,starting_lba,ending_lba,attributes,partition_name):self.partition_type_guid_raw = partition_type_guidself.partition_type_guid = decode_guid(partition_type_guid)self.partition_type = decode_gpt_partition_type_guid(self.partition_type_guid)self.unique_partition_guid_raw = unique_partition_guidself.unique_partition_guid = decode_guid(unique_partition_guid)self.starting_lba = starting_lbaself.ending_lba = ending_lbaself.attributes_raw = attributesself.attributes = decode_gpt_partition_entry_attribute(attributes)self.partition_name_raw =  partition_nameself.partition_name = nts_to_str(partition_name)def is_empty(self):return all(x == 0 for x in self.partition_type_guid_raw)class GPTheader():def __init__(self,signature,revision,header_size,header_crc32,reserved,my_lba,alternate_lba,first_usable_lba,last_usable_lba,disk_guid,partition_entry_lba,number_of_partition_entries,size_of_partition_entry,partition_entry_array_crc32):self.signature = signatureself.revision = revisionself.header_size = header_sizeself.header_crc32 = header_crc32self.reserved = reservedself.my_lba = my_lbaself.alternate_lba = alternate_lbaself.first_usable_lba = first_usable_lbaself.last_usable_lba = last_usable_lbaself.disk_guid = disk_guidself.partition_entry_lba = partition_entry_lbaself.number_of_partition_entries = number_of_partition_entriesself.size_of_partition_entry = size_of_partition_entryself.partition_of_entry_array_crc32 = partition_entry_array_crc32 def is_valid(self):return self.signature == 'EFI PART'.encode('ascii')def calculate_header_crc32(self):header_crc32_input = pack('<8s 4s I I 4s Q Q Q Q 16s Q I I I',self.signature,self.revision,self.header_size,0,self.reserved,self.my_lba,self.alternate_lba,self.first_usable_lba,self.last_usable_lba,self.disk_guid,self.partition_entry_lba,self.number_of_partition_entries,self.size_of_partition_entry,self.partition_entry_array_crc32)return binascii.crc32(header_crc32_input) & 0xffffffffdef encode_gpt_header(gpt_header):data = pack('< 8s 4s I I 4s Q Q Q Q 16s Q I I I',gpt_header.signature,gpt_header.revision,gpt_header.header_size,gpt_header.header_crc32,gpt_header.reserved,gpt_header.my_lba,gpt_header.alternate_lba,gpt_header.first_usable_lba,gpt_header.last_usable_lba,gpt_header.disk_guid,gpt_header.partition_entry_lba,gpt_header.number_of_partition_entries,gpt_header.size_of_partition_entry,gpt_header.partition_entry_array_crc32)return datadef decode_gpt_header(gpt_header):(signature,revision,header_size,header_crc32,reserved,my_lba,alternate_lba,first_usable_lba,last_usable_lba,disk_guid,partition_entry_lba,number_of_partition_entrires,size_of_partition_entry,partition_entry_array_crc32) = unpack('< 8s 4s I I 4s Q Q Q Q 16s Q I I I',data[0:92])gpt_header = GPTheader(signature,revision,      header_size,      header_crc32,reserved,my_lba,alternate_lba,first_usable_lba,last_usable_lba,disk_guid,partition_entry_lba,      number_of_partition_entries,size_of_partition_entry,partition_entry_array_crc32)return gpt_headerdef create_empty_gpt_entry():partition_type_guid = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"unique_partition_guid = b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"starting_lba = 0ending_lba = 0attributes = 0partition_name = "\x00\x00".encode('utf-16')[2:]print(partition_name)entry = GPTPartitionEntry(partition_type_guid, unique_partition_guid,starting_lba,ending_lba,attributes,partition_name)return entrydef create_gpt_entry(start_lba, end_lba, name):partition_type_guid = uuid.uuid4().bytesunique_partition_guid = uuid.uuid4().bytesstarting_lba = start_lbaending_lba = end_lbaattributes = 0partition_name = name.decode("utf-8").encode('utf-16')[2:]entry = GPTPartitionEntry(partition_type_guid,unique_partition_guid,starting_lba,ending_lba,attributes,partition_name)return entrydef complete_gpt_entries(entrylist):an = create_empty_gpt_entry()for i  in range(len(entrylist), 0x80, 1):entrylist.append(an)def create_gpt_header(current_lba):signature = b"EFI PART"revision = b"\x00\x00\x01\x00"header_size = 0x5cheader_crc32 = 0reserved = b"\x00\x00\x00\x00"my_lba = current_lbaalternate_lba = 0first_usable_lba = 34last_usable_lba = 0disk_guid = uuid.uuid4().bytespartition_entry_lba = 2number_of_partition_entries = 0x80size_of_partition_entry = 0x80partition_entry_array_crc32 = 0hdr = GPTheader(signature, revision, header_size, header_crc32, reserved, my_lba,alternate_lba, first_usable_lba, last_usable_lba, disk_guid,partition_entry_lba, number_of_partition_entries, size_of_partition_entry,partition_entry_array_crc32)return hdrclass MBRfilling():def __init__(self, boot_indicator, start_head, start_sector, start_cylinder, partion_type, end_head, end_sector, end_cylinder, partition_reset, partition_sectors):self.boot_indicator = boot_indicatorself.start_head = start_headself.start_sector = start_sectorself.start_cylinder = start_cylinderself.partion_type = partion_typeself.end_head = end_headself.end_sector = end_sectorself.end_cylinder = end_cylinderself.partition_reset = partition_resetself.partition_sectors = partition_sectorsdef encode_mbr_pack(mbr_pack):data = pack('< B B B B B B B B I I',mbr_pack.boot_indicator, mbr_pack.start_head, mbr_pack.start_sector, mbr_pack.start_cylinder,mbr_pack.partion_type, mbr_pack.end_head, mbr_pack.end_sector, mbr_pack.end_cylinder, mbr_pack.partition_reset, mbr_pack.partition_sectors)return datadef mbr_partition_pack(sectors):boot_indicator = 0x00start_head = 0x00start_sector = 0x02start_cylinder = 0x00partion_type = 0xeeend_head = 0xffend_sector = 0xffend_cylinder = 0xffpartition_reset = 0x0001partition_sectors = sectorsmbr_pack = MBRfilling(boot_indicator, start_head, start_sector, start_cylinder, partion_type,end_head, end_sector, end_cylinder, partition_reset, partition_sectors)data = encode_mbr_pack(mbr_pack)return datadef create_mbr():mbr_data = bytearray()    mbr_data.extend(bytearray(0x1be))mbr_partition_data = mbr_partition_pack(0x01dacbff)mbr_data.extend(mbr_partition_data)mbr_data.extend(bytearray(48))end_data = pack('< B B', 0x55, 0xaa)mbr_data.extend(end_data)return mbr_data    def create(back_lba, alternate_lba, entrylist):complete_gpt_entries(entrylist)entriesdata = encode_gpt_partition_entry_array(entrylist, 0x80, 0x80)hdr = create_gpt_header(1)hdr.alternate_lba = alternate_lba hdr.last_usable_lba = alternate_lba - 33hdr.partition_entry_array_crc32 = calculate_partition_entry_array_crc32(entriesdata)hdr.header_crc32 = hdr.calculate_header_crc32()gptdata = encode_gpt_header(hdr)mbrdata = create_mbr()#gpt mainmaindata = bytearray()#mbr#maindata.extend(bytearray(0x200))maindata.extend(mbrdata)#gpt headermaindata.extend(gptdata)maindata.extend(bytearray(0x200 - len(gptdata)))#gpt rablemaindata.extend(entriesdata)hdr.my_lba = alternate_lba hdr.alternate_lba = 1hdr.partition_entry_array_crc32 = calculate_partition_entry_array_crc32(entriesdata)hdr.header_crc32 = hdr.calculate_header_crc32()gptdata = encode_gpt_header(hdr)#gpt backupbackdata = bytearray()backdata.extend(entriesdata)#gpt headerbackdata.extend(gptdata)backdata.extend(bytearray(0x200 - len(gptdata)))#gpt tablereturn (bytes(maindata), bytes(backdata))def parse_conf(path, entrylist):maxsize = 0partition_num = 0with open(path, "rb") as f:items = f.readlines()for item in items:(ispart, name, fstype, starts, stops, crop) = item.split(b':')if int(ispart) == 1:partition_num = partition_num + 1if name.find('/') != -1:name = name[:name.find(b'/')]entry = create_gpt_entry(int(starts[:-1]), int(stops[:-1]), name)entrylist.append(entry)maxsize = stops[:-1]return (int(maxsize)+33, int(partition_num))if __name__ == '__main__':if len(sys.argv) != 4:print("Error: args number is not 3")print("Usage: sys.argv[0] gpt.conf main_img")sys.exit(1)path = sys.argv[1]main_img = sys.argv[2]back_img = sys.argv[3]entrylist = [](alternate_lba, back_lba)  = parse_conf(path, entrylist)print(alternate_lba)print(back_lba)(main_data, back_data) = create(back_lba, alternate_lba, entrylist)create_mbr()with open(main_img, "wb") as f:f.write(main_data)with open(back_img, "wb") as f:f.write(back_data)

gen_gpt.py 会解析分区表配置文件生成主分区表以及备份分区表
配置文件的示例如下
gpt配置文件

gpt_partition.conf

1:uboot/vfat:none:34s:262144s:1
1:system:ext4:262145s:31116254s:1

可使用如下命令生成分区表

python gen_gpt.py gpt_partition.conf main_partition.img back_partition.img

gpt分区表实例

主分区表

liefyuan@ubuntu:~/work/gpt$ hexdump main_partition.img 
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
00001c0 0002 ffee ffff 0001 0000 cbff 01da 0000
00001d0 0000 0000 0000 0000 0000 0000 0000 0000
*
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200 4645 2049 4150 5452 0000 0001 005c 0000
0000210 9229 830f 0000 0000 0001 0000 0000 0000
0000220 cbff 01da 0000 0000 0022 0000 0000 0000
0000230 cbde 01da 0000 0000 8c98 f34d 36ef 5645
0000240 8799 e483 2578 f760 0002 0000 0000 0000
0000250 0080 0000 0080 0000 fb56 8758 0000 0000
0000260 0000 0000 0000 0000 0000 0000 0000 0000
*
0000400 a05e fbd4 a7f9 8e40 6cbd 9ecd cf49 9ba0
0000410 2db5 fb66 40aa 9543 8a86 be7d 45ae 366c
0000420 0022 0000 0000 0000 0000 0004 0000 0000
0000430 0000 0000 0000 0000 0075 0062 006f 006f
0000440 0074 0000 0000 0000 0000 0000 0000 0000
0000450 0000 0000 0000 0000 0000 0000 0000 0000
*
0000480 0ed5 4faf 8ed7 504b 3a8f 2ddc 0f60 5482
0000490 aa68 0ab5 dbda 6f4c b290 51f3 fe6a 23dd
00004a0 0001 0004 0000 0000 cbde 01da 0000 0000
00004b0 0000 0000 0000 0000 0073 0079 0073 0074
00004c0 0065 006d 0000 0000 0000 0000 0000 0000
00004d0 0000 0000 0000 0000 0000 0000 0000 0000
*
0004400

备份分区表

liefyuan@ubuntu:~/work/gpt$ hexdump back_partition.img 
0000000 a05e fbd4 a7f9 8e40 6cbd 9ecd cf49 9ba0
0000010 2db5 fb66 40aa 9543 8a86 be7d 45ae 366c
0000020 0022 0000 0000 0000 0000 0004 0000 0000
0000030 0000 0000 0000 0000 0075 0062 006f 006f
0000040 0074 0000 0000 0000 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
0000080 0ed5 4faf 8ed7 504b 3a8f 2ddc 0f60 5482
0000090 aa68 0ab5 dbda 6f4c b290 51f3 fe6a 23dd
00000a0 0001 0004 0000 0000 cbde 01da 0000 0000
00000b0 0000 0000 0000 0000 0073 0079 0073 0074
00000c0 0065 006d 0000 0000 0000 0000 0000 0000
00000d0 0000 0000 0000 0000 0000 0000 0000 0000
*
0004000 4645 2049 4150 5452 0000 0001 005c 0000
0004010 072f 2af5 0000 0000 cbff 01da 0000 0000
0004020 0001 0000 0000 0000 0022 0000 0000 0000
0004030 cbde 01da 0000 0000 8c98 f34d 36ef 5645
0004040 8799 e483 2578 f760 0002 0000 0000 0000
0004050 0080 0000 0080 0000 fb56 8758 0000 0000
0004060 0000 0000 0000 0000 0000 0000 0000 0000
*
0004200

gpt分区表查看

一般fdisk适用于MBR分区,而gdisk使用GPT分区.gdisk命令常用格式如下

gdisk 设备文件名(绝对路径)

示例如下

$ gdisk system.img
GPT fdisk (gdisk) version 1.0.5
Warning! Disk size is smaller than the main header indicates! Loading
secondary header from the last sector of the disk! You should use 'v' to
verify disk integrity, and perhaps options on the experts' menu to repair
the disk.
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Error 25 reading partition table for CRC check!
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged
****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Command (? for help): print
Disk system.img: 526336 sectors, 257.0 MiB
Sector size (logical): 512 bytes
Disk identifier (GUID): CB0A9716‐409B‐FD40‐8DD9‐5FB082604799
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 62160862
Partitions will be aligned on 2048‐sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB FFFF system_A
2 2099200 4196351 1024.0 MiB FFFF system_B
3 4196352 62160862 27.6 GiB FFFF user
Command (? for help):

查看百问网T113-s3固件

主芯片是全志T113-s3,32位,双核ARM A7

liefyuan@ubuntu:~/work/img-test$ gdisk 100ask-t113-pro_sdcard.img 
GPT fdisk (gdisk) version 1.0.3Partition table scan:MBR: hybridBSD: not presentAPM: not presentGPT: presentFound valid GPT with hybrid MBR; using GPT.Command (? for help): print
Disk 100ask-t113-pro_sdcard.img: 1154152 sectors, 563.6 MiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 6BDDD82D-66B5-4034-95C6-FB3F1EF3C922
Partition table holds up to 128 entries
Main partition table begins at sector 2048 and ends at sector 2079
First usable sector is 35392, last usable sector is 1154118
Partitions will be aligned on 64-sector boundaries
Total free space is 7 sectors (3.5 KiB)Number  Start (sector)    End (sector)  Size       Code  Name1           35392           39487   2.0 MiB     8300  boot-resource2           39488           39743   128.0 KiB   8300  env3           39744           39999   128.0 KiB   8300  env-redund4           40000          105535   32.0 MiB    8300  boot5          105536          629823   256.0 MiB   8300  rootfs6          629824         1154111   256.0 MiB   8300  shareCommand (? for help): 
liefyuan@ubuntu:~/work/img-test$ fdisk 100ask-t113-pro_sdcard.img Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.A hybrid GPT was detected. You have to sync the hybrid MBR manually (expert command 'M').Command (m for help): printDisk 100ask-t113-pro_sdcard.img: 563.6 MiB, 590925824 bytes, 1154152 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: gpt
Disk identifier: 6BDDD82D-66B5-4034-95C6-FB3F1EF3C922Device                       Start     End Sectors  Size Type
100ask-t113-pro_sdcard.img1  35392   39487    4096    2M Linux filesystem
100ask-t113-pro_sdcard.img2  39488   39743     256  128K Linux filesystem
100ask-t113-pro_sdcard.img3  39744   39999     256  128K Linux filesystem
100ask-t113-pro_sdcard.img4  40000  105535   65536   32M Linux filesystem
100ask-t113-pro_sdcard.img5 105536  629823  524288  256M Linux filesystem
100ask-t113-pro_sdcard.img6 629824 1154111  524288  256M Linux filesystemCommand (m for help): 

查看友善之臂nanopi-m1-plus官方固件

主芯片是全志H3,32位,四核ARM A7

liefyuan@ubuntu:~/work/img-test$ gdisk nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img 
GPT fdisk (gdisk) version 1.0.3Partition table scan:MBR: MBR onlyBSD: not presentAPM: not presentGPT: not present***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************Warning! Secondary partition table overlaps the last partition by
1626041 blocks!
You will need to delete this partition or resize it in another utility.Command (? for help): print
Disk nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img: 958568 sectors, 468.1 MiB
Sector size (logical): 512 bytes
Disk identifier (GUID): D221F4BC-40C0-4E19-93ED-A5C1FE413A2A
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 958534
Partitions will be aligned on 2048-sector boundaries
Total free space is 49118 sectors (24.0 MiB)Number  Start (sector)    End (sector)  Size       Code  Name1           49152          131071   40.0 MiB    0700  Microsoft basic data2          131072         2516991   1.1 GiB     8300  Linux filesystem3         2516992         2584575   33.0 MiB    8300  Linux filesystemCommand (? for help): ^C
liefyuan@ubuntu:~/work/img-test$ fdisk nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): print
Disk nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img: 577.9 MiB, 605933568 bytes, 1183464 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: 0x00000000Device                                                       Boot   Start     End Sectors  Size Id Type
nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img1        49152  131071   81920   40M  b W95 FAT32
nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img2       131072 2516991 2385920  1.1G 83 Linux
nanopi-m1-plus_sd_ubuntu-tft-xenial_4.14_armhf_20210425.img3      2516992 2584575   67584   33M 83 LinuxCommand (m for help): ^C

查看荣品RV1126固件

主芯片瑞芯微RV1126,32位,双核ARM A7

liefyuan@ubuntu:~/work/img-test$ fdisk update-pro-rv1126-5-720-1280-20220505.img Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0xb57e8937.Command (m for help): print
Disk update-pro-rv1126-5-720-1280-20220505.img: 820.9 MiB, 860753920 bytes, 1681160 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: 0xb57e8937Command (m for help): ^C
Do you really want to quit? liefyuan@ubuntu:~/work/img-test$ gdisk update-pro-rv1126-5-720-1280-20220505.img 
GPT fdisk (gdisk) version 1.0.3Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Warning: File size is not a multiple of 512 bytes! Misbehavior is likely!
Partition table scan:MBR: not presentBSD: not presentAPM: not presentGPT: not presentCreating new GPT entries.Command (? for help): print
Disk update-pro-rv1126-5-720-1280-20220505.img: 2136216 sectors, 1.0 GiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 893418C0-ABD5-4E1A-98F0-6AF69C7C472A
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 2136182
Partitions will be aligned on 2048-sector boundaries
Total free space is 2136149 sectors (1.0 GiB)Number  Start (sector)    End (sector)  Size       Code  NameCommand (? for help): ^[[^H^H^H^H^C

查看f1c200s固件

主芯片全志F1c200s,32位,ARM11

liefyuan@ubuntu:~/work/img-test$ fdisk sysimage-sdcard.img Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.Command (m for help): print
Disk sysimage-sdcard.img: 109 MiB, 114294784 bytes, 223232 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: 0x00000000Device               Boot Start    End Sectors  Size Id Type
sysimage-sdcard.img1         16   2047    2032 1016K  0 Empty
sysimage-sdcard.img2 *     2048  18431   16384    8M  c W95 FAT32 (LBA)
sysimage-sdcard.img3      18432 223231  204800  100M 83 LinuxCommand (m for help): ^C
liefyuan@ubuntu:~/work/img-test$ gdisk sysimage-sdcard.img 
GPT fdisk (gdisk) version 1.0.3Partition table scan:MBR: MBR onlyBSD: not presentAPM: not presentGPT: not present***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.Command (? for help): print
Disk sysimage-sdcard.img: 223232 sectors, 109.0 MiB
Sector size (logical): 512 bytes
Disk identifier (GUID): 1CBF2B75-23D9-4529-AD2B-5A15A4833D26
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 223198
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)Number  Start (sector)    End (sector)  Size       Code  Name2            2048           18431   8.0 MiB     0700  Microsoft basic data3           18432          223231   100.0 MiB   8300  Linux filesystemCommand (? for help): ^C

目前手上的这些开发板的固件,分区类型都不是很清晰啊!

查看V3s的SD启动卡

分区:
在这里插入图片描述在这里插入图片描述

liefyuan@ubuntu:/media/liefyuan$ sudo fdisk /dev/sdbWelcome 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): print
Disk /dev/sdb: 29.1 GiB, 31243370496 bytes, 61022208 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: 0x28b6d4cfDevice     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        2048    34815    32768   16M  6 FAT16
/dev/sdb2       34816 61022207 60987392 29.1G 83 LinuxCommand (m for help): ^C 
liefyuan@ubuntu:/media/liefyuan$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.1Partition table scan:MBR: MBR onlyBSD: not presentAPM: not presentGPT: not present***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.Command (? for help): print
Disk /dev/sdb: 61022208 sectors, 29.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 3883B406-E1D8-4041-9BA1-1CA32D678B1A
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 61022174
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)Number  Start (sector)    End (sector)  Size       Code  Name1            2048           34815   16.0 MiB    0700  Microsoft basic data2           34816        61022207   29.1 GiB    8300  Linux filesystem

相关文章:

【嵌入式Linux】MBR分区表 和 GPT分区表

文章目录 GUID以及分区表MBR分区方案GPT 分区方案GPT分区表结构 GPT分区表LBALBA0&#xff08;MBR兼容部分&#xff09;LBA1LBA 2-33python生成GPT分区表gpt分区表实例 gpt分区表查看查看百问网T113-s3固件查看友善之臂nanopi-m1-plus官方固件查看荣品RV1126固件查看f1c200s固件…...

【华为OD机试真题】MVP争夺战(python)100%通过率 超详细代码注释 代码解读

【华为OD机试真题 2022&2023】真题目录 @点这里@ 【华为OD机试真题】信号发射和接收 &试读& @点这里@ 【华为OD机试真题】租车骑绿道 &试读& @点这里@ MVP争夺战 知识点DFS搜索 时间限制:1s 空间限制:256MB 限定语言:不限 题目描述: 在星球争霸篮球赛对…...

实战打靶集锦-019-BTRSys2.1

提示&#xff1a;本文记录了博主的一次普通的打靶经历 目录 1. 主机发现2. 端口扫描3. 服务枚举4. 服务探查4.1 FTP服务探查4.2 Apache服务探查4.2.1 wpscan扫描4.2.2 Metasploit神器4.2.3 手工探查页面4.2.3.1 Appearance Editor4.2.3.2 Plugins Editor 5. 提权5.1 系统信息枚…...

2023中国(苏州)国际电源工业展览会暨高端论坛

时间&#xff1a;2023年11月9&#xff5e;11日 地点&#xff1a;苏州国际博览中心 30000㎡展出面积 500参展商 50000名专业观众 中国电源行业风向标----相约苏州&#xff0c;共襄盛举&#xff01; ◆展会背景Exhibition background&#xff1a; …...

基于SpringBoot+Vue的校园疫情防控系统(附源码和数据库)

文章目录 第一章2.主要技术第三章第四章 系统设计4.1功能结构4.2 数据库设计4.2.1 数据库E/R图4.2.2 数据库表 第五章 系统功能实现5.1系统功能模块5.2后台功能模块5.2.1管理员功能 源码咨询 第一章 springboot校园疫情防控系统演示录像2022 一个好的系统能将校园疫情防控的管理…...

Docker启动安装nacos

当需要在本地或云环境中部署和管理微服务时&#xff0c;Nacos是一个非常流行的选择。Nacos是一个用于动态服务发现、配置管理和服务管理的开源平台。在本文中&#xff0c;我们将详细介绍如何使用Docker来启动和安装Nacos。 步骤1&#xff1a;安装Docker 首先&#xff0c;确保…...

FastDFS总结

目录 概述 什么是分布式文件系统 核心概念 目录结构 上传机制 下载机制 Linux中搭建FastDFS 常用指令 SpringBoot整合FastDFS FastDFS集成Nginx 概述 FastDFS是一个开源的轻量级分布式文件系统。它解决了大数据量存储和负载均衡等问题。特别适合以中小文件&#xff…...

【职场新人备忘录】新人职场生存指南:快速适应、持续成长和个人提升

新人职场生存指南&#xff1a;快速适应、持续成长和个人提升 引言 职场对于新人来说充满了新的挑战和机遇。作为一名新人&#xff0c;如何在职场中快速适应、获得成长和提升自己是至关重要的技能。本备忘录旨在为职场新人提供实用的职场tips&#xff0c;帮助他们在职场中取得…...

SpringCloud Alibaba详解

目录 微服务架构概念 服务治理 服务调用 服务网关 服务容错 链路追踪 SpringcloudAlibaba组件 Nacos 负载均衡 Ribbon Fegin Sentinel 高并发测试 容错方案 Sentinel入门 Feign整合Sentinel 微服务架构概念 服务治理 服务治理就是进行服务的自动化管理&#xf…...

Golang每日一练(leetDay0065) 位1的个数、词频统计

目录 191. 位1的个数 Nnumber of 1-bits &#x1f31f; 192. 统计词频 Word Frequency &#x1f31f;&#x1f31f; &#x1f31f; 每日一练刷题专栏 &#x1f31f; Golang每日一练 专栏 Python每日一练 专栏 C/C每日一练 专栏 Java每日一练 专栏 191. 位1的个数 Nnum…...

前端技术搭建井字游戏(内含源码)

The sand accumulates to form a pagoda ✨ 写在前面✨ 功能介绍✨ 页面搭建✨ 样式设置✨ 逻辑部分 ✨ 写在前面 上周我们实通过前端基础实现了飞机大战游戏&#xff0c;今天还是继续按照我们原定的节奏来带领大家完成一个井字游戏游戏&#xff0c;功能也比较简单简单&#x…...

视频截取gif方法分享,利用gif制作工具在线制作动图

表情包作为聊天社交中调节氛围的工具&#xff0c;而动态的gif表情包更是深受大众的喜爱。那么&#xff0c;这种gif动态图片要怎么制作呢&#xff1f;其实&#xff0c;很简单不需要下载软件&#xff0c;小白也能轻松操作的。 一、什么工具能够制作gif动画呢&#xff1f; 使用G…...

VRRP高级特性——管理VRRP

目录 管理VRRP备份组与业务VRRP备份组 管理VRRP备份组的两种实现方式 配置管理备份组 当在设备上配置了多个VRRP备份组时&#xff0c;为了减少设备间交互大量的VRRP协议报文&#xff0c;可以将其中一个VRRP备份组配置为管理VRRP备份组&#xff08;mVRRP&#xff09;&#xf…...

FreeRTOS内核:详解Task各状态(GPT4帮写)

FreeRTOS内核&#xff1a;详解Task各状态&#xff08;GPT4帮写&#xff09; 1. 背景2. Task顶层状态区分3. 运行状态&#xff08;Running&#xff09;4. 非运行状态4.1 阻塞态&#xff08;Blocked&#xff09;&#xff1a;4.2 挂起态&#xff08;Suspended&#xff09;4.3 就绪…...

基于粒子群优化算法的最佳方式优化无线传感器节点的位置(Matlab代码实现)

目录 &#x1f4a5;1 概述 &#x1f4da;2 运行结果 &#x1f389;3 参考文献 &#x1f468;‍&#x1f4bb;4 Matlab代码 &#x1f4a5;1 概述 此代码优化了由于电池耗尽而产生覆盖空洞后 WSN 节点的位置。如果活动通信中的任何节点死亡&#xff0c;则通过PSO优化再次定位…...

第一章 Andorid系统移植与驱动开发概述 - 读书笔记

Android驱动月考1 第一章 Andorid系统移植与驱动开发概述 - 读书笔记 1.Android系统的架构&#xff1a; &#xff08;1&#xff09;Linux内核&#xff0c;Android是基于Linux内核的操作系统&#xff0c;并且开源&#xff0c;所以Android与Ubuntu等操作系统的差别很小&#x…...

vi编辑器的三种模式及其对应模式下常用指令

vi是Linux系统的第一个全屏幕交互式编辑工具&#xff0c;在嵌入式的 学习中是一个不可或缺的强大的文本编辑工具。 一、三种模式 命令模式 如何进入命令模式&#xff1a;按esc键 复制&#xff1a;yy nyy(n&#xff1a;行数) 删除(剪切): dd ndd 粘贴&#xff1a;p 撤销&…...

webpack: 5 报错,错误

webpack-报错&#xff1a;Uncaught ReferenceError: $ is not defined (webpack) webpack打包jquery的插件&#xff08;EasyLazyLoad&#xff09;时&#xff0c;报错 方法一&#xff1a; //多个js文件用到jquery&#xff0c;用这种方法 在jquery.min.js的做最后写上下面的代码…...

MyBatis的缓存

文章目录 一、MyBatis的一级缓存二、MyBatis的二级缓存三、MyBatis缓存查询的顺序 一、MyBatis的一级缓存 一级缓存是SqlSession级别的&#xff0c;通过同一个SqlSession查询的数据会被缓存&#xff0c;下次查询相同的数据&#xff0c;就 会从缓存中直接获取&#xff0c;不会从…...

c语言-位段

有些数据在存储时并不需要占用一个完整的字节&#xff0c;只需要占用一个或几个二进制位即可。例如开关只有通电和断电两种状态&#xff0c;用0和1表示足以&#xff0c;也就是用一个二进位。正是基于这种考虑&#xff0c;C语言又提供了一种叫做位域的数据结构。 ​ **在结构体…...

Servlet3.0 新特性全解

Servlet3.0新特性全解 tomcat 7以上的版本都支持Servlet 3.0 Servlet 3.0 新增特性 注解支持&#xff1b;Servlet、Filter、Listener无需在web.xml中进行配置&#xff0c;可以通过对应注解进行配置&#xff1b;支持Web模块&#xff1b;Servlet异步处理&#xff1b;文件上传AP…...

PAT A1045 Favorite Color Stripe

1045 Favorite Color Stripe 分数 30 作者 CHEN, Yue 单位 浙江大学 Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the rem…...

真实业务场景使用-门面模式(外观)设计模式

1.前言 最近接到要修改的业务功能&#xff0c;这个业务增删改查很多功能都需要校验时间&#xff0c;比如&#xff1a; 1.失效时间不能超过自己父表的失效时间&#xff0c; 2.失效时间不能是当前时间 3.失效时间不能早于生效时间 类似这样的不同的判断还有很多&#xff0c;…...

基于多动作深度强化学习的柔性车间调度研究(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…...

出口亚马逊平衡车CE/UKCA认证注意事项

平衡车UKC认证 CE认证 认证项目&#xff1a;BS EN/EN71-1-2-3 UKCA认证标志与CE认证标志有什么不同? UKCA标记过程基本上遵循与CE标记相同的规则和规定。大多数制造商仍然可以根据测试结果和其他技术文档自行声明他们的产品&#xff0c;但在特定情况下&#xff0c;他们需要从第…...

云原生环境下的安全实践:保护应用程序和数据的关键策略

文章目录 云原生环境下的安全实践&#xff1a;保护应用程序和数据的关键策略一.安全措施和实践1. 身份和访问管理&#xff1a;2. 容器安全&#xff1a;3. 网络安全&#xff1a;4. 日志和监控&#xff1a;5. 持续集成和持续交付&#xff08;CI/CD&#xff09;安全&#xff1a;6.…...

vue 改变数据后,数据变化页面不刷新

文章目录 导文文章重点方法一&#xff1a;使用this.$forceUpdate()强制刷新方法二&#xff1a;Vue.set(object, key, value)方法三&#xff1a;this.$nextTick方法四&#xff1a;$set方法 导文 在vue项目中&#xff0c;会遇到修改完数据&#xff0c;但是视图却没有更新的情况 v…...

【Qt编程之Widgets模块】-006:QSortFilterProxyModel代理的使用方法

QSortFilterProxyModel是model的代理&#xff0c;不能单独使用&#xff0c;真正的数据需要另外的一个model提供&#xff0c;它的工鞥呢是对被代理的model(source model)进行排序和过滤。所谓过滤&#xff1a;也就是说按着你输入的内容进行数据的筛选&#xff0c;因为器过滤功能…...

上林赋 汉 司马相如

亡是公听然而笑曰&#xff1a;“楚则失矣&#xff0c;而齐亦未为得也。夫使诸侯纳贡者&#xff0c;非为财币&#xff0c;所以述职也。封疆画界者&#xff0c;非为守御&#xff0c;所以禁淫也。今齐列为东藩&#xff0c;而外私肃慎&#xff0c;捐国逾限&#xff0c;越海而田&…...

7.对象模型

对象模型 信号和槽 信号和槽是一种用于对象之间通信的机制。信号是对象发出的通知&#xff0c;槽是用于接收这些通知的函数。 当对象的状态发生变化时[按钮被点击]&#xff0c;它会发出一个信号[clicked()]&#xff0c;然后与该对象连接的槽函数将被自动调用。 若某个信号与多…...