Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5109

Advanced users • Can I create an autoboot.txt file with multiple conditionsfor a particular choice?

$
0
0
Given the following autoboot.tat file:

Code:

# Setup GPIO pins, set as inputs, (ip), pulled high, (pu).##  Update: 12/16/2021 Replace Raspbian for Robots with the corrected image#          I created for GoPiGo O/S 3.0.1 for testing.## Pin/dip-switch mapping for GPIO O/S selection:# Dip-switch   Broadcomm pin   Physical pin     Used to select:#   None (default)  --              --          Buster (Legacy) - Set up as dev environment#    1              21              40          GoPiGo 3.0.3 Waveshare e-Paper Display with buttons#    2              26              37          GoPiGo 3.0.3 Adafruit 16x2 LCD Display with buttons#    3              20              38          GoPiGo 3.0.3 Adafruit 128x32 OLED display#    4              19              35          Bullseye 32 bit#    5              16              36          unused#  common           ground          39gpio=21=ip,pugpio=26=ip,pugpio=20=ip,pugpio=19=ip,pugpio=16=ip,pu[default]# Default if no switches are selected# Buster Legacyboot_partition=5[all][gpio21=0]# Waveshare e-Paper Display with buttonsboot_partition=6[all][gpio26=0]# Adafruit 16x2 LCD Display with buttonsboot_partition=7[all][gpio20=0]# Adafruit 128x32 OLED display (no buttons)boot_partition=8[all][gpio19=0]# Bullseye 32 bitboot_partition=9[all]
I use this with a five-position DIP switch tied to certain GPIO pins to select one of four operating systems to boot. Note that the technical details of how the selection is actually made and the particular operating system is outside the scope of this question, though I will be happy to discuss this with any interested person.

Technically, the selection of a particular GPIO pin, (by pulling it down), forces an immediate jump to the associated BOOT partition, and things proceed normally from there.

Note that the format of the autoboot.txt file is

Code:

[condition]boot partition if true[all] <= ends conditional block
What I want to do is allow for combinations of GPIO pins to select something; Such as:

Code:

[gpio19=0 AND gpio20=0]do something if both are true[all]
Possible answer?
The documentation for config.txt mentions that filters can be cascaded. So, theoretically, I should be able to do this:

Code:

[gpio1=0]boot=partitionX[all][gpio2=0]boot=partitionY[all][gpio3=0]boot=partitionZ[all][gpio1=0][gpio2=0]boot=partitionA[all][gpio1=0][gpio3=0]boot=partitionB[all]
My logic is that when you get to a block that starts with a condition that is not true, the entire block is skipped. However if the first condition is true then it drops to the second condition and if that's true, it boots the selected partition.

Correct? Is there a better way? Or is this just not a happening thing?

Yes, I know that I can do this with a specialized startup script in PINN, but I'd really rather do it within the confines of the autoboot.txt file

Statistics: Posted by jharris1993 — Mon Aug 05, 2024 5:14 pm



Viewing all articles
Browse latest Browse all 5109

Trending Articles