Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Embedded FreeBSD Cookbook phần 9 ppsx
MIỄN PHÍ
Số trang
26
Kích thước
119.7 KB
Định dạng
PDF
Lượt xem
709

Embedded FreeBSD Cookbook phần 9 ppsx

Nội dung xem thử

Mô tả chi tiết

186 Embedded FreeBSD

Cookbook

State

The first entry in the partition is the state, which is either value 0 or 80H.

A value of 80H denotes that this partition is active and can be booted.

Start of partition

The next three bytes contain the start of the partition in head, sector, cylinder

format. Disks traditionally access storage by head, cylinder and sector offset.

With the constant increase in capacity of hard drives, the space reserved in

the MBR became too small to address a complete hard drive. To handle this

issue, a new addressing scheme was developed that used the bits in the

head, cylinder and sector fields. This new scheme is called Logical Block

Addressing (LBA).

Let’s look at an example using the start of the partition offset 2, the sector,

and 3, the cylinder. The address of the starting sector is computed using the

offsets 2 and 3 from the partition table and a few bitwise operations.

Cylinder = (Offset(3) | ((Offset(2) & C0H) << 2);

Sector = Offset(2) & 3FH;

Start = Cylinder | Sector;

The address of the sector is computed by combining all 8 bits of the cylin￾der contained in offset 3 with the upper 2 bits of the sector value. These 10

bits contain the upper 10 bits of the address of the sector. The lower 6 bits

of the sector in offset 2 contain the sector within the cylinder. The address

is the combination of the computed

cylinder and the computed sector.

Type

The type of the partition represents the file

system type. A few of the common types of

partitions are contained in Table 11-2.

End of partition

The next three bytes contain the end of the

partition in head, sector, cylinder format. The

logical block address (LBA) of the partition

end is computed using the same method as

the start of the partition.

Type Description

00H Empty

01H DOS 12 bit FAT

04H DOS 16 bits

05H Extended partition

82H Linux Swap

83H Linux Native

A5H BSD

B7H BSDI

B8H BSDI swap

Table 11-2

187 Chapter Eleven

System Startup

Distance from MBR

The next four bytes represent the LBA of the partition. The LBA is the sector

offset from the beginning of the disk to the beginning of the partition.

Length

The last four bytes contain the size of the partition in sectors.

Magic Number

The magic number is AA55H and is located at offset 1FEH. Whenever the

MBR is read, the magic number is read and tested to make sure the sector

read contains the value AA55H.

An Example

Let’s take a look at the first sector on my development machine. We’ll use

two utilities, dd and hexdump, to read and display the contents of sector 1

track 0, the MBR.

# dd if=/dev/ad0s1a of=boot.bin count=1

1+0 records in

1+0 records out

512 bytes transferred in 0.026990 secs (18970 bytes/sec)

# hexdump -C –v boot.bin

00000000 eb 3c 00 00 00 00 00 00 00 00 00 00 02 00 00 00 |.<..............|

00000010 00 00 00 00 00 00 00 00 12 00 02 00 00 00 00 00 |................|

00000020 00 00 00 00 00 16 1f 66 6a 00 51 50 06 53 31 c0 |.......fj.QP.S1.|

00000030 88 f0 50 6a 10 89 e5 e8 c7 00 8d 66 10 cb fc 31 |..Pj.......f...1|

00000040 c9 8e c1 8e d9 8e d1 bc 00 7c 89 e6 bf 00 07 fe |.........|......|

00000050 c5 f3 a5 be ee 7d 80 fa 80 72 2c b6 01 e8 67 00 |.....}...r,...g.|

00000060 b9 01 00 be be 8d b6 01 80 7c 04 a5 75 07 e3 19 |.........|..u...|

00000070 f6 04 80 75 14 83 c6 10 fe c6 80 fe 05 72 e9 49 |...u.........r.I|

00000080 e3 e1 be ac 7d eb 52 31 d2 89 16 00 09 b6 10 e8 |....}.R1........|

00000090 35 00 bb 00 90 8b 77 0a 01 de bf 00 b0 b9 00 ac |5.....w.........|

000000a0 29 f1 f3 a4 29 f9 30 c0 f3 aa e8 03 00 e9 60 13 |)...).0.......`.|

000000b0 fa e4 64 a8 02 75 fa b0 d1 e6 64 e4 64 a8 02 75 |..d..u....d.d..u|

000000c0 fa b0 df e6 60 fb c3 bb 00 8c 8b 44 08 8b 4c 0a |....`......D..L.|

000000d0 0e e8 53 ff 73 2a be a7 7d e8 1c 00 be b1 7d e8 |..S.s*..}.....}.|

000000e0 16 00 30 e4 cd 16 c7 06 72 04 34 12 ea 00 00 ff |..0.....r.4.....|

000000f0 ff bb 07 00 b4 0e cd 10 ac 84 c0 75 f4 b4 01 f9 |...........u....|

00000100 c3 52 b4 08 cd 13 88 f5 5a 72 f5 80 e1 3f 74 ed |.R......Zr...?t.|

00000110 fa 66 8b 46 08 52 66 0f b6 d9 66 31 d2 66 f7 f3 |.f.F.Rf...f1.f..|

00000120 88 eb 88 d5 43 30 d2 66 f7 f3 88 d7 5a 66 3d ff |....C0.f....Zf=.|

00000130 03 00 00 fb 77 44 86 c4 c0 c8 02 08 e8 40 91 88 |....wD.......@..|

00000140 fe 28 e0 8a 66 02 38 e0 72 02 88 e0 bf 05 00 c4 |.(..f.8.r.......|

00000150 5e 04 50 b4 02 cd 13 5b 73 0a 4f 74 1c 30 e4 cd |^.P....[s.Ot.0..|

00000160 13 93 eb eb 0f b6 c3 01 46 08 73 03 ff 46 0a d0 |........F.s..F..|

00000170 e3 00 5e 05 28 46 02 77 88 c3 2e f6 06 ba 08 80 |..^.(F.w........|

00000180 0f 84 79 ff bb aa 55 52 b4 41 cd 13 5a 0f 82 6f |..y...UR.A..Z..o|

Tải ngay đi em, còn do dự, trời tối mất!