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

25 lines
530 B
Bash
Raw Normal View History

#!/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