firecracker-netns/rootf-kernel/alpine-rootfs.sh

25 lines
590 B
Bash
Raw Normal View History

#!/bin/bash
set -ex
DISK_SIZE=10G
DISK_FILE=../out/alpine-rootfs.ext4
DISK_ROOT=../out/mount
# Allocate rootfs disk
fallocate -l "$DISK_SIZE" "$DISK_FILE"
mkfs.ext4 -F $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
sudo tar xvf ../out/alpine-minirootfs-3.19.0-x86_64.tar.gz --directory="$DISK_ROOT"
rm ../out/alpine-minirootfs-3.19.0-x86_64.tar.gz
sudo umount $DISK_ROOT
rmdir $DISK_ROOT