Skip to content

Commit

Permalink
Another batch of changes for boot.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Dec 18, 2023
1 parent 3e2b88b commit fbdfa3e
Show file tree
Hide file tree
Showing 20 changed files with 54 additions and 17 deletions.
2 changes: 2 additions & 0 deletions Boardfiles/Seeed_XIAO_nRF52840_Sense/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 6144
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/adafruit_feather_esp32s2/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/adafruit_feather_esp32s3_tft/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/adafruit_kb2040/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/beetle-esp32-c3/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = false
usb_hid_available = false
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/firebeetle2_esp32s3/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/lolin_s2_mini/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/m5stack_timer_camera_x/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = false
usb_hid_available = false
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/pimoroni_picolipo_16mb/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/pimoroni_picolipo_4mb/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/raspberry_pi_pico/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/raspberry_pi_pico_w/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/waveshare_esp32s2_pico/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/waveshare_rp2040_zero/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 4608
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/weact_esp32c6_n4/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = false
usb_hid_available = false
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/weact_esp32c6_n8/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = false
usb_hid_available = false
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/yd_esp32_s3_n16r8/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
2 changes: 2 additions & 0 deletions Boardfiles/yd_esp32_s3_n8r8/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ CIRCUITPY_PYSTACK_SIZE = 12288
[LJINUX]
setup = true

fs_label = "LJINUX"

serial_console_enabled = true
usb_msc_available = true
usb_hid_available = true
Expand Down
34 changes: 17 additions & 17 deletions rootfilesystem/boot.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
print("Early boot log:\n")

from storage import getmount, remount, disable_usb_drive
from supervisor import runtime, status_bar
from cptoml import fetch

runtime.autoreload = False
status_bar.console = False

stash = ""

lj_mount = getmount("/")

desired_label = fetch("fs_label", "LJINUX")
Expand All @@ -15,42 +15,42 @@
if lj_mount.label != desired_label:
remount("/", False)
lj_mount.label = desired_label
stash += "Reset filesystem label.\n\n"
print("Reset filesystem label.\n")
remount("/", True)

if fetch("usb_msc_available", "LJINUX"):
stash += "This board supports USB filesystem enumeration.\n"
print("This board supports USB filesystem enumeration.")
if fetch("usb_msc_enabled", "LJINUX"):
stash += "USB filesystem is enabled.\nLjinux will access root Read-Only!\n\n"
print("The USB filesystem is enabled.\nLjinux will access root Read-Only!\n")
else:
disable_usb_drive()
stash += (
"USB filesystem is disabled.\nLjinux will operate in root Read-Write.\n\n"
)
print("The USB filesystem is disabled.\nLjinux will operate normally.\n")
else:
stash += "This board does not support USB filesystem enumeration.\n\n"
print("This board does not support USB filesystem enumeration.\n")


if fetch("usb_hid_available", "LJINUX"):
import usb_hid

stash += "This board supports HID enumeration.\n"
print("This board supports HID enumeration.")

if fetch("usb_hid_enabled", "LJINUX"):
stash += "HID Enabled.\n\n"
print("HID Enabled.\n")
else:
usb_hid.disable()
stash += "Disabled HID.\n\n"
print("HID Disabled.\n")
else:
print("This board does not support HID enumeration.\n")

if fetch("usb_midi_available", "LJINUX"):
import usb_midi

stash += "This board supports MIDI enumeration.\n"
print("This board supports MIDI enumeration.")

if fetch("usb_midi_enabled", "LJINUX"):
stash += "HID Enabled.\n\n"
print("MIDI Enabled.")
usb_midi.enable()
else:
stash += "Disabled HID.\n\n"

print("Early boot log:\n" + stash)
print("MIDI Disabled.")
else:
print("This board does not support MIDI enumeration.")
1 change: 1 addition & 0 deletions source/ljinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def dmtex(
"usb_msc_enabled": (False, bool, False),
"usb_hid_enabled": (False, bool, False),
"usb_midi_enabled": (False, bool, False),
"fs_label": ("LJINUX", str, False),
"DEBUG": (False, bool, False),
"root_SCLK": (-1, int, True),
"root_SCSn": (-1, int, True),
Expand Down

0 comments on commit fbdfa3e

Please sign in to comment.