Building from Source - FarelRA/CSMWrap GitHub Wiki
This guide provides instructions for building CSMWrap on a Linux-based system.
-
Operating System: A Linux distribution (e.g., Ubuntu, Fedora).
-
Build Tools:
-
build-essential
(or equivalent package group providinggcc
,make
, etc.) -
nasm
(Netwide Assembler) git
-
curl
(for downloading OVMF for testing, optional) -
xxd
(typically part ofvim-common
or similar)
On Ubuntu/Debian, you can install these with:
sudo apt-get update sudo apt-get install -y build-essential nasm git curl xxd
-
Clone the CSMWrap repository and its submodules:
git clone https://github.com/FlyGoat/CSMWrap.git --recursive
cd csmwrap
If you've already cloned without --recursive
, you can initialize submodules with:
git submodule update --init --recursive
CSMWrap relies on specific binaries from a customized SeaBIOS build. These are Csm16.bin
(the CSM itself) and vgabios.bin
(the VESA VBIOS). The build system automates this.
-
Configure SeaBIOS: The project includes a
seabios-config
file which is copied toseabios/.config
. This configuration enables CSM and Coreboot VGA support, among other things. -
Build SeaBIOS components:
This command will:
make seabios
- Clean the SeaBIOS build directory.
- Copy
seabios-config
toseabios/.config
. - Run
make olddefconfig
andmake
within theseabios
subdirectory. - Use
xxd
to convert the resultingCsm16.bin
andvgabios.bin
into C header files (src/bins/Csm16.h
andsrc/bins/vgabios.h
) which are then compiled into CSMWrap.
CSMWrap can be built for ia32
(32-bit UEFI) or x86_64
(64-bit UEFI).
make ARCH=x86_64
Or simply:
make
The output will be bin-x86_64/csmwrap.efi
. The GitHub Actions workflow renames this to csmwrapx64.efi
.
make ARCH=ia32
The output will be bin-ia32/csmwrap.efi
. The GitHub Actions workflow renames this to csmwrapia32.efi
.
After a successful build, you will find the EFI application in the bin-<ARCH>
directory (e.g., bin-x86_64/csmwrap.efi
).
- To clean CSMWrap object files and binaries for a specific architecture:
make clean ARCH=x86_64 # or ARCH=ia32
- To clean only the SeaBIOS build products (leaves CSMWrap builds intact):
make -C seabios distclean
- To clean everything including downloaded dependencies for testing:
make distclean
The Makefile includes rules to run CSMWrap in QEMU using OVMF firmware.
-
Download OVMF:
The first time you run, it will download the necessary OVMF files if they are not present in an
ovmf
subdirectory. -
Run for x86_64:
make run ARCH=x86_64 QEMUFLAGS="-m 2G -hda your_boot_disk.img"
-
Run for IA32:
Replace
make run ARCH=ia32 QEMUFLAGS="-m 1G -hda your_boot_disk.img"
your_boot_disk.img
with a path to a disk image containing a legacy OS. TheQEMUFLAGS
variable can be used to pass additional options to QEMU. The application will be copied to a temporary FAT-formatted boot drive for QEMU.