Limine Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
mNo edit summary
(Change hdd creation instructions to allow for creation without sudo)
Line 409: Line 409:
====Creating a hard disk/USB drive image====
====Creating a hard disk/USB drive image====


In this example we'll create a [[GPT]] partition table using '''parted''', containing a single FAT partition, also known as the ESP in EFI terminology, which will store our kernel, configs, and bootloader.
In this example, we'll create a [[GPT]] partition table using '''sgdisk''', containing a single FAT partition, also known as the ESP in EFI terminology, which will store our kernel, configs, and bootloader.


This example is more involved and is made up of more steps than creating an ISO image.
This example is more involved and is made up of more steps than creating an ISO image.
Line 416: Line 416:


<source lang="bash">
<source lang="bash">
# Create an empty zeroed out 64MiB image file.
# Create an empty zeroed-out 64MiB image file.
dd if=/dev/zero bs=1M count=0 seek=64 of=image.hdd
dd if=/dev/zero bs=1M count=0 seek=64 of=image.hdd


# Create a GPT partition table.
# Create a GPT partition table.
parted -s image.hdd mklabel gpt
sgdisk image.hdd -n 1:2048 -t 1:ef00

# Create an ESP partition that spans the whole disk.
parted -s image.hdd mkpart ESP fat32 2048s 100%
parted -s image.hdd set 1 esp on


# Download the latest Limine binary release.
# Download the latest Limine binary release.
Line 435: Line 431:
./limine/limine bios-install image.hdd
./limine/limine bios-install image.hdd


# Mount the loopback device.
# Format the image as fat32.
USED_LOOPBACK=$(sudo losetup -Pf --show image.hdd)
mformat -i image.hdd@@1M

# Format the ESP partition as FAT32.
sudo mkfs.fat -F 32 ${USED_LOOPBACK}p1

# Mount the partition itself.
mkdir -p img_mount
sudo mount ${USED_LOOPBACK}p1 img_mount


# Make /EFI and /EFI/BOOT an MSDOS subdirectory.
# Copy the relevant files over.
sudo mkdir -p img_mount/EFI/BOOT
mmd -i image.hdd@@1M ::/EFI ::/EFI/BOOT
sudo cp -v myos.elf limine.cfg limine/limine-bios.sys img_mount/
sudo cp -v limine/BOOTX64.EFI img_mount/EFI/BOOT/
sudo cp -v limine/BOOTIA32.EFI img_mount/EFI/BOOT/


# Copy over the relevant files
# Sync system cache and unmount partition and loopback device.
mcopy -i image.hdd@@1M myos.elf limine.cfg limine/limine-bios.sys ::/
sync
mcopy -i image.hdd@@1M limine/BOOTX64.EFI ::/EFI/BOOT
sudo umount img_mount
mcopy -i image.hdd@@1M limine/BOOTIA32.EFI ::/EFI/BOOT
sudo losetup -d ${USED_LOOPBACK}
</source>
</source>