aboutsummaryrefslogtreecommitdiff
path: root/vm/debian-armv7.sh
blob: aa407e6f33c7e0eeec429404429d5e8cd0e5bc3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
: ${VM_CACHE:?} ${VM_DATA:?}

ISO_URL=https://cdimage.debian.org/debian-cd/current/armhf/iso-cd/debian-11.6.0-armhf-netinst.iso
KERNEL_URL=http://ftp.us.debian.org/debian/dists/stable/main/installer-armhf/current/images/cdrom/vmlinuz
INITRD_URL=http://ftp.us.debian.org/debian/dists/stable/main/installer-armhf/current/images/cdrom/initrd.gz

ISO_PATH=$VM_CACHE/$(basename $ISO_URL)
KERNEL_PATH=$VM_CACHE/$(basename $KERNEL_URL)
INITRD_PATH=$VM_CACHE/$(basename $INITRD_URL)

IMG_PATH=$VM_DATA/debian.qcow2

if [ ! -f $ISO_PATH ]; then
    curl -L -o $ISO_PATH $ISO_URL
fi

if [ ! -f $KERNEL_PATH ]; then
    curl -L -o $KERNEL_PATH $KERNEL_URL
fi

if [ ! -f $INITRD_PATH ]; then
    curl -L -o $INITRD_PATH $INITRD_URL
fi

if [ ! -f $IMG_PATH ]; then
    qemu-img create -f qcow2 $IMG_PATH 20G
fi

exec qemu-system-arm \
    -machine virt \
    -cpu cortex-a15 \
    -smp 4 \
    -m 2G \
    -kernel $KERNEL_PATH \
    -initrd $INITRD_PATH \
    -append "console=ttyAMA0" \
    -drive if=none,file=$ISO_PATH,media=cdrom,id=drive0 \
    -drive if=none,file=$IMG_PATH,media=disk,id=drive1 \
    -netdev user,id=netdev0 \
    -device virtio-scsi-device \
    -device scsi-cd,drive=drive0 \
    -device scsi-hd,drive=drive1 \
    -device virtio-net-device,netdev=netdev0 \
    -nographic \
    "$@"