Commit 8bfbbe42101026dcd35043b0a212b46bf6d64419
Commits[COMMIT BEGIN]commit 8bfbbe42101026dcd35043b0a212b46bf6d64419 Author: 0x4248 <[email protected]> Date: Fri Mar 20 22:57:46 2026 +0000 linux-ref: add more content and ref section diff --git a/doc/linux-ref/Makefile b/doc/linux-ref/Makefile index b96e95c..c4f6f13 100644 --- a/doc/linux-ref/Makefile +++ b/doc/linux-ref/Makefile @@ -2,8 +2,11 @@ PANDOC ?= pandoc BUILDDIR = build CSS = docs/_static/whitepaper.css TITLE = The 0x4248 Linux Reference Manual -SUBTITLE = For x86-64 Systems +SUBTITLE = A reference for GNU/Linux on x86-64 systems +AUTHOR = 0x4248 +BUILD_DATE = $(shell date -u +"%Y-%m-%d") HTMLDIR = $(BUILDDIR)/html +COVER_ENABLE ?= 1 CHAPTERS = $(sort $(shell find docs/chapters -name '*.md')) @@ -24,7 +27,7 @@ $(HTMLDIR): $(HTMLDIR)/chapters/%.html: docs/chapters/%.md | $(HTMLDIR) mkdir -p $(dir $@) - $(PANDOC) --standalone --embed-resources --metadata title='$(TITLE)' --metadata subtitle='$(SUBTITLE)' --css=$(CSS) -o $@ $< + $(PANDOC) --standalone --embed-resources --metadata title='$(TITLE)' --metadata subtitle='$(SUBTITLE)' --metadata author='$(AUTHOR)' --metadata date='$(BUILD_DATE)' --css=$(CSS) -o $@ $< $(HTML_INDEX): $(CHAPTERS) $(CHAPTER_HTMLS) | $(HTMLDIR) { \ @@ -42,20 +45,31 @@ $(HTML_INDEX): $(CHAPTERS) $(CHAPTER_HTMLS) | $(HTMLDIR) } | $(PANDOC) --standalone --embed-resources --metadata title='$(TITLE)' --metadata subtitle='$(SUBTITLE)' --css=$(CSS) -o $@ $(BUILDDIR)/manual.pdf: $(CHAPTERS) | $(BUILDDIR) - $(PANDOC) --toc --top-level-division=chapter \ + @# Resolve cover.pdf: prefer cover.html, fall back to cover.pdf in root + @if [ "$(COVER_ENABLE)" = "1" ] && [ -f cover.html ]; then \ + $(PANDOC) --standalone -V papersize=a4 -V geometry:margin=1in -o $(BUILDDIR)/cover.pdf cover.html; \ + elif [ "$(COVER_ENABLE)" = "1" ] && [ -f cover.pdf ]; then \ + cp cover.pdf $(BUILDDIR)/cover.pdf; \ + fi + @# Build a before-body snippet that embeds the cover via pdfpages (no pdfunite) + @if [ -f $(BUILDDIR)/cover.pdf ]; then \ + echo '\includepdf[pages=-]{$(BUILDDIR)/cover.pdf}' > $(BUILDDIR)/cover-include.tex; \ + else \ + printf '' > $(BUILDDIR)/cover-include.tex; \ + fi + $(PANDOC) --toc --toc-depth=5 --top-level-division=chapter \ -V documentclass=report \ -V papersize=a4 \ -V fontsize=11pt \ -V geometry:margin=1in \ -V fontfamily=tgtermes \ + --include-in-header=docs/_static/pdf-header.tex \ + --include-before-body=$(BUILDDIR)/cover-include.tex \ --metadata title='$(TITLE)' \ --metadata subtitle='$(SUBTITLE)' \ - -o $(BUILDDIR)/_content.pdf $(CHAPTERS) - @if [ -f cover.pdf ]; then \ - pdfunite cover.pdf $(BUILDDIR)/_content.pdf $@ && rm $(BUILDDIR)/_content.pdf; \ - else \ - mv $(BUILDDIR)/_content.pdf $@; \ - fi + --metadata author='$(AUTHOR)' \ + --metadata date='$(BUILD_DATE)' \ + -o $@ $(CHAPTERS) docs: html diff --git a/doc/linux-ref/docs/_static/pdf-header.tex b/doc/linux-ref/docs/_static/pdf-header.tex new file mode 100644 index 0000000..82a1d42 --- /dev/null +++ b/doc/linux-ref/docs/_static/pdf-header.tex @@ -0,0 +1,26 @@ +% Embed cover page (if any) as first page while keeping named destinations intact +\usepackage{pdfpages} + +% Disable auto-generated LaTeX title page so external cover is page 1 +\AtBeginDocument{\let\maketitle\relax} + +% Underline hyperlinks (deferred so hyperref is already loaded) +\AtBeginDocument{% + \hypersetup{ + colorlinks=false, + pdfborderstyle={/S/U/W 0.5}, + allbordercolors={0 0 0} + }% +} + +% Make \paragraph (h5) and \subparagraph (h6) block-level headings +\makeatletter +\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {1.5ex \@plus 0.5ex \@minus .2ex}% + {0.5ex}% + {\normalfont\normalsize\bfseries}} +\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}% + {1.25ex \@plus 0.5ex \@minus .2ex}% + {0.4ex}% + {\normalfont\normalsize\itshape}} +\makeatother diff --git a/doc/linux-ref/docs/chapters/00-frontmatter/01-intro.md b/doc/linux-ref/docs/chapters/00-frontmatter/01-intro.md index bd9e4c3..d2b5576 100644 --- a/doc/linux-ref/docs/chapters/00-frontmatter/01-intro.md +++ b/doc/linux-ref/docs/chapters/00-frontmatter/01-intro.md @@ -1,4 +1,4 @@ -# Introduction +# Introduction and Front Matter Welcome to the 0x4248 Linux Reference Manual. This manual is a very technical Linux Reference for practitioners working close to kernel internals, user-space @@ -64,3 +64,31 @@ This manual is also a continuously evolving work in progress. I will be adding more content over time, and if you have purchased this manual in print it may be outdated by the time you receive it. However, you can always access the latest version of the manual online. + +## License + +The 0x4248 Linux Reference Manual is licensed under the Creative Commons +Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0). + +Adaptation of the manual for commercial purposes is allowed under this license, +as long as you give appropriate credit, provide a link to the license, and +indicate if changes were made. + +## Copyright + +Copyright (c) 2024 by 0x4248. CC BY-SA 4.0 License applies to all content in +this manual, including text, images, and other media. + +## Credits + +### Authors and Contributors + +- 0x4248 (Main Author and Maintainer) + +### Acknowledgments + +- [Linux Kernel Documentation](https://www.kernel.org/doc/html/latest/) +- [Arch Wiki](https://wiki.archlinux.org/) +- [Linux From Scratch](http://www.linuxfromscratch.org/) +- [syscall.sh](https://syscall.sh/) +- [man7.org](https://man7.org/) \ No newline at end of file diff --git a/doc/linux-ref/docs/chapters/00-frontmatter/02-license.md b/doc/linux-ref/docs/chapters/00-frontmatter/02-license.md deleted file mode 100644 index 7b9a295..0000000 --- a/doc/linux-ref/docs/chapters/00-frontmatter/02-license.md +++ /dev/null @@ -1,27 +0,0 @@ -# License - -The 0x4248 Linux Reference Manual is licensed under the Creative Commons -Attribution-ShareAlike 4.0 International License (CC BY-SA 4.0). - -Adaptation of the manual for commercial purposes is allowed under this license, -as long as you give appropriate credit, provide a link to the license, and -indicate if changes were made. - -## Copyright - -Copyright (c) 2024 by 0x4248. CC BY-SA 4.0 License applies to all content in -this manual, including text, images, and other media. - -## Credits - -### Authors and Contributors - -- 0x4248 (Main Author and Maintainer) - -### Acknowledgments - -- [Linux Kernel Documentation](https://www.kernel.org/doc/html/latest/) -- [Arch Wiki](https://wiki.archlinux.org/) -- [Linux From Scratch](http://www.linuxfromscratch.org/) -- [syscall.sh](https://syscall.sh/) -- [man7.org](https://man7.org/) \ No newline at end of file diff --git a/doc/linux-ref/docs/chapters/01-kernel/00-part.md b/doc/linux-ref/docs/chapters/01-kernel/00-part.md new file mode 100644 index 0000000..0c595fc --- /dev/null +++ b/doc/linux-ref/docs/chapters/01-kernel/00-part.md @@ -0,0 +1,4 @@ +# Part I: Linux Systems and Kernel + +In this part we are specifically going to be looking at the Linux Kernel, its +internals and how to develop with it. \ No newline at end of file diff --git a/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel.md b/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel.md deleted file mode 100644 index ce2077e..0000000 --- a/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel.md +++ /dev/null @@ -1,60 +0,0 @@ -# The Linux Kernel - -This section will cover the Linux Kernel. In this chapter, we will look at -the Linux kernel branches, how to build, and an overview of common issues and -topics related to the kernel. Then we will look at other topics such as the -kernel's boot process and its command line parameters. - -## The /boot Directory - -If you open this directory, you should see three important files: - -- `vmlinuz-<version>`: This is the compressed Linux kernel image. -- `initramfs-<version>.img`: This is the initial RAM filesystem image. -- `initrd.img-<version>`: This is the initial RAM disk image. This is a legacy - format that is mostly unused now, but some older systems may still use it. - -Here is what my `/boot/` directory looks like: - -```bash -[root@arch boot]# ls -l -total 24916 -drwxr-xr-x 6 root root 4096 Mar 19 19:50 grub --rwxr-xr-x 1 root root 9038759 Mar 19 19:50 initramfs-linux.img --rwxr-xr-x 1 root root 16466432 Mar 19 19:50 vmlinuz-linux -[root@arch boot]# -``` - -### Vmlinuz - -**V**irtual **M**emory **LINU**x g**Z**ip. This is the compressed Linux kernel -image. When the system boots, the bootloader loads this image into memory and -decompresses it to start the operating system. - -### RAM Disks - -A RAM disk is a virtual disk that resides in the system's RAM. It is used during -the boot process to provide a temporary root filesystem before the actual root -filesystem is mounted. This allows the kernel to load necessary drivers and -modules. This is because things like controller drivers for disks and other -devices may not work without the RAM disk. - -#### Types of RAM Disks - -- **initramfs**: This is the modern format for the initial RAM filesystem. It is - a compressed cpio archive that is loaded into memory and used as the initial - root filesystem during boot. -- **initrd**: This is the older format for the initial RAM disk. - -Linux supports these compressions on the kernel and initramfs images: -- gzip -- bzip2 -- xz -- lzma -- lzop -- lz4 -- zstd - -**Note**: The kernel cant load the initramfs if it is compressed with a -compression algorithm that the kernel has not been compiled with support for. -Ensure you enable support for the compression algorithm using `menuconfig`. \ No newline at end of file diff --git a/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel_basics.md b/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel_basics.md new file mode 100644 index 0000000..14eae0f --- /dev/null +++ b/doc/linux-ref/docs/chapters/01-kernel/01-the_kernel_basics.md @@ -0,0 +1,350 @@ +# The Linux Kernel Basics + +This section will cover the Linux Kernel basics, including what it is, +how to obtain it, and how to build it. We will dive later into the kernel +workings and developing for it in later sections. + +## Linux Kernel Overview + +The Kernel in short is a monolithic operating system kernel that is responsible +for managing the system's resources and providing an interface between the +hardware and software. + +$$ +\text{User Space} \leftrightarrow \text{Kernel Space} \leftrightarrow \text{Hardware} +$$ + +### Kernel Space vs User Space + +The kernel operates in a privileged mode called kernel space, while user +applications run in user space. Unlike older systems such as MS-DOS, the Linux +kernel enforces protection by controlling access to hardware and critical system +resources. User-space applications cannot directly access these resources; instead, +they interact with the kernel through system calls, which provide a controlled +interface for requesting services. + +### Kernel design + +The Linux kernel is designed to be modular and extensible, allowing for a wide +range of hardware and software configurations. It supports a variety of +architectures, including x86, ARM, PowerPC, and more. The kernel is also +designed to be highly configurable, this manual will extensively explore the +kernel configuration system and how you can customize the kernel for your +specific needs. + + +## Kernel Branches + +*For more details about the kernel source code see the* **Kernel Source Code** *chapter.* + +Across many Linux distributions, there are several kernel branches: + +- Stable: This is the mainline kernel that is considered stable and is used in most + production environments. +- Long-Term Support (LTS): These are kernels that receive long-term support and + are maintained for several years. +- Hardened: These kernels are modified to include additional security features and + patches to enhance security. +- Real-Time: These kernels are modified to provide real-time capabilities for + applications that require low latency and deterministic behavior. + +## A Crash Course on Compiling the Kernel + +Compiling the kernel can be a complex process, but it allows you to fully +customize it for your specific hardware and needs. + +### Dependencies + +*This section has been tested to work with kernel version 7.0.0.* + +To compile the kernel, you will need to install the necessary dependencies. +Below are some of the common package names for the required dependencies on +Debian-based distributions. The exact package names may vary depending on your +distribution and version. + +``` +# Debian/Trixie +build-essential +git +bc +bison +flex +libelf-dev +dwarves +ccache +pkg-config +cmake +ninja-build +python3 +python3-pip +rsync +wget +curl +xz-utils +file +libncurses-dev +``` + +### Obtaining the Kernel Source Code + +Getting a copy of the kernel source code is non-trivial, but there are several +ways to do it. The most common way is to clone the kernel source code from the +official Linux kernel repository on GitHub: + +```bash +git clone https://github.com/torvalds/linux.git +``` + +Cloning the mainline repository gives you the latest development version +of the kernel. While it is generally usable, it is not considered a stable +release and may contain experimental changes. For production systems, +it is recommended to use a tagged stable or LTS release. + +*For this example we will be using version 6.8, but you can choose any version +you want.* + +```bash +VERSION=6.8 +git clone --depth 1 --branch v${VERSION} https://github.com/torvalds/linux.git +``` + +### Basic compilation + +Now for the fun part, compiling the kernel. This section is not an in-depth +guide to kernel compilation, but will cover the basic steps. + + +#### Configuration + +If you have just cloned the kernel source code, there will be no configuration +file, but creating one is simple. + +```bash +make defconfig +``` + +This will generate a `.config` file in the root of the kernel source code +directory. It works by enabling or disabling configuration options, which are +translated into C preprocessor macros used during compilation. + +The kernel does this by mostly using `#ifdef` and `#ifndef` preprocessor +directives. For example: + +```c +#define CONFIG_EXAMPLE 1 + +#ifdef CONFIG_EXAMPLE +pr_log("Example is enabled\n"); +#else +pr_log("Example is disabled\n"); +#endif +``` + +This means if you have turned off for example `networking support` in the kernel +configuration, the kernel will not compile any of the code related to networking +and will not include it in the final kernel image. With this knowledge, you can +see how customizable the kernel is, and how you can optimize it for your +specific hardware. + +##### Menuconfig and Xconfig + +Now we have a basic configuration file, you can edit it using `vim` or `nano` +but this can be trivial and long. Many of the config names are abbreviated and +not very descriptive. To make it easier to edit the configuration, you can use +`menuconfig` or `xconfig`. + +For this guide we will use `menuconfig` as it is more widely supported and allows +for virtual console users to edit the configuration. + +You will need an X11 graphical environment. If you are using a virtual machine +using QEMU serial console, you will not be able to use `xconfig` and will need +to use `menuconfig` instead. + +```bash +make menuconfig +``` + +You can also use the much nicer `nconfig` which looks better and has function +key navigation. + +```bash +make nconfig +``` + +This will open a `ncurses` interface that allows you to navigate through the +configuration options much like the `dialog` command seen on many Linux +distribution installers. You can use the arrow keys to navigate, `Enter` to +select, and `Space` to toggle options. + +*For now we are not going to change any options, but feel free to explore and +change any options you want.* + +The kernel uses the `Kconfig` system to manage its configuration and build +process. In this section we wont look too much into it now. + +#### Building the Kernel + +Now that we have a configuration file, we can build the kernel. This is done +using the `make` command. The kernel uses a custom build system that is based on +`make`, but it has some additional features and optimizations. To build the kernel, you can simply run: + +```bash +make -j$(nproc) +``` + +The `-j` flag tells `make` to use multiple threads to speed up the build +process. The `$(nproc)` command returns the number of CPU cores available, +which allows `make` to use all available cores for the build. + +I recommend using `ccache` to speed up subsequent builds. `ccache` is a compiler +cache that stores the results of previous compilations and reuses them when the same +compilation is requested again. This can significan notly reduce the build time for +subsequent builds, especially when making small changes to the kernel configuration. +To use `ccache`, you can set the `CC` environment variable to `ccache gcc` before + +running the `make` command: + +```bash +export CC="ccache gcc" +make -j$(nproc) +``` + +## Troubleshooting common issues + +When testing your custom kernel, you may encounter some issues. + +### Tips on testing your kernel + +Before you test your kernel, you should keep the old kernel in the `/boot` +directory. This way, if your new kernel does not boot, you can easily revert +to the old kernel. *A big life-saver* + +### Kernel panics + +*In this section we are not going over the details of `panic.c` but look into how +to read such panics* + +Here is an example from the **ArchWiki**: + +``` +kernel: BUG: unable to handle kernel NULL pointer dereference at (null) 1 +kernel: IP: fw_core_init+0x18/0x1000 [firewire_core] 2 +kernel: PGD 718d00067 +kernel: P4D 718d00067 +kernel: PUD 7b3611067 +kernel: PMD 0 +kernel: +kernel: Oops: 0002 [#1] PREEMPT SMP +kernel: Modules linked in: firewire_core(+) crc_itu_t cfg80211... 3 +kernel: CPU: 6 PID: 1438 Comm: modprobe Tainted: P O 4.13.3-1-ARCH #1 +kernel: Hardware name: Gigabyte Technology Co., Ltd. H97-D3H/H97-D3H-CF, BIOS F5 06/26/2014 +kernel: task: ffff9c667abd9e00 task.stack: ffffb53b8db34000 +kernel: RIP: 0010:fw_core_init+0x18/0x1000 [firewire_core] +kernel: RSP: 0018:ffffb53b8db37c68 EFLAGS: 00010246 +kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 +kernel: RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffffc16d3af4 +kernel: RBP: ffffb53b8db37c70 R08: 0000000000000000 R09: ffffffffae113e95 +kernel: R10: ffffe93edfdb9680 R11: 0000000000000000 R12: ffffffffc16d9000 +kernel: R13: ffff9c6729bf8f60 R14: ffffffffc16d5710 R15: ffff9c6736e55840 +kernel: FS: 00007f301fc80b80(0000) GS:ffff9c675dd80000(0000) knlGS:0000000000000000 +kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +kernel: CR2: 0000000000000000 CR3: 00000007c6456000 CR4: 00000000001406e0 +kernel: Call Trace: +kernel: do_one_initcall+0x50/0x190 4 +kernel: ? do_init_module+0x27/0x1f2 +kernel: do_init_module+0x5f/0x1f2 +kernel: load_module+0x23f3/0x2be0 +kernel: SYSC_init_module+0x16b/0x1a0 +kernel: ? SYSC_init_module+0x16b/0x1a0 +kernel: SyS_init_module+0xe/0x10 +kernel: entry_SYSCALL_64_fastpath+0x1a/0xa5 +kernel: RIP: 0033:0x7f301f3a2a0a +kernel: RSP: 002b:00007ffcabbd1998 EFLAGS: 00000246 ORIG_RAX: 00000000000000af +kernel: RAX: ffffffffffffffda RBX: 0000000000c85a48 RCX: 00007f301f3a2a0a +kernel: RDX: 000000000041aada RSI: 000000000001a738 RDI: 00007f301e7eb010 +kernel: RBP: 0000000000c8a520 R08: 0000000000000001 R09: 0000000000000085 +kernel: R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000c79208 +kernel: R13: 0000000000c8b4d8 R14: 00007f301e7fffff R15: 0000000000000030 +kernel: Code: <c7> 04 25 00 00 00 00 01 00 00 00 bb f4 ff ff ff e8 73 43 9c ec 48 +kernel: RIP: fw_core_init+0x18/0x1000 [firewire_core] RSP: ffffb53b8db37c68 +kernel: CR2: 0000000000000000 +kernel: ---[ end trace 71f4306ea1238f17 ]--- +kernel: Kernel panic - not syncing: Fatal exception 5 +kernel: Kernel Offset: 0x80000000 from 0xffffffff810000000... +kernel: ---[ end Kernel panic - not syncing: Fatal exception +``` + +This may look scary and confusing. Lets break it down. + +1. A `BUG` was called, this is a critical error that almost certainly indicates + the kernel to `panic`. This usually means its a programmers bug or error. +2. The logs suggest the error came from `fw_core_init` in the `firewire_core` + module. This is a good starting point for debugging, you can look at the + source code of this function to see what may be causing the issue. +3. Suggests that the `firewire_core` was the most recent module loaded. +4. The `do_one_initcall` function was what called the `fw_core_init` function. +5. Panic was called and system is deadlocked. + +With this information we can do two things: +- Change kernel config to not compile the module and disable it. +- Don't recompile the kernel and use `module_blacklist` to prevent the module + from loading. + +## The /boot Directory + +The `/boot` directory is where the kernel and its related files are stored. This +directory is critical for the boot process, as it contains the kernel image and +the initial RAM filesystem (initramfs) that the kernel uses during boot. + +If you open this directory, you should see three important files: + +- `vmlinuz-<version>`: This is the compressed Linux kernel image. +- `initramfs-<version>.img`: This is the initial RAM filesystem image. +- `initrd.img-<version>`: This is the initial RAM disk image. This is a legacy + format that is mostly unused now, but some older systems may still use it. + +Here is what my `/boot/` directory looks like: + +```bash +[root@arch boot]# ls -l +total 24916 +drwxr-xr-x 6 root root 4096 Mar 19 19:50 grub +-rwxr-xr-x 1 root root 9038759 Mar 19 19:50 initramfs-linux.img +-rwxr-xr-x 1 root root 16466432 Mar 19 19:50 vmlinuz-linux +[root@arch boot]# +``` + +### Vmlinuz + +**V**irtual **M**emory **LINU**x g**Z**ip. This is the compressed Linux kernel +image. When the system boots, the bootloader loads this image into memory and +decompresses it to start the operating system. + +### RAM Disks + +A RAM disk is a virtual disk that resides in the system's RAM. It is used during +the boot process to provide a temporary root filesystem before the actual root +filesystem is mounted. This allows the kernel to load necessary drivers and +modules. This is because things like controller drivers for disks and other +devices may not work without the RAM disk. + +#### Types of RAM Disks + +- **initramfs**: This is the modern format for the initial RAM filesystem. It is + a compressed `CPIO` archive that is loaded into memory and used as the initial + root filesystem during boot. +- **initrd**: This is the older format for the initial RAM disk. + +Linux supports these compressions on the kernel and initramfs images: + +- gzip +- bzip2 +- xz +- lzma +- lzop +- lz4 +- zstd + +**Note**: The kernel can not load the initramfs if it is compressed with a +compression algorithm that the kernel has not been compiled with support for. +Ensure you enable support for the compression algorithm using `menuconfig`. diff --git a/doc/linux-ref/docs/chapters/01-kernel/02-kernel-source.md b/doc/linux-ref/docs/chapters/01-kernel/02-kernel-source.md new file mode 100644 index 0000000..6410b84 --- /dev/null +++ b/doc/linux-ref/docs/chapters/01-kernel/02-kernel-source.md @@ -0,0 +1,98 @@ +# The Linux Kernel Source Code + +The Linux Kernel Source code is one of the largest and most complex codebases in +the world. With over 30 million lines of code, it is a massive undertaking to +understand. However, the base Linux kernel source code is relatively small, +with the majority of the code being drivers and architecture-specific code. + +In the last section we discussed how the Linux kernel can be obtained and built. +Now lets read and go over the source code itself. + +## Layout of the source code + +The Linux kernel source code is organized into several directories, each containing +different parts of the kernel. The main directories are: + +- `arch/`: Architecture-specific code for different CPU architectures. +- `block/`: Block device drivers. +- `certs/`: Certificates for module signing. +- `crypto/`: Cryptographic algorithms and drivers. +- `Documentation/`: Documentation for the kernel. +- `drivers/`: Device drivers for various hardware. +- `fs/`: Filesystem code. +- `include/`: Header files for the kernel. +- `init/`: Initialization code for the kernel. +- `io_uring/`: io_uring subsystem code. +- `ipc/`: Inter-process communication code. +- `kernel/`: Core kernel code. +- `lib/`: Library code used by the kernel. +- `mm/`: Memory management code. +- `net/`: Networking code. +- `rust/`: Development of the Rust language support in the kernel. +- `samples/`: Sample code for various kernel features. +- `scripts/`: Scripts for building and maintaining the kernel. +- `security/`: Security modules and code. +- `sound/`: Sound drivers and ALSA code. +- `usr/`: User-space tools and utilities. +- `virt/`: Virtualization code. + +In this book we are not going to go over every single directory and file in the +kernel source code, but we will focus on the core workings. + +### How to read the source code + +The Linux kernel source code is written in C, with some assembly code for +architecture-specific parts. It also uses Makefile and Shell scripts for +building and maintaining the kernel. + +When reading the source code, it is important to understand the overall +structure of the kernel and how the different parts interact with each other. + +The C follows the C99 standard with some GNU extensions. The code is heavily +commented, but it can still be difficult to understand without a good +understanding of C and the kernel's architecture. The code is also 80-column +formatted, which makes it easier for CRT and 4:3 users to read; like myself. + +> *"Help, I find it hard to follow functions and references in the code!"* + +Do not worry, a great website called +[The Bootlin Elixir Cross-Reference](https://elixir.bootlin.com/linux/latest/source) +allows you to easily navigate the kernel source code and find references to +functions and variables. It also has a great search feature that allows you to +find specific functions and variables. Perfect for people new and experienced. + +### Standard C file structure + +In the kernel source code, C files typically have a standard structure. They +usually start with a large comment block that describes the file, its purpose, +and its authors. This is followed by include statements, macro definitions, and +then the actual code. + +*init/main.c* + +```c +// SPDX-License-Identifier: GPL-2.0-only +/* + * linux/init/main.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + * + * GK 2/5/95 - Changed to support mounting root fs via NFS + * Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96 + * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96 + * Simplified starting of init: Michael A. Griffith <[email protected]> + */ + +#define DEBUG /* Enable initcall_debug */ +``` + +1. Line 1 is a SPDX license identifier, which is a standard way to indicate the + license of the file. In this case, it indicates that the file is licensed + under the GPL-2.0-only license. +2. Line 3 explains the file path and name. +3. Lines 5-9 are a comment block that describes the file, its purpose, and its + authors. It also includes a history of changes to the file. +4. Line 11 is a macro definition and where the actual code starts. + +The rest of this file contains allot of `#include` statements. This is because +this is one of the core kernel init files. diff --git a/doc/linux-ref/docs/chapters/01-kernel/10-boot/01-bootloaders.md b/doc/linux-ref/docs/chapters/01-kernel/10-boot/01-bootloaders.md new file mode 100644 index 0000000..62dae52 --- /dev/null +++ b/doc/linux-ref/docs/chapters/01-kernel/10-boot/01-bootloaders.md @@ -0,0 +1,37 @@ +# Bootloaders + +The Linux kernel is not a standalone executable. It must be loaded into memory +by a bootloader, which performs early system initialization and transfers +control to the kernel. On BIOS-based systems, this typically involves a boot +sector, while on UEFI systems the kernel may be loaded as an EFI executable via +the EFI stub. + +Common Bootloaders are GRUB and Systemd-boot. + +Here is a latex diagram of the boot process: + +$$ +\text{BIOS/UEFI} \rightarrow \text{Bootloader} \rightarrow \text{Kernel} \rightarrow \text{Initramfs (loaded by bootloader)} \rightarrow \text{Userspace} +$$ + + + +## Comparison of bootloaders + +Below is a comparison of some of the most common bootloader's used for Linux, +along with their support: + +| BIOS | UEFI | MBR | GPT | Multiboot | Filesystem support | +|----------------------|------|---------|---------|-----------|--------------------| +| GRUB | Yes | Yes | Yes | Yes | Built in | +| systemd-boot | No | Yes | Yes | Yes | Built in | +| EFI boot stub | No | Yes | Yes | Yes | Firmware | +| Limine | Yes | Yes | Yes | Yes | Limited | +| rEFInd | No | Yes | Yes | Yes | Extensible | +| Syslinux | Yes | Partial | Yes | Partial | Limited | +| Clover | Yes | Yes | No | Yes | Extensible | +| GRUB Legacy | Yes | No | Yes | No | Limited | +| LILO | Yes | No | Partial | Yes | Limited | +| Unified kernel image | No | Yes | Yes | Yes | Firmware | + + diff --git a/doc/linux-ref/docs/chapters/99-reference/00-part.md b/doc/linux-ref/docs/chapters/99-reference/00-part.md new file mode 100644 index 0000000..8ab0e59 --- /dev/null +++ b/doc/linux-ref/docs/chapters/99-reference/00-part.md @@ -0,0 +1,10 @@ +# REFERENCE SECTION + +The rear half of this manual is a reference section that covers various handy +topics that are useful for Linux users and developers. This section is not meant +to be read cover to cover, but rather to be used as a reference for specific topics +and tasks. It is also a good place to find links to other resources and tools that +are useful for Linux users and developers. + +Use the contents page to navigate to the specific topic or heading you are +interested in. \ No newline at end of file diff --git a/doc/linux-ref/docs/chapters/99-reference/01-syscalls.md b/doc/linux-ref/docs/chapters/99-reference/01-syscalls.md new file mode 100644 index 0000000..596d330 --- /dev/null +++ b/doc/linux-ref/docs/chapters/99-reference/01-syscalls.md @@ -0,0 +1,231 @@ +# x86_64 Linux Syscalls + +In this chapter we will be looking at the x86_64 Linux syscalls, which are the +core interface between user-space applications and the kernel. They allow +applications to request services from the kernel, such as file operations, process +management, and network communication. + + +## Quick Syscall Reference Table + +First here is a basic syscall table for x86_64 Linux with the most commonly used +syscalls. I have also had to abbreviate some of the types and parameters to fit +them in the table, so I have also included a key for the abbreviations used in the table. + +*These abbreviations are not used anywhere else in this manual* + +- uns = unsigned +- con = const +- fn = filename +- fd = file descriptor +- fp = file path +- buf = buffer +- s_t = size_t +- ch = char +- st = struct +- lg = long +- off = offset +- __old_kernel_stat = __okst +- __kernel_old_stat = _kost +- __kernel_old_itimerval = _koitv +- __kernel_old_timeval = _kotv +- __kernel_old_timespec = _kots +- __kernel_timespec = _kts + + +| syscall name | rax | 0-rdi | 1-rsi | 2-rdx | 3-r10 | 4-r8 | 5-r9 | +|---|---|---|---|---|---|---|---| +| read | 0x00 | uns int fd | ch *buf | s_t count | - | - | - | +| write | 0x01 | uns int fd | con ch *buf | s_t count | - | - | - | +| open | 0x02 | con ch *fn | int flags | umode_t mode | - | - | - | +| close | 0x03 | uns int fd | - | - | - | - | - | +| stat | 0x04 | con ch *fn | st __okst *statbuf | - | - | - | - | +| fstat | 0x05 | uns int fd | st __okst *statbuf | - | - | - | - | +| lstat | 0x06 | con ch *fn | st __okst *statbuf | - | - | - | - | +| poll | 0x07 | st pollfd *ufds | uns int nfds | int timeout | - | - | - | +| lseek | 0x08 | uns int fd | off_t off | uns int whence | - | - | - | +| mmap | 0x09 | ? | ? | ? | ? | ? | ? | +| mprotect | 0x0a | uns lg start | s_t len | uns lg prot | - | - | - | +| munmap | 0x0b | uns lg addr | s_t len | - | - | - | - | +| brk | 0x0c | uns lg brk | - | - | - | - | - | +| rt_sigaction | 0x0d | int | con st sigaction * | st sigaction * | s_t | - | - | +| rt_sigprocmask | 0x0e | int how | sigset_t *set | sigset_t *oset | s_t sigsetsize | - | - | +| rt_sigreturn | 0x0f | ? | ? | ? | ? | ? | ? | +| ioctl | 0x10 | uns int fd | uns int cmd | uns lg arg | - | - | - | +| pread64 | 0x11 | uns int fd | ch *buf | s_t count | loff_t pos | - | - | +| pwrite64 | 0x12 | uns int fd | con ch *buf | s_t count | loff_t pos | - | - | +| readv | 0x13 | uns lg fd | con st iovec *vec | uns lg vlen | - | - | - | +| writev | 0x14 | uns lg fd | con st iovec *vec | uns lg vlen | - | - | - | +| access | 0x15 | con ch *fn | int mode | - | - | - | - | +| pipe | 0x16 | int *fildes | - | - | - | - | - | +| select | 0x17 | int n | fd_set *inp | fd_set *outp | fd_set *exp | st _kotv *tvp | - | +| sched_yield | 0x18 | - | - | - | - | - | - | +| mremap | 0x19 | uns lg addr | uns lg old_len | uns lg new_len | uns lg flags | uns lg new_addr | - | +| msync | 0x1a | uns lg start | s_t len | int flags | - | - | - | +| mincore | 0x1b | uns lg start | s_t len | uns ch * vec | - | - | - | +| madvise | 0x1c | uns lg start | s_t len | int behavior | - | - | - | +| shmget | 0x1d | key_t key | s_t size | int flag | - | - | - | +| shmat | 0x1e | int shmid | ch *shmaddr | int shmflg | - | - | - | +| shmctl | 0x1f | int shmid | int cmd | st shmid_ds *buf | - | - | - | +| dup | 0x20 | uns int fildes | - | - | - | - | - | +| dup2 | 0x21 | uns int oldfd | uns int newfd | - | - | - | - | +| pause | 0x22 | - | - | - | - | - | - | +| nanosleep | 0x23 | st _kts *rqtp | st _kts *rmtp | - | - | - | - | +| getitimer | 0x24 | int which | st _koitv *value | - | - | - | - | +| alarm | 0x25 | uns int seconds | - | - | - | - | - | +| setitimer | 0x26 | int which | st _koitv *value | st _koitv *ovalue | - | - | - | +| getpid | 0x27 | - | - | - | - | - | - | +| sendfile | 0x28 | int out_fd | int in_fd | off_t *off | s_t count | - | - | +| socket | 0x29 | int | int | int | - | - | - | +| connect | 0x2a | int | st sockaddr * | int | - | - | - | +| accept | 0x2b | int | st sockaddr * | int * | - | - | - | +| sendto | 0x2c | int | void * | s_t | uns | st sockaddr * | int | +| recvfrom | 0x2d | int | void * | s_t | uns | st sockaddr * | int * | +| sendmsg | 0x2e | int fd | st user_msghdr *msg | uns flags | - | - | - | +| recvmsg | 0x2f | int fd | st user_msghdr *msg | uns flags | - | - | - | +| shutdown | 0x30 | int | int | - | - | - | - | +| bind | 0x31 | int | st sockaddr * | int | - | - | - | +| listen | 0x32 | int | int | - | - | - | - | +| getsockname | 0x33 | int | st sockaddr * | int * | - | - | - | +| getpeername | 0x34 | int | st sockaddr * | int * | - | - | - | +| socketpair | 0x35 | int | int | int | int * | - | - | +| setsockopt | 0x36 | int fd | int level | int optname | ch *optval | int optlen | - | +| getsockopt | 0x37 | int fd | int level | int optname | ch *optval | int *optlen | - | +| clone | 0x38 | uns lg | uns lg | int * | int * | uns lg | - | +| fork | 0x39 | - | - | - | - | - | - | +| vfork | 0x3a | - | - | - | - | - | - | +| execve | 0x3b | con ch *fn | con ch *con *argv | con ch *con *envp | - | - | - | +| exit | 0x3c | int error_code | - | - | - | - | - | +| wait4 | 0x3d | pid_t pid | int *stat_addr | int options | st rusage *ru | - | - | +| kill | 0x3e | pid_t pid | int sig | - | - | - | - | +| uname | 0x3f | st old_utsname * | - | - | - | - | - | +| semget | 0x40 | key_t key | int nsems | int semflg | - | - | - | +| semop | 0x41 | int semid | st sembuf *sops | uns nsops | - | - | - | +| semctl | 0x42 | int semid | int semnum | int cmd | uns lg arg | - | - | +| shmdt | 0x43 | ch *shmaddr | - | - | - | - | - | +| msgget | 0x44 | key_t key | int msgflg | - | - | - | - | +| msgsnd | 0x45 | int msqid | st msgbuf *msgp | s_t msgsz | int msgflg | - | - | +| msgrcv | 0x46 | int msqid | st msgbuf *msgp | s_t msgsz | lg msgtyp | int msgflg | - | +| msgctl | 0x47 | int msqid | int cmd | st msqid_ds *buf | - | - | - | +| fcntl | 0x48 | uns int fd | uns int cmd | uns lg arg | - | - | - | +| flock | 0x49 | uns int fd | uns int cmd | - | - | - | - | +| fsync | 0x4a | uns int fd | - | - | - | - | - | +| fdatasync | 0x4b | uns int fd | - | - | - | - | - | +| truncate | 0x4c | con ch *path | lg length | - | - | - | - | +| ftruncate | 0x4d | uns int fd | off_t length | - | - | - | - | +| getdents | 0x4e | uns int fd | st linux_dirent *dirent | uns int count | - | - | - | +| getcwd | 0x4f | ch *buf | uns lg size | - | - | - | - | +| chdir | 0x50 | con ch *fn | - | - | - | - | - | +| fchdir | 0x51 | uns int fd | - | - | - | - | - | +| rename | 0x52 | con ch *oldname | con ch *newname | - | - | - | - | +| mkdir | 0x53 | con ch *pathname | umode_t mode | - | - | - | - | +| rmdir | 0x54 | con ch *pathname | - | - | - | - | - | +| creat | 0x55 | con ch *pathname | umode_t mode | - | - | - | - | +| link | 0x56 | con ch *oldname | con ch *newname | - | - | - | - | +| unlink | 0x57 | con ch *pathname | - | - | - | - | - | +| symlink | 0x58 | con ch *old | con ch *new | - | - | - | - | +| readlink | 0x59 | con ch *path | ch *buf | int bufsiz | - | - | - | +| chmod | 0x5a | con ch *fn | umode_t mode | - | - | - | - | +| fchmod | 0x5b | uns int fd | umode_t mode | - | - | - | - | +| chown | 0x5c | con ch *fn | uid_t user | gid_t group | - | - | - | +| fchown | 0x5d | uns int fd | uid_t user | gid_t group | - | - | - | +| lchown | 0x5e | con ch *fn | uid_t user | gid_t group | - | - | - | +| umask | 0x5f | int mask | - | - | - | - | - | +| gettimeofday | 0x60 | st _kotv *tv | st timezone *tz | - | - | - | - | +| getrlimit | 0x61 | uns int resource | st rlimit *rlim | - | - | - | - | +| getrusage | 0x62 | int who | st rusage *ru | - | - | - | - | +| sysinfo | 0x63 | st sysinfo *info | - | - | - | - | - | +| times | 0x64 | st tms *tbuf | - | - | - | - | - | +| ptrace | 0x65 | lg request | lg pid | uns lg addr | uns lg data | - | - | +| getuid | 0x66 | - | - | - | - | - | - | +| syslog | 0x67 | int type | ch *buf | int len | - | - | - | +| getgid | 0x68 | - | - | - | - | - | - | +| setuid | 0x69 | uid_t uid | - | - | - | - | - | +| setgid | 0x6a | gid_t gid | - | - | - | - | - | +| geteuid | 0x6b | - | - | - | - | - | - | +| getegid | 0x6c | - | - | - | - | - | - | +| setpgid | 0x6d | pid_t pid | pid_t pgid | - | - | - | - | +| getppid | 0x6e | - | - | - | - | - | - | +| getpgrp | 0x6f | - | - | - | - | - | - | +| setsid | 0x70 | - | - | - | - | - | - | +| setreuid | 0x71 | uid_t ruid | uid_t euid | - | - | - | - | +| setregid | 0x72 | gid_t rgid | gid_t egid | - | - | - | - | +| getgroups | 0x73 | int gidsetsize | gid_t *grouplist | - | - | - | - | +| setgroups | 0x74 | int gidsetsize | gid_t *grouplist | - | - | - | - | +| setresuid | 0x75 | uid_t ruid | uid_t euid | uid_t suid | - | - | - | + +## Syscall Details + +Now we are going to go over some of the details of the syscalls and document +the parameters and return values and its behavior. This is not going to be an +exhaustive list of all the syscalls, but I am slowly adding to this section. + +### 0x00 - read +The `read` syscall reads data from a file descriptor into a buffer. + +#### Synopsis + +```c +#include <unistd.h> +ssize_t read(int fd, void *buf, size_t count); +``` + + +#### Example + +```c +int fd = open("example.txt", O_RDONLY); +char buf[100]; +ssize_t bytes_read = read(fd, buf, sizeof(buf)); +if (bytes_read < 0) { + // handle error +} +``` + +#### Parameters +- `fd`: The file descriptor to read from. +- `buf`: The buffer to read the data into. +- `count`: The number of bytes to read. + +#### Return Value + +The number of bytes read on success, or -1 on error. `errno` is set to indicate +the error. + +#### Error values + +- `EAGAIN`: The file descriptor is non-blocking and no data is available to read. +- `EBADF`: The file descriptor is not valid or is not open for reading. +- `EFAULT`: The buffer is outside the accessible address space. +- `EINTR`: The call was interrupted by a signal before any data was read. +- `EINVAL`: The file descriptor cannot be read from, or the buffer is not valid. +- `EIO`: An I/O error occurred while reading from the file descriptor. +- `EISDIR`: The file descriptor refers to a directory. + +### 0x01 - write +The `write` syscall writes data from a buffer to a file descriptor. + +#### Synopsis + +```c +#include <unistd.h> +ssize_t write(int fd, const void *buf, size_t count); +``` + +#### Example + +```c +int fd = open("example.txt", O_WRONLY | O_CREAT, 0644); +const char *buf = "Hello, world!"; +ssize_t bytes_written = write(fd, buf, strlen(buf)); +if (bytes_written < 0) { + // handle error +} +``` + +#### Parameters +- `fd`: The file descriptor to write to. +- `buf`: The buffer containing the data to write. +- `count`: The number of bytes to write. + +#### Return Value diff --git a/doc/linux-ref/docs/chapters/99-reference/02-charsets.md b/doc/linux-ref/docs/chapters/99-reference/02-charsets.md new file mode 100644 index 0000000..55dcdcd --- /dev/null +++ b/doc/linux-ref/docs/chapters/99-reference/02-charsets.md @@ -0,0 +1,138 @@ +# Character Sets and Encodings + +Character sets and encodings are fundamental concepts in computing that define +how characters are represented and stored in digital form. This chapter will +provide several character sets to help with as a quick reference for developers. + +## American Standard Code for Information Interchange (ASCII) + +| Decimal | Hexadecimal | Character | C escape | Notes | +|---------|-------------|-----------|----------|-------------------------------| +| 0 | 0x00 | NUL | `\0` | Null character | +| 1 | 0x01 | SOH | | Start of Heading | +| 2 | 0x02 | STX | | Start of Text | +| 3 | 0x03 | ETX | | End of Text | +| 4 | 0x04 | EOT | | End of Transmission | +| 5 | 0x05 | ENQ | | Enquiry | +| 6 | 0x06 | ACK | | Acknowledge | +| 7 | 0x07 | BEL | `\a` | Bell | +| 8 | 0x08 | BS | `\b` | Backspace | +| 9 | 0x09 | HT | `\t` | Horizontal Tab | +| 10 | 0x0a | LF | `\n` | Line Feed | +| 11 | 0x0b | VT | `\v` | Vertical Tab | +| 12 | 0x0c | FF | `\f` | Form Feed | +| 13 | 0x0d | CR | `\r` | Carriage Return | +| 14 | 0x0e | SO | | Shift Out | +| 15 | 0x0f | SI | | Shift In | +| 16 | 0x10 | DLE | | Data Link Escape | +| 17 | 0x11 | DC1 | | Device Control 1 | +| 18 | 0x12 | DC2 | | Device Control 2 | +| 19 | 0x13 | DC3 | | Device Control 3 | +| 20 | 0x14 | DC4 | | Device Control 4 | +| 21 | 0x15 | NAK | | Negative Acknowledge | +| 22 | 0x16 | SYN | | Synchronous Idle | +| 23 | 0x17 | ETB | | End of Transmission Block | +| 24 | 0x18 | CAN | | Cancel | +| 25 | 0x19 | EM | | End of Medium | +| 26 | 0x1a | SUB | | Substitute | +| 27 | 0x1b | ESC | `\e` | Escape | +| 28 | 0x1c | FS | | File Separator | +| 29 | 0x1d | GS | | Group Separator | +| 30 | 0x1e | RS | | Record Separator | +| 31 | 0x1f | US | | Unit Separator | +| 32 | 0x20 | SPACE | | Space | +| 33 | 0x21 | ! | | Exclamation Mark | +| 34 | 0x22 | " | | Quotation Mark | +| 35 | 0x23 | # | | Number Sign | +| 36 | 0x24 | $ | | Dollar Sign | +| 37 | 0x25 | % | | Percent Sign | +| 38 | 0x26 | & | | Ampersand | +| 39 | 0x27 | ' | | Apostrophe | +| 40 | 0x28 | ( | | Left Parenthesis | +| 41 | 0x29 | ) | | Right Parenthesis | +| 42 | 0x2a | * | | Asterisk | +| 43 | 0x2b | + | | Plus Sign | +| 44 | 0x2c | , | | Comma | +| 45 | 0x2d | - | | Hyphen-Minus | +| 46 | 0x2e | . | | Full Stop | +| 47 | 0x2f | / | | Solidus | +| 48 | 0x30 | 0 | | | +| 49 | 0x31 | 1 | | | +| 50 | 0x32 | 2 | | | +| 51 | 0x33 | 3 | | | +| 52 | 0x34 | 4 | | | +| 53 | 0x35 | 5 | | | +| 54 | 0x36 | 6 | | | +| 55 | 0x37 | 7 | | | +| 56 | 0x38 | 8 | | | +| 57 | 0x39 | 9 | | | +| 58 | 0x3a | : | | Colon | +| 59 | 0x3b | ; | | Semicolon | +| 60 | 0x3c | < | | Less-Than Sign | +| 61 | 0x3d | = | | Equals Sign | +| 62 | 0x3e | > | | Greater-Than Sign | +| 63 | 0x3f | ? | | Question Mark | +| 64 | 0x40 | @ | | At Sign | +| 65 | 0x41 | A | | | +| 66 | 0x42 | B | | | +| 67 | 0x43 | C | | | +| 68 | 0x44 | D | | | +| 69 | 0x45 | E | | | +| 70 | 0x46 | F | | | +| 71 | 0x47 | G | | | +| 72 | 0x48 | H | | | +| 73 | 0x49 | I | | | +| 74 | 0x4a | J | | | +| 75 | 0x4b | K | | | +| 76 | 0x4c | L | | | +| 77 | 0x4d | M | | | +| 78 | 0x4e | N | | | +| 79 | 0x4f | O | | | +| 80 | 0x50 | P | | | +| 81 | 0x51 | Q | | | +| 82 | 0x52 | R | | | +| 83 | 0x53 | S | | | +| 84 | 0x54 | T | | | +| 85 | 0x55 | U | | | +| 86 | 0x56 | V | | | +| 87 | 0x57 | W | | | +| 88 | 0x58 | X | | | +| 89 | 0x59 | Y | | | +| 90 | 0x5a | Z | | | +| 91 | 0x5b | [ | | Left Square Bracket | +| 92 | 0x5c | \ | `\\` | Backslash | +| 93 | 0x5d | ] | | Right Square Bracket | +| 94 | 0x5e | ^ | | Circumflex Accent | +| 95 | 0x5f | _ | | Low Line +| 96 | 0x60 | ` | | Grave Accent | +| 97 | 0x61 | a | | | +| 98 | 0x62 | b | | | +| 99 | 0x63 | c | | | +| 100 | 0x64 | d | | | +| 101 | 0x65 | e | | | +| 102 | 0x66 | f | | | +| 103 | 0x67 | g | | | +| 104 | 0x68 | h | | | +| 105 | 0x69 | i | | | +| 106 | 0x6a | j | | | +| 107 | 0x6b | k | | | +| 108 | 0x6c | l | | | +| 109 | 0x6d | m | | | +| 110 | 0x6e | n | | | +| 111 | 0x6f | o | | | +| 112 | 0x70 | p | | | +| 113 | 0x71 | q | | | +| 114 | 0x72 | r | | | +| 115 | 0x73 | s | | | +| 116 | 0x74 | t | | | +| 117 | 0x75 | u | | | +| 118 | 0x76 | v | | | +| 119 | 0x77 | w | | | +| 120 | 0x78 | x | | | +| 121 | 0x79 | y | | | +| 122 | 0x7a | z | | | +| 123 | 0x7b | { | | Left Curly Bracket | +| 124 | 0x7c | \| | | Vertical Bar | +| 125 | 0x7d | } | | Right Curly Bracket | +| 126 | 0x7e | ~ | | Tilde | +| 127 | 0x7f | DEL | | Delete | diff --git a/doc/linux-ref/docs/chapters/99-sources.md b/doc/linux-ref/docs/chapters/99-sources.md new file mode 100644 index 0000000..165ba77 --- /dev/null +++ b/doc/linux-ref/docs/chapters/99-sources.md @@ -0,0 +1,19 @@ +# Bibliography and Sources + +Many thanks to all the sources that were used to write this book: + + +## Main sources + +1. [Linux Kernel Source Code](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) +2. [Linux Kernel Documentation](https://www.kernel.org/doc/html/latest/) +3. [Linux Kernel Mailing List](https://lkml.org/) +4. [Elixir Cross-Reference](https://elixir.bootlin.com/linux/latest/source) +5. [Linux From Scratch](http://www.linuxfromscratch.org/) +6. [Arch Wiki](https://wiki.archlinux.org/) +7. [Gentoo Wiki](https://wiki.gentoo.org/wiki/Main_Page) + +## Pages, links, and other resources + +1. https://wiki.archlinux.org/title/Kernel +2. https://static.sched.com/hosted_files/osseu2020/f5/2020_ELCE_initcalls_myjosserand.pdf[COMMIT END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.