I have successfully set up PINN with OpenWrt and Arch (PiKVM) on my Raspberry Pi and can reboot between the two using the PINN interface.
I am also able to reboot directly from the Arch partition into OpenWrt using reboot 10 - where 10 is the OpenWrt boot partition number, but running reboot 6 from OpenWrt to boot directly into Arch does not work.
Is there another way to boot from OpenWrt to a different partition? I tried a few of the solutions I tried online but none have work so far so wondering if anyone know if OpenWrt has a way to do this.
I'm betting 'reboot' is just a symlink to Busybox on OpenWrt, like many essential commands on OpenWrt. For supported dualboot devices, OpenWrt has code to set a boot partition, to some extent - it sets a u-boot value AFAIK, and thoses values are fixed, whereas it sounds like yours is dynamic. Partition numbers 6 and 10 sound random in the sense that they probably depend on the actual partitioning of your SD card, and you can do whatever with those.
So either you'd compile OpenWrt to include a more full-featured reboot implementation, but I'm not sure if that would have the same feature as the RPi one you ended up installing yourself, or you stick with the RPi one you already installed.
Yes you are correct, PINN creates these partitions as you use it to install the OS, so these numbers are dynamic, I believe 6 would always be the first OS`s boot Partition but after that it dynamic based on what you installed.
For now I have figured out that I can just set the PINN autoboot.txt file from OpenWrt by mounting the PINN partition and then I can reboot, but it would be better to reboot directly from OpenWrt into the other OS, so I will look into more options.
I was able to compile something similar and it does seem to work, but I was wondering where to best get some input on what all to do before I actually run syscall(SYS_reboot and reboot OpenWrt.
In the custom command I found they run
system("/etc/init.d/rcK || /etc/init.d/rc 0");
but since this is for Rasbian those are not present on OpenWrt.
Any idea what would be needed to run to safely reboot? Is a simple sync() enough for OpenWrt? Or are there other scripts to run. I did poke around on Github looking for some OpenWrt reboot commands and that seems about all it does before it runs a reboot via Busybox, but I am unsure if Busybox is doing something else?
Also if there was any other reason to not create a script like this that could break OpenWrt please let me know. Thanks alot for all the help.