Add Linux/GNU Debian compatibility
This commit is contained in:
44
Makefile
44
Makefile
@@ -6,7 +6,7 @@
|
||||
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2021/11/02 17:47:57 by gbaconni #+# #+# #
|
||||
# Updated: 2021/11/04 08:46:53 by gbaconni ### lausanne.ch #
|
||||
# Updated: 2021/11/05 08:39:30 by gbaconni ### lausanne.ch #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@@ -16,15 +16,38 @@ CPU = 8
|
||||
RAM = 2048
|
||||
SSD = 31539
|
||||
|
||||
KERNEL = $(shell uname -s)
|
||||
|
||||
all: sync
|
||||
|
||||
virtualbox:
|
||||
@test -d ~/goinfre/VirtualBox\ VMs || mkdir -p ~/goinfre/VirtualBox\ VMs
|
||||
@ln -snf ~/goinfre/VirtualBox\ VMs ~/VirtualBox\ VMs
|
||||
|
||||
brew:
|
||||
uefi:
|
||||
ifeq ($(KERNEL),Linux)
|
||||
@test -f efi-virtio.rom || cp /usr/lib/ipxe/qemu/efi-virtio.rom efi-virtio.rom
|
||||
@test -f edk2-aarch64-code.fd || cp /usr/share/AAVMF/AAVMF_CODE.fd edk2-aarch64-code.fd
|
||||
@test -f edk2-arm-vars.fd || cp /usr/share/AAVMF/AAVMF_VARS.fd edk2-arm-vars.fd
|
||||
@test -f edk2-x86_64-code.fd || cp /usr/share/OVMF/OVMF_CODE_4M.fd edk2-x86_64-code.fd
|
||||
@test -f edk2-i386-vars.fd || cp /usr/share/OVMF/OVMF_VARS_4M.fd edk2-i386-vars.fd
|
||||
endif
|
||||
ifeq ($(KERNEL),Darwin)
|
||||
@test -f efi-virtio.rom || cp /opt/homebrew/Cellar/qemu/*/share/qemu/efi-virtio.rom efi-virtio.rom
|
||||
@test -f edk2-aarch64-code.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-aarch64-code.fd edk2-aarch64-code.fd
|
||||
@test -f edk2-arm-vars.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-arm-vars.fd edk2-arm-vars.fd
|
||||
@test -f edk2-x86_64-code.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-x86_64-code.fd edk2-x86_64-code.fd
|
||||
@test -f edk2-i386-vars.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-i386-vars.fd edk2-i386-vars.fd
|
||||
endif
|
||||
|
||||
qemu: uefi
|
||||
ifeq ($(KERNEL),Linux)
|
||||
@which qemu-system-x86_64 >/dev/null 2>&1 || sudo apt-get install -qq -y qemu-utils qemu-system-x86 qemu-system-arm qemu-efi-aarch64 ovmf ipxe-qemu
|
||||
endif
|
||||
ifeq ($(KERNEL),Darwin)
|
||||
@which brew >/dev/null 2>&1 || bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
@test -L /opt/homebrew/bin/qemu-img || (eval "$$(/opt/homebrew/bin/brew shellenv)" && brew install qemu)
|
||||
@test -L /opt/homebrew/bin/qemu-system-x86_64 || (eval "$$(/opt/homebrew/bin/brew shellenv)" && brew install qemu)
|
||||
endif
|
||||
|
||||
debian:
|
||||
@test -f debian-$(DVER)-amd64-netinst.iso || curl -sLO https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-$(DVER)-amd64-netinst.iso
|
||||
@@ -36,16 +59,9 @@ auto:
|
||||
@rm -f debian-$(DVER)-amd64-netinst.iso.orig debian-$(DVER)-arm64-netinst.iso.orig
|
||||
|
||||
sda:
|
||||
@test -f sda.raw || dd if=/dev/zero of=sda.raw count=0 bs=1m seek=$(SSD) >/dev/null 2>&1
|
||||
@test -f sda.raw || qemu-img create -f raw -o size=$(SSD)M sda.raw
|
||||
|
||||
uefi:
|
||||
@test -f efi-virtio.rom || cp /opt/homebrew/Cellar/qemu/*/share/qemu/efi-virtio.rom efi-virtio.rom
|
||||
@test -f edk2-aarch64-code.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-aarch64-code.fd edk2-aarch64-code.fd
|
||||
@test -f edk2-arm-vars.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-arm-vars.fd edk2-arm-vars.fd
|
||||
@test -f edk2-x86_64-code.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-x86_64-code.fd edk2-x86_64-code.fd
|
||||
@test -f edk2-i386-vars.fd || cp /opt/homebrew/Cellar/qemu/*/share/qemu/edk2-i386-vars.fd edk2-i386-vars.fd
|
||||
|
||||
amd64: sda debian uefi
|
||||
amd64: qemu sda debian
|
||||
@qemu-system-x86_64 \
|
||||
-name debian \
|
||||
-cpu qemu64-v1 \
|
||||
@@ -71,7 +87,7 @@ amd64: sda debian uefi
|
||||
-monitor stdio \
|
||||
-rtc base=localtime,clock=host
|
||||
|
||||
debug:
|
||||
debug: qemu
|
||||
@qemu-system-x86_64 \
|
||||
-name debian \
|
||||
-cpu qemu64-v1 \
|
||||
@@ -95,7 +111,7 @@ debug:
|
||||
|
||||
test: auto amd64 debug
|
||||
|
||||
arm64: sda debian uefi
|
||||
arm64: qemu sda debian
|
||||
@qemu-system-aarch64 \
|
||||
-name debian \
|
||||
-accel hvf \
|
||||
|
||||
Reference in New Issue
Block a user