OK, First thing is the reboot_part is no longer exist since RPI linux branch 4.8.y.
All the posts are outdated if they told you to change this attributes:
Rebooting into a new OS
Enlaces entre varios sistemas operativos
The answer for current RPI linux is simply use system call function below:
syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_part);
Most modern linux init system (upstart, systemd) will implement their reboot command included the SYS_reboot system call.
So you simply can use command "reboot 5" to reboot from partition 5.
If you use busybox or something else that might not include this system call, you can just write your own, or just get a sample code from someone's post:
how to reboot into partition with new firmware but no systemd?
Here is the sample code I copied from the post above, thanks to matthuisman:
#include <linux/reboot.h>
#include <sys/syscall.h>
#include <signal.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
char *param = NULL;
int cmd;
if(argc == 2) {
param = argv[1];
cmd = LINUX_REBOOT_CMD_RESTART2;
}
else {
cmd = LINUX_REBOOT_CMD_RESTART;
}
sync();
system("/etc/init.d/rcK || /etc/init.d/rc 0");
sync();
syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, param);
return 0;
}