Skip to content
Snippets Groups Projects
Commit b8431a64 authored by Dragoș-Iulian ARGINT (94922)'s avatar Dragoș-Iulian ARGINT (94922)
Browse files

Update local.sh


Add option to allow SO2 VM to start with qemu monitor

Signed-off-by: default avatarDragos Iulian Argint <dragos.argint@stud.acs.upb.ro>
parent de13c943
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,36 @@ $ make build
> You DO NOT need to reboot the VM each time you build modules.
> But if you want to stop the Virtual Machine use the following key combination `Ctrl + A then q`.
# Starting the VM (inside the docker) with qemu display
Start the Docker using the following command
```
$ sudo ./local.sh docker interactive --allow-gui
```
> **Warning**
> If you're running on WSL you should follow the steps listed below, before starting the VM!
Start the VM with the following command (inside the docker)
```
make gui
```
Only on WSL, we need to instsall an X11 server:
Just download it from [here](https://sourceforge.net/projects/vcxsrv/) and launch the installer.
After installing it, run the XLaunch app and make sure you select the following checkbox
![XLaunch](./img/XLaunch.png)
"Also, ensure that both of the VcXsrv checkboxes are checked in the Windows Firewall Manager."
![XLaunch2](./img/XLaunch2.png)
Now, you should be able to run the `make gui` command.
> **Warning**
> Just as in the case of `make console`, you DO NOT need to reboot the VM each time you build modules.
> But if you want to stop the Virtual Machine, use the following key combination `Ctrl + A then q` (in the console, not in the qemu display).
> To escape the mouse from the qemu display use `Ctrl + Alt + g`
# Searching Symbols Using VIM + CSCOPE
The kernel compiled within the Docker image also features a cscope database, which you can utilize with vim for symbol searching.
TODO: add commands
......@@ -70,7 +100,13 @@ TODO: add commands
# Using VSCode
Even though we love `vim`, it's not the only editor out there.
If you want something fancier, you can use VSCode.
To accomplish this, you'll need to access the directory where the `/linux` tree is mounted on your host system.
To accomplish this there are two ways, you'll need to access the directory where the `/linux` tree is mounted.
## Option 1 (Suitable for WSL and Linux)
Install the `Dev Containers` and `WSL` extensions in VScode, attach to the container, and open the `/linux` directory.
## Option 2 (Suitable for Linux)
Open the mountpoint of the volume from the host.
This information is displayed at the beginning when you execute the `local.sh` script.
![VScode](./img/VScode.png)
......@@ -101,4 +137,4 @@ $ docker volume rm SO2_DOCKER_VOLUME
$ ./local.sh docker interactive
```
* If you encounter the "bad interpreter" error while attempting to run a script on WSL try [this](https://stackoverflow.com/questions/14219092/bash-script-bin-bashm-bad-interpreter-no-such-file-or-directory)
* If you encounter any other unexpected issues, consider restarting the container.
\ No newline at end of file
* If you encounter any other unexpected issues, consider restarting the container.
img/XLaunch.png

100 KiB

img/XLaunch2.png

55.4 KiB

......@@ -72,7 +72,9 @@ docker_interactive() {
if ! docker volume inspect $SO2_VOLUME >/dev/null 2>&1; then
echo "Volume $SO2_VOLUME does not exist."
echo "Creating it"
docker volume create $SO2_VOLUME
docker volume create $SO2_VOLUME
local vol_mount=$(docker inspect $SO2_VOLUME | grep -i mountpoin | cut -d : -f2 | cut -d, -f1)
chmod 777 -R $vol_mount
fi
echo "The /linux directory is made persistent within the $SO2_VOLUME:"
......@@ -86,6 +88,17 @@ docker_interactive() {
--workdir "$SO2_WORKSPACE" \
"$full_image_name" sed "s+\${QEMU_DISPLAY:-\"sdl\"+\${QEMU_DISPLAY:-\"gtk\"+g" -i /linux/tools/labs/qemu/run-qemu.sh
# wsl
if cat /proc/version | grep -i microsoft &> /dev/null ; then
export DISPLAY="$(ip r show default | awk '{print $3}'):0.0"
fi
if [[ $DISPLAY == "" ]]; then
echo "Error: Something unexpected happend. The environment var DISPLAY is not set. Consider setting it with"
echo -e "\texport DISPLAY=<dispaly>"
exit 1
fi
local xauth_var=$(echo $(xauth info | grep Auth | cut -d: -f2))
docker run --privileged --rm -it \
--net=host --env="DISPLAY" --volume="${xauth_var}:/root/.Xauthority:rw" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment