Skip to content

Instantly share code, notes, and snippets.

View parastuffs's full-sized avatar
🐦

Quentin Delhaye parastuffs

🐦
  • ECAM
  • Brussels
View GitHub Profile
@parastuffs
parastuffs / 00_qemu-vm.md
Last active March 25, 2026 09:52
How to create and run a minimal Linux VM using qemu

The aim is to have a full Linux OS available, with its own kernel. It will be minimal, meaning no GUI, terminal only and very limited software installed. The VM will be built around a Ubuntu cloud image, using cloud-inits to kick it off.

If you just want to use the VM, jump to "Running the VM image".

Building the VM image

On a Linux host, make sure the following packages are installed: qemu-system-x86 qemu-kvm cloud-image-utils qemu-utils genisoimage wget

Run the init-lab.sh script. It does the following:

@parastuffs
parastuffs / gdb-xv6.md
Created February 5, 2026 21:37
GDB with xv6

In one window: $ make qemu-gdb It should end with -gdb tcp::26000

In another window: $ gdb Then in gdb:

(gdb) target remote localhost:26000
(gdb) file kernel/kernel
git clone https://github.com/devttys0/sasquatch
cd sasquatch && git pull origin pull/56/head
./build.sh

If it fails with this kind of error:

unsquashfs.c:2242:26: error: passing argument 2 of ‘signal’ from incompatible pointer type [-Wincompatible-pointer-types]
 2242 | signal(SIGWINCH, sigwinch_handler);
@parastuffs
parastuffs / led-toggle-platform-driver.c
Created May 14, 2025 14:23
LED toggle using platform driver and a DTS
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/timer.h>
#define DRIVER_NAME "example-led-toggle"
static struct gpio_desc *led_gpio;
@parastuffs
parastuffs / Zephyr.dts
Last active May 13, 2025 13:25
Zephyr DTS for a Longan Nano (Gigadevice)
/dts-v1/;
/ {
#address-cells = < 0x1 >;
#size-cells = < 0x1 >;
model = "Sipeed Longan Nano";
compatible = "sipeed,longan_nano";
cpus {
#address-cells = < 0x1 >;
#size-cells = < 0x0 >;
@parastuffs
parastuffs / DTS_example.dts
Created May 13, 2025 09:53
Device Tree Source example
/* Device Tree Specification version
/dts-v1/;
/ {
/* Identifies the hardware platform.
* Used by drivers to match the hardware in the `of_device_id`
* struct defined in `/include/linux/mod_devicetable.h`:
* struct of_device_id {
* char name[32];
* char type[32];
* char compatible[128];
#include <stdio.h>
#include <stdlib.h>
int main()
{
/* Create a variable containing 42.*/
int foo = 42;
/* &foo gives the address of the variable foo.*/
printf("foo = %i, address: %p\n", foo, &foo);
// ***** fonction pour aller un pas plus loin ****
int StepperMotor ( int _step, bool dir){
// ***** mise à jour de l'état ****
switch(_step){
case 0 :
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
break;
#include "Arduino.h"
#include "Audio.h"
#include "BluetoothSerial.h" //Header File for Serial Bluetooth, will be added by default into Arduino
#include "FS.h"
#define SD_CS 5
#define SPI_MOSI 23
#define SPI_MISO 19
#define SPI_SCK 18
#define button_A 4 // Top face
/**
Make sure that the 'MCP9800' library is installed.
https://github.com/JChristensen/MCP9800/tree/master
*/
#include <MCP9800.h>
MCP9800 mySensor;
void setup()