diff --git a/rpi/mass-storage-gadget64/boot.img b/rpi/mass-storage-gadget64/boot.img index efaeea6..20cbb81 100644 Binary files a/rpi/mass-storage-gadget64/boot.img and b/rpi/mass-storage-gadget64/boot.img differ diff --git a/rpi/mass-storage-gadget64/bootfiles.bin b/rpi/mass-storage-gadget64/bootfiles.bin deleted file mode 100644 index 7035a17..0000000 Binary files a/rpi/mass-storage-gadget64/bootfiles.bin and /dev/null differ diff --git a/rpi/mass-storage-gadget64/bootfiles.bin b/rpi/mass-storage-gadget64/bootfiles.bin new file mode 120000 index 0000000..f9b98a3 --- /dev/null +++ b/rpi/mass-storage-gadget64/bootfiles.bin @@ -0,0 +1 @@ +../firmware/bootfiles.bin \ No newline at end of file diff --git a/rpi/rpiboot b/rpi/rpiboot index c62da6d..f0bce5d 100755 Binary files a/rpi/rpiboot and b/rpi/rpiboot differ diff --git a/rpi/write_to b/rpi/write_to index 59fe3e6..7b061cf 100755 --- a/rpi/write_to +++ b/rpi/write_to @@ -43,53 +43,46 @@ class HostSystem: class Linux(HostSystem): - rescue = """ - Remark: not all cables might work. - Example on Markus Mac: - - does not work: black USB C to USB C cable - - works: white USB A to USB C cable plugged into docking station. - - Please unpower the box with compute module, - start this script again and put power immediately.""" + rescue = "" + usbbootdir = os.path.expanduser('~/usbboot') def get_disks(self): return [line for line in cmd('lsblk -d').split('\n') if line] def rpiboot(self): - lines = [] - with Popen(['sudo', './rpiboot', '-d', 'mass-storage-gadget64'], stdout=PIPE) as p: + msg = '\nswitch device power on now' + with Popen(['sudo', f'{self.usbbootdir}/rpiboot', '-d', f'{self.usbbootdir}/mass-storage-gadget64'], stdout=PIPE) as p: tmo = 1 - t = 0 while select([p.stdout], [], [], tmo)[0]: rawline = p.stdout.readline() if not rawline: return tmo != 1 line = rawline.decode('latin-1').strip() print(line) - if lines is None: - pass # print(line) - elif 'Waiting' in line: + if 'Waiting' in line: tmo = 30 - lines.append(line) - t = time.time() - elif tmo == 1: - lines.append(line) - else: - print('\n'.join(lines)) - print(line) - lines = None + if msg: + print(msg) + msg = None else: p.terminate() return False def find_raspi(self): - input('make sure device is not connected [confirm]') prevset = set(self.get_disks()) - input('now connect [confirm]') - disks = self.wait_disks(prevset, 5) + short = {v.split()[0] for v in prevset} + if short != {'mmcblk0boot1', 'mmcblk0boot0', 'mmcblk0', 'NAME'}: + # not the disks we typically have on a dual-eth-rpi + input('make sure device is not powered [confirm]') + prevset = set(self.get_disks()) + if self.kind in EMMC: # need rpiboot + disks = None + else: + input('now connect the device [confirm]') + disks = self.wait_disks(prevset, 5) if not disks: print('can not yet detect disk, try to run rpiboot') - print('if is blocked at "Waiting for BCM...", turn off and on power of target rpi') + input('\nconnect the device with power off [confirm]') # cmd('sudo ./rpiboot -d mass-storage-gadget64') self.rpiboot() disks = self.wait_disks(prevset, 15) @@ -111,6 +104,10 @@ class Linux(HostSystem): return None def write_image(self): + if not os.path.exists(self.usbbootdir): + print(f'please install the usbboot directory at {self.usbbootdir}') + return + print('troubleshooting: install newest version of usbboot') proposed = [v.split()[0] for v in self.find_raspi()] self.list_external() if len(proposed) == 1: @@ -135,7 +132,7 @@ class Linux(HostSystem): print('you may be prompted for your account password for sudo') os.system(f'sudo umount /dev/{dev}') print('') - prt('get, uncompress and write... (takes about 15 min)') + prt('get, uncompress and write... (takes about 20-30 min)') os.system(f'ssh {IMAGES_HOST} "dd if={self.imgdir}/{image} bs=512k" | lz4 -d | sudo dd of=/dev/{dev} bs=512k') prt('unmount bootfs') for _ in range(3):