Skip to content

Commit 67adf77

Browse files
committed
wip: add quark build command
Signed-off-by: Julian Labatut <julian.labatut@etu.umontpellier.fr>
1 parent 6cd10e0 commit 67adf77

5 files changed

Lines changed: 212 additions & 101 deletions

File tree

rootfs/mkrootfs.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

scripts/mkbundle.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# From https://github.com/virt-do/kaps/blob/main/hack/mkbundle.sh
2+
3+
# The URL of a container image archive should be supplied in parameter
4+
# Example with alpine : https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz
5+
if [[ $# -ne 1 ]]; then
6+
echo "Missing container image URL"
7+
exit 1
8+
fi
9+
10+
DEST="ctr-bundle"
11+
IMAGE_ARCHIVE_URL=$1
12+
IMAGE_ARCHIVE_NAME="imageArchive"
13+
14+
rm -rf $DEST $IMAGE_ARCHIVE_NAME && mkdir -p "$DEST"/rootfs
15+
16+
# Download and untar the image
17+
curl -sSL $IMAGE_ARCHIVE_URL -o $IMAGE_ARCHIVE_NAME
18+
tar xf $IMAGE_ARCHIVE_NAME -C "$DEST"/rootfs
19+
rm $IMAGE_ARCHIVE_NAME
20+
21+
pushd "$DEST" > /dev/null
22+
# Generate a runtime spec
23+
runc spec --rootless
24+
popd > /dev/null
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ then
99
git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "ch-5.14" $LINUX_REPO
1010
fi
1111

12-
pushd $LINUX_REPO
12+
pushd $LINUX_REPO > /dev/null
1313
pwd
1414
wget -qO .config $CONFIG_URL
1515
make bzImage -j `nproc`
16-
popd
16+
popd > /dev/null

scripts/mkrootfs.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# From https://github.com/virt-do/lumper/blob/main/rootfs/mkrootfs.sh
2+
3+
DEST="alpine-minirootfs"
4+
IMAGE_ARCHIVE_URL="https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz"
5+
IMAGE_ARCHIVE_NAME="imageArchive"
6+
7+
rm -rf $DEST $IMAGE_ARCHIVE_NAME && mkdir $DEST
8+
9+
# Download and untar the image
10+
curl -sSL $IMAGE_ARCHIVE_URL -o $IMAGE_ARCHIVE_NAME
11+
tar xf $IMAGE_ARCHIVE_NAME -C $DEST
12+
rm $IMAGE_ARCHIVE_NAME
13+
14+
pushd "$DEST" > /dev/null
15+
# Create an init file in the rootfs
16+
cat > init <<EOF
17+
#! /bin/sh
18+
#
19+
# /init executable file in the initramfs
20+
#
21+
mount -t devtmpfs dev /dev
22+
mount -t proc proc /proc
23+
mount -t sysfs sysfs /sys
24+
ip link set up dev lo
25+
26+
exec /opt/kaps run --bundle /ctr-bundle
27+
poweroff -f
28+
EOF
29+
30+
chmod +x init
31+
32+
popd > /dev/null
33+
34+
# Here we do not create the rootfs image because we need to add some files in it later

0 commit comments

Comments
 (0)