Skip to content
Snippets Groups Projects
Commit e49c9684 authored by Thomas Schneider's avatar Thomas Schneider
Browse files

Initial import

parents
No related branches found
No related tags found
No related merge requests found
/image.sqfs
/initramfs-virt
/vmlinuz-virt
/apk-cache
image.sqfs:
podman run --rm -ti -v $$PWD:/build -w /build alpine:3.17 ./make-image.sh
.PHONY: image.sqfs
#!/bin/sh
set -e
set -x
exec qemu-system-x86_64 \
-M microvm,x-option-roms=off,pit=off,pic=off,rtc=off,isa-serial=off,pcie=on \
-bios /usr/share/qemu/qboot.rom \
-enable-kvm \
-cpu host \
-m 1536M \
-nodefaults \
-no-user-config \
-nographic \
-device virtio-balloon-device \
-device virtio-rng-device \
-drive id=root,file=image.sqfs,format=raw,if=none \
-device virtio-blk-device,drive=root \
-kernel vmlinuz-virt \
-initrd initramfs-virt \
-append "root=/dev/vda overlaytmpfs console=hvc0 earlyprintk=hvc0" \
-chardev stdio,mux=on,id=stdio \
-device virtio-serial-device \
-device virtconsole,chardev=stdio,name=console.0 \
-mon chardev=stdio,mode=readline \
-netdev user,id=net \
-device virtio-net-device,netdev=net \
-chardev socket,path=qga,server=on,wait=off,id=qga \
-device virtserialport,chardev=qga,name=org.qemu.guest_agent.0 \
-chardev socket,id=virtfs,path=/tmp/virtfs.sock \
-device vhost-user-fs-pci,chardev=virtfs,tag=virtfs,queue-size=1024 \
-object memory-backend-memfd,id=mem,size=1536M,share=on \
-numa node,memdev=mem
#!/bin/sh
if test x"$container" != xpodman; then
echo This script is supposed to be run inside the container. >&2
exit 1
fi
set -e
set -x
mkdir -p /image/etc/apk
mkdir -p apk-cache
ln -s "$PWD/apk-cache" /etc/apk/cache
ln -s "$PWD/apk-cache" /image/etc/apk/cache
cp -r /etc/apk/repositories /etc/apk/keys /image/etc/apk
apk add --root /image --update-cache --initdb alpine-base mkinitfs \
qemu-guest-agent git git-lfs gitlab-runner bash buildah
echo 'features="base squashfs virtio"' > /image/etc/mkinitfs/mkinitfs.conf
apk add --root /image linux-virt
oldpwd="$PWD"
cd /image/etc/runlevels
for i in devfs dmesg mdev hwdrivers cgroups; do
ln -s /etc/init.d/$i sysinit/$i
done
for i in modules hostname sysctl bootmisc syslog osclock networking; do
ln -s /etc/init.d/$i boot/$i
done
ln -s /etc/init.d/killprocs shutdown/killprocs
for i in qemu-guest-agent; do
ln -s /etc/init.d/$i default/$i
done
cd "$oldpwd"
echo hvc0::respawn:/sbin/getty 115200 hvc0 >> /image/etc/inittab
cat <<EOF >/image/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
EOF
find /image/var/cache/apk -name APKINDEX.\* -delete
rm -f /image/etc/apk/cache
mv /image/boot/vmlinuz-virt /image/boot/initramfs-virt .
apk add squashfs-tools
rm -f image.sqfs
mksquashfs /image/ image.sqfs
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment