Skip to content

Instantly share code, notes, and snippets.

View smalinux's full-sized avatar
🎯
FOCUS

Sohaib Mohamed smalinux

🎯
FOCUS
View GitHub Profile
@smalinux
smalinux / 0001-mychar-hello-world-character-driver.patch
Last active January 18, 2021 17:35
Embox hacking - 101 tutorial
From 39991fa0f75e7e6302f17e4882ff2d2a18f36cae Mon Sep 17 00:00:00 2001
From: Sohaib Mohammed <sohaib.amhmd@gmail.com>
Date: Sat, 16 Jan 2021 06:48:31 +0200
Subject: [PATCH 1/1] mychar - hello world character device
---
src/kernel/Mybuild | 7 +++++++
src/kernel/mychar.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 src/kernel/mychar.c
@smalinux
smalinux / gcp.rst
Last active December 27, 2020 17:19
Good C programmer

# Random notes for me to become a good C programmer

C89 (aka "Standard C", aka "ANSI C")

  • Pointers. This is critical. You can't do anything more than "hello world" type stuff in C if you don't get this.
  • Stop reading articles! No website is as good as a good book. [https://fabiensanglard.net/c/]
  • read this book: Expert C Programming
  • Write code every single day.
@smalinux
smalinux / x11.c
Last active December 15, 2020 07:49
My X11 simple window creation example.
// gcc x11.c -L/usr/X11R6/lib -lX11 -o x11
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
Display *d;
Window w;
XEvent e;
@smalinux
smalinux / timer.c
Created November 25, 2020 17:37 — forked from yagihiro/sample.c
timer sample on linux kernel
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
static void mykmod_timer_handler(unsigned long data);
static unsigned long onesec;
DEFINE_TIMER(mytimer, mykmod_timer_handler, 0, 0);
/*
* linux/fs/exec.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/*
* #!-checking implemented by tytso.
*/
/*
@smalinux
smalinux / Makefile
Created April 22, 2020 04:21
Hello, world USB driver
# Set module name from the list:
program = sma_usb
# 'The list'
#----------
obj-m += sma_usb.o
# obj-m += sma_chardev.o
# obj-m += sma_skeleton.o
all:
# ./fasm/fasm boot.asm
nasm -f bin boot.asm -o boot.bin
run:
# bochs
qemu-system-x86_64 boot.bin
@smalinux
smalinux / config.h
Created December 27, 2019 09:42
PIC problem 101
/* Microchip Technology Inc. and its subsidiaries. You may use this software
* and any derivatives exclusively with Microchip products.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
* PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
* WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
*
* IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
@smalinux
smalinux / OSDev.org
Last active November 7, 2019 16:53
OS Dev Log!

OSDev.org

Category:Categories

====================================================================================

= OS_Development β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„

>= FAQ β–„ Not! >= Troubleshooting β–„ Not!

= Bare_bones_tutorials how to start Category. page for every programming lang!