diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2024-01-08 18:50:10 +0100 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2024-01-08 18:50:10 +0100 |
| commit | 39abd6b00a427ac4d33564d9a00cde35abe90be8 (patch) | |
| tree | c92ea389ab832929263612b556f8f141feb9ea1a /vm/alpine-armv7.sh | |
| parent | 52ee08731eeebed097cf2d17c76597d7ded5b038 (diff) | |
.
Diffstat (limited to 'vm/alpine-armv7.sh')
| -rw-r--r-- | vm/alpine-armv7.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vm/alpine-armv7.sh b/vm/alpine-armv7.sh new file mode 100644 index 0000000..2d6e6e7 --- /dev/null +++ b/vm/alpine-armv7.sh @@ -0,0 +1,39 @@ +: ${VM_CACHE:?} ${VM_DATA:?} + +alpine_url=https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/armv7/alpine-uboot-3.18.4-armv7.tar.gz + +alpine_path=$VM_CACHE/$(basename -- "$alpine_url") +kernel_path=$VM_CACHE/vmlinuz-lts +initrd_path=$VM_CACHE/initramfs-lts + +image_path=$VM_DATA/alpine.qcow2 + + +if [ ! -f $alpine_path ]; then + curl -L -o $alpine_path $alpine_url +fi + +if [ ! -f $kernel_path ]; then + tar -x -f $alpine_path -C $(dirname $kernel_path) \ + --strip-components=2 ./boot/$(basename $kernel_path) +fi + +if [ ! -f $initrd_path ]; then + tar -x -f $alpine_path -C $(dirname $initrd_path) \ + --strip-components=2 ./boot/$(basename $initrd_path) +fi + +if [ ! -f $image_path ]; then + qemu-img create -f qcow2 $image_path 20G +fi + +exec qemu-system-arm \ + -M virt \ + -m 1G \ + -cpu cortex-a15 \ + -kernel $kernel_path \ + -initrd $initrd_path \ + -append "console=ttyAMA0" \ + -hda $image_path \ + -nographic \ + "$@" |
