Things to Learn
Bin stands for binaries
Essential command binaries that need to be available in single-user mode
cat ls cp
Boot loaders
Kernels Initrd
Device files
System-wide config files
Config files for add-ons in opt
Config files for softare that processes SGML
Config files for software that processes XML
Home directors for the user
This can be used for whatever you want, but I've found that it's actually nicer to use your /home directory as something like /etc, but for different kinds of things.
Whereas the root version of /etc has configurations for the root, /home has configurations for the user
Then you create a separate /data directory or partition, and use that for your actual files
Libraries essential for the binaries in bin and sbin
Mount points for removable media
Temporarily mounted filesystems
Add-on packages
Virtual filesystem providing process and kernel info as files
In linux it corresponds to a procfs mount
Home directory for the root user
Run-time variable data
Essential system binaries
fsck init route
Site-specific data like data and scripts for web servers
Info about devices, drivers, and some kernel features
Variable files
Application cache data
State information
Lock files
Log files
auth.log
syslog
Mailbox files
Variable data from add-ons that are stored in opt
Run-time variable data
For tasks waiting to be processed
Temporary files to be preserved during reboots
When you install an OS, the installer writes the bootloader onto the hard drive
Modern motherboards come preloaded with public keys from the manufacturer
The bootloader needs to be digitally signed with a matching private key
The private key is
SHIM
This allows software to register its bootloader with the firmware
NVRAM Boot Entries
Non-volatile random access memory
Fallback Path
If there are no entries, it looks for a file with a specific name
Can't read files It always looks at the first 512 bytes of a disk
Master Boot Record
If the first sector (512 bytes) ends in the bytes 0x55 and 0xAA, the BIOS recognizes it as a bootloader
Insecure
You can just write a malicious program in assembly and end it with 0x55AA
These kinds of malware are called Bootkits
It's primarily written in C (GNU C) With a bit of Assembly and Rust