/*++

Copyright (c) 2015 Minoca Corp. All Rights Reserved

Module Name:

    pctiny.txt

Abstract:

    This module implements the setup recipe for a minimal standard BIOS-based
    PC.

Author:

    Evan Green 19-Oct-2015

Environment:

    Setup

--*/

//
// Completely clobber the drivers list with one that fits x86 Qemu perfectly.
//

DriversCopy["Files"] = [
    "acpi.drv",
    "fat.drv",
    "netcore.drv",
    "null.drv",
    "part.drv",
    "pci.drv",
    "special.drv",
    "usrinput.drv",
    "videocon.drv",
    "ata.drv",
    "e100.drv",
    "i8042.drv",
];

DriverDb["BootDrivers"] = [
    "acpi.drv",
    "ata.drv",
    "fat.drv",
    "null.drv",
    "part.drv",
    "pci.drv",
    "special.drv",
    "videocon.drv",
];

//
// Copy the firmware to the system partition for recovery if needed.
//

SystemFiles += SystemFilesX86Pcat;

//
// Remove apps from the user files since it can be huge. Just add the bare
// minimum.
//

UserAppsCopy["Source"] = "";

//
// Set the MBR file.
//

MbrCopy = {
    "Offset": 0,
    "Source": SourceDir + "mbr.bin",
    "SourceVolume": 0,
};

DiskData["Mbr"] = MbrCopy;

//
// Set the VBR file.
//

VbrCopy = {
    "Offset": 0,
    "Source": SourceDir + "fatboot.bin",
    "SourceVolume": 0,
};

//
// Replace the boot files with the boot manager.
//

BootmanCopy = {
    "Destination": "/",
    "Source": SourceDir,
    "SourceVolume": 0,
    "Files": ["bootman.bin"]
};

TotalCopies = [BootmanCopy] + SystemPartition["Files"];

BootPartition = {
    "Index": 0,
    "Size": -1,
    "PartitionType": PARTITION_TYPE_MINOCA,
    "MbrType": PARTITION_ID_MINOCA,
    "Files": TotalCopies,
    "Attributes": 0,
    "Alignment": 4 * KILOBYTE,
    "Vbr": VbrCopy,
    "Flags": {
        "Boot": TRUE,
        "System": TRUE,
        "CompatibilityMode": FALSE,
        "WriteVbrLba": TRUE,
        "MergeVbr": TRUE,
    },
};

DiskData["Partitions"] = [BootPartition];
DiskData["Format"] = PARTITION_FORMAT_MBR;
BootEntry["LoaderPath"] = LoaderPathPcat;
BootPartition["Alignment"] = 1 * MEGABYTE;
SystemPartition["Alignment"] = 1 * MEGABYTE;

