Looking in the android source for the reboot command we find the following line:
__reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, \
LINUX_REBOOT_CMD_RESTART2, argv[optind]);
Which is the standard Linux system call to reboot the system with a specific command, see Unix System Call Reboot.
In Android this command is used to tell the bootloader to start either the kernel in recovery mode or to go to the fastboot mode within the bootloader.
My question is: How does the bootloader pick up the command? And is this functionality implemented in U-Boot? (I am unable to find it searching either through Google or in the U-Boot source.)
Additionally it seems this is not specific to Android, but is the way Linux performs a "reboot with a command". Any information on how this is "normally" handled/used in Linux?