Skip to content

Development

Jorge Buzeti edited this page Feb 24, 2023 · 4 revisions

Development

Environment

It is not recommended to run this code on your machine, as it is not only a ring-0 code, but also malware. First, let's set up a vm for programming, I will use qemu and/or virtualbox, but feel free to use any other virtualization software.

! DISCLAIMER: DOCKER NOT IS VIRTUAL MACHINE

Qemu

You can follow a simple tutorial to install qemu dependencies like this

We will use the following commands to create the vm, install the dependencies and set up the shared fs:

# We will usage Ubuntu
wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img -O /var/lib/libvirt/images/ubuntu.img

virt-customize -a /var/lib/libvirt/images/ubuntu.img --root-password password:root

# Feel free to change the ram, cpu and disk values
virt-install \
    --import  \
    --noautoconsole \
    --noreboot \
    --name brokepkg-guest \
    --ram=4096 \
    --vcpus=4 \
    --accelerate \
    --network network:default,model=virtio \
    --console pty \
    --disk path=/var/lib/libvirt/images/ubuntu.img,bus=virtio,size=20 \
    --os-variant ubuntu18.04

# download source code
git clone https://github.com/R3tr074/brokepkg brokepkg-source
cat > fs.xml <<EOF
<filesystem type='mount' accessmode='mapped'>
  <source dir='$(pwd)/brokepkg-source'/>
  <target dir='brokepkg-source'/>
</filesystem>
EOF

virsh attach-device brokepkg-guest fs.xml --config
rm -rf fs.xml

# ---
# start VM
virsh start brokepkg-guest && virsh console brokepkg-guest
# mount source in /mnt
mount brokepkg-source /mnt -t 9p -o trans=virtio # run this in virtual machine

! If you have network issues, try dhclient <network interface> on the vm, to see interface just type ip a.

VirtualBox

VirtualBox are more user friendly, you can see here how install ubuntu cloud image and here how create a shared folder to development.

Clone this wiki locally