From fd7081778b411e8ebd573b4eb400ce22c61dc81d Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 23 Sep 2025 16:12:34 +0000 Subject: [PATCH] bless --- Makefile | 29 +++++++++++++++++++---------- static/config.txt | 10 ++++++++++ static/unattended.sh | 13 +++++++++++++ 3 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 static/config.txt create mode 100644 static/unattended.sh diff --git a/Makefile b/Makefile index 19693f8..2dda4c3 100644 --- a/Makefile +++ b/Makefile @@ -40,31 +40,40 @@ PLATFORM := arm64 QEMU_VM := qemu-system-aarch64 QEMU_IMG := qemu-img +SSH_AUTH_KEYS := $(ALPINE)/authorized_keys + all: $(TARGET) $(TARGET): $(TOOLCHAIN) $(SRC) $(BUILD_DIR) $(LIB) echo $(HOME) $(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LIB) -get: $(ASSETS) $(ALPINE) $(ALPINE_TAR) $(ALPINE_HEADLESS) +get: $(ASSETS) $(ALPINE_TAR) $(ALPINE_HEADLESS) rm -rf $(ALPINE)/* tar xvf $(ALPINE_TAR) -C $(ALPINE) + cp $(ALPINE_HEADLESS) $(ALPINE) qemu: $(ALPINE_CUSTOM_IMG) img - $(QEMU_VM) -M virt -cpu cortex-a72 -smp 2 -m 1G \ - -kernel $(ALPINE_KERNEL) \ - -initrd $(ALPINE_INITFRAM_FS) \ - -append "console=ttyAMA0 root=/dev/vda rw" \ - -drive format=raw,file=fat:rw:$(ALPINE)/ \ - -nographic \ - -virtfs local,path=$(BUILD_DIR),mount_tag=$(BUILD_DIR),security_model=none + $(QEMU_VM) -machine raspi3ap -cpu cortex-a53 -smp 4 -m 512M \ + -drive format=raw,file=$(ALPINE_CUSTOM_IMG) \ + -nographic + #$(QEMU_VM) -M virt -cpu cortex-a72 -smp 2 -m 1G \ + # -kernel $(ALPINE_KERNEL) \ + # -initrd $(ALPINE_INITFRAM_FS) \ + # -append "console=ttyAMA0 root=/dev/vda rw" \ + # -drive format=raw,file=fat:rw:$(ALPINE)/ \ + # -nographic \ + # -virtfs local,path=$(BUILD_DIR),mount_tag=$(BUILD_DIR),security_model=none -img: $(ALPINE) get +img: get $(ALPINE) $(BUILD_DIR) $(QEMU_IMG) create -f raw $(ALPINE_CUSTOM_IMG) 512M mformat -i $(ALPINE_CUSTOM_IMG) -F :: mcopy -i $(ALPINE_CUSTOM_IMG) -s $(ALPINE)/* :: -bootable: $(ALPINE) get +$(SSH_AUTH_KEYS): + cp ~/.ssh/authorized_keys $(ALPINE) + +bootable: $(ALPINE) $(WPA_CONFIG) get tar czf $(MINIROOTFS) -C $(ALPINE) ./ $(ALPINE_HEADLESS): diff --git a/static/config.txt b/static/config.txt new file mode 100644 index 0000000..2844a79 --- /dev/null +++ b/static/config.txt @@ -0,0 +1,10 @@ +# do not modify this file as it will be overwritten on upgrade. +# create and/or modify usercfg.txt instead. +# https://www.raspberrypi.com/documentation/computers/config_txt.html + +kernel=boot/vmlinuz-rpi +initramfs boot/initramfs-rpi +arm_64bit=1 +dtoverlay=dwc2 +include usercfg.txt + diff --git a/static/unattended.sh b/static/unattended.sh new file mode 100644 index 0000000..8922157 --- /dev/null +++ b/static/unattended.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +echo "dwc2" >> /etc/modules +echo "g_ether" >> /etc/modules +modprobe dwc2 +modprobe g_ether + +cat >> /etc/network/interfaces << EOF +auto usb0 +iface usb0 inet static + address 192.168.7.2 + netmask 255.255.255.0 +EOF