This commit is contained in:
Your Name 2025-09-23 16:12:34 +00:00
parent c6732e14e9
commit fd7081778b
3 changed files with 42 additions and 10 deletions

View File

@ -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):

10
static/config.txt Normal file
View File

@ -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

13
static/unattended.sh Normal file
View File

@ -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