Skip to content

purs3lab/linux-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

linux-playground

This is a playground to play with the Linux kernel, providing an easy way to build and debug kernel inside a Docker container.

The following steps are verified on Ubuntu 22.04, x86-64 machine.

Prerequisites

The following are the packages and tools that are required to use this repo.

Resources

We expect the machine to have at least 8 GB of free disk space.

VScode

  • Install VSCode by following the official instructions.
  • Install Remote Development extension in VSCode (Identifier : ms-vscode-remote.vscode-remote-extensionpack) - Refer instructions on how to install extensions.

Docker and utils

Add your user to the docker group
  • Create docker group : sudo groupadd docker
  • Add your user to the docker group : sudo usermod -aG docker $USER
  • Reboot or logout and login again

Setup and Build Docker

Note: all our steps are expected to work with VSCode. You may be able to use our image without VSCode but we do not currently support it.

Clone the playground repository:

git clone https://github.com/purs3lab/linux-playground.git

The playground is integrated into the VSCode IDE. So start by opening the linux-playground folder in the VSCode IDE.

code linux-playground

Once the playground is open, in VSCode you may see a message window at the bottom right of the editor window:

opencontainer

Click on Reopen in Container

This command will build the relevant container image and bring up the workspace in the new environment.

The VSCode will restart and you will see the following message at the bottom right of the window

startingcontainer

This may take a while. Once this process is done you should get your workspace now open inside the container. If you open a terminal from inside VS Code you should get a prompt from inside the container and everything.

At this point your VScode window should contain the linux kernel sources and you should see the following:

StartingDocker

Build FS Image

Since we are trying to mount a basic filesystem, it needs to be built before you are able to start the playground.

Once you are inside the container, you can build the filesystem by opening the command palette using Ctrl + Shift + P and typing: Tasks: Run Task

runtasks

Which should give you a prompt with multiple options (This is the VSCode Tasks List).

advance

Select the (Needed) build-fs option. This should create the filesystem that would be used by the kernel.

Note : If you want to run the same command without using vscode, you should be able to find a bash script at /scripts/build-fs.sh

Next steps

Debugging the kernel

Modifying the kernel

About

Linux kernel playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •