Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

can bootcode.bin be configured to mount a predefined partition and write to it? #507

Closed
d3banjan opened this issue Jul 27, 2018 · 10 comments

Comments

@d3banjan
Copy link

d3banjan commented Jul 27, 2018

Is it possible to make bootcode.bin to write a predefined string (i.e recovery partition id) to autoboot.txt?

The usecase is that we want the file to signify that start of the bootprocess and also boot into the recovery (i.e another extended parttion, not noobs recovery) partition automatically if the boot process fails between start to end of boot (signified by start of init.d !).

Before exploring the option of compiling a custom bootcode.bin, I just want to know if there is an existing hook to hitch a ride on.

@popcornmix
Copy link

No. The firmware (bootcode.bin or start.elf) never writes to the sdcard.

@d3banjan
Copy link
Author

What about something a bit later in the boot process?

@maxnet
Copy link
Collaborator

maxnet commented Jul 27, 2018

What about something a bit later in the boot process?

You could modify the NOOBS code to do that.
But that's something you would need to code yourself, rather than there being a standard option for that.

Would set default_partition_to_boot parameter in noobs.conf on the setting ext4 partition rather than touch autoboot.txt or any other file on the FAT partition, though.

@d3banjan
Copy link
Author

@maxnet thanks.. you are right of course - it is not a good idea to write on the FAT partition.

Since this is a resonably simple operation of writing a predetermined string to a file as early as possible, any idea where in the noobs code can I add this behaviour?

@maxnet
Copy link
Collaborator

maxnet commented Jul 30, 2018

@lurch
Copy link
Collaborator

lurch commented Jul 30, 2018

I wonder if the before-reboot feature of PINN (mentioned here ) would do what you want?
Ping @procount

@procount
Copy link
Contributor

Unfortunately, I removed the before-reboot.sh feature in p2.4.4b because it prevented some OSes from booting. See procount/pinn@4b15b32#diff-81706e5fe8ac70459737d21c007fceddL102 . But feel free to add it in again and debug it for me. 😉

@XECDesign
Copy link
Contributor

Since this isn't really NOOBS related, it probably belongs on the forum instead.

@ghost
Copy link

ghost commented Aug 3, 2018

Here's the fix! (d3banjan actually asked this on my behalf and I have been trying to find something since)

The default partition to boot (from the NOOBS login screen) can be changed by editing /media/pi/SETTINGS/noobs.conf and changing default_partition_to_boot (the settings partition is /dev/mmcblk0p5 in the event that it isn't already mounted to /media/pi/SETTINGS).

From there, you can just do sudo reboot <partition_number> and it will ignore default_partition_to_boot in noobs.conf for only the next reboot, so that on the reboot after it will go back to the default partition :)

@lurch
Copy link
Collaborator

lurch commented Aug 3, 2018

See also #508 , if you're interested in that sort of thing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants