Skip to content

Commit

Permalink
wip: add quark build command
Browse files Browse the repository at this point in the history
Signed-off-by: Julian Labatut <[email protected]>
  • Loading branch information
jlabatut committed May 1, 2022
1 parent 6cd10e0 commit 67adf77
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 101 deletions.
25 changes: 0 additions & 25 deletions rootfs/mkrootfs.sh

This file was deleted.

24 changes: 24 additions & 0 deletions scripts/mkbundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# From https://github.com/virt-do/kaps/blob/main/hack/mkbundle.sh

# The URL of a container image archive should be supplied in parameter
# Example with alpine : https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz
if [[ $# -ne 1 ]]; then
echo "Missing container image URL"
exit 1
fi

DEST="ctr-bundle"
IMAGE_ARCHIVE_URL=$1
IMAGE_ARCHIVE_NAME="imageArchive"

rm -rf $DEST $IMAGE_ARCHIVE_NAME && mkdir -p "$DEST"/rootfs

# Download and untar the image
curl -sSL $IMAGE_ARCHIVE_URL -o $IMAGE_ARCHIVE_NAME
tar xf $IMAGE_ARCHIVE_NAME -C "$DEST"/rootfs
rm $IMAGE_ARCHIVE_NAME

pushd "$DEST" > /dev/null
# Generate a runtime spec
runc spec --rootless
popd > /dev/null
4 changes: 2 additions & 2 deletions kernel/mkkernel.sh → scripts/mkkernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ then
git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "ch-5.14" $LINUX_REPO
fi

pushd $LINUX_REPO
pushd $LINUX_REPO > /dev/null
pwd
wget -qO .config $CONFIG_URL
make bzImage -j `nproc`
popd
popd > /dev/null
34 changes: 34 additions & 0 deletions scripts/mkrootfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# From https://github.com/virt-do/lumper/blob/main/rootfs/mkrootfs.sh

DEST="alpine-minirootfs"
IMAGE_ARCHIVE_URL="https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz"
IMAGE_ARCHIVE_NAME="imageArchive"

rm -rf $DEST $IMAGE_ARCHIVE_NAME && mkdir $DEST

# Download and untar the image
curl -sSL $IMAGE_ARCHIVE_URL -o $IMAGE_ARCHIVE_NAME
tar xf $IMAGE_ARCHIVE_NAME -C $DEST
rm $IMAGE_ARCHIVE_NAME

pushd "$DEST" > /dev/null
# Create an init file in the rootfs
cat > init <<EOF
#! /bin/sh
#
# /init executable file in the initramfs
#
mount -t devtmpfs dev /dev
mount -t proc proc /proc
mount -t sysfs sysfs /sys
ip link set up dev lo
exec /opt/kaps run --bundle /ctr-bundle
poweroff -f
EOF

chmod +x init

popd > /dev/null

# Here we do not create the rootfs image because we need to add some files in it later
Loading

0 comments on commit 67adf77

Please sign in to comment.