Skip to content

Commit

Permalink
chore: reformat readme
Browse files Browse the repository at this point in the history
  • Loading branch information
swysocki committed Aug 4, 2022
1 parent 2feea0b commit c4533a9
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ This is useful for creating a disk image on SD Cards or embedded devices.

## Quick Start

### Installation

`pip install gpt-image`

### Create a GPT disk image

```python

import gpt_image
Expand All @@ -18,30 +24,29 @@ disk.create(16 * 1024 * 1024)

# create a 2MB Linux partition named "boot"
boot_part = gpt_image.partition.Partition(
"boot",
2 * 1024 * 1024,
gpt_image.partition.Partition.EFI_SYSTEM_PARTITION
)
"boot",
2 * 1024 * 1024,
gpt_image.partition.Partition.EFI_SYSTEM_PARTITION
)
disk.table.partitions.add(boot_part)

# create an 8MB Linux partition named "data"
data_part = gpt_image.partition.Partition(
"data",
8 * 1024 * 1024,
gpt_image.partition.Partition.LINUX_FILE_SYSTEM
)
"data",
8 * 1024 * 1024,
gpt_image.partition.Partition.LINUX_FILE_SYSTEM
)
disk.table.partitions.add(data_part)

# commit the change to disk
disk.write()
disk.commit()

# dump the current GPT information:

print(disk)
```

The final `print(disk)` command will output a JSON document of the current GPT
configuration:
The final `print(disk)` command outputs a JSON document of the current GPT configuration:

```json
{
Expand Down

0 comments on commit c4533a9

Please sign in to comment.