Update
This commit is contained in:
parent
d1f49a3700
commit
2832550c31
1 changed files with 20 additions and 4 deletions
24
GNUmakefile
24
GNUmakefile
|
@ -3,6 +3,20 @@ override MAKEFLAGS += -rR
|
||||||
|
|
||||||
override IMAGE_NAME := barebones
|
override IMAGE_NAME := barebones
|
||||||
|
|
||||||
|
# Convenience macro to reliably declare user overridable variables.
|
||||||
|
define DEFAULT_VAR =
|
||||||
|
ifeq ($(origin $1),default)
|
||||||
|
override $(1) := $(2)
|
||||||
|
endif
|
||||||
|
ifeq ($(origin $1),undefined)
|
||||||
|
override $(1) := $(2)
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Compiler for building the 'limine' executable for the host.
|
||||||
|
override DEFAULT_HOST_CC := cc
|
||||||
|
$(eval $(call DEFAULT_VAR,HOST_CC,$(DEFAULT_HOST_CC)))
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(IMAGE_NAME).iso
|
all: $(IMAGE_NAME).iso
|
||||||
|
|
||||||
|
@ -31,7 +45,7 @@ ovmf:
|
||||||
|
|
||||||
limine:
|
limine:
|
||||||
git clone https://github.com/limine-bootloader/limine.git --branch=v5.x-branch-binary --depth=1
|
git clone https://github.com/limine-bootloader/limine.git --branch=v5.x-branch-binary --depth=1
|
||||||
$(MAKE) -C limine
|
$(MAKE) -C limine CC="$(HOST_CC)"
|
||||||
|
|
||||||
.PHONY: kernel
|
.PHONY: kernel
|
||||||
kernel:
|
kernel:
|
||||||
|
@ -40,10 +54,11 @@ kernel:
|
||||||
$(IMAGE_NAME).iso: limine kernel
|
$(IMAGE_NAME).iso: limine kernel
|
||||||
rm -rf iso_root
|
rm -rf iso_root
|
||||||
mkdir -p iso_root
|
mkdir -p iso_root
|
||||||
cp kernel/kernel.elf \
|
cp -v kernel/kernel.elf \
|
||||||
limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/
|
limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/
|
||||||
mkdir -p iso_root/EFI/BOOT
|
mkdir -p iso_root/EFI/BOOT
|
||||||
cp limine/BOOT*.EFI iso_root/EFI/BOOT/
|
cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/
|
||||||
|
cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/
|
||||||
xorriso -as mkisofs -b limine-bios-cd.bin \
|
xorriso -as mkisofs -b limine-bios-cd.bin \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
--efi-boot limine-uefi-cd.bin \
|
--efi-boot limine-uefi-cd.bin \
|
||||||
|
@ -65,7 +80,8 @@ $(IMAGE_NAME).hdd: limine kernel
|
||||||
sudo mount `cat loopback_dev`p1 img_mount
|
sudo mount `cat loopback_dev`p1 img_mount
|
||||||
sudo mkdir -p img_mount/EFI/BOOT
|
sudo mkdir -p img_mount/EFI/BOOT
|
||||||
sudo cp -v kernel/kernel.elf limine.cfg limine/limine-bios.sys img_mount/
|
sudo cp -v kernel/kernel.elf limine.cfg limine/limine-bios.sys img_mount/
|
||||||
sudo cp -v limine/BOOT*.EFI img_mount/EFI/BOOT/
|
sudo cp -v limine/BOOTX64.EFI img_mount/EFI/BOOT/
|
||||||
|
sudo cp -v limine/BOOTIA32.EFI img_mount/EFI/BOOT/
|
||||||
sync
|
sync
|
||||||
sudo umount img_mount
|
sudo umount img_mount
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
|
|
Loading…
Reference in a new issue