There are thousands of different bootloaders. The design and capabilities vary depending on the processor architectures, hardware resources and intended usage.
The simplest type of bootloader has just one function: Check for an upload at startup and load it.
Arduino UNO Bootloader
A good example of a basic bootloader is the bootloader programmed into the Arduino UNO.
On power-up or reset, the bootloader watches the serial receive pin for a few seconds - waiting to receive the special sequence of bytes that indicates an upload attempt from the IDE. If that magic byte sequence is received, the bootloader will respond with an acknowledgement and the IDE will start sending the code. The bootloader will receive the code from the IDE and burn it into flash memory.
If the bootloader does not see the magic byte sequence, after a few seconds it will proceed to start running whatever code is already burned into flash.
More advanced bootloaders add additional functionality such as choosing between operating modes and/or performing some low-level diagnostics.
CircuitPython UF2 Bootloader
A good example of an advanced bootloader is the UF2 bootloader used on our CircuitPython capable boards.
This bootloader can work like an Arduino and accept serial uploads via the USB connection. Or it can emulate a disk drive that lets you copy Python programs to it.
An on-board RGB LED is used to provide diagnostic feedback in the form of steady or flashing patterns in different colors to indicate the state of the bootloading process.
Your notebook, desktop computer and even your smartphone most likely have at least two stages of bootstrapping. This gives you options such as selecting different operating modes, or even an entirely different operating system.
The BIOS or UEFI is burned into flash memory on the motherboard. At startup it will look for a bootable drive and load an operating system bootloader from the drive. At that point it turns control over to the operating system’s bootloader which takes care of loading your operating system. Once the operating system is up and running, you can just point and click to load and run any program you want.