Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
dd if=/dev/zero of=$(IMAGE) bs=1024k count=20480
curl -s$(VERSION)/$(ISO) -o $(CD)
cp $(MOUNTPOINT)/casper/initrd $(DATA)/
gunzip $(KERNEL).gz
$(KERNEL).gz: $(MOUNTPOINT)/casper
cp $(MOUNTPOINT)/casper/vmlinuz $(KERNEL).gz
xcode-select --switch /Applications/
run: $(vftool) $(CD) $(IMAGE) $(KERNEL) $(INITRD)
$(vftool) \
-k $(KERNEL) \
-i $(INITRD) \
-d $(IMAGE) \
-c $(CD) \
-m 2048 \
-a "console=hvc0 root=/dev/vda2"
sudo mkdir -p $(MOUNTPOINT)
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