chore: reorganizar estructura de archivos
- tambien he puesto los documentos en `doc` directamente para evitar el symlink
This commit is contained in:
72
res/vm/Makefile
Normal file
72
res/vm/Makefile
Normal file
@@ -0,0 +1,72 @@
|
||||
# Makefile para reproducir todo lo necesario de la charla
|
||||
|
||||
ISOFILE = archlinux.iso
|
||||
MEMORY_GIB = 8
|
||||
MEMORY_MIB != bc <<<"1024 * $(MEMORY_GIB)"
|
||||
ROOT_SIZE = 20G
|
||||
|
||||
VM_DEPS =
|
||||
QEMU = qemu-system-x86_64
|
||||
QEMU_ARGS = \
|
||||
-m $(MEMORY_MIB) \
|
||||
-enable-kvm \
|
||||
-machine accel=kvm \
|
||||
-cpu host \
|
||||
-machine q35 \
|
||||
-cdrom $(ISOFILE) \
|
||||
-drive file=root.img,format=qcow2,if=virtio \
|
||||
-netdev bridge,id=net0,br=virbr0 \
|
||||
-device virtio-net-pci,netdev=net0 \
|
||||
-smp 4,sockets=1,cores=2,threads=2
|
||||
|
||||
# in case I fuck up
|
||||
ifeq ($(RECOVERY),1)
|
||||
QEMU_ARGS += -boot d
|
||||
else
|
||||
QEMU_ARGS += -boot c
|
||||
endif
|
||||
|
||||
OVMF_x64 = /usr/share/OVMF/x64
|
||||
OVMF.fd = $(OVMF_x64)/OVMF.4m.fd
|
||||
OVMF_VARS.fd = $(OVMF_x64)/OVMF_VARS.4m.fd
|
||||
OVMF_VARS = OVMF_VARS.fd
|
||||
|
||||
ifneq ($(LEGACY_BIOS),1)
|
||||
VM_DEPS += $(OVMF_VARS)
|
||||
QEMU_ARGS += \
|
||||
-drive if=pflash,format=raw,readonly=on,file=$(OVMF.fd) \
|
||||
-drive if=pflash,format=raw,file=$(OVMF_VARS)
|
||||
endif
|
||||
|
||||
root.img:
|
||||
test -f $@ || qemu-img create -f qcow2 $@ $(ROOT_SIZE)
|
||||
|
||||
$(OVMF_VARS):
|
||||
cp $(OVMF_VARS.fd) $@
|
||||
|
||||
.PHONY: exit-notice vm vm-nographic serve
|
||||
|
||||
exit-notice:
|
||||
@echo -e "\x1b[0mExit with \x1b[1;4mCtrl + A, X\x1b[0m"
|
||||
@read -t 3 -r || :
|
||||
|
||||
vm: root.img $(VM_DEPS)
|
||||
$(QEMU) -display sdl,gl=on $(QEMU_ARGS)
|
||||
|
||||
vm-nographic: exit-notice root.img $(VM_DEPS)
|
||||
$(QEMU) -nographic $(QEMU_ARGS)
|
||||
|
||||
# debe haber una carpeta `arch-repo` con todos los paquetes a servir (de
|
||||
# `/var/cache/pacman/pkg/`)
|
||||
#
|
||||
# Una vez se han copiado todos a esta carpeta, se hace `repo-add
|
||||
# custom.db.tar.gz ./*.pkg.tar.zst~*.sig` (pq lo he copiado todo, sig incluido)
|
||||
# para generar los archivos de la base de datos de los paquetes
|
||||
serve:
|
||||
@echo -e "\033[4;7m/etc/pacman.conf:\033[0m"
|
||||
@echo "[custom]"
|
||||
@echo "SigLevel = Optional TrustAll"
|
||||
@echo "http://192.168.122.1:8080"
|
||||
@echo "# y comentar los repositorios existentes por si acaso"
|
||||
@echo
|
||||
(cd arch-repo && python -m http.server 8080)
|
||||
Reference in New Issue
Block a user