Skip to content

Instantly share code, notes, and snippets.

@zchee
Forked from jedahan/Makefile.podman-bridge
Created January 26, 2021 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zchee/305ae7a0ce34d56b0ce29b432e438946 to your computer and use it in GitHub Desktop.
Save zchee/305ae7a0ce34d56b0ce29b432e438946 to your computer and use it in GitHub Desktop.
ARCH ?= arm64
VERSION ?= 20.10
SPIN ?= live-server
vftool ?= ./vftool/build/vftool
DATA ?= ./data
ISO := ubuntu-$(VERSION)-$(SPIN)-$(ARCH).iso
MOUNTPOINT := /Volumes/Ubuntu
CD := $(DATA)/$(ISO)
IMAGE := $(DATA)/disk.img
KERNEL := $(DATA)/vmlinuz
INITRD := $(DATA)/initrd
.PHONY: run select
all: run
$(IMAGE):
dd if=/dev/zero of=$(IMAGE) bs=1024k count=20480
$(CD):
curl -s https://releases.ubuntu.com/$(VERSION)/$(ISO) -o $(CD)
$(INITRD): $(MOUNTPOINT)/casper
cp $(MOUNTPOINT)/casper/initrd $(DATA)/
$(KERNEL): $(KERNEL).gz
gunzip $(KERNEL).gz
$(KERNEL).gz: $(MOUNTPOINT)/casper
cp $(MOUNTPOINT)/casper/vmlinuz $(KERNEL).gz
build/Release/podracer:
xcodebuild
select:
xcode-select --switch /Applications/XCode.app
run: $(vftool) $(CD) $(IMAGE) $(KERNEL) $(INITRD)
$(vftool) \
-k $(KERNEL) \
-i $(INITRD) \
-d $(IMAGE) \
-c $(CD) \
-m 2048 \
-a "console=hvc0 root=/dev/vda2"
$(MOUNTPOINT):
sudo mkdir -p $(MOUNTPOINT)
$(MOUNTPOINT)/casper: $(MOUNTPOINT) $(CD)
sudo umount $(MOUNTPOINT)
$(eval DISK := $(shell sudo hdiutil attach -nomount $(CD) | head -n1 | cut -d' ' -f1))
sudo mount -t cd9660 $(DISK) $(MOUNTPOINT)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment