-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: add initramfs implementation for vmm (#34)
* feat(vmm): implemented automatic generation of rootfs with initramfs Signed-off-by: Muriel Paraire <[email protected]> * feat: image generation based off language Signed-off-by: Muriel Paraire <[email protected]> * feat(vmm): implemented automatic generation of rootfs with initramfs Signed-off-by: Muriel Paraire <[email protected]> * fix(vmm): fix logging & language order Signed-off-by: Muriel Paraire <[email protected]> * feat(vmm): one image per language Signed-off-by: Muriel Paraire <[email protected]> * feat(vmm): implemented initramfs Signed-off-by: Muriel Paraire <[email protected]> * fix(vmm): code cleanup Signed-off-by: Muriel Paraire <[email protected]> * fix(vmm): code cleanup Signed-off-by: Muriel Paraire <[email protected]> * fix(vmm): code cleanup Signed-off-by: Muriel Paraire <[email protected]> * fix: rust export for cargo agent and increase MMIO_GAP_END Signed-off-by: Mauran <[email protected]> * chore: lint Signed-off-by: Mauran <[email protected]> * fix: add back tracing Signed-off-by: Mauran <[email protected]> --------- Signed-off-by: Muriel Paraire <[email protected]> Signed-off-by: Mauran <[email protected]> Co-authored-by: Mauran <[email protected]>
- Loading branch information
1 parent
d1d1f47
commit e5b085d
Showing
10 changed files
with
132 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
#! /bin/sh | ||
# | ||
# Cloudlet initramfs generation | ||
# /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 | ||
|
||
slattach -L /dev/ttyS1& | ||
export CARGO_HOME='/usr/local/cargo' | ||
export RUSTUP_HOME='/usr/local/rustup' | ||
export RUST_VERSION='1.77.2' | ||
|
||
while ! ifconfig sl0 &> /dev/null; do | ||
sleep 1 | ||
done | ||
|
||
ifconfig sl0 172.30.0.11 netmask 255.255.0.0 up | ||
export PATH=$CARGO_HOME/bin:$PATH | ||
|
||
/agent | ||
|
||
reboot | ||
reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#!/usr/bin/bash | ||
|
||
LINUX_REPO=linux-cloud-hypervisor | ||
cd ./tools/kernel/ | ||
|
||
if [ ! -d $LINUX_REPO ] | ||
then | ||
git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "ch-6.2" $LINUX_REPO | ||
fi | ||
|
||
pushd $LINUX_REPO | ||
cd $LINUX_REPO | ||
cp ../linux-config-x86_64 .config | ||
KCFLAGS="-Wa,-mx86-used-note=no" make bzImage -j `nproc` | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,17 @@ | ||
#!/usr/bin/bash | ||
|
||
set -e | ||
|
||
if [ ! -d alpine-minirootfs ] | ||
# test if its already in src folder => fs-gen available | ||
# launch from src folder at the same level as tools | ||
if [ -d src ] | ||
then | ||
curl -O https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz | ||
|
||
mkdir alpine-minirootfs | ||
tar xf alpine-minirootfs-3.14.2-x86_64.tar.gz -C alpine-minirootfs | ||
cd src | ||
fi | ||
|
||
# augment the open file limit | ||
ulimit -Sn 8192 | ||
|
||
pushd alpine-minirootfs | ||
mkdir -p etc/cloudlet/agent | ||
cp ../../../target/x86_64-unknown-linux-musl/release/agent agent | ||
cp ../config.toml etc/cloudlet/agent/config.toml | ||
|
||
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 | ||
ifconfig eth0 172.29.0.2 netmask 255.255.0.0 up | ||
/agent | ||
reboot | ||
EOF | ||
|
||
chmod +x init | ||
|
||
find . -print0 | | ||
cpio --null --create --verbose --owner root:root --format=newc | | ||
xz -9 --format=lzma > ../initramfs.img | ||
|
||
popd | ||
if [ -d fs-gen ] | ||
then | ||
cargo run --bin fs-gen -- $1 $2 -o $3 | ||
else | ||
echo "Module fs-gen not found" | ||
fi |