# Linux Kernel Module Cheat
The perfect emulation setup to study and develop the <<linux-kernel>> v5.9.2, kernel modules, <<qemu-buildroot-setup,QEMU>>, <<gem5-buildroot-setup,gem5>> and x86_64, ARMv7 and ARMv8 <<userland-assembly,userland>> and <<baremetal-setup,baremetal>> assembly, <<c,ANSI C>>, <<cpp,C++>> and <<posix,POSIX>>. <<gdb>> and <<kgdb>> just work. Powered by <<about-the-qemu-buildroot-setup,Buildroot>> and <<about-the-baremetal-setup,crosstool-NG>>. Highly automated. Thoroughly documented. Automated <<test-this-repo,tests>>.

### 33.2. Baremetal bootloaders

As can be seen from Baremetal GDB step debug, all examples under baremetal/, with the exception of `baremetal/arch/<arch>/no_bootloader`, start from our tiny bootloaders:

- baremetal/lib/arm.S

- baremetal/lib/aarch64.S

Out simplistic bootloaders basically setup up just enough system state to allow calling:

- C functions such as `exit` from the assembly examples

- the `main` of C examples itself

The most important things that we setup in the bootloaders are:

- the stack pointer

- NEON: Section 33.11.2, “aarch64 baremetal NEON setup”

- TODO: we don’t do this currently but maybe we should setup BSS

The C functions that become available as a result are:

- Newlib functions implemented at baremetal/lib/syscalls.c

- `lkmc_` non-Newlib functions implemented at lkmc.c

It is not possible to call those C functions from the examples that don’t use a bootloader.

For this reason, we tend to create examples with bootloaders, as it is easier to write them portably.