Skip to content

Commit

Permalink
make(tools): add kernel and rootfs for development (#23)
Browse files Browse the repository at this point in the history
* make: add tools to build kernel with alpine minirootfs and run it

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* fix(makefile): use shebang to load env in build-kernel

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* make: add setup utility

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* refactor(tools): rename do-vmm to tools

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* make(kernel): enable slip and probing for 2 serials

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* make(tools/rootfs): setup slip interface

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* fix(make/tools): remove useless comands and add initramfs parameter

Signed-off-by: Martin Moreira de Jesus <[email protected]>

* fix: make it work for weak ubuntu users

Co-authored-by: Noé Tarbouriech <[email protected]>
Signed-off-by: Martin Moreira de Jesus <[email protected]>

---------

Signed-off-by: Martin Moreira de Jesus <[email protected]>
Co-authored-by: Noé Tarbouriech <[email protected]>
  • Loading branch information
mmoreiradj and noetarbouriech authored Apr 22, 2024
1 parent 99590cf commit 779fbe7
Show file tree
Hide file tree
Showing 6 changed files with 3,296 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ $RECYCLE.BIN/

# End of https://www.toptal.com/developers/gitignore/api/windows,macos,linux,vim,intellij+all,rust,rust-analyzer,visualstudiocode

# RooFs and Kernel
# RootFs and Kernel
kernel/*
rootfs/*
rootfs/*
30 changes: 30 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set shell := ["/bin/bash", "-uc"]

setup:
#!/bin/bash
pushd tools/rootfs
./mkrootfs.sh
popd

pushd tools/kernel
./mkkernel.sh
popd

run:
#!/bin/bash
CARGO_PATH=$(which cargo)
sudo -E capsh --keep=1 --user=$USER --inh=cap_net_admin --addamb=cap_net_admin -- -c \
'RUST_BACKTRACE=1 '$CARGO_PATH' run --bin vmm -- --memory 512 --cpus 1 \
--kernel tools/kernel/linux-cloud-hypervisor/arch/x86/boot/compressed/vmlinux.bin \
--network-host-ip 172.29.0.1 --network-host-netmask 255.255.0.0 \
--initramfs=tools/rootfs/initramfs.img'

build-kernel:
#!/bin/bash
pushd tools/kernel/linux-cloud-hypervisor && \
KCFLAGS="-Wa,-mx86-used-note=no" make bzImage -j `nproc`

build-rootfs:
#!/bin/bash
pushd tools/rootfs && \
./mkrootfs.sh
4 changes: 4 additions & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
kernel/linux-cloud-hypervisor
rootfs/alpine-minirootfs*
rootfs/initramfs.img

Loading

0 comments on commit 779fbe7

Please sign in to comment.