[Gnuk-users] Upgrading gnuk on a nitrokey start

Jan Suhr | Nitrokey jan at nitrokey.com
Wed Mar 22 12:03:09 UTC 2017


Hi! 

This discussion is almost three months old but for the record: Upgrading
the firmware of Nitrokey Start works. You find latest firmware binaries
and instructions here:
https://github.com/Nitrokey/nitrokey-start-firmware/tree/gnuk1.2-regnual-fix/prebuilt


Best regards,
Jan 

Am 03.01.2017 19:41, schrieb Remy van Elst:

> Hi Szczepan (hopefully correctly spelled)
> 
> I tried to upgrade with the prebuilt bin file, after doing the make clean, ./configure and new make for gnuk and regnual on the 16.10 machine. It seems to fail for me, just as the other times I tried (with RTM1 firmware):
> 
> Device: 
> Vendor: Nitrokey
> Product: Nitrokey Start
> Serial: FSIJ-1.0.4-52FF7106
> Revision: release/1.0.4-6-g739e00e
> Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=yes:keygen=yes
> Sys: 1.0
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ~/tmp/nitrokey-start-firmware-1.0.4-1a.bin 
> ../regnual/regnual.bin: 4388
> /home/remy/tmp/nitrokey-start-firmware-1.0.4-1a.bin: 58368
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20001400:20004a00
> Downloading flash upgrade program...
> start 20001400
> end   20002500
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> ^CTraceback (most recent call last):
> File "./upgrade_by_passwd.py", line 134, in <module>
> main(wait_e, keyno, passwd, data_regnual, data_upgrade[4096:])
> File "./upgrade_by_passwd.py", line 75, in main
> time.sleep(wait_e)
> KeyboardInterrupt
> 
> Device: 
> Vendor: Nitrokey
> Product: Nitrokey Start
> Serial: FSIJ-1.0.4-52FF7106
> Revision: release/1.0.4-6-g739e00e
> Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=yes:keygen=yes
> Sys: 1.0
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ~/tmp/nitrokey-start-firmware-1.0.4-1a.bin 
> ../regnual/regnual.bin: 4388
> /home/remy/tmp/nitrokey-start-firmware-1.0.4-1a.bin: 58368
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20001400:20004a00
> Downloading flash upgrade program...
> start 20001400
> end   20002500
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> ^CTraceback (most recent call last):
> File "./upgrade_by_passwd.py", line 134, in <module>
> main(wait_e, keyno, passwd, data_regnual, data_upgrade[4096:])
> File "./upgrade_by_passwd.py", line 75, in main
> time.sleep(wait_e)
> KeyboardInterrupt
> 
> Upgrading to RTM2:
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ../../nitrokey-start-firmware/prebuilt/RTM.2/gnuk.bin 
> ../regnual/regnual.bin: 4388
> ../../nitrokey-start-firmware/prebuilt/RTM.2/gnuk.bin: 53248
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20001400:20004a00
> Downloading flash upgrade program...
> start 20001400
> end   20002500
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> ^CTraceback (most recent call last):
> File "./upgrade_by_passwd.py", line 134, in <module>
> main(wait_e, keyno, passwd, data_regnual, data_upgrade[4096:])
> File "./upgrade_by_passwd.py", line 75, in main
> time.sleep(wait_e)
> KeyboardInterrupt
> 
> On 1.2.2:
> 
> $ python2 usb_strings.py 
> Device: 
> Vendor: Nitrokey
> Product: Nitrokey Start
> Serial: FSIJ-1.2.2-87042430
> Revision: release/1.0.2-471-g1a76ab5-modified
> Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=no
> Sys: 3.0
> 
> It works:
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ../src/build/gnuk.bin 
> ../regnual/regnual.bin: 4388
> ../src/build/gnuk.bin: 110592
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20002800:20005000
> Downloading flash upgrade program...
> start 20002800
> end   20003900
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> Device: 
> 08001000:08020000
> Downloading the program
> start 08001000
> end   0801b000
> Resetting device
> Update procedure finished
> 
> $ python2 usb_strings.py 
> Device: 
> Vendor: Nitrokey
> Product: Nitrokey Start
> Serial: FSIJ-1.2.2-87042430
> Revision: release/1.0.2-471-g1a76ab5-modified
> Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=no
> Sys: 3.0
> 
> From 1.2.2 to RTM1:
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ../../nitrokey-start-firmware/prebuilt/RTM.1/nitrokey-start-firmware-1.0.4-1a.bin
> ../regnual/regnual.bin: 4388
> ../../nitrokey-start-firmware/prebuilt/RTM.1/nitrokey-start-firmware-1.0.4-1a.bin: 58368
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20002800:20005000
> Downloading flash upgrade program...
> start 20002800
> end   20003900
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> Device: 
> 08001000:08020000
> Downloading the program
> start 08001000
> end   0800e400
> Resetting device
> Update procedure finished
> 
> However, afterwards the green light stays on and dmesg says this:
> 
> [Tue Jan  3 19:37:11 2017] usb 1-1.1: device descriptor read/64, error -32
> [Tue Jan  3 19:37:11 2017] usb 1-1.1: new full-speed USB device number 37 using ehci-pci
> [Tue Jan  3 19:37:11 2017] usb 1-1.1: device not accepting address 37, error -32
> [Tue Jan  3 19:37:12 2017] usb 1-1.1: new full-speed USB device number 38 using ehci-pci
> [Tue Jan  3 19:37:12 2017] usb 1-1.1: device not accepting address 38, error -32
> [Tue Jan  3 19:37:12 2017] usb 1-1-port1: unable to enumerate USB device
> 
> $ python2 usb_strings.py 
> 
> Back on RTM1:
> 
> $ python2 usb_strings.py 
> Device: 
> Vendor: Nitrokey
> Product: Nitrokey Start
> Serial: FSIJ-1.0.4-52FF7106
> Revision: 
> Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=no:keygen=no
> Sys: 1.0
> 
> $ python2 ./upgrade_by_passwd.py -f  ../regnual/regnual.bin ../src/build/gnuk.bin
> ../regnual/regnual.bin: 4388
> ../src/build/gnuk.bin: 110592
> CRC32: a4811640
> 
> Device: 
> Configuration: 1
> Interface: 0
> 20001400:20004a00
> Downloading flash upgrade program...
> start 20001400
> end   20002500
> Run flash upgrade program...
> Waiting for device to appear:
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> - Wait 1 seconds...
> ^CTraceback (most recent call last):
> File "./upgrade_by_passwd.py", line 134, in <module>
> main(wait_e, keyno, passwd, data_regnual, data_upgrade[4096:])
> File "./upgrade_by_passwd.py", line 75, in main
> time.sleep(wait_e)
> KeyboardInterrupt
> 
> So it seems to still fail, even with the bin files instead of the HEX. 
> 
> https://raymii.org 
> On Thu, Dec 29, 2016 at 12:27 PM, Szczepan Zalega | Nitrokey <szczepan at nitrokey.com> wrote:
> 
>> Hi Remy!
>> 
>> I have noticed that you have used .hex file for regnual update. The tool
>> does not understand this format and in consequence it sends ASCII
>> hexdump representation directly to device, which obviously will not
>> work. This was the cause of the update issues mentioned in previous
>> email. The stm32flash tool handles both .bin and .hex.
>> 
>> Just for testing purposes I have converted the firmware you have
>> received to binary [3] with srecord tools (not checked it though):
>> 
>> ```
>> srec_cat nitrokey-start-firmware-1.0.4-1a.hex -intel -offset
>> -0x08000000 -o nitrokey-start-firmware-1.0.4-1a.bin -binary
>> 
>> ```
>> 
>> Have you tried upgrading using regnual with prebuilt binaries? [2]
>> 
>> As for compiling firmware for first release on Ubuntu 16.10, I have done
>> the same successfully on Virtualbox with image downloaded from OSBoxes
>> (to make it fully reproducible) - full log attached [1]. Please try the
>> compilation on a clean repository.
>> 
>> Additionally regnual tool might need recompilation (make clean; make) on
>> each ./configure run since it uses files generated with it.
>> 
>> SHA sum for downloaded Ubuntu image from OSBoxes:
>> $ sha512sum Ubuntu_16.10_Yakkety-VB-64bit.7z
>> fa16b1fc694679a7e470030eddc3fc1e842e94e6cb62ac5ea3f346a2ccbc39b8c909395655b3134a189021e8c02fdd001fb2fe544f012e18dffb14e369a79a6e
>> Ubuntu_16.10_Yakkety-VB-64bit.7z
>> 
>> [1] http://paste.ubuntu.com/23664245/ [1]
>> [2]
>> https://github.com/Nitrokey/nitrokey-start-firmware/tree/gnuk1.2-regnual-fix/prebuilt [2]
>> [3]
>> https://github.com/Nitrokey/nitrokey-start-firmware/tree/gnuk1.2-regnual-fix/prebuilt/RTM.1 [3]
>> 
>> --
>> Best regards,
>> Szczepan
>> 
>> _______________________________________________
>> gnuk-users mailing list
>> gnuk-users at lists.alioth.debian.org
>> https://lists.alioth.debian.org/mailman/listinfo/gnuk-users [4]
> 
> _______________________________________________
> gnuk-users mailing list
> gnuk-users at lists.alioth.debian.org
> https://lists.alioth.debian.org/mailman/listinfo/gnuk-users
 

Links:
------
[1] http://paste.ubuntu.com/23664245/
[2]
https://github.com/Nitrokey/nitrokey-start-firmware/tree/gnuk1.2-regnual-fix/prebuilt
[3]
https://github.com/Nitrokey/nitrokey-start-firmware/tree/gnuk1.2-regnual-fix/prebuilt/RTM.1
[4] https://lists.alioth.debian.org/mailman/listinfo/gnuk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/gnuk-users/attachments/20170322/24fd754c/attachment.html>


More information about the gnuk-users mailing list