2021-11-03 21:37:47 +01:00
|
|
|
# **************************************************************************** #
|
|
|
|
|
# #
|
|
|
|
|
# ::: :::::::: #
|
|
|
|
|
# Makefile :+: :+: :+: #
|
|
|
|
|
# +:+ +:+ +:+ #
|
|
|
|
|
# By: gbaconni@student.42lausanne.ch +#+ +:+ +#+ #
|
|
|
|
|
# +#+#+#+#+#+ +#+ #
|
|
|
|
|
# Created: 2021/11/02 17:47:57 by gbaconni #+# #+# #
|
2021-11-04 09:36:13 +01:00
|
|
|
# Updated: 2021/11/04 08:46:53 by gbaconni ### lausanne.ch #
|
2021-11-03 21:37:47 +01:00
|
|
|
# #
|
|
|
|
|
# **************************************************************************** #
|
|
|
|
|
|
|
|
|
|
DVER = 11.1.0
|
|
|
|
|
|
|
|
|
|
CPU = 8
|
|
|
|
|
RAM = 2048
|
|
|
|
|
SSD = 31539
|
2021-11-01 16:51:34 +01:00
|
|
|
|
|
|
|
|
all: sync
|
|
|
|
|
|
2021-11-03 21:37:47 +01:00
|
|
|
virtualbox:
|
|
|
|
|
@test -d ~/goinfre/VirtualBox\ VMs || mkdir -p ~/goinfre/VirtualBox\ VMs
|
|
|
|
|
@ln -snf ~/goinfre/VirtualBox\ VMs ~/VirtualBox\ VMs
|
|
|
|
|
|
|
|
|
|
brew:
|
|
|
|
|
@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)
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
@test -f debian-$(DVER)-arm64-netinst.iso || curl -sLO https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/debian-$(DVER)-arm64-netinst.iso
|
2021-11-04 09:36:13 +01:00
|
|
|
|
|
|
|
|
auto:
|
|
|
|
|
@grep -q 42url debian-$(DVER)-amd64-netinst.iso || sed -i'.orig' -e 's|auto=true priority=critical vga=788|auto url=https://42url.com/6eMNuv2Y|g' debian-$(DVER)-amd64-netinst.iso
|
2021-11-03 21:37:47 +01:00
|
|
|
@grep -q 42url debian-$(DVER)-arm64-netinst.iso || sed -i'.orig' -e 's|auto=true priority=critical --- quiet|auto url=https://42url.com/6eMNuv2Y |g' debian-$(DVER)-arm64-netinst.iso
|
|
|
|
|
@rm -f debian-$(DVER)-amd64-netinst.iso.orig debian-$(DVER)-arm64-netinst.iso.orig
|
|
|
|
|
|
|
|
|
|
sda:
|
2021-11-03 22:16:06 +01:00
|
|
|
@test -f sda.raw || dd if=/dev/zero of=sda.raw count=0 bs=1m seek=$(SSD) >/dev/null 2>&1
|
2021-11-03 21:37:47 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2021-11-04 09:36:13 +01:00
|
|
|
amd64: sda debian uefi
|
2021-11-03 21:37:47 +01:00
|
|
|
@qemu-system-x86_64 \
|
|
|
|
|
-name debian \
|
|
|
|
|
-cpu qemu64-v1 \
|
|
|
|
|
-smp $(CPU) \
|
|
|
|
|
-machine q35,vmport=off \
|
|
|
|
|
-accel tcg,tb-size=512 \
|
|
|
|
|
-global ICH9-LPC.disable_s3=1 \
|
|
|
|
|
-m $(RAM) \
|
|
|
|
|
-usb \
|
|
|
|
|
-device qemu-xhci \
|
|
|
|
|
-device usb-kbd \
|
|
|
|
|
-device usb-mouse \
|
|
|
|
|
-device usb-tablet \
|
|
|
|
|
-device virtio-gpu \
|
|
|
|
|
-device virtio-scsi-pci,num_queues=4,id=scsi0 \
|
|
|
|
|
-device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0,bootindex=0 \
|
|
|
|
|
-device scsi-cd,drive=cdrom0,bus=scsi0.0,channel=0,scsi-id=1,lun=0,bootindex=1 \
|
2021-11-03 23:37:39 +01:00
|
|
|
-drive id=pflash0,unit=0,file=${PWD}/edk2-x86_64-code.fd,if=pflash,format=raw,readonly=on \
|
|
|
|
|
-drive id=pflash1,unit=1,file=${PWD}/edk2-i386-vars.fd,if=pflash,format=raw \
|
2021-11-03 21:37:47 +01:00
|
|
|
-drive id=drive0,index=0,file=${PWD}/sda.raw,if=none,media=disk,format=raw,cache=writethrough,discard=unmap \
|
|
|
|
|
-drive id=cdrom0,index=1,file=${PWD}/debian-$(DVER)-amd64-netinst.iso,if=none,media=cdrom,readonly=on \
|
|
|
|
|
-nic user,model=virtio \
|
|
|
|
|
-monitor stdio \
|
|
|
|
|
-rtc base=localtime,clock=host
|
2021-11-03 23:37:39 +01:00
|
|
|
|
2021-11-04 09:36:13 +01:00
|
|
|
debug:
|
2021-11-03 23:37:39 +01:00
|
|
|
@qemu-system-x86_64 \
|
|
|
|
|
-name debian \
|
|
|
|
|
-cpu qemu64-v1 \
|
|
|
|
|
-smp $(CPU) \
|
|
|
|
|
-machine q35,vmport=off \
|
|
|
|
|
-accel tcg,tb-size=512 \
|
|
|
|
|
-global ICH9-LPC.disable_s3=1 \
|
|
|
|
|
-m $(RAM) \
|
|
|
|
|
-usb \
|
|
|
|
|
-device qemu-xhci \
|
|
|
|
|
-device usb-kbd \
|
|
|
|
|
-device usb-mouse \
|
|
|
|
|
-device usb-tablet \
|
|
|
|
|
-device virtio-gpu \
|
|
|
|
|
-device virtio-scsi-pci,num_queues=4,id=scsi0 \
|
|
|
|
|
-device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0,bootindex=0 \
|
|
|
|
|
-drive id=drive0,index=0,file=${PWD}/sda.raw,if=none,media=disk,format=raw,cache=writethrough,discard=unmap \
|
|
|
|
|
-nic user,model=virtio \
|
|
|
|
|
-monitor stdio \
|
|
|
|
|
-rtc base=localtime,clock=host
|
2021-11-03 21:37:47 +01:00
|
|
|
|
2021-11-04 09:36:13 +01:00
|
|
|
test: auto amd64 debug
|
|
|
|
|
|
|
|
|
|
arm64: sda debian uefi
|
2021-11-03 21:37:47 +01:00
|
|
|
@qemu-system-aarch64 \
|
|
|
|
|
-name debian \
|
|
|
|
|
-accel hvf \
|
|
|
|
|
-cpu host \
|
|
|
|
|
-smp $(CPU) \
|
|
|
|
|
-machine virt,highmem=off \
|
|
|
|
|
-accel hvf \
|
|
|
|
|
-accel tcg,tb-size=128 \
|
|
|
|
|
-m $(RAM) \
|
|
|
|
|
-usb \
|
|
|
|
|
-device qemu-xhci \
|
|
|
|
|
-device usb-kbd \
|
|
|
|
|
-device usb-mouse \
|
|
|
|
|
-device usb-tablet \
|
|
|
|
|
-device virtio-gpu \
|
|
|
|
|
-device virtio-scsi-pci,num_queues=4,id=scsi0 \
|
|
|
|
|
-device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0,bootindex=0 \
|
|
|
|
|
-device scsi-cd,drive=cdrom0,bus=scsi0.0,channel=0,scsi-id=1,lun=0,bootindex=1 \
|
|
|
|
|
-drive id=pflash0,unit=0,file=${PWD}/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on \
|
|
|
|
|
-drive id=pflash1,unit=1,file=${PWD}/edk2-arm-vars.fd,if=pflash,format=raw \
|
|
|
|
|
-drive id=drive0,index=0,file=${PWD}/sda.raw,if=none,media=disk,format=raw,cache=writethrough,discard=unmap \
|
|
|
|
|
-drive id=cdrom0,index=1,file=${PWD}/debian-$(DVER)-arm64-netinst.iso,if=none,media=cdrom,readonly=on \
|
|
|
|
|
-nic user,model=virtio \
|
|
|
|
|
-monitor stdio \
|
|
|
|
|
-rtc base=localtime,clock=host
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
@rm -f sda.raw
|
|
|
|
|
|
|
|
|
|
fclean: clean
|
|
|
|
|
@rm -f debian-$(DVER)-amd64-netinst.iso
|
|
|
|
|
@rm -f debian-$(DVER)-arm64-netinst.iso
|
|
|
|
|
|
2021-11-04 09:36:13 +01:00
|
|
|
re: clean test
|
|
|
|
|
|
2021-11-03 21:37:47 +01:00
|
|
|
ps:
|
|
|
|
|
@ps ax | grep qemu | sed 's/ -/ \\\n-/g; s/^[^\/]*//;'
|
|
|
|
|
|
2021-11-03 23:37:39 +01:00
|
|
|
sync: up update
|
2021-11-01 16:51:34 +01:00
|
|
|
@git status | grep -q 'nothing to commit' || (git add -A && git commit -am "$$(date '+%F %T')" && git push) || true
|
|
|
|
|
|
2021-11-03 23:37:39 +01:00
|
|
|
up:
|
2021-11-01 16:51:34 +01:00
|
|
|
@dig +short vogsphere.baco.net A | grep -q '213\.5\.156\.25' || echo 'vogsphere.baco.net unreachable'
|
|
|
|
|
|
|
|
|
|
update:
|
|
|
|
|
@git pull
|
|
|
|
|
|