Code Monkey home page Code Monkey logo

mkgpt's Introduction

mkgpt: create GPT disk images from partition images

A simple tool for creating disk images with a GPT header and including the contents of provided partition images.

How to build

Just say make followed by sudo make install and you'll most likely be happy. If you want a compact, statically-linked executable instead, install the musl toolchain of your choice (even the musl-gcc wrapper works) and say make static (or CC=whatever make static) followed by sudo make install instead.

How to use

Program options

  • -o <output_file> specify output filename
  • --sector-size <size> size of a sector (defaults to 512)
  • --minimum-image-size <size> minimum size of the image in sectors (defaults to 2048)
  • --disk-guid <guid> GUID of the entire disk (see GUID format below, defaults to random)
  • --part <file> <options> begin a partition entry containing the specified image as its data and options as below

Partition options

  • --name <name> set the name of the entry in the GPT
  • --type <type> set the type of the entry, either a GUID, numeric MBR-style partition ID, or one of the known partition types
  • --uuid <guid> specify the UUID of the partition in the GPT (defaults to a random UUID)

Known partition types

  • EFI system partition: system
  • BIOS boot partition: bios
  • FAT types: fat12, fat16, fat16b, fat32, fat16x, fat32x, fat16+, fat32+
  • NTFS types: ntfs
  • Linux types: linux, swap

GUID format

GUIDs/UUIDs should be in the canonical representation as per https://en.wikipedia.org/wiki/Universally_unique_identifier#Format without any surrounding braces. An example is: 123E4567-E89B-12D3-A456-426655440000 Optionally, the string random can be used to generate a random GUID.

Why fork?

  • the original build process seemed bloated for a tool this simple
  • no way to create swap partitions (borked GUID parsing)
  • some overly specific code (Linux, Windoze) without a strong need for it
  • some strange code (static info in oversized, dynamically populated array?)
  • some rather broken code (required calls in asserts, misaligned pointers, memory leaks)

References

Not enough people seem to know about these things, so here you go:

Here's some background on the whole GPT mess:

Want to scare yourself?

Similar tool with JSON input?

mkgpt's People

Contributors

jncronin avatar phf avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.