Skip to content

Commit

Permalink
osbuilder: update README and add snap build
Browse files Browse the repository at this point in the history
  • Loading branch information
Meulengracht committed Apr 1, 2022
1 parent a403a74 commit c4c1377
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 28 deletions.
131 changes: 103 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ You should end up with the executable in build folder.
You can now create disk images by executing the following command

```
./osbuilder --project <your_yaml> --target {img, vmdk}
./osbuilder <your_yaml> --target {img, vmdk}
```

When you builder is complete, you should end up with disk.{img,vmdk} in the folder
Expand All @@ -48,7 +48,7 @@ from where the builder is called.

Examples on yaml disk images can be found in the examples/ folder.

### GPT (UEFI) Disk Example
### YAML Specification

```
#####################
Expand All @@ -67,43 +67,118 @@ Examples on yaml disk images can be found in the examples/ folder.
scheme: GPT
size: 2GB
# define partitions for disk
# Partitions that should be installed onto the disk image.
# Each partition will be right after each other on the disk image
# and can support different yaml attributes.
partitions:
#####################
# label
# The label for this partition. For some filesystems this label
# will also be the name the partition will appear under. For FAT
# this label must be no longer than 11 bytes.
#
- label: efi-boot
# FAT16 for any size less than 512mb, size must be above 64mb
#####################
# type
# values: {FAT, MFS}
#
# FAT
# FAT16 for any size less than 512mb, size must be above 64mb. FAT supports installation
# of a stage1 and stage2 bootloader.
#
# MFS
# MFS is natively supported by this tool, but is a custom, not very good filesystem
# for MollenOS/Vali. Don't use this as it is subject to being changed. MFS supports
# installation of stage1 and stage2 bootloaders.
#
type: FAT
# EFI System GUID
#####################
# guid
# The guid for the partition, this is only used if the disk schema is GPT or
# if the filesystem has any guid identifier in it's superblock. The GUID present
# below is the EFI System GUID.
#
guid: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
size: 128MB
sources:
- type: file
path: <path_to_bootloader>/BOOT.efi
target: /EFI/BOOT/BOOTX64.EFI
- type: dir
path: <path_to_additional_bootfiles>
target: /EFI/vali/
- label: os-boot
type: MFS
guid: C4483A10-E3A0-4D3F-B7CC-C04A6E16612B
# attributes can be: boot, readonly, shadow, noautomount
#####################
# size
# The size of this partition. This cannot be more than all the partitions combined
# or be larger than the disk size. For the last partition its not required to specify
# the partition size, as this will resize the partition to the last remaining disk capacity.
#
size: 128MB
#####################
# attributes
# values: {boot, readonly, shadow, noautomount}
#
# Partition attributes, primarily used by the GPT table or if the filesystem
# supports them. When using GPT and want to mark a partition as BIOS bootable
# the 'boot' attribute must be specified for this partition.
attributes:
- boot
- readonly
- noautomount
size: 128MB
sources:
- type: dir
path: deploy/hdd/boot
target: /
- label: vali-data
type: MFS
guid: 80C6C62A-B0D6-4FF4-A69D-558AB6FD8B53
#####################
# vbr-image
vbr-image: stage1.bin
#####################
# reserved-sectors-image
reserved-sectors-image: stage2.bin
#####################
# sources
# Sources are the files/directories that should be installed onto
# the disk partition as a part of the build process.
#
sources:
#####################
# source.type
# values: {file, dir, chef}
#
# file
# This installs a single file from host location 'path' to partition location 'target'.
#
# dir
# This copies the entire contents (recursively) into the partition, like the file parameter
# the 'path' key specifies where on the host machine the directory is, and the 'target' key
# specifies the directory the contents should be copied into on the disk partition.
#
# chef
# Osbuilder supports chef packages, and can download and install those directly to the partition
# if specified. The 'target' key specifies where on the partition the package should be copied to,
# this can be either a full file path (must contain an extension) or a directory path.
- type: file
#####################
# source.path
# If the path is a relative path, it will be resolved from where osbuilder is invoked.
#
path: <path_to_bootloader>/BOOT.efi
#####################
# source.target
# Must be an absolute path from the root of the partition.
target: /EFI/BOOT/BOOTX64.EFI
- type: dir
path: deploy/hdd/shared
target: /
path: <path_to_additional_bootfiles>
target: /EFI/vali/
#####################
# source.type.chef
#
# The chef plugin for sources supports some additional keys to specify
# the package and its configuration.
- type: chef
package: vali/hello-world
channel: stable
platform: my-os
arch: x64
target: packages/
```
22 changes: 22 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: diskbuilder
version: '1.0'
summary: A diskutility build tool for building vm images
description: |
Originally developed for the Vali/MollenOS operating system, this is a generic virtual machine image builder.
It supports configuration in yaml, and supports installing sources into the VM image as a part of the build process.
It also supports installing bootloaders (stage1 and stage2) onto the partitions.
base: core18
grade: stable
confinement: strict

apps:
osbuilder:
command: osbuilder

parts:
osbuilder-src:
source: osbuilder
plugin: dotnet
dotnet-version: 3.1
dotnet-runtime-version: 3.1.0

0 comments on commit c4c1377

Please sign in to comment.