build: Allow out of tree builds
This commit is contained in:
parent
30b0657e38
commit
eaef49b78b
141
Makefile
141
Makefile
|
@ -5,6 +5,9 @@ endif
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
DESTDIR ?=
|
DESTDIR ?=
|
||||||
|
|
||||||
|
BUILDDIR ?= $(shell pwd)/build
|
||||||
|
BINDIR ?= $(BUILDDIR)/bin
|
||||||
|
|
||||||
export PATH := $(shell pwd)/toolchain/bin:$(PATH)
|
export PATH := $(shell pwd)/toolchain/bin:$(PATH)
|
||||||
|
|
||||||
NCPUS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
|
NCPUS := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
|
||||||
|
@ -50,71 +53,69 @@ all:
|
||||||
$(MAKE) limine-uefi
|
$(MAKE) limine-uefi
|
||||||
$(MAKE) limine-uefi32
|
$(MAKE) limine-uefi32
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
|
|
||||||
.PHONY: bin/limine-install
|
.PHONY: $(BINDIR)/limine-install
|
||||||
bin/limine-install:
|
$(BINDIR)/limine-install:
|
||||||
$(MAKE) -C limine-install LIMINE_HDD_BIN="`pwd`/bin/limine-hdd.bin"
|
$(MAKE) -C limine-install LIMINE_HDD_BIN="$(BINDIR)/limine-hdd.bin" BUILDDIR="$(BINDIR)"
|
||||||
[ -f limine-install/limine-install ] && cp limine-install/limine-install bin/ || true
|
|
||||||
[ -f limine-install/limine-install.exe ] && cp limine-install/limine-install.exe bin/ || true
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: limine-bios-clean limine-uefi-clean limine-uefi32-clean
|
clean: limine-bios-clean limine-uefi-clean limine-uefi32-clean
|
||||||
$(MAKE) -C limine-install clean
|
$(MAKE) -C limine-install clean
|
||||||
rm -rf bin build
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
install -d "$(DESTDIR)$(PREFIX)/bin"
|
install -d "$(DESTDIR)$(PREFIX)/bin"
|
||||||
install -s bin/limine-install "$(DESTDIR)$(PREFIX)/bin/"
|
install -s $(BINDIR)/limine-install "$(DESTDIR)$(PREFIX)/bin/"
|
||||||
install -d "$(DESTDIR)$(PREFIX)/share"
|
install -d "$(DESTDIR)$(PREFIX)/share"
|
||||||
install -d "$(DESTDIR)$(PREFIX)/share/limine"
|
install -d "$(DESTDIR)$(PREFIX)/share/limine"
|
||||||
install -m 644 bin/limine.sys "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/limine.sys "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
install -m 644 bin/limine-cd.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/limine-cd.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
install -m 644 bin/limine-eltorito-efi.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/limine-eltorito-efi.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
install -m 644 bin/limine-pxe.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/limine-pxe.bin "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
install -m 644 bin/BOOTX64.EFI "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/BOOTX64.EFI "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
install -m 644 bin/BOOTIA32.EFI "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
install -m 644 $(BINDIR)/BOOTIA32.EFI "$(DESTDIR)$(PREFIX)/share/limine/" || true
|
||||||
|
|
||||||
build/stage1: $(STAGE1_FILES) build/decompressor/decompressor.bin build/stage23-bios/stage2.bin.gz
|
$(BUILDDIR)/stage1: $(STAGE1_FILES) $(BUILDDIR)/decompressor/decompressor.bin $(BUILDDIR)/stage23-bios/stage2.bin.gz
|
||||||
mkdir -p bin
|
mkdir -p $(BINDIR)
|
||||||
cd stage1/hdd && nasm bootsect.asm -Werror -fbin -o ../../bin/limine-hdd.bin
|
cd stage1/hdd && nasm bootsect.asm -Werror -fbin -DBUILDDIR="'$(BUILDDIR)'" -o $(BINDIR)/limine-hdd.bin
|
||||||
cd stage1/cd && nasm bootsect.asm -Werror -fbin -o ../../bin/limine-cd.bin
|
cd stage1/cd && nasm bootsect.asm -Werror -fbin -DBUILDDIR="'$(BUILDDIR)'" -o $(BINDIR)/limine-cd.bin
|
||||||
cd stage1/pxe && nasm bootsect.asm -Werror -fbin -o ../../bin/limine-pxe.bin
|
cd stage1/pxe && nasm bootsect.asm -Werror -fbin -DBUILDDIR="'$(BUILDDIR)'" -o $(BINDIR)/limine-pxe.bin
|
||||||
cp build/stage23-bios/limine.sys ./bin/
|
cp $(BUILDDIR)/stage23-bios/limine.sys $(BINDIR)/
|
||||||
touch build/stage1
|
touch $(BUILDDIR)/stage1
|
||||||
|
|
||||||
.PHONY: limine-bios
|
.PHONY: limine-bios
|
||||||
limine-bios: stage23-bios decompressor
|
limine-bios: stage23-bios decompressor
|
||||||
$(MAKE) build/stage1
|
$(MAKE) $(BUILDDIR)/stage1
|
||||||
|
|
||||||
.PHONY: bin/limine-eltorito-efi.bin
|
.PHONY: $(BINDIR)/limine-eltorito-efi.bin
|
||||||
bin/limine-eltorito-efi.bin:
|
$(BINDIR)/limine-eltorito-efi.bin:
|
||||||
|
mkdir -p $(BINDIR)
|
||||||
dd if=/dev/zero of=$@ bs=512 count=2880
|
dd if=/dev/zero of=$@ bs=512 count=2880
|
||||||
( mformat -i $@ -f 1440 :: && \
|
( mformat -i $@ -f 1440 :: && \
|
||||||
mmd -D s -i $@ ::/EFI && \
|
mmd -D s -i $@ ::/EFI && \
|
||||||
mmd -D s -i $@ ::/EFI/BOOT && \
|
mmd -D s -i $@ ::/EFI/BOOT && \
|
||||||
( ( [ -f build/stage23-uefi/BOOTX64.EFI ] && \
|
( ( [ -f $(BUILDDIR)/stage23-uefi/BOOTX64.EFI ] && \
|
||||||
mcopy -D o -i $@ build/stage23-uefi/BOOTX64.EFI ::/EFI/BOOT ) || true ) && \
|
mcopy -D o -i $@ $(BUILDDIR)/stage23-uefi/BOOTX64.EFI ::/EFI/BOOT ) || true ) && \
|
||||||
( ( [ -f build/stage23-uefi32/BOOTIA32.EFI ] && \
|
( ( [ -f $(BUILDDIR)/stage23-uefi32/BOOTIA32.EFI ] && \
|
||||||
mcopy -D o -i $@ build/stage23-uefi32/BOOTIA32.EFI ::/EFI/BOOT ) || true ) \
|
mcopy -D o -i $@ $(BUILDDIR)/stage23-uefi32/BOOTIA32.EFI ::/EFI/BOOT ) || true ) \
|
||||||
) || rm -f $@
|
) || rm -f $@
|
||||||
|
|
||||||
.PHONY: limine-uefi
|
.PHONY: limine-uefi
|
||||||
limine-uefi:
|
limine-uefi:
|
||||||
$(MAKE) gnu-efi
|
$(MAKE) gnu-efi
|
||||||
$(MAKE) stage23-uefi
|
$(MAKE) stage23-uefi
|
||||||
mkdir -p bin
|
mkdir -p $(BINDIR)
|
||||||
cp build/stage23-uefi/BOOTX64.EFI ./bin/
|
cp $(BUILDDIR)/stage23-uefi/BOOTX64.EFI $(BINDIR)/
|
||||||
$(MAKE) bin/limine-eltorito-efi.bin
|
$(MAKE) $(BINDIR)/limine-eltorito-efi.bin
|
||||||
|
|
||||||
.PHONY: limine-uefi32
|
.PHONY: limine-uefi32
|
||||||
limine-uefi32:
|
limine-uefi32:
|
||||||
$(MAKE) gnu-efi
|
$(MAKE) gnu-efi
|
||||||
$(MAKE) stage23-uefi32
|
$(MAKE) stage23-uefi32
|
||||||
mkdir -p bin
|
mkdir -p $(BINDIR)
|
||||||
cp build/stage23-uefi32/BOOTIA32.EFI ./bin/
|
cp $(BUILDDIR)/stage23-uefi32/BOOTIA32.EFI $(BINDIR)/
|
||||||
$(MAKE) bin/limine-eltorito-efi.bin
|
$(MAKE) $(BINDIR)/limine-eltorito-efi.bin
|
||||||
|
|
||||||
.PHONY: limine-bios-clean
|
.PHONY: limine-bios-clean
|
||||||
limine-bios-clean: stage23-bios-clean decompressor-clean
|
limine-bios-clean: stage23-bios-clean decompressor-clean
|
||||||
|
@ -141,7 +142,7 @@ dist:
|
||||||
|
|
||||||
.PHONY: distclean
|
.PHONY: distclean
|
||||||
distclean: clean test-clean
|
distclean: clean test-clean
|
||||||
rm -rf toolchain ovmf*
|
rm -rf build toolchain ovmf*
|
||||||
|
|
||||||
.PHONY: repoclean
|
.PHONY: repoclean
|
||||||
repoclean: distclean
|
repoclean: distclean
|
||||||
|
@ -152,35 +153,35 @@ stivale:
|
||||||
|
|
||||||
.PHONY: stage23-uefi
|
.PHONY: stage23-uefi
|
||||||
stage23-uefi: stivale
|
stage23-uefi: stivale
|
||||||
$(MAKE) -C stage23 all TARGET=uefi BUILDDIR="`pwd`/build/stage23-uefi"
|
$(MAKE) -C stage23 all TARGET=uefi BUILDDIR="$(BUILDDIR)/stage23-uefi"
|
||||||
|
|
||||||
.PHONY: stage23-uefi-clean
|
.PHONY: stage23-uefi-clean
|
||||||
stage23-uefi-clean:
|
stage23-uefi-clean:
|
||||||
$(MAKE) -C stage23 clean TARGET=uefi BUILDDIR="`pwd`/build/stage23-uefi"
|
$(MAKE) -C stage23 clean TARGET=uefi BUILDDIR="$(BUILDDIR)/stage23-uefi"
|
||||||
|
|
||||||
.PHONY: stage23-uefi32
|
.PHONY: stage23-uefi32
|
||||||
stage23-uefi32: stivale
|
stage23-uefi32: stivale
|
||||||
$(MAKE) -C stage23 all TARGET=uefi32 BUILDDIR="`pwd`/build/stage23-uefi32"
|
$(MAKE) -C stage23 all TARGET=uefi32 BUILDDIR="$(BUILDDIR)/stage23-uefi32"
|
||||||
|
|
||||||
.PHONY: stage23-uefi32-clean
|
.PHONY: stage23-uefi32-clean
|
||||||
stage23-uefi32-clean:
|
stage23-uefi32-clean:
|
||||||
$(MAKE) -C stage23 clean TARGET=uefi32 BUILDDIR="`pwd`/build/stage23-uefi32"
|
$(MAKE) -C stage23 clean TARGET=uefi32 BUILDDIR="$(BUILDDIR)/stage23-uefi32"
|
||||||
|
|
||||||
.PHONY: stage23-bios
|
.PHONY: stage23-bios
|
||||||
stage23-bios: stivale
|
stage23-bios: stivale
|
||||||
$(MAKE) -C stage23 all TARGET=bios BUILDDIR="`pwd`/build/stage23-bios"
|
$(MAKE) -C stage23 all TARGET=bios BUILDDIR="$(BUILDDIR)/stage23-bios"
|
||||||
|
|
||||||
.PHONY: stage23-bios-clean
|
.PHONY: stage23-bios-clean
|
||||||
stage23-bios-clean:
|
stage23-bios-clean:
|
||||||
$(MAKE) -C stage23 clean TARGET=bios BUILDDIR="`pwd`/build/stage23-bios"
|
$(MAKE) -C stage23 clean TARGET=bios BUILDDIR="$(BUILDDIR)/stage23-bios"
|
||||||
|
|
||||||
.PHONY: decompressor
|
.PHONY: decompressor
|
||||||
decompressor:
|
decompressor:
|
||||||
$(MAKE) -C decompressor all BUILDDIR="`pwd`/build/decompressor"
|
$(MAKE) -C decompressor all BUILDDIR="$(BUILDDIR)/decompressor"
|
||||||
|
|
||||||
.PHONY: decompressor-clean
|
.PHONY: decompressor-clean
|
||||||
decompressor-clean:
|
decompressor-clean:
|
||||||
$(MAKE) -C decompressor clean BUILDDIR="`pwd`/build/decompressor"
|
$(MAKE) -C decompressor clean BUILDDIR="$(BUILDDIR)/decompressor"
|
||||||
|
|
||||||
.PHONY: test-clean
|
.PHONY: test-clean
|
||||||
test-clean:
|
test-clean:
|
||||||
|
@ -215,7 +216,7 @@ echfs-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
echfs-utils -g -p0 test.hdd quick-format 512 > part_guid
|
echfs-utils -g -p0 test.hdd quick-format 512 > part_guid
|
||||||
sed "s/@GUID@/`cat part_guid`/g" < test/limine.cfg > limine.cfg.tmp
|
sed "s/@GUID@/`cat part_guid`/g" < test/limine.cfg > limine.cfg.tmp
|
||||||
|
@ -223,8 +224,8 @@ echfs-test:
|
||||||
rm -f limine.cfg.tmp part_guid
|
rm -f limine.cfg.tmp part_guid
|
||||||
echfs-utils -g -p0 test.hdd import test/test.elf boot/test.elf
|
echfs-utils -g -p0 test.hdd import test/test.elf boot/test.elf
|
||||||
echfs-utils -g -p0 test.hdd import test/bg.bmp boot/bg.bmp
|
echfs-utils -g -p0 test.hdd import test/bg.bmp boot/bg.bmp
|
||||||
echfs-utils -g -p0 test.hdd import bin/limine.sys boot/limine.sys
|
echfs-utils -g -p0 test.hdd import $(BINDIR)/limine.sys boot/limine.sys
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: ext2-test
|
.PHONY: ext2-test
|
||||||
|
@ -232,7 +233,7 @@ ext2-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -241,12 +242,12 @@ ext2-test:
|
||||||
sudo mkfs.ext2 `cat loopback_dev`p1
|
sudo mkfs.ext2 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: fat12-test
|
.PHONY: fat12-test
|
||||||
|
@ -254,7 +255,7 @@ fat12-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -263,12 +264,12 @@ fat12-test:
|
||||||
sudo mkfs.fat -F 12 `cat loopback_dev`p1
|
sudo mkfs.fat -F 12 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: fat16-test
|
.PHONY: fat16-test
|
||||||
|
@ -276,7 +277,7 @@ fat16-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -285,12 +286,12 @@ fat16-test:
|
||||||
sudo mkfs.fat -F 16 `cat loopback_dev`p1
|
sudo mkfs.fat -F 16 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: fat32-test
|
.PHONY: fat32-test
|
||||||
|
@ -298,7 +299,7 @@ fat32-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -307,12 +308,12 @@ fat32-test:
|
||||||
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: iso9660-test
|
.PHONY: iso9660-test
|
||||||
|
@ -323,7 +324,7 @@ iso9660-test:
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir -p test_image/boot
|
mkdir -p test_image/boot
|
||||||
cp -rv bin/* test/* test_image/boot/
|
cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table test_image/ -o test.iso
|
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table test_image/ -o test.iso
|
||||||
qemu-system-x86_64 -net none -smp 4 -cdrom test.iso -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -cdrom test.iso -debugcon stdio
|
||||||
|
|
||||||
|
@ -332,7 +333,7 @@ ntfs-test:
|
||||||
$(MAKE) test-clean
|
$(MAKE) test-clean
|
||||||
$(MAKE) test.hdd
|
$(MAKE) test.hdd
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir test_image
|
mkdir test_image
|
||||||
|
@ -341,12 +342,12 @@ ntfs-test:
|
||||||
sudo mkfs.ntfs `cat loopback_dev`p1
|
sudo mkfs.ntfs `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
rm -rf test_image loopback_dev
|
rm -rf test_image loopback_dev
|
||||||
bin/limine-install test.hdd
|
$(BINDIR)/limine-install test.hdd
|
||||||
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
qemu-system-x86_64 -net none -smp 4 -hda test.hdd -debugcon stdio
|
||||||
|
|
||||||
.PHONY: full-hybrid-test
|
.PHONY: full-hybrid-test
|
||||||
|
@ -357,13 +358,13 @@ full-hybrid-test:
|
||||||
$(MAKE) limine-uefi
|
$(MAKE) limine-uefi
|
||||||
$(MAKE) limine-uefi32
|
$(MAKE) limine-uefi32
|
||||||
$(MAKE) limine-bios
|
$(MAKE) limine-bios
|
||||||
$(MAKE) bin/limine-install
|
$(MAKE) $(BINDIR)/limine-install
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir -p test_image/boot
|
mkdir -p test_image/boot
|
||||||
cp -rv bin/* test/* test_image/boot/
|
cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot boot/limine-eltorito-efi.bin -efi-boot-part --efi-boot-image --protective-msdos-label test_image/ -o test.iso
|
xorriso -as mkisofs -b boot/limine-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot boot/limine-eltorito-efi.bin -efi-boot-part --efi-boot-image --protective-msdos-label test_image/ -o test.iso
|
||||||
bin/limine-install test.iso
|
$(BINDIR)/limine-install test.iso
|
||||||
qemu-system-x86_64 -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
|
qemu-system-x86_64 -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
|
||||||
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -hda test.iso -debugcon stdio
|
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-x64/OVMF.fd -net none -smp 4 -hda test.iso -debugcon stdio
|
||||||
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-ia32/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
|
qemu-system-x86_64 -m 512M -M q35 -bios ovmf-ia32/OVMF.fd -net none -smp 4 -cdrom test.iso -debugcon stdio
|
||||||
|
@ -378,7 +379,7 @@ pxe-test:
|
||||||
$(MAKE) -C test
|
$(MAKE) -C test
|
||||||
rm -rf test_image/
|
rm -rf test_image/
|
||||||
mkdir -p test_image/boot
|
mkdir -p test_image/boot
|
||||||
cp -rv bin/* test/* test_image/boot/
|
cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio
|
qemu-system-x86_64 -smp 4 -netdev user,id=n0,tftp=./test_image,bootfile=boot/limine-pxe.bin -device rtl8139,netdev=n0,mac=00:00:00:11:11:11 -debugcon stdio
|
||||||
|
|
||||||
.PHONY: uefi-test
|
.PHONY: uefi-test
|
||||||
|
@ -395,9 +396,9 @@ uefi-test:
|
||||||
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sudo mkdir -p test_image/EFI/BOOT
|
sudo mkdir -p test_image/EFI/BOOT
|
||||||
sudo cp bin/BOOTX64.EFI test_image/EFI/BOOT/
|
sudo cp $(BINDIR)/BOOTX64.EFI test_image/EFI/BOOT/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
|
@ -418,9 +419,9 @@ uefi32-test:
|
||||||
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
sudo mkfs.fat -F 32 `cat loopback_dev`p1
|
||||||
sudo mount `cat loopback_dev`p1 test_image
|
sudo mount `cat loopback_dev`p1 test_image
|
||||||
sudo mkdir test_image/boot
|
sudo mkdir test_image/boot
|
||||||
sudo cp -rv bin/* test/* test_image/boot/
|
sudo cp -rv $(BINDIR)/* test/* test_image/boot/
|
||||||
sudo mkdir -p test_image/EFI/BOOT
|
sudo mkdir -p test_image/EFI/BOOT
|
||||||
sudo cp bin/BOOTIA32.EFI test_image/EFI/BOOT/
|
sudo cp $(BINDIR)/BOOTIA32.EFI test_image/EFI/BOOT/
|
||||||
sync
|
sync
|
||||||
sudo umount test_image/
|
sudo umount test_image/
|
||||||
sudo losetup -d `cat loopback_dev`
|
sudo losetup -d `cat loopback_dev`
|
||||||
|
|
|
@ -3,17 +3,18 @@ CC = cc
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
DESTDIR =
|
DESTDIR =
|
||||||
|
|
||||||
|
BUILDDIR = .
|
||||||
LIMINE_HDD_BIN = limine-hdd.bin
|
LIMINE_HDD_BIN = limine-hdd.bin
|
||||||
|
|
||||||
CFLAGS = -O2 -pipe -Wall -Wextra
|
CFLAGS = -O2 -pipe -Wall -Wextra
|
||||||
|
|
||||||
.PHONY: all install clean
|
.PHONY: all install clean
|
||||||
|
|
||||||
all: limine-install
|
all: $(BUILDDIR)/limine-install
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
install -d "$(DESTDIR)$(PREFIX)/bin"
|
install -d "$(DESTDIR)$(PREFIX)/bin"
|
||||||
install -s limine-install "$(DESTDIR)$(PREFIX)/bin/"
|
install -s "$(BUILDDIR)/limine-install" "$(DESTDIR)$(PREFIX)/bin/"
|
||||||
install -d "$(DESTDIR)$(PREFIX)/share"
|
install -d "$(DESTDIR)$(PREFIX)/share"
|
||||||
install -d "$(DESTDIR)$(PREFIX)/share/limine"
|
install -d "$(DESTDIR)$(PREFIX)/share/limine"
|
||||||
install -m 644 limine.sys "$(DESTDIR)$(PREFIX)/share/limine/"
|
install -m 644 limine.sys "$(DESTDIR)$(PREFIX)/share/limine/"
|
||||||
|
@ -24,7 +25,7 @@ install: all
|
||||||
install -m 644 BOOTIA32.EFI "$(DESTDIR)$(PREFIX)/share/limine/"
|
install -m 644 BOOTIA32.EFI "$(DESTDIR)$(PREFIX)/share/limine/"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f limine-install limine-install.exe
|
rm -f "$(BUILDDIR)/limine-install" "$(BUILDDIR)/limine-install.exe"
|
||||||
|
|
||||||
limine-install: limine-install.c inc.S $(LIMINE_HDD_BIN)
|
$(BUILDDIR)/limine-install: limine-install.c inc.S $(LIMINE_HDD_BIN)
|
||||||
$(CC) $(CFLAGS) -std=c11 -DLIMINE_HDD_BIN='"$(LIMINE_HDD_BIN)"' limine-install.c inc.S -o $@
|
$(CC) $(CFLAGS) -std=c11 -DLIMINE_HDD_BIN='"$(LIMINE_HDD_BIN)"' limine-install.c inc.S -o "$@"
|
||||||
|
|
|
@ -95,11 +95,13 @@ pmode:
|
||||||
; Align stage2 to 2K ON DISK
|
; Align stage2 to 2K ON DISK
|
||||||
times 2048-($-$$) db 0
|
times 2048-($-$$) db 0
|
||||||
decompressor:
|
decompressor:
|
||||||
incbin '../../build/decompressor/decompressor.bin'
|
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
|
||||||
|
incbin DECOMPRESSOR_PATH
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
stage2:
|
stage2:
|
||||||
incbin '../../build/stage23-bios/stage2.bin.gz'
|
%strcat STAGE2_PATH BUILDDIR, '/stage23-bios/stage2.bin.gz'
|
||||||
|
incbin STAGE2_PATH
|
||||||
.size: equ $ - stage2
|
.size: equ $ - stage2
|
||||||
|
|
||||||
times ((($-$$)+2047) & ~2047)-($-$$) db 0
|
times ((($-$$)+2047) & ~2047)-($-$$) db 0
|
||||||
|
|
|
@ -132,9 +132,11 @@ dw 0xaa55
|
||||||
; ********************* Stage 2 *********************
|
; ********************* Stage 2 *********************
|
||||||
|
|
||||||
decompressor:
|
decompressor:
|
||||||
incbin '../../build/decompressor/decompressor.bin'
|
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
|
||||||
|
incbin DECOMPRESSOR_PATH
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
stage2:
|
stage2:
|
||||||
incbin '../../build/stage23-bios/stage2.bin.gz'
|
%strcat STAGE2_PATH BUILDDIR, '/stage23-bios/stage2.bin.gz'
|
||||||
|
incbin STAGE2_PATH
|
||||||
.size: equ $ - stage2
|
.size: equ $ - stage2
|
||||||
|
|
|
@ -49,10 +49,12 @@ start:
|
||||||
; ********************* Stage 2 *********************
|
; ********************* Stage 2 *********************
|
||||||
|
|
||||||
decompressor:
|
decompressor:
|
||||||
incbin '../../build/decompressor/decompressor.bin'
|
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor/decompressor.bin'
|
||||||
|
incbin DECOMPRESSOR_PATH
|
||||||
|
|
||||||
align 16
|
align 16
|
||||||
stage2:
|
stage2:
|
||||||
incbin '../../build/stage23-bios/stage2.bin.gz'
|
%strcat STAGE2_PATH BUILDDIR, '/stage23-bios/stage2.bin.gz'
|
||||||
|
incbin STAGE2_PATH
|
||||||
.size: equ $ - stage2
|
.size: equ $ - stage2
|
||||||
.fullsize: equ $ - decompressor
|
.fullsize: equ $ - decompressor
|
||||||
|
|
Loading…
Reference in New Issue