diff --git a/rootf-kernel/Makefile b/rootf-kernel/Makefile index b5987ea..5e5425f 100644 --- a/rootf-kernel/Makefile +++ b/rootf-kernel/Makefile @@ -1,6 +1,22 @@ -.PHONY: get-alpine-rootfs +.PHONY: use-alpine use-arch use-ubuntu -get-alpine-rootfs: out/alpine-minirootfs-3.19.0-x86_64.tar.gz -out/alpine-minirootfs-3.19.0-x86_64.tar.gz: - wget -O $@ https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-minirootfs-3.19.0-x86_64.tar.gz +use-arch: ../out/arch-rootfs.ext4 + ln -s $< ../out/rootfs.ext4 + +use-alpine: ../out/alpine-rootf.ext4 + ln -s $< ../out/rootfs.ext4 + +use-ubuntu: ../out/ubuntu-22.04.ext4 + ln -s $< ../out/rootfs.ext4 + + + +../out/arch-rootfs.ext4: + bash ./arch-rootf.sh + +../out/alpine-rootf.ext4: + bash ./alpine-rootf.sh + +../out/ubuntu-22.04.ext4: + wget -O $@ https://s3.amazonaws.com/spec.ccfc.min/firecracker-ci/v1.7/$$(uname -m)/ubuntu-22.04.ext4 diff --git a/rootf-kernel/alpine-rootf.sh b/rootf-kernel/alpine-rootf.sh new file mode 100644 index 0000000..98d3df1 --- /dev/null +++ b/rootf-kernel/alpine-rootf.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -x + +DISK_SIZE=10G +DISK_FILE=../out/alpine-rootfs.ext4 +DISK_ROOT=../out/mount + +# Allocate rootfs disk +fallocate -l "$DISK_SIZE" "$DISK_FILE" +mkfs.ext4 $DISK_FILE + +# Mount rootfs to mount +mkdir -p $DISK_ROOT + +sudo mount $DISK_FILE $DISK_ROOT + +wget -O ../out/alpine-minirootfs-3.19.0-x86_64.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-minirootfs-3.19.0-x86_64.tar.gz + +tar xvf ../out/alpine-minirootfs-3.12.0-x86.tar.gz --directory="$DISK_ROOT" + + +sudo umount $DISK_ROOT +rmdir $DISK_ROOT diff --git a/rootf-kernel/rootfs.sh b/rootf-kernel/arch-rootfs.sh similarity index 100% rename from rootf-kernel/rootfs.sh rename to rootf-kernel/arch-rootfs.sh