Partitioning and Boot Scenarios - FlyGoat/csmwrap GitHub Wiki
This page outlines various methods and considerations for partitioning your storage and setting up CSMWrap to boot legacy operating systems. It is sourced from user-contributed methods with general best practices, particularly drawing from scenarios involving MBR-formatted disks and BIOS/GPT booting for Linux.
Key UEFI Settings (Recap):
- Secure Boot: MUST be DISABLED.
- Above 4G Decoding / Resizable BAR / Smart Access Memory: MUST be DISABLED. This is critical for legacy VBIOS compatibility as it ensures PCI resources (like VRAM) are mapped below the 4GB address space.
-
Native CSM: Try with it DISABLED first. CSMWrap aims to be its own CSM.
- If issues occur, try enabling the native CSM as some motherboards might require it for initial low-level hardware setup. This can sometimes cause conflicts, so experimentation is key.
- SATA Mode: Consider IDE/Compatible for very old OSes like Windows XP if AHCI drivers are an issue.
- USB Legacy Support: ENABLED.
CSMWrap aims to create a legacy BIOS environment. Legacy BIOS traditionally boots from disks formatted with a Master Boot Record (MBR).
-
MBR (Master Boot Record):
- The first 512 bytes of the disk contain the bootloader code and the partition table.
- Limited to 4 primary partitions, or 3 primary and 1 extended partition (which can contain multiple logical partitions).
- Maximum addressable disk size is typically 2TiB.
- CSMWrap generally expects to boot legacy OSes from MBR-formatted disks. The methods below primarily focus on this for OSes like DOS/Windows.
-
GPT (GUID Partition Table):
- Modern standard, part of UEFI. Uses GUIDs for disks and partitions.
- Supports a much larger number of partitions and larger disk sizes.
- Includes a "protective MBR" for compatibility with MBR-only tools.
- BIOS/GPT Booting: It's possible to boot a legacy BIOS system (or an emulated one like CSMWrap provides) from a GPT disk if the bootloader (like GRUB) supports it. This requires a special BIOS Boot Partition.
Recommendation:
- For DOS/Windows legacy OSes with CSMWrap: Use an MBR-formatted hard drive for the OS installation for simplicity.
- For Linux distributions in legacy BIOS mode with CSMWrap: You can use a GPT-formatted disk, but it requires specific setup for GRUB (see Scenario 5).
The following methods describe how to set up CSMWrap and the target OS. Most involve an initial step of launching csmwrap<ARCH>.efi
(renamed to BOOT<ARCH>.EFI
) from a FAT32 partition accessible by UEFI. CSMWrap then creates the legacy environment for the actual OS boot.
Important General Notes:
- Install Legacy OS First (Generally): For MBR-based OSes like DOS/Windows, install your target legacy OS in Legacy Boot Mode to the MBR disk first.
-
EFI/BOOT
Folder for CSMWrap: This folder needs to be on a partition that the UEFI firmware can read (typically FAT16/FAT32) to launch CSMWrap.- If your legacy OS partition is NTFS/ext2/etc., you might need a small, separate FAT32 "boot" partition (or USB) to hold
BOOTX64.EFI
(CSMWrap).
- If your legacy OS partition is NTFS/ext2/etc., you might need a small, separate FAT32 "boot" partition (or USB) to hold
-
Windows Considerations: If installing Windows 7 or later, and it created its own
EFI
folder during a previous UEFI attempt, you might need to delete or rename it on the Windows partition before creating yourEFI/BOOT
folder for CSMWrap.
- Applies to: OS like FreeDOS on a single FAT32 partition.
- Disk Format: MBR.
-
Steps:
- Install the legacy OS in Legacy Boot Mode.
- On the OS partition (which is FAT32), create
EFI\BOOT
. - Copy
csmwrapx64.efi
(orcsmwrapia32.efi
) toEFI\BOOT
and rename it toBOOTX64.EFI
(orBOOTIA32.EFI
). - Configure UEFI to boot from the hard drive. It should find
BOOTX64.EFI
.
- Applies to: Useful for complex boot sequences. Assumes OS partition is FAT32 or a separate FAT32 partition for the EFI shell.
- Disk Format: MBR.
-
Steps:
- Install legacy OS in Legacy Boot Mode.
- On a FAT32 partition:
- Create
EFI\BOOT
. - Copy UEFI Shell (e.g.,
Shellx64.efi
) toEFI\BOOT
and rename toBOOTX64.EFI
. - Copy
csmwrapx64.efi
to the same folder (or root).
- Create
- Create
startup.nsh
in the root of the FAT32 partition to launchcsmwrapx64.efi
. (See Usage Guide forstartup.nsh
examples). - Configure UEFI to boot from the partition with the EFI Shell.
- Applies to: Common for Windows (NTFS) or non-boot Linux (ext4) installations.
- Disk Format: OS disk is MBR.
- Requires a separate small FAT32 partition (or USB) for CSMWrap's EFI launcher.
-
Steps (Dedicated FAT32 Partition):
- Install legacy OS in Legacy Boot Mode to its MBR partition.
- Create a small (e.g., 100-500MB) FAT32 partition.
- On this FAT32 partition, create
EFI\BOOT
. - Copy
csmwrapx64.efi
toEFI\BOOT
and rename toBOOTX64.EFI
. - Configure UEFI to boot from this FAT32 partition. CSMWrap launches, then boots the legacy OS.
-
Steps (EFI Shell on Dedicated FAT32 Partition): As above, but place EFI Shell as
BOOTX64.EFI
and usestartup.nsh
to launchcsmwrapx64.efi
.
- Applies to: Portability, testing. Legacy OS usually on internal MBR HDD.
- USB Drive Format: FAT16 or FAT32.
-
Steps (Direct Boot of CSMWrap from USB):
- On USB, create
EFI\BOOT
. - Copy
csmwrapx64.efi
to USB'sEFI\BOOT
and rename toBOOTX64.EFI
. - Configure UEFI to boot from USB first.
- When SeaBIOS (via CSMWrap) starts, use its boot menu (often
ESC
) to select the internal HDD.
- On USB, create
-
Steps (EFI Shell on USB): Similar to above, but USB's
BOOTX64.EFI
is the EFI Shell, andstartup.nsh
on USB launchescsmwrapx64.efi
(also on USB).
This scenario is for users who want to install a Linux distribution on a GPT disk but need/want to boot it in legacy BIOS mode (which CSMWrap will provide). GRUB is used as the legacy bootloader for Linux.
-
Prerequisites:
- CSMWrap is set up to launch from UEFI (e.g., from a USB drive as in Scenario 4, or a small FAT32 partition on the GPT disk itself if you create one for
BOOTX64.EFI
). - The target Linux distribution installed on GPT partitions.
- CSMWrap is set up to launch from UEFI (e.g., from a USB drive as in Scenario 4, or a small FAT32 partition on the GPT disk itself if you create one for
- Disk Format: GPT for the Linux installation disk.
-
Steps:
-
Create a BIOS Boot Partition:
- On your GPT disk where Linux is (or will be) installed, create a small partition (typically 1MiB is sufficient, though some recommend up to 2MiB).
- This partition must not be formatted with a filesystem.
-
Partition Type GUID:
21686148-6449-6E6F-744E-656564454649
- Using
gdisk
: Type codeef02
. - Using
fdisk
(recent versions): TypeBIOS boot
. - Using
parted
: Set thebios_grub
flag on this partition. - This partition can be anywhere but must be within the first 2TiB of the disk.
-
Install Linux: Install your Linux distribution to its desired GPT partitions (e.g.,
/
,/home
, swap). -
Install GRUB (for BIOS/GPT):
- Boot into your Linux installation (you might need to use a live environment and chroot if it's a fresh install).
- Ensure the
grub
package is installed. - Install GRUB's BIOS bootloader components to the MBR area (which points to the BIOS Boot Partition on GPT disks):
Replace
sudo grub-install --target=i386-pc /dev/sdX
/dev/sdX
with the actual device name of your GPT disk (e.g.,/dev/sda
,/dev/nvme0n1
). Do NOT specify a partition number. This command embeds GRUB'score.img
into the BIOS Boot Partition.
-
Generate GRUB Configuration:
sudo grub-mkconfig -o /boot/grub/grub.cfg
-
Boot Process:
- Boot your system via UEFI into CSMWrap.
- CSMWrap initializes the legacy BIOS environment.
- SeaBIOS (within CSMWrap) scans for bootable devices. It should detect the GPT disk with the GRUB MBR/BIOS Boot Partition setup.
- GRUB (the legacy version installed in step 3) loads from the BIOS Boot Partition, displays its menu, and boots your Linux installation.
-
Create a BIOS Boot Partition:
Considerations for BIOS/GPT Linux Boot via CSMWrap:
- CSMWrap as the Enabler: CSMWrap provides the foundational legacy BIOS environment. GRUB then acts as the secondary bootloader specifically for your Linux system within that emulated environment.
-
UEFI Chainload (Alternative for CSMWrap launch): Instead of a USB, you could have a small FAT32 EFI System Partition on your GPT disk. Place
csmwrap<ARCH>.efi
asBOOT<ARCH>.EFI
there. The UEFI firmware boots CSMWrap from this ESP, and then CSMWrap/SeaBIOS boots GRUB from the BIOS Boot Partition on the same disk.
If you already use GRUB (for UEFI) as your primary bootloader (e.g., for a modern Linux), you can chainload csmwrap.efi
.
-
Place
csmwrap<ARCH>.efi
: Copy to your ESP, e.g.,esp/EFI/csmwrap/csmwrapx64.efi
. -
Add GRUB Menu Entry:
Replace
menuentry "Launch CSMWrap for Legacy OS" { insmod part_gpt # or part_msdos insmod fat insmod chain search --no-floppy --fs-uuid --set=root YOUR_ESP_UUID chainloader /EFI/csmwrap/csmwrapx64.efi }
YOUR_ESP_UUID
and adjust the path. -
Update GRUB Config:
sudo grub-mkconfig -o /boot/grub/grub.cfg
. - Select the new entry from your UEFI GRUB menu. CSMWrap then boots the legacy OS.
This combination of methods should provide flexibility for various disk layouts and user preferences when setting up CSMWrap. Remember to consult the Troubleshooting page if you encounter issues.