The current _boot.py does this:
Code: Select all
...
import uos
from flashbdev import bdev
try:
if bdev:
uos.mount(bdev, '/')
except OSError:
import inisetup
inisetup.setup()
...
Code: Select all
File "_boot.py", line 8, in <module>
AttributeError: 'FlashBdev' object has no attribute 'mount'
But a question: In my project i also change the inisetup.py to this:
Code: Select all
...
import esp
import flashbdev
import uos
FS_FAT = 'FAT'
FS_LITTLEFS = 'LittleFS'
def detect_filesystem():
buf = bytearray(16)
flashbdev.bdev.readblocks(0, buf)
if buf[3:8] == b'MSDOS':
return FS_FAT
elif buf[8:16] == b'littlefs':
return FS_LITTLEFS
return 'unknown'
def setup():
print("Performing initial setup")
filesystem = detect_filesystem()
print('Detected filesystem: %r' % filesystem)
if filesystem != FS_LITTLEFS:
print('Erase flash start sector 0x%x' % flashbdev.bdev.START_SEC)
esp.flash_erase(flashbdev.bdev.START_SEC)
print('convert to littlefs2')
uos.VfsLfs2.mkfs(flashbdev.bdev)
print('mount filesystem')
uos.mount(flashbdev.bdev, '/')
with open("boot.py", "w") as f:
f.write("""\
...
Do any of you think I could submit this as a pull request, too?
Maybe a cleaned/tunes variant of this.