Use initramfs.dev only if exists and newer
This commit is contained in:
parent
7bb5c56ff2
commit
746c6214ce
1 changed files with 14 additions and 3 deletions
17
Makefile
17
Makefile
|
|
@ -16,9 +16,16 @@ qemu_vm_ip = 10.2.2.10
|
|||
qemu_disk = tmp/qemu-disk.img
|
||||
qemu_target ?= debian-stretch
|
||||
qemu_kernel = $(qemu_target).linux
|
||||
qemu_initramfs = $(qemu_target).initramfs.dev
|
||||
qemu_torrent = $(qemu_target).torrent
|
||||
|
||||
qemu_initramfs = $(shell \
|
||||
if [ -e $(qemu_target).initramfs.dev ] && [ `date -r $(qemu_target).initramfs.dev +%s` -gt `date -r $(qemu_target).initramfs +%s` ]; then \
|
||||
echo "$(qemu_target).initramfs.dev"; \
|
||||
else \
|
||||
echo "$(qemu_target).initramfs"; \
|
||||
fi \
|
||||
)
|
||||
|
||||
.PHONY: default
|
||||
default: dockerimg images/debian-stretch.squashfs images/debian-stretch.torrent
|
||||
|
||||
|
|
@ -101,6 +108,10 @@ tmp/tftproot/debian-installer/amd64/boot-screens/txt.cfg: txt.cfg
|
|||
/sys/devices/virtual/net/$(qemu_ifname_br)/brif/$(qemu_ifname_tap): /sys/devices/virtual/net/$(qemu_ifname_tap) /sys/devices/virtual/net/$(qemu_ifname_br)
|
||||
sudo brctl addif $(qemu_ifname_br) $(qemu_ifname_tap)
|
||||
|
||||
.PHONY: docker-services
|
||||
docker-services:
|
||||
docker-compose up -d
|
||||
|
||||
.PHONY: qemu-network
|
||||
qemu-network: /sys/devices/virtual/net/$(qemu_ifname_br)/brif/$(qemu_ifname_tap)
|
||||
if ! ip addr show dev $(qemu_ifname_br) | grep -F "$(qemu_host_ip)/$(qemu_netmask)"; then \
|
||||
|
|
@ -110,7 +121,7 @@ qemu-network: /sys/devices/virtual/net/$(qemu_ifname_br)/brif/$(qemu_ifname_tap
|
|||
sudo ip link set $(qemu_ifname_br) up
|
||||
|
||||
.PHONY: qemu
|
||||
qemu: qemu-network $(qemu_disk)
|
||||
qemu: qemu-network $(qemu_disk) docker-services
|
||||
qemu-system-x86_64 \
|
||||
-kernel "images/$(qemu_kernel)" \
|
||||
-initrd "images/$(qemu_initramfs)" \
|
||||
|
|
@ -121,7 +132,7 @@ qemu: qemu-network $(qemu_disk)
|
|||
-net nic \
|
||||
-net tap,ifname=$(qemu_ifname_tap),script=no,downscript=no
|
||||
|
||||
.PHONY: qemu-tftp
|
||||
.PHONY: qemu-tftp docker-services
|
||||
qemu-tftp: tmp/tftproot tmp/tftproot/images tmp/tftproot/debian-installer/amd64/boot-screens/txt.cfg qemu-network $(qemu_disk)
|
||||
qemu-system-x86_64 \
|
||||
-net nic -net tap,ifname=$(qemu_ifname_tap),script=no,downscript=no \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue