raspberrypi / noobs

NOOBS (New Out Of Box Software) - An easy Operating System install manager for the Raspberry Pi

Home Page:http://www.raspberrypi.org/downloads

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how does noobs select different boot partition?

CXianRen opened this issue · comments

hi, I review the code of recovery, and I notice that: it use syscall to reboot the rpi and jump to another system.
code:
reboot_part = getFileContents("/run/reboot_part").trimmed();
::syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_part.constData());

and I try to compile "noobs" of myself, which mean I want to reboot and boot another system from current system. but I failed. what I miss ?

IIRC @procount has a handy rebootp program you can use for this, which he'll hopefully provide a link to... 🙂

@lurch
hi, I try this code:
#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;

}

and run like this myreboot 2 (my first boot fat is mmcblk0p1 and sencod is mmcblk0p2 and rootf0 and rootf1 is mmcblk0p3 and mmcblk0p4)
and I get this :
[ 245.044027 ] reboot: Restarting system with command '2'

and it still failed to boot from another fat-partiton.
help!

What did it do - reboot back into partition 1?
Which model (and revision) of RPi are you using -
Rpi4 rev 1 for instance?

does Pi4 now support reboot {part}?
Wasn't it not possible due to the Sd card speed change?

I am using RPI4 B 2G 2018 version
and the noobs can work in my pi.
@procount
@matthuisman
Yes, when I reboot 2 , it still reboot from partition from parition 1

I get it.

The fix to the issue I thought this was was introduced in 241-4, so yes, it's definitely a part of Raspbian now.

Sorry, I completely forgot about this, but you can't reboot into different partitions when the uSD interface is running on 1.8V (UHS). You need to boot with sdhci.debug_quirks2=4 in cmdline.txt for it to work, but it will sacrifice SD speed (I don't know how much).

AIUI, the issue is that once the card is in UHS mode, we can't get out of it without resetting power, losing the content of the reset register (which contains the reboot partition number). Due to reasons I don't quite understand, we can't continue in UHS mode and must switch to 3.3V to properly initialise the card.

@matthuisman @procount @lurch thank you so much